Bug 770047 - Add the LayerView directly to the XML layout rather than creating it later, so that we don't get a black flash on startup on JellyBean devices. r=sriram

This commit is contained in:
Kartikaya Gupta 2012-07-28 10:33:51 -04:00
Родитель 16efaa3cc0
Коммит 55c4097bef
5 изменённых файлов: 23 добавлений и 14 удалений

Просмотреть файл

@ -1683,12 +1683,7 @@ abstract public class GeckoApp
* run experience, perhaps?
*/
mLayerController = new LayerController(this);
View v = mLayerController.getView();
// Instead of flickering the checkerboard, show a white screen until Gecko paints
v.setBackgroundColor(Color.WHITE);
mGeckoLayout.addView(v, 0);
mLayerController.setView((LayerView)findViewById(R.id.layer_view));
}
mPluginContainer = (AbsoluteLayout) findViewById(R.id.plugin_container);

Просмотреть файл

@ -10,6 +10,7 @@ import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import org.mozilla.gecko.gfx.LayerView;
public final class GeckoViewsFactory implements LayoutInflater.Factory {
private static final String LOGTAG = "GeckoViewsFactory";
@ -50,6 +51,10 @@ public final class GeckoViewsFactory implements LayoutInflater.Factory {
return new TabsPanel(context, attrs);
else if (TextUtils.equals(viewName, "TextSelectionHandle"))
return new TextSelectionHandle(context, attrs);
else if (TextUtils.equals(viewName, "gfx.LayerView"))
return new LayerView(context, attrs);
else
Log.e(LOGTAG, "Error: unknown custom view: " + viewName);
}
return null;

Просмотреть файл

@ -68,10 +68,14 @@ public class LayerController {
mForceRedraw = true;
mViewportMetrics = new ImmutableViewportMetrics(new ViewportMetrics());
mPanZoomController = new PanZoomController(this);
mView = new LayerView(context, this);
mCheckerboardShouldShowChecks = true;
}
public void setView(LayerView v) {
mView = v;
mView.connect(this);
}
public void setRoot(Layer layer) { mRootLayer = layer; }
public void setLayerClient(GeckoLayerClient layerClient) {

Просмотреть файл

@ -13,6 +13,7 @@ import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.util.AttributeSet;
import android.util.Log;
import android.graphics.PixelFormat;
import android.view.SurfaceHolder;
@ -31,7 +32,6 @@ import java.nio.IntBuffer;
public class LayerView extends SurfaceView implements SurfaceHolder.Callback {
private static String LOGTAG = "GeckoLayerView";
private Context mContext;
private LayerController mController;
private TouchEventHandler mTouchEventHandler;
private GLController mGLController;
@ -48,18 +48,18 @@ public class LayerView extends SurfaceView implements SurfaceHolder.Callback {
public static final int PAINT_BEFORE_FIRST = 1;
public static final int PAINT_AFTER_FIRST = 2;
public LayerView(Context context, LayerController controller) {
super(context);
public LayerView(Context context, AttributeSet attrs) {
super(context, attrs);
SurfaceHolder holder = getHolder();
holder.addCallback(this);
holder.setFormat(PixelFormat.RGB_565);
mGLController = new GLController(this);
mContext = context;
}
void connect(LayerController controller) {
mController = controller;
mTouchEventHandler = new TouchEventHandler(context, this, mController);
mTouchEventHandler = new TouchEventHandler(getContext(), this, mController);
mRenderer = new LayerRenderer(this);
mInputConnectionHandler = null;

Просмотреть файл

@ -8,6 +8,11 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<org.mozilla.gecko.gfx.LayerView android:id="@+id/layer_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFF"/>
<AbsoluteLayout android:id="@+id/plugin_container"
android:background="@android:color/transparent"
android:layout_width="fill_parent"