Loading res/layout/arrow_toast.xml +3 −2 Original line number Diff line number Diff line Loading @@ -28,13 +28,14 @@ android:padding="16dp" android:background="@drawable/arrow_toast_rounded_background" android:elevation="2dp" android:outlineProvider="none" android:textColor="@color/arrow_tip_view_content" android:textSize="14sp"/> <View android:id="@+id/arrow" android:elevation="2dp" android:outlineProvider="none" android:layout_width="@dimen/arrow_toast_arrow_width" android:layout_height="8dp" android:layout_marginTop="-2dp"/> android:layout_height="10dp"/> </merge> res/values-v28/dimens.xml +1 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2009 The Android Open Source Project <!-- Copyright (C) 2021 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. Loading res/values/dimens.xml +1 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ <dimen name="widget_reconfigure_button_padding">6dp</dimen> <dimen name="widget_reconfigure_button_margin">32dp</dimen> <dimen name="widget_reconfigure_button_size">36dp</dimen> <dimen name="widget_reconfigure_tip_top_margin">16dp</dimen> <!-- Fast scroll --> <dimen name="fastscroll_track_min_width">6dp</dimen> Loading res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,11 @@ <!-- Dialog text. This dialog lets a user know how they can use widgets on their phone. [CHAR_LIMIT=NONE] --> <string name="widget_education_content">To get info without opening apps, you can add widgets to your Home screen</string> <!-- Text on an educational tip on widget informing users that they can change widget settings. [CHAR_LIMIT=NONE] --> <string name="reconfigurable_widget_education_tip">Tap to change widget settings</string> <!-- Text on the button that closes the education dialog about widgets. [CHAR_LIMIT=50] --> <string name="widget_education_close_button">Got it</string> Loading src/com/android/launcher3/AppWidgetResizeFrame.java +36 −0 Original line number Diff line number Diff line Loading @@ -24,12 +24,16 @@ import android.view.View; import android.widget.ImageButton; import android.widget.ImageView; import androidx.annotation.Nullable; import androidx.annotation.Px; import com.android.launcher3.accessibility.DragViewStateAnnouncer; import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.logging.InstanceId; import com.android.launcher3.logging.InstanceIdSequence; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.util.PendingRequestArgs; import com.android.launcher3.views.ArrowTipView; import com.android.launcher3.widget.LauncherAppWidgetHostView; import com.android.launcher3.widget.LauncherAppWidgetProviderInfo; import com.android.launcher3.widget.util.WidgetSizes; Loading @@ -42,6 +46,8 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O private static final float DIMMED_HANDLE_ALPHA = 0f; private static final float RESIZE_THRESHOLD = 0.66f; private static final String KEY_RECONFIGURABLE_WIDGET_EDUCATION_TIP_SEEN = "launcher.reconfigurable_widget_education_tip_seen"; private static final Rect sTmpRect = new Rect(); private static final int HANDLE_COUNT = 4; Loading Loading @@ -238,6 +244,15 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O mWidgetView.getAppWidgetId(), Launcher.REQUEST_RECONFIGURE_APPWIDGET); }); if (!hasSeenReconfigurableWidgetEducationTip()) { post(() -> { if (showReconfigurableWidgetEducationTip() != null) { mLauncher.getSharedPrefs().edit() .putBoolean(KEY_RECONFIGURABLE_WIDGET_EDUCATION_TIP_SEEN, true).apply(); } }); } } // When we create the resize frame, we first mark all cells as unoccupied. The appropriate Loading Loading @@ -679,4 +694,25 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O || keyCode == KeyEvent.KEYCODE_MOVE_HOME || keyCode == KeyEvent.KEYCODE_MOVE_END || keyCode == KeyEvent.KEYCODE_PAGE_UP || keyCode == KeyEvent.KEYCODE_PAGE_DOWN); } @Nullable private ArrowTipView showReconfigurableWidgetEducationTip() { Rect rect = new Rect(); if (!mReconfigureButton.getGlobalVisibleRect(rect)) { return null; } @Px int tipMargin = mLauncher.getResources() .getDimensionPixelSize(R.dimen.widget_reconfigure_tip_top_margin); return new ArrowTipView(mLauncher, /* isPointingUp= */ true) .showAroundRect( getContext().getString(R.string.reconfigurable_widget_education_tip), /* arrowXCoord= */ rect.left + mReconfigureButton.getWidth() / 2, /* rect= */ rect, /* margin= */ tipMargin); } private boolean hasSeenReconfigurableWidgetEducationTip() { return mLauncher.getSharedPrefs() .getBoolean(KEY_RECONFIGURABLE_WIDGET_EDUCATION_TIP_SEEN, false) || Utilities.IS_RUNNING_IN_TEST_HARNESS; } } Loading
res/layout/arrow_toast.xml +3 −2 Original line number Diff line number Diff line Loading @@ -28,13 +28,14 @@ android:padding="16dp" android:background="@drawable/arrow_toast_rounded_background" android:elevation="2dp" android:outlineProvider="none" android:textColor="@color/arrow_tip_view_content" android:textSize="14sp"/> <View android:id="@+id/arrow" android:elevation="2dp" android:outlineProvider="none" android:layout_width="@dimen/arrow_toast_arrow_width" android:layout_height="8dp" android:layout_marginTop="-2dp"/> android:layout_height="10dp"/> </merge>
res/values-v28/dimens.xml +1 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2009 The Android Open Source Project <!-- Copyright (C) 2021 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. Loading
res/values/dimens.xml +1 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ <dimen name="widget_reconfigure_button_padding">6dp</dimen> <dimen name="widget_reconfigure_button_margin">32dp</dimen> <dimen name="widget_reconfigure_button_size">36dp</dimen> <dimen name="widget_reconfigure_tip_top_margin">16dp</dimen> <!-- Fast scroll --> <dimen name="fastscroll_track_min_width">6dp</dimen> Loading
res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,11 @@ <!-- Dialog text. This dialog lets a user know how they can use widgets on their phone. [CHAR_LIMIT=NONE] --> <string name="widget_education_content">To get info without opening apps, you can add widgets to your Home screen</string> <!-- Text on an educational tip on widget informing users that they can change widget settings. [CHAR_LIMIT=NONE] --> <string name="reconfigurable_widget_education_tip">Tap to change widget settings</string> <!-- Text on the button that closes the education dialog about widgets. [CHAR_LIMIT=50] --> <string name="widget_education_close_button">Got it</string> Loading
src/com/android/launcher3/AppWidgetResizeFrame.java +36 −0 Original line number Diff line number Diff line Loading @@ -24,12 +24,16 @@ import android.view.View; import android.widget.ImageButton; import android.widget.ImageView; import androidx.annotation.Nullable; import androidx.annotation.Px; import com.android.launcher3.accessibility.DragViewStateAnnouncer; import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.logging.InstanceId; import com.android.launcher3.logging.InstanceIdSequence; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.util.PendingRequestArgs; import com.android.launcher3.views.ArrowTipView; import com.android.launcher3.widget.LauncherAppWidgetHostView; import com.android.launcher3.widget.LauncherAppWidgetProviderInfo; import com.android.launcher3.widget.util.WidgetSizes; Loading @@ -42,6 +46,8 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O private static final float DIMMED_HANDLE_ALPHA = 0f; private static final float RESIZE_THRESHOLD = 0.66f; private static final String KEY_RECONFIGURABLE_WIDGET_EDUCATION_TIP_SEEN = "launcher.reconfigurable_widget_education_tip_seen"; private static final Rect sTmpRect = new Rect(); private static final int HANDLE_COUNT = 4; Loading Loading @@ -238,6 +244,15 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O mWidgetView.getAppWidgetId(), Launcher.REQUEST_RECONFIGURE_APPWIDGET); }); if (!hasSeenReconfigurableWidgetEducationTip()) { post(() -> { if (showReconfigurableWidgetEducationTip() != null) { mLauncher.getSharedPrefs().edit() .putBoolean(KEY_RECONFIGURABLE_WIDGET_EDUCATION_TIP_SEEN, true).apply(); } }); } } // When we create the resize frame, we first mark all cells as unoccupied. The appropriate Loading Loading @@ -679,4 +694,25 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O || keyCode == KeyEvent.KEYCODE_MOVE_HOME || keyCode == KeyEvent.KEYCODE_MOVE_END || keyCode == KeyEvent.KEYCODE_PAGE_UP || keyCode == KeyEvent.KEYCODE_PAGE_DOWN); } @Nullable private ArrowTipView showReconfigurableWidgetEducationTip() { Rect rect = new Rect(); if (!mReconfigureButton.getGlobalVisibleRect(rect)) { return null; } @Px int tipMargin = mLauncher.getResources() .getDimensionPixelSize(R.dimen.widget_reconfigure_tip_top_margin); return new ArrowTipView(mLauncher, /* isPointingUp= */ true) .showAroundRect( getContext().getString(R.string.reconfigurable_widget_education_tip), /* arrowXCoord= */ rect.left + mReconfigureButton.getWidth() / 2, /* rect= */ rect, /* margin= */ tipMargin); } private boolean hasSeenReconfigurableWidgetEducationTip() { return mLauncher.getSharedPrefs() .getBoolean(KEY_RECONFIGURABLE_WIDGET_EDUCATION_TIP_SEEN, false) || Utilities.IS_RUNNING_IN_TEST_HARNESS; } }