Merge "Preventing overdraw. Drawing background directly at the window, instead of the rootview." into ub-launcher3-burnaby
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
android:id="@+id/launcher"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/workspace_bg"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.android.launcher3.DragLayer
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
android:id="@+id/launcher"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/workspace_bg"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.android.launcher3.DragLayer
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
android:id="@+id/launcher"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/workspace_bg"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.android.launcher3.DragLayer
|
||||
|
||||
@@ -55,6 +55,7 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
@@ -157,6 +158,10 @@ public class Launcher extends Activity
|
||||
private static final int REQUEST_BIND_APPWIDGET = 11;
|
||||
private static final int REQUEST_RECONFIGURE_APPWIDGET = 12;
|
||||
|
||||
private static final int WORKSPACE_BACKGROUND_GRADIENT = 0;
|
||||
private static final int WORKSPACE_BACKGROUND_TRANSPARENT = 1;
|
||||
private static final int WORKSPACE_BACKGROUND_BLACK = 2;
|
||||
|
||||
/**
|
||||
* IntentStarter uses request codes starting with this. This must be greater than all activity
|
||||
* request codes used internally.
|
||||
@@ -1042,8 +1047,9 @@ public class Launcher extends Activity
|
||||
}
|
||||
}
|
||||
|
||||
// Background was set to gradient in onPause(), restore to black if in all apps.
|
||||
setWorkspaceBackground(mState == State.WORKSPACE);
|
||||
// Background was set to gradient in onPause(), restore to transparent if in all apps.
|
||||
setWorkspaceBackground(mState == State.WORKSPACE ? WORKSPACE_BACKGROUND_TRANSPARENT
|
||||
: WORKSPACE_BACKGROUND_GRADIENT);
|
||||
|
||||
mPaused = false;
|
||||
if (mRestoring || mOnResumeNeedsLoad) {
|
||||
@@ -3296,9 +3302,17 @@ public class Launcher extends Activity
|
||||
return (mState == State.WIDGETS) || (mOnResumeState == State.WIDGETS);
|
||||
}
|
||||
|
||||
private void setWorkspaceBackground(boolean workspace) {
|
||||
mLauncherView.setBackground(workspace ?
|
||||
mWorkspaceBackgroundDrawable : null);
|
||||
private void setWorkspaceBackground(int background) {
|
||||
switch (background) {
|
||||
case WORKSPACE_BACKGROUND_TRANSPARENT:
|
||||
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
break;
|
||||
case WORKSPACE_BACKGROUND_BLACK:
|
||||
getWindow().setBackgroundDrawable(null);
|
||||
break;
|
||||
default:
|
||||
getWindow().setBackgroundDrawable(mWorkspaceBackgroundDrawable);
|
||||
}
|
||||
}
|
||||
|
||||
protected void changeWallpaperVisiblity(boolean visible) {
|
||||
@@ -3308,7 +3322,7 @@ public class Launcher extends Activity
|
||||
if (wpflags != curflags) {
|
||||
getWindow().setFlags(wpflags, WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER);
|
||||
}
|
||||
setWorkspaceBackground(visible);
|
||||
setWorkspaceBackground(visible ? WORKSPACE_BACKGROUND_GRADIENT : WORKSPACE_BACKGROUND_BLACK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user