summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorLikai Ding <likaid@codeaurora.org>2016-06-06 09:25:33 +0800
committerLikai Ding <likaid@codeaurora.org>2016-06-06 09:25:33 +0800
commitd1208622bd805d170e25e6f5e9f66b3bca28abdd (patch)
tree3a7e6d42f1eae4cc4905cffbc0cc6353f4cee639 /src/com
parent7905d9942c40ff802a8215be5740a0c6541edfd5 (diff)
downloadandroid_packages_apps_Gallery2-d1208622bd805d170e25e6f5e9f66b3bca28abdd.tar.gz
android_packages_apps_Gallery2-d1208622bd805d170e25e6f5e9f66b3bca28abdd.tar.bz2
android_packages_apps_Gallery2-d1208622bd805d170e25e6f5e9f66b3bca28abdd.zip
Gallery: fix several lint issues
CRs-Fixed: 1024516 Change-Id: Ia629e83e244fd1400b87edfefdba0b9a540d8153
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/gallery3d/glrenderer/TiledTexture.java19
-rw-r--r--src/com/android/gallery3d/ui/TimeLineSlidingWindow.java26
-rw-r--r--src/com/android/gallery3d/ui/TimeLineSlotRenderer.java8
3 files changed, 16 insertions, 37 deletions
diff --git a/src/com/android/gallery3d/glrenderer/TiledTexture.java b/src/com/android/gallery3d/glrenderer/TiledTexture.java
index f33a52c97..bd93d3acc 100644
--- a/src/com/android/gallery3d/glrenderer/TiledTexture.java
+++ b/src/com/android/gallery3d/glrenderer/TiledTexture.java
@@ -59,8 +59,7 @@ public class TiledTexture implements Texture {
private final RectF mDestRect = new RectF();
public static class Uploader implements OnGLIdleListener {
- private final ArrayDeque<TiledTexture> mTextures =
- new ArrayDeque<TiledTexture>(INIT_CAPACITY);
+ private final ArrayDeque<TiledTexture> mTextures = new ArrayDeque<>(INIT_CAPACITY);
private final GLRoot mGlRoot;
private boolean mIsQueued = false;
@@ -137,7 +136,6 @@ public class TiledTexture implements Texture {
int r = localBitmapRef.getWidth() + x;
int b = localBitmapRef.getHeight() + y;
sCanvas.drawBitmap(localBitmapRef, x, y, sBitmapPaint);
- localBitmapRef = null;
// draw borders if need
if (x > 0) sCanvas.drawLine(x - 1, 0, x - 1, TILE_SIZE, sPaint);
@@ -199,7 +197,7 @@ public class TiledTexture implements Texture {
public TiledTexture(Bitmap bitmap) {
mWidth = bitmap.getWidth();
mHeight = bitmap.getHeight();
- ArrayList<Tile> list = new ArrayList<Tile>();
+ ArrayList<Tile> list = new ArrayList<>();
for (int x = 0, w = mWidth; x < w; x += CONTENT_SIZE) {
for (int y = 0, h = mHeight; y < h; y += CONTENT_SIZE) {
@@ -223,8 +221,8 @@ public class TiledTexture implements Texture {
// Can be called in UI thread.
public void recycle() {
synchronized (mTiles) {
- for (int i = 0, n = mTiles.length; i < n; ++i) {
- freeTile(mTiles[i]);
+ for (Tile mTile : mTiles) {
+ freeTile(mTile);
}
}
}
@@ -277,8 +275,7 @@ public class TiledTexture implements Texture {
float scaleX = (float) width / mWidth;
float scaleY = (float) height / mHeight;
synchronized (mTiles) {
- for (int i = 0, n = mTiles.length; i < n; ++i) {
- Tile t = mTiles[i];
+ for (Tile t : mTiles) {
src.set(0, 0, t.contentWidth, t.contentHeight);
src.offset(t.offsetX, t.offsetY);
mapRect(dest, src, 0, 0, x, y, scaleX, scaleY);
@@ -296,8 +293,7 @@ public class TiledTexture implements Texture {
float scaleX = (float) width / mWidth;
float scaleY = (float) height / mHeight;
synchronized (mTiles) {
- for (int i = 0, n = mTiles.length; i < n; ++i) {
- Tile t = mTiles[i];
+ for (Tile t : mTiles) {
src.set(0, 0, t.contentWidth, t.contentHeight);
src.offset(t.offsetX, t.offsetY);
mapRect(dest, src, 0, 0, x, y, scaleX, scaleY);
@@ -319,8 +315,7 @@ public class TiledTexture implements Texture {
float scaleY = target.height() / source.height();
synchronized (mTiles) {
- for (int i = 0, n = mTiles.length; i < n; ++i) {
- Tile t = mTiles[i];
+ for (Tile t : mTiles) {
src.set(0, 0, t.contentWidth, t.contentHeight);
src.offset(t.offsetX, t.offsetY);
if (!src.intersect(source)) continue;
diff --git a/src/com/android/gallery3d/ui/TimeLineSlidingWindow.java b/src/com/android/gallery3d/ui/TimeLineSlidingWindow.java
index 5041ba683..d37d4e812 100644
--- a/src/com/android/gallery3d/ui/TimeLineSlidingWindow.java
+++ b/src/com/android/gallery3d/ui/TimeLineSlidingWindow.java
@@ -32,8 +32,6 @@ import com.android.gallery3d.util.Future;
import com.android.gallery3d.util.FutureListener;
import com.android.gallery3d.util.JobLimiter;
-import java.util.ArrayList;
-
public class TimeLineSlidingWindow implements TimeLineDataLoader.DataListener {
@SuppressWarnings("unused")
private static final String TAG = "TimeLineSlidingWindow";
@@ -41,10 +39,9 @@ public class TimeLineSlidingWindow implements TimeLineDataLoader.DataListener {
private static final int MSG_UPDATE_ENTRY = 0;
private static final int JOB_LIMIT = 2;
- public static interface Listener {
- public void onSizeChanged(int[] size);
- public void onContentChanged();
- public int getTitleWidth();
+ public interface Listener {
+ void onSizeChanged(int[] size);
+ void onContentChanged();
}
public static class AlbumEntry {
@@ -76,16 +73,10 @@ public class TimeLineSlidingWindow implements TimeLineDataLoader.DataListener {
private int mActiveRequestCount = 0;
private boolean mIsActive = false;
- private TimeLineTitleMaker mTitleMaker;
- private int mTitleSize;
- private int mTitleContentStart = 0;
- private int mTitleContentEnd = 0;
- private final int TITLE_CACHE_SIZE = 15;
+ private final TimeLineTitleMaker mTitleMaker;
- public TimeLineSlidingWindow(AbstractGalleryActivity activity,
- TimeLineDataLoader source,
- int cacheSize, TimeLineSlotRenderer.LabelSpec labelSpec,
- SelectionManager selection, TimeLineSlotView slotView) {
+ public TimeLineSlidingWindow(AbstractGalleryActivity activity, TimeLineDataLoader source,
+ int cacheSize, TimeLineSlotRenderer.LabelSpec labelSpec, TimeLineSlotView slotView) {
source.setDataListener(this);
mSource = source;
mData = new AlbumEntry[cacheSize];
@@ -111,11 +102,10 @@ public class TimeLineSlidingWindow implements TimeLineDataLoader.DataListener {
if (!isActiveSlot(slotIndex)) {
return null;
}
- AlbumEntry item = mData[slotIndex % mData.length];
- return item;
+ return mData[slotIndex % mData.length];
}
- public boolean isActiveSlot(int slotIndex) {
+ private boolean isActiveSlot(int slotIndex) {
return slotIndex >= mActiveStart && slotIndex < mActiveEnd;
}
diff --git a/src/com/android/gallery3d/ui/TimeLineSlotRenderer.java b/src/com/android/gallery3d/ui/TimeLineSlotRenderer.java
index a9ee9a8db..575b9d637 100644
--- a/src/com/android/gallery3d/ui/TimeLineSlotRenderer.java
+++ b/src/com/android/gallery3d/ui/TimeLineSlotRenderer.java
@@ -130,12 +130,6 @@ public class TimeLineSlotRenderer extends AbstractSlotRenderer {
mSlotView.setSlotCount(size);
mSlotView.invalidate();
}
-
- @Override
- public int getTitleWidth() {
- return mSlotView.getTitleWidth();
- }
-
}
public void resume() {
@@ -176,7 +170,7 @@ public class TimeLineSlotRenderer extends AbstractSlotRenderer {
}
if (model != null) {
mDataWindow = new TimeLineSlidingWindow(mActivity, model, CACHE_SIZE, mLabelSpec,
- mSelectionManager, mSlotView);
+ mSlotView);
mDataWindow.setListener(new MyDataModelListener());
}
}