android: remove unused imports, call static methods the static way
and remove some redundant casts Change-Id: If58a395227e4b9d54b0d757032d4a55c25315019
This commit is contained in:
@@ -10,7 +10,6 @@ import org.libreoffice.canvas.SelectionHandle;
|
|||||||
import org.libreoffice.kit.Document;
|
import org.libreoffice.kit.Document;
|
||||||
import org.libreoffice.overlay.DocumentOverlay;
|
import org.libreoffice.overlay.DocumentOverlay;
|
||||||
import org.mozilla.gecko.gfx.GeckoLayerClient;
|
import org.mozilla.gecko.gfx.GeckoLayerClient;
|
||||||
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -28,7 +27,7 @@ public class InvalidationHandler implements Document.MessageCallback {
|
|||||||
|
|
||||||
public InvalidationHandler(LibreOfficeMainActivity mainActivity) {
|
public InvalidationHandler(LibreOfficeMainActivity mainActivity) {
|
||||||
mDocumentOverlay = mainActivity.getDocumentOverlay();
|
mDocumentOverlay = mainActivity.getDocumentOverlay();
|
||||||
mLayerClient = mainActivity.getLayerClient();
|
mLayerClient = LibreOfficeMainActivity.getLayerClient();
|
||||||
mState = OverlayState.NONE;
|
mState = OverlayState.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,16 +122,14 @@ public class InvalidationHandler implements Document.MessageCallback {
|
|||||||
int width = Integer.decode(coordinates[2]);
|
int width = Integer.decode(coordinates[2]);
|
||||||
int height = Integer.decode(coordinates[3]);
|
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(x, dpi),
|
||||||
LOKitTileProvider.twipToPixel(y, dpi),
|
LOKitTileProvider.twipToPixel(y, dpi),
|
||||||
LOKitTileProvider.twipToPixel(x + width, dpi),
|
LOKitTileProvider.twipToPixel(x + width, dpi),
|
||||||
LOKitTileProvider.twipToPixel(y + height, dpi)
|
LOKitTileProvider.twipToPixel(y + height, dpi)
|
||||||
);
|
);
|
||||||
|
|
||||||
return rect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -78,7 +78,7 @@ public class LOKitShell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static LayerView getLayerView() {
|
public static LayerView getLayerView() {
|
||||||
return LibreOfficeMainActivity.mAppContext.getLayerClient().getView();
|
return LibreOfficeMainActivity.getLayerClient().getView();
|
||||||
}
|
}
|
||||||
|
|
||||||
// EVENTS
|
// EVENTS
|
||||||
|
@@ -174,7 +174,7 @@ public class LOKitThread extends Thread {
|
|||||||
mApplication = LibreOfficeMainActivity.mAppContext;
|
mApplication = LibreOfficeMainActivity.mAppContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
mLayerClient = mApplication.getLayerClient();
|
mLayerClient = LibreOfficeMainActivity.getLayerClient();
|
||||||
|
|
||||||
mInvalidationHandler = new InvalidationHandler(LibreOfficeMainActivity.mAppContext);
|
mInvalidationHandler = new InvalidationHandler(LibreOfficeMainActivity.mAppContext);
|
||||||
mTileProvider = TileProviderFactory.create(mLayerClient, mInvalidationHandler, filename);
|
mTileProvider = TileProviderFactory.create(mLayerClient, mInvalidationHandler, filename);
|
||||||
|
@@ -55,7 +55,7 @@ public class LOKitTileProvider implements TileProvider {
|
|||||||
public LOKitTileProvider(GeckoLayerClient layerClient, Document.MessageCallback messageCallback, String input) {
|
public LOKitTileProvider(GeckoLayerClient layerClient, Document.MessageCallback messageCallback, String input) {
|
||||||
mLayerClient = layerClient;
|
mLayerClient = layerClient;
|
||||||
mMessageCallback = messageCallback;
|
mMessageCallback = messageCallback;
|
||||||
mDPI = (float) LOKitShell.getDpi();
|
mDPI = LOKitShell.getDpi();
|
||||||
mTileWidth = pixelToTwip(TILE_SIZE, mDPI);
|
mTileWidth = pixelToTwip(TILE_SIZE, mDPI);
|
||||||
mTileHeight = pixelToTwip(TILE_SIZE, mDPI);
|
mTileHeight = pixelToTwip(TILE_SIZE, mDPI);
|
||||||
|
|
||||||
|
@@ -69,9 +69,7 @@ public class MockTileProvider implements TileProvider {
|
|||||||
String imageName = "d" + tileNumber;
|
String imageName = "d" + tileNumber;
|
||||||
Bitmap bitmap = mLayerClient.getView().getDrawable(imageName);
|
Bitmap bitmap = mLayerClient.getView().getDrawable(imageName);
|
||||||
|
|
||||||
CairoImage image = new BufferedCairoImage(bitmap);
|
return new BufferedCairoImage(bitmap);
|
||||||
|
|
||||||
return image;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -11,7 +11,6 @@ package org.libreoffice;
|
|||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.graphics.RectF;
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
import org.mozilla.gecko.gfx.CairoImage;
|
import org.mozilla.gecko.gfx.CairoImage;
|
||||||
|
@@ -35,7 +35,7 @@ public class TileProviderFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static enum TileProviderID {
|
private enum TileProviderID {
|
||||||
MOCK, LOKIT
|
MOCK, LOKIT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package org.libreoffice.canvas;
|
package org.libreoffice.canvas;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
|
|
||||||
import org.libreoffice.R;
|
import org.libreoffice.R;
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package org.libreoffice.canvas;
|
package org.libreoffice.canvas;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
|
|
||||||
import org.libreoffice.R;
|
import org.libreoffice.R;
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package org.libreoffice.canvas;
|
package org.libreoffice.canvas;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
|
|
||||||
import org.libreoffice.R;
|
import org.libreoffice.R;
|
||||||
|
|
||||||
|
@@ -9,8 +9,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.libreoffice.storage.IFile;
|
import org.libreoffice.storage.IFile;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||||
import com.owncloud.android.lib.resources.files.ChunkedUploadRemoteFileOperation;
|
import com.owncloud.android.lib.resources.files.ChunkedUploadRemoteFileOperation;
|
||||||
import com.owncloud.android.lib.resources.files.DownloadRemoteFileOperation;
|
import com.owncloud.android.lib.resources.files.DownloadRemoteFileOperation;
|
||||||
|
@@ -144,7 +144,7 @@ public class OwnCloudProvider implements IDocumentProvider,
|
|||||||
* @param file
|
* @param file
|
||||||
* File or directory to be deleted.
|
* File or directory to be deleted.
|
||||||
*/
|
*/
|
||||||
private void deleteRecursive(File file) {
|
private static void deleteRecursive(File file) {
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
for (File child : file.listFiles())
|
for (File child : file.listFiles())
|
||||||
deleteRecursive(child);
|
deleteRecursive(child);
|
||||||
|
@@ -8,8 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.libreoffice.ui;
|
package org.libreoffice.ui;
|
||||||
|
|
||||||
import org.libreoffice.R;
|
|
||||||
|
|
||||||
import org.libreoffice.storage.IFile;
|
import org.libreoffice.storage.IFile;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@@ -8,15 +8,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.libreoffice.ui;
|
package org.libreoffice.ui;
|
||||||
|
|
||||||
import org.libreoffice.R;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Style;
|
|
||||||
import android.graphics.Rect;
|
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
@@ -100,7 +96,7 @@ public class FolderIconView extends View{
|
|||||||
for (File file : contents) {
|
for (File file : contents) {
|
||||||
if (!FileUtilities.isThumbnail(file))
|
if (!FileUtilities.isThumbnail(file))
|
||||||
continue;
|
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)
|
if (thumbs.size() > 3)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -9,15 +9,6 @@
|
|||||||
|
|
||||||
package org.libreoffice.ui;
|
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.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -26,12 +17,11 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.graphics.Bitmap;
|
import org.libreoffice.R;
|
||||||
import android.graphics.BlurMaskFilter;
|
import org.libreoffice.storage.IFile;
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.Paint;
|
import java.util.List;
|
||||||
import android.graphics.Color;
|
|
||||||
|
|
||||||
public class GridItemAdapter extends BaseAdapter {
|
public class GridItemAdapter extends BaseAdapter {
|
||||||
Context mContext;
|
Context mContext;
|
||||||
@@ -69,7 +59,7 @@ public class GridItemAdapter extends BaseAdapter {
|
|||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
gridView = new View(mContext);
|
gridView = new View(mContext);
|
||||||
} else {
|
} else {
|
||||||
gridView = (View) convertView;
|
gridView = convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get layout from mobile.xml
|
// get layout from mobile.xml
|
||||||
|
@@ -15,8 +15,6 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.DataSetObserver;
|
import android.database.DataSetObserver;
|
||||||
import android.graphics.Shader;
|
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -24,8 +22,8 @@ import android.os.Handler;
|
|||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.ActionBarActivity;
|
|
||||||
import android.support.v7.app.ActionBarDrawerToggle;
|
import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
@@ -68,7 +66,7 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
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 String LOGTAG = LibreOfficeUIActivity.class.getSimpleName();
|
||||||
private SharedPreferences prefs;
|
private SharedPreferences prefs;
|
||||||
private int filterMode = FileUtilities.ALL;
|
private int filterMode = FileUtilities.ALL;
|
||||||
@@ -464,7 +462,7 @@ public class LibreOfficeUIActivity extends ActionBarActivity implements ActionBa
|
|||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.view_menu, menu);
|
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) {
|
if (viewMode == GRID_VIEW) {
|
||||||
item.setTitle(R.string.list_view);
|
item.setTitle(R.string.list_view);
|
||||||
item.setIcon(R.drawable.light_view_as_list);
|
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.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) {
|
if (sortMode == FileUtilities.SORT_LARGEST) {
|
||||||
item.setTitle(R.string.sort_smallest);
|
item.setTitle(R.string.sort_smallest);
|
||||||
} else {
|
} else {
|
||||||
item.setTitle(R.string.sort_largest);
|
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) {
|
if (sortMode == FileUtilities.SORT_AZ) {
|
||||||
item.setTitle(R.string.sort_za);
|
item.setTitle(R.string.sort_za);
|
||||||
} else {
|
} else {
|
||||||
item.setTitle(R.string.sort_az);
|
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) {
|
if (sortMode == FileUtilities.SORT_NEWEST) {
|
||||||
item.setTitle(R.string.sort_oldest);
|
item.setTitle(R.string.sort_oldest);
|
||||||
} else {
|
} else {
|
||||||
@@ -721,7 +719,7 @@ public class LibreOfficeUIActivity extends ActionBarActivity implements ActionBa
|
|||||||
listItem = new View(mContext);
|
listItem = new View(mContext);
|
||||||
listItem = inflater.inflate(R.layout.file_list_item, null);
|
listItem = inflater.inflate(R.layout.file_list_item, null);
|
||||||
} else {
|
} else {
|
||||||
listItem = (View) convertView;
|
listItem = convertView;
|
||||||
}
|
}
|
||||||
final int pos = position;
|
final int pos = position;
|
||||||
listItem.setClickable(true);
|
listItem.setClickable(true);
|
||||||
|
@@ -342,7 +342,7 @@ public class LayerView extends FrameLayout {
|
|||||||
/** This function is invoked by Gecko (compositor thread) via JNI; be careful when modifying signature. */
|
/** This function is invoked by Gecko (compositor thread) via JNI; be careful when modifying signature. */
|
||||||
public static GLController registerCxxCompositor() {
|
public static GLController registerCxxCompositor() {
|
||||||
try {
|
try {
|
||||||
LayerView layerView = LibreOfficeMainActivity.mAppContext.getLayerClient().getView();
|
LayerView layerView = LibreOfficeMainActivity.getLayerClient().getView();
|
||||||
layerView.mListener.compositorCreated();
|
layerView.mListener.compositorCreated();
|
||||||
return layerView.getGLController();
|
return layerView.getGLController();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@@ -13,10 +13,8 @@ import android.graphics.PorterDuff;
|
|||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.opengl.GLES20;
|
import android.opengl.GLES20;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.libreoffice.kit.DirectBufferAllocator;
|
import org.libreoffice.kit.DirectBufferAllocator;
|
||||||
import org.libreoffice.LibreOfficeMainActivity;
|
|
||||||
import org.mozilla.gecko.util.FloatUtils;
|
import org.mozilla.gecko.util.FloatUtils;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
@@ -35,7 +35,7 @@ public class TextureGenerator {
|
|||||||
public synchronized int take() {
|
public synchronized int take() {
|
||||||
try {
|
try {
|
||||||
// Will block until one becomes available
|
// Will block until one becomes available
|
||||||
return (int) mTextureIds.take();
|
return mTextureIds.take();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user