Kaydet (Commit) 20ca5ea8 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

android: null safeguards and cleanup unneeded calls

Change-Id: I0ffcfb0fbaa03e5035bec9dd1ffed21f85972470
üst 52228bbd
...@@ -3,7 +3,6 @@ package org.libreoffice; ...@@ -3,7 +3,6 @@ package org.libreoffice;
import android.os.Handler; import android.os.Handler;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log;
public class LOKitShell { public class LOKitShell {
...@@ -20,10 +19,6 @@ public class LOKitShell { ...@@ -20,10 +19,6 @@ public class LOKitShell {
} }
} }
public static void viewSizeChanged() {
Log.i(LOGTAG, "viewSizeChanged");
}
// Get a Handler for the main java thread // Get a Handler for the main java thread
public static Handler getMainHandler() { public static Handler getMainHandler() {
return LibreOfficeMainActivity.mAppContext.mMainHandler; return LibreOfficeMainActivity.mAppContext.mMainHandler;
......
...@@ -131,6 +131,10 @@ public class DynamicTileLayer extends Layer { ...@@ -131,6 +131,10 @@ public class DynamicTileLayer extends Layer {
} }
public void reevaluateTiles(ImmutableViewportMetrics viewportMetrics) { public void reevaluateTiles(ImmutableViewportMetrics viewportMetrics) {
if (tileProvider == null) {
return;
}
RectF newCurrentViewPort = inflate(roundToTileSize(viewportMetrics.getViewport(), tileSize), tileSize); RectF newCurrentViewPort = inflate(roundToTileSize(viewportMetrics.getViewport(), tileSize), tileSize);
if (!currentViewport.equals(newCurrentViewPort)) { if (!currentViewport.equals(newCurrentViewPort)) {
...@@ -193,5 +197,6 @@ public class DynamicTileLayer extends Layer { ...@@ -193,5 +197,6 @@ public class DynamicTileLayer extends Layer {
public void clearAllTiles() { public void clearAllTiles() {
tiles.clear(); tiles.clear();
currentViewport = new RectF();
} }
} }
...@@ -71,7 +71,6 @@ public class GeckoLayerClient implements LayerView.Listener { ...@@ -71,7 +71,6 @@ public class GeckoLayerClient implements LayerView.Listener {
private ImmutableViewportMetrics mNewGeckoViewport; private ImmutableViewportMetrics mNewGeckoViewport;
private Context mContext; private Context mContext;
private boolean mPendingViewportAdjust; private boolean mPendingViewportAdjust;
private boolean mViewportSizeChanged;
public GeckoLayerClient(Context context) { public GeckoLayerClient(Context context) {
mContext = context; mContext = context;
...@@ -147,8 +146,6 @@ public class GeckoLayerClient implements LayerView.Listener { ...@@ -147,8 +146,6 @@ public class GeckoLayerClient implements LayerView.Listener {
/* Informs Gecko that the screen size has changed. */ /* Informs Gecko that the screen size has changed. */
private void sendResizeEventIfNecessary(boolean force) { private void sendResizeEventIfNecessary(boolean force) {
Log.e(LOGTAG, "### sendResizeEventIfNecessary " + force);
DisplayMetrics metrics = new DisplayMetrics(); DisplayMetrics metrics = new DisplayMetrics();
LibreOfficeMainActivity.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics); LibreOfficeMainActivity.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics);
View view = mLayerController.getView(); View view = mLayerController.getView();
...@@ -183,7 +180,6 @@ public class GeckoLayerClient implements LayerView.Listener { ...@@ -183,7 +180,6 @@ public class GeckoLayerClient implements LayerView.Listener {
public void viewportSizeChanged() { public void viewportSizeChanged() {
sendResizeEventIfNecessary(true); sendResizeEventIfNecessary(true);
LOKitShell.viewSizeChanged();
} }
void adjustViewport(DisplayPortMetrics displayPort) { void adjustViewport(DisplayPortMetrics displayPort) {
...@@ -204,10 +200,6 @@ public class GeckoLayerClient implements LayerView.Listener { ...@@ -204,10 +200,6 @@ public class GeckoLayerClient implements LayerView.Listener {
} }
LOKitShell.sendEvent(LOEventFactory.viewport(clampedMetrics)); LOKitShell.sendEvent(LOEventFactory.viewport(clampedMetrics));
if (mViewportSizeChanged) {
mViewportSizeChanged = false;
LOKitShell.viewSizeChanged();
}
} }
/** This function is invoked by Gecko via JNI; be careful when modifying signature. /** This function is invoked by Gecko via JNI; be careful when modifying signature.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment