зеркало из https://github.com/mozilla/gecko-dev.git
Bug 777351 - Move the getDrawable functions from LayerController to LayerView. r=sriram
This commit is contained in:
Родитель
e6a93f7653
Коммит
8143ab8d72
|
@ -10,9 +10,6 @@ import org.mozilla.gecko.ui.PanZoomController;
|
||||||
import org.mozilla.gecko.ui.PanZoomTarget;
|
import org.mozilla.gecko.ui.PanZoomTarget;
|
||||||
import org.mozilla.gecko.ui.SimpleScaleGestureDetector;
|
import org.mozilla.gecko.ui.SimpleScaleGestureDetector;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
|
@ -102,9 +99,6 @@ public class LayerController implements PanZoomTarget {
|
||||||
return mViewportMetrics.getSize();
|
return mViewportMetrics.getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bitmap getBackgroundPattern() { return getDrawable("tabs_tray_selected_bg"); }
|
|
||||||
public Bitmap getShadowPattern() { return getDrawable("shadow"); }
|
|
||||||
|
|
||||||
public PanZoomController getPanZoomController() { return mPanZoomController; }
|
public PanZoomController getPanZoomController() { return mPanZoomController; }
|
||||||
public GestureDetector.OnGestureListener getGestureListener() { return mPanZoomController; }
|
public GestureDetector.OnGestureListener getGestureListener() { return mPanZoomController; }
|
||||||
public SimpleScaleGestureDetector.SimpleScaleGestureListener getScaleGestureListener() {
|
public SimpleScaleGestureDetector.SimpleScaleGestureListener getScaleGestureListener() {
|
||||||
|
@ -112,14 +106,6 @@ public class LayerController implements PanZoomTarget {
|
||||||
}
|
}
|
||||||
public GestureDetector.OnDoubleTapListener getDoubleTapListener() { return mPanZoomController; }
|
public GestureDetector.OnDoubleTapListener getDoubleTapListener() { return mPanZoomController; }
|
||||||
|
|
||||||
private Bitmap getDrawable(String name) {
|
|
||||||
Resources resources = mContext.getResources();
|
|
||||||
int resourceID = resources.getIdentifier(name, "drawable", mContext.getPackageName());
|
|
||||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
|
||||||
options.inScaled = false;
|
|
||||||
return BitmapFactory.decodeResource(mContext.getResources(), resourceID, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The view calls this function to indicate that the viewport changed size. It must hold the
|
* The view calls this function to indicate that the viewport changed size. It must hold the
|
||||||
* monitor while calling it.
|
* monitor while calling it.
|
||||||
|
|
|
@ -143,14 +143,12 @@ public class LayerRenderer {
|
||||||
public LayerRenderer(LayerView view) {
|
public LayerRenderer(LayerView view) {
|
||||||
mView = view;
|
mView = view;
|
||||||
|
|
||||||
LayerController controller = view.getController();
|
CairoImage backgroundImage = new BufferedCairoImage(view.getBackgroundPattern());
|
||||||
|
|
||||||
CairoImage backgroundImage = new BufferedCairoImage(controller.getBackgroundPattern());
|
|
||||||
mBackgroundLayer = new SingleTileLayer(true, backgroundImage);
|
mBackgroundLayer = new SingleTileLayer(true, backgroundImage);
|
||||||
|
|
||||||
mCheckerboardLayer = ScreenshotLayer.create();
|
mCheckerboardLayer = ScreenshotLayer.create();
|
||||||
|
|
||||||
CairoImage shadowImage = new BufferedCairoImage(controller.getShadowPattern());
|
CairoImage shadowImage = new BufferedCairoImage(view.getShadowPattern());
|
||||||
mShadowLayer = new NinePatchTileLayer(shadowImage);
|
mShadowLayer = new NinePatchTileLayer(shadowImage);
|
||||||
|
|
||||||
mHorizScrollLayer = ScrollbarLayer.create(this, false);
|
mHorizScrollLayer = ScrollbarLayer.create(this, false);
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.mozilla.gecko.GeckoApp;
|
||||||
import org.mozilla.gecko.GeckoInputConnection;
|
import org.mozilla.gecko.GeckoInputConnection;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
@ -18,6 +19,8 @@ import android.view.TextureView;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
import android.view.SurfaceHolder;
|
import android.view.SurfaceHolder;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
|
@ -220,6 +223,23 @@ public class LayerView extends FrameLayout {
|
||||||
return mGLController;
|
return mGLController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Bitmap getDrawable(String name) {
|
||||||
|
Context context = getContext();
|
||||||
|
Resources resources = context.getResources();
|
||||||
|
int resourceID = resources.getIdentifier(name, "drawable", context.getPackageName());
|
||||||
|
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||||
|
options.inScaled = false;
|
||||||
|
return BitmapFactory.decodeResource(context.getResources(), resourceID, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bitmap getBackgroundPattern() {
|
||||||
|
return getDrawable("tabs_tray_selected_bg");
|
||||||
|
}
|
||||||
|
|
||||||
|
Bitmap getShadowPattern() {
|
||||||
|
return getDrawable("shadow");
|
||||||
|
}
|
||||||
|
|
||||||
private void onSizeChanged(int width, int height) {
|
private void onSizeChanged(int width, int height) {
|
||||||
mGLController.surfaceChanged(width, height);
|
mGLController.surfaceChanged(width, height);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче