Merge "Moving GradientView background alpha to resources" into ub-launcher3-dorval-polish2
This commit is contained in:
commit
1ff6c41613
|
@ -9,6 +9,8 @@
|
||||||
<bool name="is_large_tablet">false</bool>
|
<bool name="is_large_tablet">false</bool>
|
||||||
<bool name="allow_rotation">false</bool>
|
<bool name="allow_rotation">false</bool>
|
||||||
|
|
||||||
|
<integer name="extracted_color_gradient_alpha">191</integer>
|
||||||
|
|
||||||
<!-- A string pointer to the original app name string. This allows derived projects to
|
<!-- A string pointer to the original app name string. This allows derived projects to
|
||||||
easily override the app name without providing all translations -->
|
easily override the app name without providing all translations -->
|
||||||
<string name="derived_app_name" translatable="false">@string/app_name</string>
|
<string name="derived_app_name" translatable="false">@string/app_name</string>
|
||||||
|
|
|
@ -27,6 +27,7 @@ import android.graphics.RectF;
|
||||||
import android.graphics.Shader;
|
import android.graphics.Shader;
|
||||||
import android.support.v4.graphics.ColorUtils;
|
import android.support.v4.graphics.ColorUtils;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.animation.AccelerateInterpolator;
|
import android.view.animation.AccelerateInterpolator;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
|
@ -46,7 +47,6 @@ public class GradientView extends View implements WallpaperColorInfo.OnChangeLis
|
||||||
private static final int DEFAULT_COLOR = Color.WHITE;
|
private static final int DEFAULT_COLOR = Color.WHITE;
|
||||||
private static final int ALPHA_MASK_HEIGHT_DP = 500;
|
private static final int ALPHA_MASK_HEIGHT_DP = 500;
|
||||||
private static final int ALPHA_MASK_WIDTH_DP = 2;
|
private static final int ALPHA_MASK_WIDTH_DP = 2;
|
||||||
private static final int ALPHA_COLORS = 0xBF;
|
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
private final Bitmap mAlphaGradientMask;
|
private final Bitmap mAlphaGradientMask;
|
||||||
|
@ -62,7 +62,7 @@ public class GradientView extends View implements WallpaperColorInfo.OnChangeLis
|
||||||
private final Paint mPaintNoScrim = new Paint();
|
private final Paint mPaintNoScrim = new Paint();
|
||||||
private float mProgress;
|
private float mProgress;
|
||||||
private final int mMaskHeight, mMaskWidth;
|
private final int mMaskHeight, mMaskWidth;
|
||||||
private final Context mAppContext;
|
private final int mAlphaColors;
|
||||||
private final Paint mDebugPaint = DEBUG ? new Paint() : null;
|
private final Paint mDebugPaint = DEBUG ? new Paint() : null;
|
||||||
private final Interpolator mAccelerator = new AccelerateInterpolator();
|
private final Interpolator mAccelerator = new AccelerateInterpolator();
|
||||||
private final float mAlphaStart;
|
private final float mAlphaStart;
|
||||||
|
@ -71,15 +71,14 @@ public class GradientView extends View implements WallpaperColorInfo.OnChangeLis
|
||||||
|
|
||||||
public GradientView(Context context, AttributeSet attrs) {
|
public GradientView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
this.mAppContext = context.getApplicationContext();
|
DisplayMetrics dm = getResources().getDisplayMetrics();
|
||||||
this.mMaskHeight = Utilities.pxFromDp(ALPHA_MASK_HEIGHT_DP,
|
this.mMaskHeight = Utilities.pxFromDp(ALPHA_MASK_HEIGHT_DP, dm);
|
||||||
mAppContext.getResources().getDisplayMetrics());
|
this.mMaskWidth = Utilities.pxFromDp(ALPHA_MASK_WIDTH_DP, dm);
|
||||||
this.mMaskWidth = Utilities.pxFromDp(ALPHA_MASK_WIDTH_DP,
|
|
||||||
mAppContext.getResources().getDisplayMetrics());
|
|
||||||
Launcher launcher = Launcher.getLauncher(context);
|
Launcher launcher = Launcher.getLauncher(context);
|
||||||
this.mAlphaStart = launcher.getDeviceProfile().isVerticalBarLayout() ? 0 : 100;
|
this.mAlphaStart = launcher.getDeviceProfile().isVerticalBarLayout() ? 0 : 100;
|
||||||
this.mScrimColor = Themes.getAttrColor(context, R.attr.allAppsScrimColor);
|
this.mScrimColor = Themes.getAttrColor(context, R.attr.allAppsScrimColor);
|
||||||
this.mWallpaperColorInfo = WallpaperColorInfo.getInstance(launcher);
|
this.mWallpaperColorInfo = WallpaperColorInfo.getInstance(launcher);
|
||||||
|
mAlphaColors = getResources().getInteger(R.integer.extracted_color_gradient_alpha);
|
||||||
updateColors();
|
updateColors();
|
||||||
mAlphaGradientMask = createDitheredAlphaMask();
|
mAlphaGradientMask = createDitheredAlphaMask();
|
||||||
}
|
}
|
||||||
|
@ -104,9 +103,9 @@ public class GradientView extends View implements WallpaperColorInfo.OnChangeLis
|
||||||
|
|
||||||
private void updateColors() {
|
private void updateColors() {
|
||||||
this.mColor1 = ColorUtils.setAlphaComponent(mWallpaperColorInfo.getMainColor(),
|
this.mColor1 = ColorUtils.setAlphaComponent(mWallpaperColorInfo.getMainColor(),
|
||||||
ALPHA_COLORS);
|
mAlphaColors);
|
||||||
this.mColor2 = ColorUtils.setAlphaComponent(mWallpaperColorInfo.getSecondaryColor(),
|
this.mColor2 = ColorUtils.setAlphaComponent(mWallpaperColorInfo.getSecondaryColor(),
|
||||||
ALPHA_COLORS);
|
mAlphaColors);
|
||||||
if (mWidth + mHeight > 0) {
|
if (mWidth + mHeight > 0) {
|
||||||
createRadialShader();
|
createRadialShader();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue