summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2015-10-03 20:23:25 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2015-10-03 22:54:37 +0200
commit7b282e3db8cc608373d09e49dba57945be07f895 (patch)
treeb64eab2fa1f118ce10dd21d73445e5987a1d8c28 /android
parent20d5c4cce51284fd39d22755d19ac7a28ab51e14 (diff)
android: remove unused imports, call static methods the static way
and remove some redundant casts Change-Id: If58a395227e4b9d54b0d757032d4a55c25315019
Diffstat (limited to 'android')
-rw-r--r--android/source/src/java/org/libreoffice/InvalidationHandler.java9
-rw-r--r--android/source/src/java/org/libreoffice/LOKitShell.java2
-rw-r--r--android/source/src/java/org/libreoffice/LOKitThread.java2
-rw-r--r--android/source/src/java/org/libreoffice/LOKitTileProvider.java2
-rw-r--r--android/source/src/java/org/libreoffice/MockTileProvider.java4
-rw-r--r--android/source/src/java/org/libreoffice/TileProvider.java1
-rw-r--r--android/source/src/java/org/libreoffice/TileProviderFactory.java2
-rw-r--r--android/source/src/java/org/libreoffice/canvas/SelectionHandleEnd.java1
-rw-r--r--android/source/src/java/org/libreoffice/canvas/SelectionHandleMiddle.java1
-rw-r--r--android/source/src/java/org/libreoffice/canvas/SelectionHandleStart.java1
-rw-r--r--android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java2
-rw-r--r--android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java2
-rw-r--r--android/source/src/java/org/libreoffice/ui/FileUtilities.java2
-rw-r--r--android/source/src/java/org/libreoffice/ui/FolderIconView.java6
-rw-r--r--android/source/src/java/org/libreoffice/ui/GridItemAdapter.java22
-rw-r--r--android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java16
-rw-r--r--android/source/src/java/org/mozilla/gecko/gfx/LayerView.java2
-rw-r--r--android/source/src/java/org/mozilla/gecko/gfx/ScrollbarLayer.java2
-rw-r--r--android/source/src/java/org/mozilla/gecko/gfx/TextureGenerator.java2
19 files changed, 25 insertions, 56 deletions
diff --git a/android/source/src/java/org/libreoffice/InvalidationHandler.java b/android/source/src/java/org/libreoffice/InvalidationHandler.java
index f0a3982197aa..fcbff63b48a8 100644
--- a/android/source/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/source/src/java/org/libreoffice/InvalidationHandler.java
@@ -10,7 +10,6 @@ import org.libreoffice.canvas.SelectionHandle;
import org.libreoffice.kit.Document;
import org.libreoffice.overlay.DocumentOverlay;
import org.mozilla.gecko.gfx.GeckoLayerClient;
-import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
import java.util.ArrayList;
import java.util.Collections;
@@ -28,7 +27,7 @@ public class InvalidationHandler implements Document.MessageCallback {
public InvalidationHandler(LibreOfficeMainActivity mainActivity) {
mDocumentOverlay = mainActivity.getDocumentOverlay();
- mLayerClient = mainActivity.getLayerClient();
+ mLayerClient = LibreOfficeMainActivity.getLayerClient();
mState = OverlayState.NONE;
}
@@ -123,16 +122,14 @@ public class InvalidationHandler implements Document.MessageCallback {
int width = Integer.decode(coordinates[2]);
int height = Integer.decode(coordinates[3]);
- float dpi = (float) LOKitShell.getDpi();
+ float dpi = LOKitShell.getDpi();
- RectF rect = new RectF(
+ return new RectF(
LOKitTileProvider.twipToPixel(x, dpi),
LOKitTileProvider.twipToPixel(y, dpi),
LOKitTileProvider.twipToPixel(x + width, dpi),
LOKitTileProvider.twipToPixel(y + height, dpi)
);
-
- return rect;
}
/**
diff --git a/android/source/src/java/org/libreoffice/LOKitShell.java b/android/source/src/java/org/libreoffice/LOKitShell.java
index 5c8ce78018a5..609a6cf56bf1 100644
--- a/android/source/src/java/org/libreoffice/LOKitShell.java
+++ b/android/source/src/java/org/libreoffice/LOKitShell.java
@@ -78,7 +78,7 @@ public class LOKitShell {
}
public static LayerView getLayerView() {
- return LibreOfficeMainActivity.mAppContext.getLayerClient().getView();
+ return LibreOfficeMainActivity.getLayerClient().getView();
}
// EVENTS
diff --git a/android/source/src/java/org/libreoffice/LOKitThread.java b/android/source/src/java/org/libreoffice/LOKitThread.java
index a762184954e6..d87a152a74bf 100644
--- a/android/source/src/java/org/libreoffice/LOKitThread.java
+++ b/android/source/src/java/org/libreoffice/LOKitThread.java
@@ -174,7 +174,7 @@ public class LOKitThread extends Thread {
mApplication = LibreOfficeMainActivity.mAppContext;
}
- mLayerClient = mApplication.getLayerClient();
+ mLayerClient = LibreOfficeMainActivity.getLayerClient();
mInvalidationHandler = new InvalidationHandler(LibreOfficeMainActivity.mAppContext);
mTileProvider = TileProviderFactory.create(mLayerClient, mInvalidationHandler, filename);
diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
index 00af8d51b1d5..6b7759d4a90e 100644
--- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
@@ -55,7 +55,7 @@ public class LOKitTileProvider implements TileProvider {
public LOKitTileProvider(GeckoLayerClient layerClient, Document.MessageCallback messageCallback, String input) {
mLayerClient = layerClient;
mMessageCallback = messageCallback;
- mDPI = (float) LOKitShell.getDpi();
+ mDPI = LOKitShell.getDpi();
mTileWidth = pixelToTwip(TILE_SIZE, mDPI);
mTileHeight = pixelToTwip(TILE_SIZE, mDPI);
diff --git a/android/source/src/java/org/libreoffice/MockTileProvider.java b/android/source/src/java/org/libreoffice/MockTileProvider.java
index 44f9e6b6f629..19f7b48713b3 100644
--- a/android/source/src/java/org/libreoffice/MockTileProvider.java
+++ b/android/source/src/java/org/libreoffice/MockTileProvider.java
@@ -69,9 +69,7 @@ public class MockTileProvider implements TileProvider {
String imageName = "d" + tileNumber;
Bitmap bitmap = mLayerClient.getView().getDrawable(imageName);
- CairoImage image = new BufferedCairoImage(bitmap);
-
- return image;
+ return new BufferedCairoImage(bitmap);
}
@Override
diff --git a/android/source/src/java/org/libreoffice/TileProvider.java b/android/source/src/java/org/libreoffice/TileProvider.java
index 9a706962e165..cf9173a8d1bd 100644
--- a/android/source/src/java/org/libreoffice/TileProvider.java
+++ b/android/source/src/java/org/libreoffice/TileProvider.java
@@ -11,7 +11,6 @@ package org.libreoffice;
import android.graphics.Bitmap;
import android.graphics.PointF;
-import android.graphics.RectF;
import android.view.KeyEvent;
import org.mozilla.gecko.gfx.CairoImage;
diff --git a/android/source/src/java/org/libreoffice/TileProviderFactory.java b/android/source/src/java/org/libreoffice/TileProviderFactory.java
index 6dff903a12d2..003a7141ecf3 100644
--- a/android/source/src/java/org/libreoffice/TileProviderFactory.java
+++ b/android/source/src/java/org/libreoffice/TileProviderFactory.java
@@ -35,7 +35,7 @@ public class TileProviderFactory {
}
}
- private static enum TileProviderID {
+ private enum TileProviderID {
MOCK, LOKIT
}
}
diff --git a/android/source/src/java/org/libreoffice/canvas/SelectionHandleEnd.java b/android/source/src/java/org/libreoffice/canvas/SelectionHandleEnd.java
index c13ad1fc8f7d..7d4d63520035 100644
--- a/android/source/src/java/org/libreoffice/canvas/SelectionHandleEnd.java
+++ b/android/source/src/java/org/libreoffice/canvas/SelectionHandleEnd.java
@@ -1,7 +1,6 @@
package org.libreoffice.canvas;
import android.content.Context;
-import android.graphics.Bitmap;
import org.libreoffice.R;
diff --git a/android/source/src/java/org/libreoffice/canvas/SelectionHandleMiddle.java b/android/source/src/java/org/libreoffice/canvas/SelectionHandleMiddle.java
index 7415d6d3dadd..b7f6e26d1929 100644
--- a/android/source/src/java/org/libreoffice/canvas/SelectionHandleMiddle.java
+++ b/android/source/src/java/org/libreoffice/canvas/SelectionHandleMiddle.java
@@ -1,7 +1,6 @@
package org.libreoffice.canvas;
import android.content.Context;
-import android.graphics.Bitmap;
import org.libreoffice.R;
diff --git a/android/source/src/java/org/libreoffice/canvas/SelectionHandleStart.java b/android/source/src/java/org/libreoffice/canvas/SelectionHandleStart.java
index af2e7ba7cf0a..ac6e08922d78 100644
--- a/android/source/src/java/org/libreoffice/canvas/SelectionHandleStart.java
+++ b/android/source/src/java/org/libreoffice/canvas/SelectionHandleStart.java
@@ -1,7 +1,6 @@
package org.libreoffice.canvas;
import android.content.Context;
-import android.graphics.Bitmap;
import org.libreoffice.R;
diff --git a/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java b/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
index 89a7f0930a96..13c3d6c2ba34 100644
--- a/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
+++ b/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
@@ -9,8 +9,6 @@ import java.util.List;
import org.libreoffice.storage.IFile;
-import android.util.Log;
-
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.resources.files.ChunkedUploadRemoteFileOperation;
import com.owncloud.android.lib.resources.files.DownloadRemoteFileOperation;
diff --git a/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java b/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
index bf866b92fef7..c037941b69ea 100644
--- a/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
+++ b/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
@@ -144,7 +144,7 @@ public class OwnCloudProvider implements IDocumentProvider,
* @param file
* File or directory to be deleted.
*/
- private void deleteRecursive(File file) {
+ private static void deleteRecursive(File file) {
if (file.isDirectory()) {
for (File child : file.listFiles())
deleteRecursive(child);
diff --git a/android/source/src/java/org/libreoffice/ui/FileUtilities.java b/android/source/src/java/org/libreoffice/ui/FileUtilities.java
index e2df3f0021d9..3455b9c0742a 100644
--- a/android/source/src/java/org/libreoffice/ui/FileUtilities.java
+++ b/android/source/src/java/org/libreoffice/ui/FileUtilities.java
@@ -8,8 +8,6 @@
*/
package org.libreoffice.ui;
-import org.libreoffice.R;
-
import org.libreoffice.storage.IFile;
import java.io.File;
diff --git a/android/source/src/java/org/libreoffice/ui/FolderIconView.java b/android/source/src/java/org/libreoffice/ui/FolderIconView.java
index 1c2b25f36766..004e5e9a8190 100644
--- a/android/source/src/java/org/libreoffice/ui/FolderIconView.java
+++ b/android/source/src/java/org/libreoffice/ui/FolderIconView.java
@@ -8,15 +8,11 @@
*/
package org.libreoffice.ui;
-import org.libreoffice.R;
-
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
-import android.graphics.Paint.Style;
-import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Color;
import android.util.AttributeSet;
@@ -100,7 +96,7 @@ public class FolderIconView extends View{
for (File file : contents) {
if (!FileUtilities.isThumbnail(file))
continue;
- thumbs.push(factory.decodeFile(file.getAbsolutePath()));//TODO switch to push for semantics
+ thumbs.push(BitmapFactory.decodeFile(file.getAbsolutePath()));//TODO switch to push for semantics
if (thumbs.size() > 3)
break;
}
diff --git a/android/source/src/java/org/libreoffice/ui/GridItemAdapter.java b/android/source/src/java/org/libreoffice/ui/GridItemAdapter.java
index c50d3a3edd59..d1e4278aee19 100644
--- a/android/source/src/java/org/libreoffice/ui/GridItemAdapter.java
+++ b/android/source/src/java/org/libreoffice/ui/GridItemAdapter.java
@@ -9,15 +9,6 @@
package org.libreoffice.ui;
-import org.libreoffice.R;
-import org.libreoffice.storage.IFile;
-
-
-import java.io.File;
-import java.nio.ByteBuffer;
-import java.nio.IntBuffer;
-import java.util.List;
-
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
@@ -26,12 +17,11 @@ import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
-import android.graphics.BitmapFactory;
-import android.graphics.Bitmap;
-import android.graphics.BlurMaskFilter;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.Color;
+
+import org.libreoffice.R;
+import org.libreoffice.storage.IFile;
+
+import java.util.List;
public class GridItemAdapter extends BaseAdapter {
Context mContext;
@@ -69,7 +59,7 @@ public class GridItemAdapter extends BaseAdapter {
if (convertView == null) {
gridView = new View(mContext);
} else {
- gridView = (View) convertView;
+ gridView = convertView;
}
// get layout from mobile.xml
diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index 72d2e82800b5..5290a50cf7b8 100644
--- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -15,8 +15,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.DataSetObserver;
-import android.graphics.Shader;
-import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -24,8 +22,8 @@ import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
-import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBarDrawerToggle;
+import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.ContextMenu;
@@ -68,7 +66,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
-public class LibreOfficeUIActivity extends ActionBarActivity implements ActionBar.OnNavigationListener {
+public class LibreOfficeUIActivity extends AppCompatActivity implements ActionBar.OnNavigationListener {
private String LOGTAG = LibreOfficeUIActivity.class.getSimpleName();
private SharedPreferences prefs;
private int filterMode = FileUtilities.ALL;
@@ -464,7 +462,7 @@ public class LibreOfficeUIActivity extends ActionBarActivity implements ActionBa
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.view_menu, menu);
- MenuItem item = (MenuItem)menu.findItem(R.id.menu_view_toggle);
+ MenuItem item = menu.findItem(R.id.menu_view_toggle);
if (viewMode == GRID_VIEW) {
item.setTitle(R.string.list_view);
item.setIcon(R.drawable.light_view_as_list);
@@ -473,21 +471,21 @@ public class LibreOfficeUIActivity extends ActionBarActivity implements ActionBa
item.setIcon(R.drawable.light_view_as_grid);
}
- item = (MenuItem)menu.findItem(R.id.menu_sort_size);
+ item = menu.findItem(R.id.menu_sort_size);
if (sortMode == FileUtilities.SORT_LARGEST) {
item.setTitle(R.string.sort_smallest);
} else {
item.setTitle(R.string.sort_largest);
}
- item = (MenuItem)menu.findItem(R.id.menu_sort_az);
+ item = menu.findItem(R.id.menu_sort_az);
if (sortMode == FileUtilities.SORT_AZ) {
item.setTitle(R.string.sort_za);
} else {
item.setTitle(R.string.sort_az);
}
- item = (MenuItem)menu.findItem(R.id.menu_sort_modified);
+ item = menu.findItem(R.id.menu_sort_modified);
if (sortMode == FileUtilities.SORT_NEWEST) {
item.setTitle(R.string.sort_oldest);
} else {
@@ -721,7 +719,7 @@ public class LibreOfficeUIActivity extends ActionBarActivity implements ActionBa
listItem = new View(mContext);
listItem = inflater.inflate(R.layout.file_list_item, null);
} else {
- listItem = (View) convertView;
+ listItem = convertView;
}
final int pos = position;
listItem.setClickable(true);
diff --git a/android/source/src/java/org/mozilla/gecko/gfx/LayerView.java b/android/source/src/java/org/mozilla/gecko/gfx/LayerView.java
index 88d93cad99f6..62dc997dbd89 100644
--- a/android/source/src/java/org/mozilla/gecko/gfx/LayerView.java
+++ b/android/source/src/java/org/mozilla/gecko/gfx/LayerView.java
@@ -342,7 +342,7 @@ public class LayerView extends FrameLayout {
/** This function is invoked by Gecko (compositor thread) via JNI; be careful when modifying signature. */
public static GLController registerCxxCompositor() {
try {
- LayerView layerView = LibreOfficeMainActivity.mAppContext.getLayerClient().getView();
+ LayerView layerView = LibreOfficeMainActivity.getLayerClient().getView();
layerView.mListener.compositorCreated();
return layerView.getGLController();
} catch (Exception e) {
diff --git a/android/source/src/java/org/mozilla/gecko/gfx/ScrollbarLayer.java b/android/source/src/java/org/mozilla/gecko/gfx/ScrollbarLayer.java
index 09229d88bfcc..7ef8ff020610 100644
--- a/android/source/src/java/org/mozilla/gecko/gfx/ScrollbarLayer.java
+++ b/android/source/src/java/org/mozilla/gecko/gfx/ScrollbarLayer.java
@@ -13,10 +13,8 @@ import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.RectF;
import android.opengl.GLES20;
-import android.util.Log;
import org.libreoffice.kit.DirectBufferAllocator;
-import org.libreoffice.LibreOfficeMainActivity;
import org.mozilla.gecko.util.FloatUtils;
import java.nio.ByteBuffer;
diff --git a/android/source/src/java/org/mozilla/gecko/gfx/TextureGenerator.java b/android/source/src/java/org/mozilla/gecko/gfx/TextureGenerator.java
index 15272618d337..bccd8968c81f 100644
--- a/android/source/src/java/org/mozilla/gecko/gfx/TextureGenerator.java
+++ b/android/source/src/java/org/mozilla/gecko/gfx/TextureGenerator.java
@@ -35,7 +35,7 @@ public class TextureGenerator {
public synchronized int take() {
try {
// Will block until one becomes available
- return (int) mTextureIds.take();
+ return mTextureIds.take();
} catch (InterruptedException e) {
return 0;
}