android: remove unused imports, call static methods the static way
and remove some redundant casts Change-Id: If58a395227e4b9d54b0d757032d4a55c25315019
This commit is contained in:
parent
20d5c4cce5
commit
7b282e3db8
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,7 @@ public class LOKitShell {
|
||||
}
|
||||
|
||||
public static LayerView getLayerView() {
|
||||
return LibreOfficeMainActivity.mAppContext.getLayerClient().getView();
|
||||
return LibreOfficeMainActivity.getLayerClient().getView();
|
||||
}
|
||||
|
||||
// EVENTS
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -35,7 +35,7 @@ public class TileProviderFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private static enum TileProviderID {
|
||||
private enum TileProviderID {
|
||||
MOCK, LOKIT
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.libreoffice.canvas;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import org.libreoffice.R;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.libreoffice.canvas;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import org.libreoffice.R;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.libreoffice.canvas;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import org.libreoffice.R;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -8,8 +8,6 @@
|
||||
*/
|
||||
package org.libreoffice.ui;
|
||||
|
||||
import org.libreoffice.R;
|
||||
|
||||
import org.libreoffice.storage.IFile;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user