Merge "Add app info icon with no shadow for popup" into ub-launcher3-dorval

This commit is contained in:
Tony Wickham 2017-04-12 22:35:51 +00:00 committed by Android (Google) Code Review
commit 25e8f6d83e
4 changed files with 42 additions and 15 deletions

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/workspace_icon_text_color"
android:pathData="M11 17h2v-6h-2v6zm1-15C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zM11 9h2V7h-2v2z"/>
</vector>

View File

@ -17,7 +17,7 @@
package com.android.launcher3.popup; package com.android.launcher3.popup;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.res.Resources; import android.content.Context;
import android.os.Handler; import android.os.Handler;
import android.os.UserHandle; import android.os.UserHandle;
import android.service.notification.StatusBarNotification; import android.service.notification.StatusBarNotification;
@ -293,15 +293,19 @@ public class PopupPopulator {
@Override @Override
public void run() { public void run() {
final Resources res = mSystemShortcutChild.getResources(); final Context context = mSystemShortcutChild.getContext();
if (mSystemShortcutChild instanceof DeepShortcutView) { if (mSystemShortcutChild instanceof DeepShortcutView) {
// Expanded system shortcut, with both icon and text shown on white background.
final DeepShortcutView shortcutView = (DeepShortcutView) mSystemShortcutChild; final DeepShortcutView shortcutView = (DeepShortcutView) mSystemShortcutChild;
shortcutView.getIconView().setBackground(mSystemShortcutInfo.getIcon(res)); shortcutView.getIconView().setBackground(mSystemShortcutInfo.getIcon(context,
shortcutView.getBubbleText().setText(mSystemShortcutInfo.getLabel(res)); android.R.attr.textColorTertiary));
shortcutView.getBubbleText().setText(mSystemShortcutInfo.getLabel(context));
} else if (mSystemShortcutChild instanceof ImageView) { } else if (mSystemShortcutChild instanceof ImageView) {
// Only the system shortcut icon shows on a gray background header.
final ImageView shortcutIcon = (ImageView) mSystemShortcutChild; final ImageView shortcutIcon = (ImageView) mSystemShortcutChild;
shortcutIcon.setImageDrawable(mSystemShortcutInfo.getIcon(res)); shortcutIcon.setImageDrawable(mSystemShortcutInfo.getIcon(context,
shortcutIcon.setContentDescription(mSystemShortcutInfo.getLabel(res)); android.R.attr.textColorHint));
shortcutIcon.setContentDescription(mSystemShortcutInfo.getLabel(context));
} }
if (!(mSystemShortcutInfo instanceof SystemShortcut.Widgets)) { if (!(mSystemShortcutInfo instanceof SystemShortcut.Widgets)) {
mSystemShortcutChild.setOnClickListener(mSystemShortcutInfo mSystemShortcutChild.setOnClickListener(mSystemShortcutInfo

View File

@ -1,6 +1,6 @@
package com.android.launcher3.popup; package com.android.launcher3.popup;
import android.content.res.Resources; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.view.View; import android.view.View;
@ -10,6 +10,7 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.R; import com.android.launcher3.R;
import com.android.launcher3.model.WidgetItem; import com.android.launcher3.model.WidgetItem;
import com.android.launcher3.util.PackageUserKey; import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.util.Themes;
import com.android.launcher3.widget.WidgetsAndMore; import com.android.launcher3.widget.WidgetsAndMore;
import java.util.List; import java.util.List;
@ -29,14 +30,14 @@ public abstract class SystemShortcut {
mLabelResId = labelResId; mLabelResId = labelResId;
} }
public Drawable getIcon(Resources resources) { public Drawable getIcon(Context context, int colorAttr) {
Drawable icon = resources.getDrawable(mIconResId); Drawable icon = context.getResources().getDrawable(mIconResId);
icon.setTint(resources.getColor(R.color.system_shortcuts_icon_color)); icon.setTint(Themes.getAttrColor(context, colorAttr));
return icon; return icon;
} }
public String getLabel(Resources resources) { public String getLabel(Context context) {
return resources.getString(mLabelResId); return context.getString(mLabelResId);
} }
public abstract View.OnClickListener getOnClickListener(final Launcher launcher, public abstract View.OnClickListener getOnClickListener(final Launcher launcher,
@ -72,7 +73,7 @@ public abstract class SystemShortcut {
public static class AppInfo extends SystemShortcut { public static class AppInfo extends SystemShortcut {
public AppInfo() { public AppInfo() {
super(R.drawable.ic_info_launcher, R.string.app_info_drop_target_label); super(R.drawable.ic_info_no_shadow, R.string.app_info_drop_target_label);
} }
@Override @Override

View File

@ -53,8 +53,6 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import static android.R.attr.bottom;
/** /**
* Bottom sheet for the "Widgets & more" long-press option. * Bottom sheet for the "Widgets & more" long-press option.
*/ */