Merge "Update Launcher to use theme colors." into ub-launcher3-calgary

This commit is contained in:
Andrew Sapperstein
2016-06-20 19:38:54 +00:00
committed by Android (Google) Code Review
23 changed files with 44 additions and 42 deletions
@@ -16,7 +16,7 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/container_fastscroll_thumb_active_color" />
<solid android:color="?android:attr/colorAccent" />
<size
android:width="64dp"
android:height="64dp" />
@@ -16,7 +16,7 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/container_fastscroll_thumb_active_color" />
<solid android:color="?android:attr/colorAccent" />
<size
android:width="64dp"
android:height="64dp" />
+1 -1
View File
@@ -23,7 +23,7 @@
android:paddingRight="16dp"
android:fontFamily="sans-serif-medium"
android:textSize="14sp"
android:textColor="@color/launcher_accent_color"
android:textColor="?android:attr/colorAccent"
android:text="@string/all_apps_search_market_message"
android:textAllCaps="true"
android:focusable="true"
+1 -1
View File
@@ -21,7 +21,7 @@
android:layout_weight="1"
android:orientation="vertical"
android:focusable="true"
android:background="@color/widgets_cell_color"
android:background="?android:attr/colorPrimary"
android:gravity="center_horizontal">
<LinearLayout
+1 -1
View File
@@ -19,7 +19,7 @@
android:id="@+id/widgets_cell_list_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/widgets_cell_color"
android:background="?android:attr/colorPrimary"
android:orientation="vertical"
android:focusable="true"
android:descendantFocusability="afterDescendants">
+2 -1
View File
@@ -25,7 +25,8 @@
android:paddingTop="@dimen/container_bounds_inset"
android:paddingBottom="@dimen/container_bounds_inset"
android:descendantFocusability="afterDescendants"
launcher:revealBackground="@drawable/quantum_panel_shape_dark">
launcher:revealBackground="@drawable/quantum_panel_shape_dark"
android:theme="@android:style/Theme.DeviceDefault.Settings">
<View
android:id="@+id/reveal_view"
+1 -4
View File
@@ -24,8 +24,5 @@
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#00000000</item>
<item name="android:navigationBarColor">#00000000</item>
<item name="android:colorControlActivated">@color/launcher_accent_color</item>
<item name="android:colorAccent">@color/launcher_accent_color</item>
<item name="android:colorPrimary">@color/launcher_accent_color</item>
</style>
</resources>
</resources>
-10
View File
@@ -22,7 +22,6 @@
over the delete target or the info target -->
<color name="delete_target_hover_tint">#FFC1C1C1</color>
<color name="uninstall_target_hover_tint">#FFF0592B</color>
<color name="info_target_hover_tint">#FF009688</color>
<color name="cling_scrim_background">#80000000</color>
<color name="focused_background">#80c6c5c5</color>
@@ -38,20 +37,11 @@
<color name="quantum_panel_bg_color_dark">#FF374248</color>
<color name="outline_color">#FFFFFFFF</color>
<color name="launcher_accent_color">#ff009688</color>
<color name="spring_loaded_panel_color">#40FFFFFF</color>
<color name="spring_loaded_highlighted_panel_border_color">#FFF</color>
<!-- Containers -->
<color name="container_fastscroll_thumb_inactive_color">#009688</color>
<color name="container_fastscroll_thumb_active_color">#009688</color>
<!-- All Apps -->
<color name="all_apps_grid_section_text_color">#009688</color>
<!-- Widgets view -->
<color name="widgets_view_section_text_color">#FFFFFF</color>
<color name="widgets_view_item_text_color">#C4C4C4</color>
<color name="widgets_cell_color">#263238</color>
</resources>
+1 -1
View File
@@ -31,7 +31,7 @@
<style name="Theme" parent="@style/LauncherTheme"></style>
<!-- Overscroll effect -->
<style name="CustomOverscroll.Light" parent="@android:style/Theme.DeviceDefault">
<style name="CustomOverscroll.Light" parent="@android:style/Theme.DeviceDefault.Light">
<item name="android:colorEdgeEffect">@color/folder_edge_effect_color</item>
</style>
@@ -50,10 +50,10 @@ public abstract class BaseContainerView extends FrameLayout {
public BaseContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
int width = ((Launcher) context).getDeviceProfile().availableWidthPx;
Launcher launcher = Launcher.getLauncher(context);
int width = launcher.getDeviceProfile().availableWidthPx;
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP &&
this instanceof AllAppsContainerView &&
!((Launcher) context).getDeviceProfile().isLandscape) {
this instanceof AllAppsContainerView && launcher.getDeviceProfile().isLandscape) {
mHorizontalPadding = 0;
} else {
mHorizontalPadding = DeviceProfile.getContainerPadding(context, width);
@@ -89,4 +89,4 @@ public abstract class BaseContainerView extends FrameLayout {
public final View getRevealView() {
return mRevealView;
}
}
}
@@ -81,9 +81,7 @@ public class BaseRecyclerViewFastScrollBar {
mTrackPaint = new Paint();
mTrackPaint.setColor(rv.getFastScrollerTrackColor(Color.BLACK));
mTrackPaint.setAlpha(MAX_TRACK_ALPHA);
mThumbInactiveColor = rv.getFastScrollerThumbInactiveColor(
res.getColor(R.color.container_fastscroll_thumb_inactive_color));
mThumbActiveColor = res.getColor(R.color.container_fastscroll_thumb_active_color);
mThumbActiveColor = mThumbInactiveColor = Utilities.getColorAccent(rv.getContext());
mThumbPaint = new Paint();
mThumbPaint.setAntiAlias(true);
mThumbPaint.setColor(mThumbInactiveColor);
@@ -53,7 +53,7 @@ public class BaseRecyclerViewFastScrollPopup {
mRes = res;
mRv = rv;
mBgOriginalSize = res.getDimensionPixelSize(R.dimen.container_fastscroll_popup_size);
mBg = res.getDrawable(R.drawable.container_fastscroll_popup_bg);
mBg = rv.getContext().getDrawable(R.drawable.container_fastscroll_popup_bg);
mBg.setBounds(0, 0, mBgOriginalSize, mBgOriginalSize);
mTextPaint = new Paint();
mTextPaint.setColor(Color.WHITE);
@@ -103,7 +103,7 @@ public class BubbleTextView extends TextView
public BubbleTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mLauncher = (Launcher) context;
mLauncher = Launcher.getLauncher(context);
DeviceProfile grid = mLauncher.getDeviceProfile();
TypedArray a = context.obtainStyledAttributes(attrs,
@@ -43,7 +43,7 @@ public class InfoDropTarget extends UninstallDropTarget {
protected void onFinishInflate() {
super.onFinishInflate();
// Get the hover color
mHoverColor = getResources().getColor(R.color.info_target_hover_tint);
mHoverColor = Utilities.getColorAccent(getContext());
setDrawable(R.drawable.ic_info_launcher);
}
+8
View File
@@ -38,6 +38,7 @@ import android.content.ComponentCallbacks2;
import android.content.ComponentName;
import android.content.ContentValues;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
@@ -4523,6 +4524,13 @@ public class Launcher extends Activity
}
}
public static Launcher getLauncher(Context context) {
if (context instanceof Launcher) {
return (Launcher) context;
}
return ((Launcher) ((ContextWrapper) context).getBaseContext());
}
private class RotationPrefChangeHandler implements OnSharedPreferenceChangeListener, Runnable {
@Override
+8
View File
@@ -30,6 +30,7 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -839,4 +840,11 @@ public final class Utilities {
return getBitmap().getWidth();
}
}
public static int getColorAccent(Context context) {
TypedArray ta = context.obtainStyledAttributes(new int[]{android.R.attr.colorAccent});
int colorAccent = ta.getColor(0, 0);
ta.recycle();
return colorAccent;
}
}
@@ -584,7 +584,7 @@ public class WidgetPreviewLoader {
// which would gets re-written next time.
mVersions = getPackageVersion(mKey.componentName.getPackageName());
Launcher launcher = (Launcher) mCaller.getContext();
Launcher launcher = Launcher.getLauncher(mCaller.getContext());
// it's not in the db... we need to generate it
preview = generatePreview(launcher, mInfo, unusedBitmap, mPreviewWidth, mPreviewHeight);
@@ -178,7 +178,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
super(context, attrs, defStyleAttr);
Resources res = context.getResources();
mLauncher = (Launcher) context;
mLauncher = Launcher.getLauncher(context);
mSectionNamesMargin = res.getDimensionPixelSize(R.dimen.all_apps_grid_view_start_margin);
mApps = new AlphabeticalAppsList(context);
mAdapter = new AllAppsGridAdapter(mLauncher, mApps, this, mLauncher, this);
@@ -378,7 +378,7 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
mSectionTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mSectionTextPaint.setTextSize(res.getDimensionPixelSize(
R.dimen.all_apps_grid_section_text_size));
mSectionTextPaint.setColor(res.getColor(R.color.all_apps_grid_section_text_color));
mSectionTextPaint.setColor(Utilities.getColorAccent(launcher));
mPredictedAppsDividerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPredictedAppsDividerPaint.setStrokeWidth(Utilities.pxFromDp(1f, res.getDisplayMetrics()));
@@ -123,7 +123,7 @@ public class PageIndicatorDots extends PageIndicator {
mDotRadius = getResources().getDimension(R.dimen.page_indicator_dot_size) / 2;
setOutlineProvider(new MyOutlineProver());
mActiveColor = getResources().getColor(R.color.launcher_accent_color);
mActiveColor = Utilities.getColorAccent(context);
mInActiveColor = getResources().getColor(R.color.page_indicator_dot_color);
mIsRtl = Utilities.isRtl(getResources());
@@ -88,7 +88,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
super(context, attrs, defStyle);
final Resources r = context.getResources();
mLauncher = (Launcher) context;
mLauncher = Launcher.getLauncher(context);
mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this);
setContainerWidth();
@@ -82,9 +82,9 @@ public class WidgetsContainerView extends BaseContainerView
public WidgetsContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mLauncher = (Launcher) context;
mLauncher = Launcher.getLauncher(context);
mDragController = mLauncher.getDragController();
mAdapter = new WidgetsListAdapter(this, this, mLauncher);
mAdapter = new WidgetsListAdapter(this, this, context);
mIconCache = (LauncherAppState.getInstance()).getIconCache();
if (LOGD) {
Log.d(TAG, "WidgetsContainerView constructor");
@@ -16,6 +16,7 @@
package com.android.launcher3.widget;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.Adapter;
@@ -27,7 +28,6 @@ import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
@@ -63,13 +63,13 @@ public class WidgetsListAdapter extends Adapter<WidgetsRowViewHolder> {
public WidgetsListAdapter(View.OnClickListener iconClickListener,
View.OnLongClickListener iconLongClickListener,
Launcher launcher) {
mLayoutInflater = launcher.getLayoutInflater();
Context context) {
mLayoutInflater = LayoutInflater.from(context);
mWidgetPreviewLoader = LauncherAppState.getInstance().getWidgetCache();
mIconClickListener = iconClickListener;
mIconLongClickListener = iconLongClickListener;
mIndent = launcher.getResources().getDimensionPixelSize(R.dimen.widget_section_indent);
mIndent = context.getResources().getDimensionPixelSize(R.dimen.widget_section_indent);
}
public void setWidgetsModel(WidgetsModel w) {