summaryrefslogtreecommitdiff
path: root/go
diff options
context:
space:
mode:
authorJon Spivack <spivack@google.com>2021-10-28 18:37:19 -0700
committerJon Spivack <spivack@google.com>2021-10-28 19:30:31 -0700
commit688621498a0798862db468a20b00ff3ed693fe23 (patch)
treea91c185d1f53e8f9b14764ef8ad937c6aa11cfd2 /go
parent011d37be5ade17808f3c38bd4be514a6e5a3ed7b (diff)
downloadLauncher3-688621498a0798862db468a20b00ff3ed693fe23.tar.gz
P2P App Sharing: Gray out disabled SystemShortcut
The Share App system shortcut is disabled for apps that are deemed unshareable. This updates the UX to gray out the shortcut instead of hiding it. When the user clicks on the grayed out shortcut, a Toast message is displayed. This update also enables the shareability check. In order to properly gray out the shortcut, this also fixes a bug with BubbleTextView in which ColorStateLists weren't applied correctly. Bug: 202556634 Bug: 204495363 Test: Manual (observed UX on Wembley device in regular and dark themes) Test: m -j RunLauncherGoGoogleRoboTests Change-Id: Ieb04baf8c9cb9d325119cb97fceb96f2fc5a62ff
Diffstat (limited to 'go')
-rw-r--r--go/quickstep/res/values/strings.xml4
-rw-r--r--go/quickstep/src/com/android/launcher3/AppSharing.java14
2 files changed, 17 insertions, 1 deletions
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 @@
<string name="tooltip_listen">Tap here to listen to text on this screen</string>
<!-- Tooltip to highlight and explain the Translate button -->
<string name="tooltip_translate">Tap here to translate text on this screen</string>
+
+ <!-- ******* Toast Messages ******* -->
+ <!-- Toast to indicate that an app cannot be shared -->
+ <string name="toast_p2p_app_not_shareable">This app can’t be shared</string>
</resources>
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();
+ }
}
/**