diff --git a/go/quickstep/res/values/strings.xml b/go/quickstep/res/values/strings.xml index 8429f6a7f2..42f4702141 100644 --- a/go/quickstep/res/values/strings.xml +++ b/go/quickstep/res/values/strings.xml @@ -41,4 +41,8 @@ Tap here to listen to text on this screen Tap here to translate text on this screen + + + + This app can’t be shared diff --git a/go/quickstep/src/com/android/launcher3/AppSharing.java b/go/quickstep/src/com/android/launcher3/AppSharing.java index fd5456c73b..7c66f6e105 100644 --- a/go/quickstep/src/com/android/launcher3/AppSharing.java +++ b/go/quickstep/src/com/android/launcher3/AppSharing.java @@ -25,6 +25,7 @@ import android.net.Uri; import android.text.TextUtils; import android.util.Log; import android.view.View; +import android.widget.Toast; import androidx.core.content.FileProvider; @@ -53,7 +54,7 @@ public final class AppSharing { * With this flag enabled, the Share App button will be dynamically enabled/disabled based * on each app's shareability status. */ - public static final boolean ENABLE_SHAREABILITY_CHECK = false; + public static final boolean ENABLE_SHAREABILITY_CHECK = true; private static final String TAG = "AppSharing"; private static final String FILE_PROVIDER_SUFFIX = ".overview.fileprovider"; @@ -111,6 +112,11 @@ public final class AppSharing { @Override public void onClick(View view) { + if (!isEnabled()) { + showCannotShareToast(view.getContext()); + return; + } + Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); @@ -163,6 +169,12 @@ public final class AppSharing { mShareabilityMgr.requestAppStatusUpdate(packageName, this::onStatusUpdated); } } + + private void showCannotShareToast(Context context) { + CharSequence text = context.getText(R.string.toast_p2p_app_not_shareable); + int duration = Toast.LENGTH_SHORT; + Toast.makeText(context, text, duration).show(); + } } /** diff --git a/res/color/system_shortcut_text.xml b/res/color/system_shortcut_text.xml new file mode 100644 index 0000000000..f9f8239a99 --- /dev/null +++ b/res/color/system_shortcut_text.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/res/layout/system_shortcut_content.xml b/res/layout/system_shortcut_content.xml index e693dbd8eb..ddcef096e0 100644 --- a/res/layout/system_shortcut_content.xml +++ b/res/layout/system_shortcut_content.xml @@ -33,7 +33,7 @@ android:maxLines="2" android:ellipsize="end" android:hyphenationFrequency="full" - android:textColor="?android:attr/textColorPrimary" + android:textColor="@color/system_shortcut_text" launcher:iconDisplay="shortcut_popup" launcher:layoutHorizontal="true" android:focusable="false" /> @@ -44,5 +44,5 @@ android:layout_height="@dimen/system_shortcut_icon_size" android:layout_marginStart="@dimen/system_shortcut_margin_start" android:layout_gravity="start|center_vertical" - android:backgroundTint="?android:attr/textColorPrimary"/> + android:backgroundTint="@color/system_shortcut_text"/> diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 35c257f53e..413882e097 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -148,6 +148,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, @ViewDebug.ExportedProperty(category = "launcher") private int mTextColor; @ViewDebug.ExportedProperty(category = "launcher") + private ColorStateList mTextColorStateList; + @ViewDebug.ExportedProperty(category = "launcher") private float mTextAlpha = 1; @ViewDebug.ExportedProperty(category = "launcher") @@ -617,12 +619,14 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, @Override public void setTextColor(int color) { mTextColor = color; + mTextColorStateList = null; super.setTextColor(getModifiedColor()); } @Override public void setTextColor(ColorStateList colors) { mTextColor = colors.getDefaultColor(); + mTextColorStateList = colors; if (Float.compare(mTextAlpha, 1) == 0) { super.setTextColor(colors); } else { @@ -644,7 +648,11 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, private void setTextAlpha(float alpha) { mTextAlpha = alpha; - super.setTextColor(getModifiedColor()); + if (mTextColorStateList != null) { + setTextColor(mTextColorStateList); + } else { + super.setTextColor(getModifiedColor()); + } } private int getModifiedColor() { diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java index cfde143ce8..278f57ddec 100644 --- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java +++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java @@ -364,11 +364,6 @@ public class PopupContainerWithArrow } private void initializeSystemShortcut(int resId, ViewGroup container, SystemShortcut info) { - if (!info.isEnabled()) { - // If the shortcut is disabled, do not display it - return; - } - View view = inflateAndAdd( resId, container, getInsertIndexForSystemShortcut(container, info)); if (view instanceof DeepShortcutView) { diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java index 826c79b289..5ebbc67b56 100644 --- a/src/com/android/launcher3/popup/SystemShortcut.java +++ b/src/com/android/launcher3/popup/SystemShortcut.java @@ -77,12 +77,15 @@ public abstract class SystemShortcut extend public void setIconAndLabelFor(View iconView, TextView labelView) { iconView.setBackgroundResource(mIconResId); + iconView.setEnabled(isEnabled); labelView.setText(mLabelResId); + labelView.setEnabled(isEnabled); } public void setIconAndContentDescriptionFor(ImageView view) { view.setImageResource(mIconResId); view.setContentDescription(view.getContext().getText(mLabelResId)); + view.setEnabled(isEnabled); } public AccessibilityNodeInfo.AccessibilityAction createAccessibilityAction(Context context) {