Optimizing some layouts in taskview
> Recycling DigitalWellBeingToast so that the view is not inflated everytime > Simplifying DigitalWellBeingToast to use a single text view > Adding support for footers in taskView without creating additional layout Bug: 122345781 Change-Id: Ia889819b93eb8644532ea95c6767554874d5e2d1
This commit is contained in:
1 parent
3d6e96d526
commit
5b636ebfd4
10 files changed
+272
-145
No files matched your search
@@ -69,6 +69,7 @@ import com.android.launcher3.compat.ShortcutConfigActivityInfo;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
|
||||
import com.android.launcher3.graphics.RotationMode;
|
||||
import com.android.launcher3.graphics.TintedDrawableSpan;
|
||||
import com.android.launcher3.icons.LauncherIcons;
|
||||
import com.android.launcher3.shortcuts.DeepShortcutManager;
|
||||
import com.android.launcher3.shortcuts.ShortcutKey;
|
||||
@@ -562,6 +563,20 @@ public final class Utilities {
|
||||
return spanned;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefixes a text with the provided icon
|
||||
*/
|
||||
public static CharSequence prefixTextWithIcon(Context context, int iconRes, CharSequence msg) {
|
||||
// Update the hint to contain the icon.
|
||||
// Prefix the original hint with two spaces. The first space gets replaced by the icon
|
||||
// using span. The second space is used for a singe space character between the hint
|
||||
// and the icon.
|
||||
SpannableString spanned = new SpannableString(" " + msg);
|
||||
spanned.setSpan(new TintedDrawableSpan(context, iconRes),
|
||||
0, 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
|
||||
return spanned;
|
||||
}
|
||||
|
||||
public static SharedPreferences getPrefs(Context context) {
|
||||
return context.getSharedPreferences(
|
||||
LauncherFiles.SHARED_PREFERENCES_KEY, Context.MODE_PRIVATE);
|
||||
|
||||
Reference in new issue
Block a user