Show different tooltips for QS features auto-added and non-auto-added
There are 2 different kinds of auto-added / non-auto-added subtext in QS tooltips for framework features. Show animation in the settings page for full flow for non-framework services. Bug: 218968108 Test: make RunSettingsRoboTests ROBOTEST_FILTER=AccessibilityQuickSettingsTooltipWindowTest AccessibilityShortcutPreferenceFragmentTest Change-Id: I462cfcece959df8b9d97fab8e28337bceca9e25e
This commit is contained in:
@@ -23,10 +23,10 @@
|
|||||||
android:background="@drawable/accessibility_qs_tooltips_background">
|
android:background="@drawable/accessibility_qs_tooltips_background">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/qs_illustration"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="@dimen/accessibility_qs_tooltips_margin_top"
|
android:paddingTop="@dimen/accessibility_qs_tooltips_margin_top"
|
||||||
android:src="@drawable/accessibility_qs_tooltips_illustration"
|
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:contentDescription="@null" />
|
android:contentDescription="@null" />
|
||||||
|
|
||||||
|
@@ -5523,8 +5523,10 @@
|
|||||||
<string name="accessibility_service_primary_switch_title">Use <xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g></string>
|
<string name="accessibility_service_primary_switch_title">Use <xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g></string>
|
||||||
<!-- Used in the accessibility service settings to open the activity. [CHAR LIMIT=NONE] -->
|
<!-- Used in the accessibility service settings to open the activity. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_service_primary_open_title">Open <xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g></string>
|
<string name="accessibility_service_primary_open_title">Open <xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g></string>
|
||||||
|
<!-- Used in the accessibility service settings to show quick settings tooltips for auto-added feature. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="accessibility_service_auto_added_qs_tooltips_content"><xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g> added to Quick Settings. Swipe down to turn it on or off anytime.</string>
|
||||||
<!-- Used in the accessibility service settings to show quick settings tooltips. [CHAR LIMIT=NONE] -->
|
<!-- Used in the accessibility service settings to show quick settings tooltips. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_service_quick_settings_tooltips_content"><xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g> added to Quick Settings. Swipe down to turn it on or off anytime.</string>
|
<string name="accessibility_service_qs_tooltips_content">You can add a shortcut to <xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g> by editing quick settings</string>
|
||||||
<!-- Used in the accessibility action for accessibility quick settings tooltips to dismiss. [CHAR LIMIT=NONE] -->
|
<!-- Used in the accessibility action for accessibility quick settings tooltips to dismiss. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_quick_settings_tooltips_dismiss">Dismiss</string>
|
<string name="accessibility_quick_settings_tooltips_dismiss">Dismiss</string>
|
||||||
<!-- Intro for color correction settings screen to control turning on/off the feature entirely. [CHAR LIMIT=NONE] -->
|
<!-- Intro for color correction settings screen to control turning on/off the feature entirely. [CHAR LIMIT=NONE] -->
|
||||||
|
@@ -27,10 +27,12 @@ import android.view.View;
|
|||||||
import android.view.View.AccessibilityDelegate;
|
import android.view.View.AccessibilityDelegate;
|
||||||
import android.view.accessibility.AccessibilityNodeInfo;
|
import android.view.accessibility.AccessibilityNodeInfo;
|
||||||
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
|
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.DrawableRes;
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -76,9 +78,10 @@ public class AccessibilityQuickSettingsTooltipWindow extends PopupWindow {
|
|||||||
* Sets up {@link #AccessibilityQuickSettingsTooltipWindow}'s layout and content.
|
* Sets up {@link #AccessibilityQuickSettingsTooltipWindow}'s layout and content.
|
||||||
*
|
*
|
||||||
* @param text text to be displayed
|
* @param text text to be displayed
|
||||||
|
* @param imageResId the resource ID of the image drawable
|
||||||
*/
|
*/
|
||||||
public void setup(String text) {
|
public void setup(String text, @DrawableRes int imageResId) {
|
||||||
this.setup(text, /* closeDelayTimeMillis= */ 0);
|
this.setup(text, imageResId, /* closeDelayTimeMillis= */ 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,9 +91,10 @@ public class AccessibilityQuickSettingsTooltipWindow extends PopupWindow {
|
|||||||
* close delay time is positive number. </p>
|
* close delay time is positive number. </p>
|
||||||
*
|
*
|
||||||
* @param text text to be displayed
|
* @param text text to be displayed
|
||||||
|
* @param imageResId the resource ID of the image drawable
|
||||||
* @param closeDelayTimeMillis how long the popup window be auto-closed
|
* @param closeDelayTimeMillis how long the popup window be auto-closed
|
||||||
*/
|
*/
|
||||||
public void setup(String text, long closeDelayTimeMillis) {
|
public void setup(String text, @DrawableRes int imageResId, long closeDelayTimeMillis) {
|
||||||
this.mCloseDelayTimeMillis = closeDelayTimeMillis;
|
this.mCloseDelayTimeMillis = closeDelayTimeMillis;
|
||||||
|
|
||||||
setBackgroundDrawable(new ColorDrawable(mContext.getColor(android.R.color.transparent)));
|
setBackgroundDrawable(new ColorDrawable(mContext.getColor(android.R.color.transparent)));
|
||||||
@@ -101,6 +105,8 @@ public class AccessibilityQuickSettingsTooltipWindow extends PopupWindow {
|
|||||||
popupView.setAccessibilityDelegate(mAccessibilityDelegate);
|
popupView.setAccessibilityDelegate(mAccessibilityDelegate);
|
||||||
setContentView(popupView);
|
setContentView(popupView);
|
||||||
|
|
||||||
|
final ImageView imageView = getContentView().findViewById(R.id.qs_illustration);
|
||||||
|
imageView.setImageResource(imageResId);
|
||||||
final TextView textView = getContentView().findViewById(R.id.qs_content);
|
final TextView textView = getContentView().findViewById(R.id.qs_content);
|
||||||
textView.setText(text);
|
textView.setText(text);
|
||||||
setWidth(getWindowWidthWith(textView));
|
setWidth(getWindowWidthWith(textView));
|
||||||
|
@@ -18,6 +18,7 @@ package com.android.settings.accessibility;
|
|||||||
|
|
||||||
import static com.android.settings.accessibility.AccessibilityDialogUtils.DialogEnums;
|
import static com.android.settings.accessibility.AccessibilityDialogUtils.DialogEnums;
|
||||||
import static com.android.settings.accessibility.ToggleFeaturePreferenceFragment.KEY_GENERAL_CATEGORY;
|
import static com.android.settings.accessibility.ToggleFeaturePreferenceFragment.KEY_GENERAL_CATEGORY;
|
||||||
|
import static com.android.settings.accessibility.ToggleFeaturePreferenceFragment.KEY_SAVED_QS_TOOLTIP_TYPE;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
@@ -41,6 +42,7 @@ import androidx.preference.PreferenceCategory;
|
|||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
|
||||||
import com.android.settings.dashboard.DashboardFragment;
|
import com.android.settings.dashboard.DashboardFragment;
|
||||||
import com.android.settings.utils.LocaleUtils;
|
import com.android.settings.utils.LocaleUtils;
|
||||||
|
|
||||||
@@ -70,6 +72,7 @@ public abstract class AccessibilityShortcutPreferenceFragment extends DashboardF
|
|||||||
private CheckBox mHardwareTypeCheckBox;
|
private CheckBox mHardwareTypeCheckBox;
|
||||||
private AccessibilityQuickSettingsTooltipWindow mTooltipWindow;
|
private AccessibilityQuickSettingsTooltipWindow mTooltipWindow;
|
||||||
private boolean mNeedsQSTooltipReshow = false;
|
private boolean mNeedsQSTooltipReshow = false;
|
||||||
|
private int mNeedsQSTooltipType = QuickSettingsTooltipType.GUIDE_TO_EDIT;
|
||||||
|
|
||||||
/** Returns the accessibility component name. */
|
/** Returns the accessibility component name. */
|
||||||
protected abstract ComponentName getComponentName();
|
protected abstract ComponentName getComponentName();
|
||||||
@@ -96,6 +99,9 @@ public abstract class AccessibilityShortcutPreferenceFragment extends DashboardF
|
|||||||
if (savedInstanceState.containsKey(KEY_SAVED_QS_TOOLTIP_RESHOW)) {
|
if (savedInstanceState.containsKey(KEY_SAVED_QS_TOOLTIP_RESHOW)) {
|
||||||
mNeedsQSTooltipReshow = savedInstanceState.getBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW);
|
mNeedsQSTooltipReshow = savedInstanceState.getBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW);
|
||||||
}
|
}
|
||||||
|
if (savedInstanceState.containsKey(KEY_SAVED_QS_TOOLTIP_TYPE)) {
|
||||||
|
mNeedsQSTooltipType = savedInstanceState.getInt(KEY_SAVED_QS_TOOLTIP_TYPE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final int resId = getPreferenceScreenResId();
|
final int resId = getPreferenceScreenResId();
|
||||||
@@ -176,6 +182,7 @@ public abstract class AccessibilityShortcutPreferenceFragment extends DashboardF
|
|||||||
}
|
}
|
||||||
if (mTooltipWindow != null) {
|
if (mTooltipWindow != null) {
|
||||||
outState.putBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW, mTooltipWindow.isShowing());
|
outState.putBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW, mTooltipWindow.isShowing());
|
||||||
|
outState.putInt(KEY_SAVED_QS_TOOLTIP_TYPE, mNeedsQSTooltipType);
|
||||||
}
|
}
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
}
|
}
|
||||||
@@ -198,7 +205,7 @@ public abstract class AccessibilityShortcutPreferenceFragment extends DashboardF
|
|||||||
case DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL:
|
case DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL:
|
||||||
dialog = AccessibilityGestureNavigationTutorial
|
dialog = AccessibilityGestureNavigationTutorial
|
||||||
.createAccessibilityTutorialDialog(getPrefContext(),
|
.createAccessibilityTutorialDialog(getPrefContext(),
|
||||||
getUserShortcutTypes());
|
getUserShortcutTypes(), this::callOnTutorialDialogButtonClicked);
|
||||||
dialog.setCanceledOnTouchOutside(false);
|
dialog.setCanceledOnTouchOutside(false);
|
||||||
return dialog;
|
return dialog;
|
||||||
default:
|
default:
|
||||||
@@ -296,6 +303,17 @@ public abstract class AccessibilityShortcutPreferenceFragment extends DashboardF
|
|||||||
getComponentName());
|
getComponentName());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be invoked when a button in the tutorial dialog is clicked.
|
||||||
|
*
|
||||||
|
* @param dialog The dialog that received the click
|
||||||
|
* @param which The button that was clicked
|
||||||
|
*/
|
||||||
|
private void callOnTutorialDialogButtonClicked(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
showQuickSettingsTooltipIfNeeded();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be invoked when a button in the edit shortcut dialog is clicked.
|
* This method will be invoked when a button in the edit shortcut dialog is clicked.
|
||||||
*
|
*
|
||||||
@@ -308,12 +326,17 @@ public abstract class AccessibilityShortcutPreferenceFragment extends DashboardF
|
|||||||
}
|
}
|
||||||
|
|
||||||
final int value = getShortcutTypeCheckBoxValue();
|
final int value = getShortcutTypeCheckBoxValue();
|
||||||
|
|
||||||
saveNonEmptyUserShortcutType(value);
|
saveNonEmptyUserShortcutType(value);
|
||||||
AccessibilityUtil.optInAllValuesToSettings(getPrefContext(), value, getComponentName());
|
AccessibilityUtil.optInAllValuesToSettings(getPrefContext(), value, getComponentName());
|
||||||
AccessibilityUtil.optOutAllValuesFromSettings(getPrefContext(), ~value, getComponentName());
|
AccessibilityUtil.optOutAllValuesFromSettings(getPrefContext(), ~value, getComponentName());
|
||||||
mShortcutPreference.setChecked(value != AccessibilityUtil.UserShortcutType.EMPTY);
|
final boolean shortcutAssigned = value != AccessibilityUtil.UserShortcutType.EMPTY;
|
||||||
|
mShortcutPreference.setChecked(shortcutAssigned);
|
||||||
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
||||||
|
|
||||||
|
// Show the quick setting tooltip if the shortcut assigned in the first time
|
||||||
|
if (shortcutAssigned) {
|
||||||
|
showQuickSettingsTooltipIfNeeded();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -452,7 +475,18 @@ public abstract class AccessibilityShortcutPreferenceFragment extends DashboardF
|
|||||||
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void showQuickSettingsTooltipIfNeeded() {
|
/**
|
||||||
|
* Shows the quick settings tooltip if the quick settings feature is assigned. The tooltip only
|
||||||
|
* shows once.
|
||||||
|
*
|
||||||
|
* @param type The quick settings tooltip type
|
||||||
|
*/
|
||||||
|
protected void showQuickSettingsTooltipIfNeeded(@QuickSettingsTooltipType int type) {
|
||||||
|
mNeedsQSTooltipType = type;
|
||||||
|
showQuickSettingsTooltipIfNeeded();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showQuickSettingsTooltipIfNeeded() {
|
||||||
final ComponentName tileComponentName = getTileComponentName();
|
final ComponentName tileComponentName = getTileComponentName();
|
||||||
if (tileComponentName == null) {
|
if (tileComponentName == null) {
|
||||||
// Returns if no tile service assigned.
|
// Returns if no tile service assigned.
|
||||||
@@ -471,10 +505,13 @@ public abstract class AccessibilityShortcutPreferenceFragment extends DashboardF
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String title =
|
final int titleResId = mNeedsQSTooltipType == QuickSettingsTooltipType.GUIDE_TO_EDIT
|
||||||
getString(R.string.accessibility_service_quick_settings_tooltips_content, tileName);
|
? R.string.accessibility_service_qs_tooltips_content
|
||||||
|
: R.string.accessibility_service_auto_added_qs_tooltips_content;
|
||||||
|
final String title = getString(titleResId, tileName);
|
||||||
|
final int imageResId = R.drawable.accessibility_qs_tooltips_illustration;
|
||||||
mTooltipWindow = new AccessibilityQuickSettingsTooltipWindow(getContext());
|
mTooltipWindow = new AccessibilityQuickSettingsTooltipWindow(getContext());
|
||||||
mTooltipWindow.setup(title);
|
mTooltipWindow.setup(title, imageResId);
|
||||||
mTooltipWindow.showAtTopCenter(getView());
|
mTooltipWindow.showAtTopCenter(getView());
|
||||||
AccessibilityQuickSettingUtils.optInValueToSharedPreferences(getContext(),
|
AccessibilityQuickSettingUtils.optInValueToSharedPreferences(getContext(),
|
||||||
tileComponentName);
|
tileComponentName);
|
||||||
|
@@ -46,7 +46,7 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
/** Provides utility methods to accessibility settings only. */
|
/** Provides utility methods to accessibility settings only. */
|
||||||
final class AccessibilityUtil {
|
public final class AccessibilityUtil {
|
||||||
|
|
||||||
private AccessibilityUtil(){}
|
private AccessibilityUtil(){}
|
||||||
|
|
||||||
@@ -105,6 +105,17 @@ final class AccessibilityUtil {
|
|||||||
int TRIPLETAP = 4; // 1 << 2
|
int TRIPLETAP = 4; // 1 << 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Denotes the quick setting tooltip type.
|
||||||
|
*
|
||||||
|
* {@code GUIDE_TO_EDIT} for QS tiles that need to be added by editing.
|
||||||
|
* {@code GUIDE_TO_DIRECT_USE} for QS tiles that have been auto-added already.
|
||||||
|
*/
|
||||||
|
public @interface QuickSettingsTooltipType {
|
||||||
|
int GUIDE_TO_EDIT = 0;
|
||||||
|
int GUIDE_TO_DIRECT_USE = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/** Denotes the accessibility enabled status */
|
/** Denotes the accessibility enabled status */
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface State {
|
public @interface State {
|
||||||
|
@@ -20,11 +20,9 @@ import static com.android.settings.accessibility.AccessibilityStatsLogUtils.logA
|
|||||||
|
|
||||||
import android.accessibilityservice.AccessibilityShortcutInfo;
|
import android.accessibilityservice.AccessibilityShortcutInfo;
|
||||||
import android.app.ActivityOptions;
|
import android.app.ActivityOptions;
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@@ -138,20 +136,6 @@ public class LaunchAccessibilityActivityPreferenceFragment extends ToggleFeature
|
|||||||
return loadTileLabel(getPrefContext(), componentName);
|
return loadTileLabel(getPrefContext(), componentName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Dialog onCreateDialog(int dialogId) {
|
|
||||||
switch (dialogId) {
|
|
||||||
case AccessibilityDialogUtils.DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL:
|
|
||||||
final Dialog dialog = AccessibilityGestureNavigationTutorial
|
|
||||||
.createAccessibilityTutorialDialog(getPrefContext(),
|
|
||||||
getUserShortcutTypes(), this::callOnTutorialDialogButtonClicked);
|
|
||||||
dialog.setCanceledOnTouchOutside(false);
|
|
||||||
return dialog;
|
|
||||||
default:
|
|
||||||
return super.onCreateDialog(dialogId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
// Do not call super. We don't want to see the "Help & feedback" option on this page so as
|
// Do not call super. We don't want to see the "Help & feedback" option on this page so as
|
||||||
@@ -236,22 +220,4 @@ public class LaunchAccessibilityActivityPreferenceFragment extends ToggleFeature
|
|||||||
|
|
||||||
return settingsIntent;
|
return settingsIntent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This method will be invoked when a button in the tutorial dialog is clicked.
|
|
||||||
*
|
|
||||||
* @param dialog The dialog that received the click
|
|
||||||
* @param which The button that was clicked
|
|
||||||
*/
|
|
||||||
private void callOnTutorialDialogButtonClicked(DialogInterface dialog, int which) {
|
|
||||||
dialog.dismiss();
|
|
||||||
showQuickSettingsTooltipIfNeeded();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void callOnAlertDialogCheckboxClicked(DialogInterface dialog, int which) {
|
|
||||||
super.callOnAlertDialogCheckboxClicked(dialog, which);
|
|
||||||
showQuickSettingsTooltipIfNeeded(getShortcutTypeCheckBoxValue());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -206,12 +206,6 @@ public class ToggleAccessibilityServicePreferenceFragment extends
|
|||||||
.createDisableDialog(getPrefContext(), info,
|
.createDisableDialog(getPrefContext(), info,
|
||||||
this::onDialogButtonFromDisableToggleClicked);
|
this::onDialogButtonFromDisableToggleClicked);
|
||||||
return mWarningDialog;
|
return mWarningDialog;
|
||||||
case DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL:
|
|
||||||
final Dialog dialog = AccessibilityGestureNavigationTutorial
|
|
||||||
.createAccessibilityTutorialDialog(getPrefContext(),
|
|
||||||
getUserShortcutTypes(), this::callOnTutorialDialogButtonClicked);
|
|
||||||
dialog.setCanceledOnTouchOutside(false);
|
|
||||||
return dialog;
|
|
||||||
default:
|
default:
|
||||||
return super.onCreateDialog(dialogId);
|
return super.onCreateDialog(dialogId);
|
||||||
}
|
}
|
||||||
@@ -496,23 +490,6 @@ public class ToggleAccessibilityServicePreferenceFragment extends
|
|||||||
mWarningDialog.dismiss();
|
mWarningDialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This method will be invoked when a button in the tutorial dialog is clicked.
|
|
||||||
*
|
|
||||||
* @param dialog The dialog that received the click
|
|
||||||
* @param which The button that was clicked
|
|
||||||
*/
|
|
||||||
private void callOnTutorialDialogButtonClicked(DialogInterface dialog, int which) {
|
|
||||||
dialog.dismiss();
|
|
||||||
showQuickSettingsTooltipIfNeeded();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void callOnAlertDialogCheckboxClicked(DialogInterface dialog, int which) {
|
|
||||||
super.callOnAlertDialogCheckboxClicked(dialog, which);
|
|
||||||
showQuickSettingsTooltipIfNeeded(getShortcutTypeCheckBoxValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
void onDialogButtonFromShortcutClicked(View view) {
|
void onDialogButtonFromShortcutClicked(View view) {
|
||||||
final int viewId = view.getId();
|
final int viewId = view.getId();
|
||||||
if (viewId == R.id.permission_enable_allow_button) {
|
if (viewId == R.id.permission_enable_allow_button) {
|
||||||
|
@@ -33,6 +33,7 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
|
||||||
import com.android.settings.widget.SettingsMainSwitchPreference;
|
import com.android.settings.widget.SettingsMainSwitchPreference;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -50,7 +51,9 @@ public class ToggleColorInversionPreferenceFragment extends ToggleFeaturePrefere
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
|
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
|
||||||
super.onPreferenceToggled(preferenceKey, enabled);
|
if (enabled) {
|
||||||
|
showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_DIRECT_USE);
|
||||||
|
}
|
||||||
logAccessibilityServiceEnabled(mComponentName, enabled);
|
logAccessibilityServiceEnabled(mComponentName, enabled);
|
||||||
Settings.Secure.putInt(getContentResolver(), ENABLED, enabled ? ON : OFF);
|
Settings.Secure.putInt(getContentResolver(), ENABLED, enabled ? ON : OFF);
|
||||||
}
|
}
|
||||||
|
@@ -35,6 +35,7 @@ import android.view.ViewGroup;
|
|||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settings.widget.SettingsMainSwitchPreference;
|
import com.android.settings.widget.SettingsMainSwitchPreference;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
@@ -165,7 +166,9 @@ public final class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePrefe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
|
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
|
||||||
super.onPreferenceToggled(preferenceKey, enabled);
|
if (enabled) {
|
||||||
|
showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_DIRECT_USE);
|
||||||
|
}
|
||||||
logAccessibilityServiceEnabled(mComponentName, enabled);
|
logAccessibilityServiceEnabled(mComponentName, enabled);
|
||||||
Settings.Secure.putInt(getContentResolver(), ENABLED, enabled ? ON : OFF);
|
Settings.Secure.putInt(getContentResolver(), ENABLED, enabled ? ON : OFF);
|
||||||
}
|
}
|
||||||
|
@@ -56,6 +56,7 @@ import com.android.settings.R;
|
|||||||
import com.android.settings.SettingsActivity;
|
import com.android.settings.SettingsActivity;
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
import com.android.settings.accessibility.AccessibilityDialogUtils.DialogType;
|
import com.android.settings.accessibility.AccessibilityDialogUtils.DialogType;
|
||||||
|
import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
|
||||||
import com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
|
import com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
|
||||||
import com.android.settings.utils.LocaleUtils;
|
import com.android.settings.utils.LocaleUtils;
|
||||||
import com.android.settings.widget.SettingsMainSwitchBar;
|
import com.android.settings.widget.SettingsMainSwitchBar;
|
||||||
@@ -103,6 +104,7 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
private static final String KEY_SHORTCUT_PREFERENCE = "shortcut_preference";
|
private static final String KEY_SHORTCUT_PREFERENCE = "shortcut_preference";
|
||||||
protected static final String KEY_SAVED_USER_SHORTCUT_TYPE = "shortcut_type";
|
protected static final String KEY_SAVED_USER_SHORTCUT_TYPE = "shortcut_type";
|
||||||
protected static final String KEY_SAVED_QS_TOOLTIP_RESHOW = "qs_tooltip_reshow";
|
protected static final String KEY_SAVED_QS_TOOLTIP_RESHOW = "qs_tooltip_reshow";
|
||||||
|
protected static final String KEY_SAVED_QS_TOOLTIP_TYPE = "qs_tooltip_type";
|
||||||
protected static final String KEY_ANIMATED_IMAGE = "animated_image";
|
protected static final String KEY_ANIMATED_IMAGE = "animated_image";
|
||||||
|
|
||||||
private TouchExplorationStateChangeListener mTouchExplorationStateChangeListener;
|
private TouchExplorationStateChangeListener mTouchExplorationStateChangeListener;
|
||||||
@@ -113,6 +115,7 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
|
|
||||||
private AccessibilityQuickSettingsTooltipWindow mTooltipWindow;
|
private AccessibilityQuickSettingsTooltipWindow mTooltipWindow;
|
||||||
private boolean mNeedsQSTooltipReshow = false;
|
private boolean mNeedsQSTooltipReshow = false;
|
||||||
|
private int mNeedsQSTooltipType = QuickSettingsTooltipType.GUIDE_TO_EDIT;
|
||||||
|
|
||||||
public static final int NOT_SET = -1;
|
public static final int NOT_SET = -1;
|
||||||
// Save user's shortcutType value when savedInstance has value (e.g. device rotated).
|
// Save user's shortcutType value when savedInstance has value (e.g. device rotated).
|
||||||
@@ -148,6 +151,9 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
if (savedInstanceState.containsKey(KEY_SAVED_QS_TOOLTIP_RESHOW)) {
|
if (savedInstanceState.containsKey(KEY_SAVED_QS_TOOLTIP_RESHOW)) {
|
||||||
mNeedsQSTooltipReshow = savedInstanceState.getBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW);
|
mNeedsQSTooltipReshow = savedInstanceState.getBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW);
|
||||||
}
|
}
|
||||||
|
if (savedInstanceState.containsKey(KEY_SAVED_QS_TOOLTIP_TYPE)) {
|
||||||
|
mNeedsQSTooltipType = savedInstanceState.getInt(KEY_SAVED_QS_TOOLTIP_TYPE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setupDefaultShortcutIfNecessary(getPrefContext());
|
setupDefaultShortcutIfNecessary(getPrefContext());
|
||||||
@@ -254,6 +260,7 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
}
|
}
|
||||||
if (mTooltipWindow != null) {
|
if (mTooltipWindow != null) {
|
||||||
outState.putBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW, mTooltipWindow.isShowing());
|
outState.putBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW, mTooltipWindow.isShowing());
|
||||||
|
outState.putInt(KEY_SAVED_QS_TOOLTIP_TYPE, mNeedsQSTooltipType);
|
||||||
}
|
}
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
}
|
}
|
||||||
@@ -274,7 +281,7 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
case DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL:
|
case DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL:
|
||||||
mDialog = AccessibilityGestureNavigationTutorial
|
mDialog = AccessibilityGestureNavigationTutorial
|
||||||
.createAccessibilityTutorialDialog(getPrefContext(),
|
.createAccessibilityTutorialDialog(getPrefContext(),
|
||||||
getUserShortcutTypes());
|
getUserShortcutTypes(), this::callOnTutorialDialogButtonClicked);
|
||||||
mDialog.setCanceledOnTouchOutside(false);
|
mDialog.setCanceledOnTouchOutside(false);
|
||||||
return mDialog;
|
return mDialog;
|
||||||
default:
|
default:
|
||||||
@@ -694,6 +701,17 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
null, LocaleUtils.getConcatenatedString(list));
|
null, LocaleUtils.getConcatenatedString(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be invoked when a button in the tutorial dialog is clicked.
|
||||||
|
*
|
||||||
|
* @param dialog The dialog that received the click
|
||||||
|
* @param which The button that was clicked
|
||||||
|
*/
|
||||||
|
private void callOnTutorialDialogButtonClicked(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
showQuickSettingsTooltipIfNeeded();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be invoked when a button in the edit shortcut dialog is clicked.
|
* This method will be invoked when a button in the edit shortcut dialog is clicked.
|
||||||
*
|
*
|
||||||
@@ -706,12 +724,17 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
}
|
}
|
||||||
|
|
||||||
final int value = getShortcutTypeCheckBoxValue();
|
final int value = getShortcutTypeCheckBoxValue();
|
||||||
|
|
||||||
saveNonEmptyUserShortcutType(value);
|
saveNonEmptyUserShortcutType(value);
|
||||||
AccessibilityUtil.optInAllValuesToSettings(getPrefContext(), value, mComponentName);
|
AccessibilityUtil.optInAllValuesToSettings(getPrefContext(), value, mComponentName);
|
||||||
AccessibilityUtil.optOutAllValuesFromSettings(getPrefContext(), ~value, mComponentName);
|
AccessibilityUtil.optOutAllValuesFromSettings(getPrefContext(), ~value, mComponentName);
|
||||||
mShortcutPreference.setChecked(value != UserShortcutType.EMPTY);
|
final boolean shortcutAssigned = value != UserShortcutType.EMPTY;
|
||||||
|
mShortcutPreference.setChecked(shortcutAssigned);
|
||||||
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
||||||
|
|
||||||
|
// Show the quick setting tooltip if the shortcut assigned in the first time
|
||||||
|
if (shortcutAssigned) {
|
||||||
|
showQuickSettingsTooltipIfNeeded();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateShortcutPreferenceData() {
|
protected void updateShortcutPreferenceData() {
|
||||||
@@ -823,23 +846,17 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the quick settings tooltip if the quick settings service and the shortcut are assigned.
|
* Shows the quick settings tooltip if the quick settings feature is assigned. The tooltip only
|
||||||
* The tooltip only shows once.
|
* shows once.
|
||||||
*
|
*
|
||||||
* @param shortcutType The shortcut type.
|
* @param type The quick settings tooltip type
|
||||||
*/
|
*/
|
||||||
protected void showQuickSettingsTooltipIfNeeded(@UserShortcutType int shortcutType) {
|
protected void showQuickSettingsTooltipIfNeeded(@QuickSettingsTooltipType int type) {
|
||||||
if (shortcutType == AccessibilityUtil.UserShortcutType.EMPTY) {
|
mNeedsQSTooltipType = type;
|
||||||
return;
|
|
||||||
}
|
|
||||||
showQuickSettingsTooltipIfNeeded();
|
showQuickSettingsTooltipIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void showQuickSettingsTooltipIfNeeded() {
|
||||||
* Shows the quick settings tooltip if the quick settings service is assigned. The tooltip only
|
|
||||||
* shows once.
|
|
||||||
*/
|
|
||||||
protected void showQuickSettingsTooltipIfNeeded() {
|
|
||||||
final ComponentName tileComponentName = getTileComponentName();
|
final ComponentName tileComponentName = getTileComponentName();
|
||||||
if (tileComponentName == null) {
|
if (tileComponentName == null) {
|
||||||
// Returns if no tile service assigned.
|
// Returns if no tile service assigned.
|
||||||
@@ -858,10 +875,13 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String title =
|
final int titleResId = mNeedsQSTooltipType == QuickSettingsTooltipType.GUIDE_TO_EDIT
|
||||||
getString(R.string.accessibility_service_quick_settings_tooltips_content, tileName);
|
? R.string.accessibility_service_qs_tooltips_content
|
||||||
|
: R.string.accessibility_service_auto_added_qs_tooltips_content;
|
||||||
|
final String title = getString(titleResId, tileName);
|
||||||
|
final int imageResId = R.drawable.accessibility_qs_tooltips_illustration;
|
||||||
mTooltipWindow = new AccessibilityQuickSettingsTooltipWindow(getContext());
|
mTooltipWindow = new AccessibilityQuickSettingsTooltipWindow(getContext());
|
||||||
mTooltipWindow.setup(title);
|
mTooltipWindow.setup(title, imageResId);
|
||||||
mTooltipWindow.showAtTopCenter(getView());
|
mTooltipWindow.showAtTopCenter(getView());
|
||||||
AccessibilityQuickSettingUtils.optInValueToSharedPreferences(getContext(),
|
AccessibilityQuickSettingUtils.optInValueToSharedPreferences(getContext(),
|
||||||
tileComponentName);
|
tileComponentName);
|
||||||
|
@@ -36,6 +36,7 @@ import androidx.preference.PreferenceCategory;
|
|||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.SwitchPreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settings.widget.SeekBarPreference;
|
import com.android.settings.widget.SeekBarPreference;
|
||||||
import com.android.settings.widget.SettingsMainSwitchPreference;
|
import com.android.settings.widget.SettingsMainSwitchPreference;
|
||||||
@@ -147,7 +148,9 @@ public class ToggleReduceBrightColorsPreferenceFragment extends ToggleFeaturePre
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
|
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
|
||||||
super.onPreferenceToggled(preferenceKey, enabled);
|
if (enabled) {
|
||||||
|
showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_DIRECT_USE);
|
||||||
|
}
|
||||||
logAccessibilityServiceEnabled(mComponentName, enabled);
|
logAccessibilityServiceEnabled(mComponentName, enabled);
|
||||||
mColorDisplayManager.setReduceBrightColorsActivated(enabled);
|
mColorDisplayManager.setReduceBrightColorsActivated(enabled);
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@ import android.os.UserHandle;
|
|||||||
import com.android.internal.accessibility.AccessibilityShortcutController;
|
import com.android.internal.accessibility.AccessibilityShortcutController;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment;
|
import com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment;
|
||||||
|
import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
|
||||||
import com.android.settings.accessibility.ShortcutPreference;
|
import com.android.settings.accessibility.ShortcutPreference;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settingslib.widget.IllustrationPreference;
|
import com.android.settingslib.widget.IllustrationPreference;
|
||||||
@@ -64,7 +65,7 @@ public class OneHandedSettings extends AccessibilityShortcutPreferenceFragment {
|
|||||||
mainSwitchPreference.addOnSwitchChangeListener((switchView, isChecked) -> {
|
mainSwitchPreference.addOnSwitchChangeListener((switchView, isChecked) -> {
|
||||||
switchView.setChecked(isChecked);
|
switchView.setChecked(isChecked);
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
showQuickSettingsTooltipIfNeeded();
|
showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_DIRECT_USE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -53,6 +53,7 @@ public class AccessibilityQuickSettingsTooltipWindowTest {
|
|||||||
private PopupWindow.OnDismissListener mMockOnDismissListener;
|
private PopupWindow.OnDismissListener mMockOnDismissListener;
|
||||||
|
|
||||||
private static final String TEST_PACKAGE_NAME = "com.test.package";
|
private static final String TEST_PACKAGE_NAME = "com.test.package";
|
||||||
|
private static final int TEST_RES_ID = 1234;
|
||||||
private final Context mContext = ApplicationProvider.getApplicationContext();
|
private final Context mContext = ApplicationProvider.getApplicationContext();
|
||||||
private AccessibilityQuickSettingsTooltipWindow mTooltipView;
|
private AccessibilityQuickSettingsTooltipWindow mTooltipView;
|
||||||
private View mView;
|
private View mView;
|
||||||
@@ -66,8 +67,8 @@ public class AccessibilityQuickSettingsTooltipWindowTest {
|
|||||||
@Test
|
@Test
|
||||||
public void initTooltipView_atMostAvailableTextWidth() {
|
public void initTooltipView_atMostAvailableTextWidth() {
|
||||||
final String quickSettingsTooltipsContent = mContext.getString(
|
final String quickSettingsTooltipsContent = mContext.getString(
|
||||||
R.string.accessibility_service_quick_settings_tooltips_content, TEST_PACKAGE_NAME);
|
R.string.accessibility_service_qs_tooltips_content, TEST_PACKAGE_NAME);
|
||||||
mTooltipView.setup(quickSettingsTooltipsContent);
|
mTooltipView.setup(quickSettingsTooltipsContent, TEST_RES_ID);
|
||||||
|
|
||||||
final int getMaxWidth = mTooltipView.getAvailableWindowWidth();
|
final int getMaxWidth = mTooltipView.getAvailableWindowWidth();
|
||||||
assertThat(mTooltipView.getWidth()).isAtMost(getMaxWidth);
|
assertThat(mTooltipView.getWidth()).isAtMost(getMaxWidth);
|
||||||
@@ -75,7 +76,7 @@ public class AccessibilityQuickSettingsTooltipWindowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void showTooltipView_success() {
|
public void showTooltipView_success() {
|
||||||
mTooltipView.setup(TEST_PACKAGE_NAME);
|
mTooltipView.setup(TEST_PACKAGE_NAME, TEST_RES_ID);
|
||||||
assertThat(getLatestPopupWindow()).isNull();
|
assertThat(getLatestPopupWindow()).isNull();
|
||||||
|
|
||||||
mTooltipView.showAtTopCenter(mView);
|
mTooltipView.showAtTopCenter(mView);
|
||||||
@@ -85,7 +86,7 @@ public class AccessibilityQuickSettingsTooltipWindowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void accessibilityClickActionOnTooltipViewShown_shouldInvokeCallbackAndNotShowing() {
|
public void accessibilityClickActionOnTooltipViewShown_shouldInvokeCallbackAndNotShowing() {
|
||||||
mTooltipView.setup(TEST_PACKAGE_NAME);
|
mTooltipView.setup(TEST_PACKAGE_NAME, TEST_RES_ID);
|
||||||
mTooltipView.setOnDismissListener(mMockOnDismissListener);
|
mTooltipView.setOnDismissListener(mMockOnDismissListener);
|
||||||
mTooltipView.showAtTopCenter(mView);
|
mTooltipView.showAtTopCenter(mView);
|
||||||
|
|
||||||
@@ -101,7 +102,7 @@ public class AccessibilityQuickSettingsTooltipWindowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void dismiss_tooltipViewShown_shouldInvokeCallbackAndNotShowing() {
|
public void dismiss_tooltipViewShown_shouldInvokeCallbackAndNotShowing() {
|
||||||
mTooltipView.setup(TEST_PACKAGE_NAME);
|
mTooltipView.setup(TEST_PACKAGE_NAME, TEST_RES_ID);
|
||||||
mTooltipView.setOnDismissListener(mMockOnDismissListener);
|
mTooltipView.setOnDismissListener(mMockOnDismissListener);
|
||||||
mTooltipView.showAtTopCenter(mView);
|
mTooltipView.showAtTopCenter(mView);
|
||||||
|
|
||||||
@@ -113,7 +114,7 @@ public class AccessibilityQuickSettingsTooltipWindowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void waitAutoCloseDelayTime_tooltipViewShown_shouldInvokeCallbackAndNotShowing() {
|
public void waitAutoCloseDelayTime_tooltipViewShown_shouldInvokeCallbackAndNotShowing() {
|
||||||
mTooltipView.setup(TEST_PACKAGE_NAME, /* closeDelayTimeMillis= */ 1);
|
mTooltipView.setup(TEST_PACKAGE_NAME, TEST_RES_ID, /* closeDelayTimeMillis= */ 1);
|
||||||
mTooltipView.setOnDismissListener(mMockOnDismissListener);
|
mTooltipView.setOnDismissListener(mMockOnDismissListener);
|
||||||
mTooltipView.showAtTopCenter(mView);
|
mTooltipView.showAtTopCenter(mView);
|
||||||
|
|
||||||
|
@@ -18,6 +18,7 @@ package com.android.settings.accessibility;
|
|||||||
|
|
||||||
import static com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment.KEY_SAVED_QS_TOOLTIP_RESHOW;
|
import static com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment.KEY_SAVED_QS_TOOLTIP_RESHOW;
|
||||||
import static com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment.KEY_SAVED_USER_SHORTCUT_TYPE;
|
import static com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment.KEY_SAVED_USER_SHORTCUT_TYPE;
|
||||||
|
import static com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
|
||||||
import static com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
|
import static com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
@@ -204,7 +205,7 @@ public class AccessibilityShortcutPreferenceFragmentTest {
|
|||||||
@Config(shadows = ShadowFragment.class)
|
@Config(shadows = ShadowFragment.class)
|
||||||
public void restoreValueFromSavedInstanceState_showTooltipView() {
|
public void restoreValueFromSavedInstanceState_showTooltipView() {
|
||||||
mContext.setTheme(R.style.Theme_AppCompat);
|
mContext.setTheme(R.style.Theme_AppCompat);
|
||||||
mFragment.showQuickSettingsTooltipIfNeeded();
|
mFragment.showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_EDIT);
|
||||||
assertThat(getLatestPopupWindow().isShowing()).isTrue();
|
assertThat(getLatestPopupWindow().isShowing()).isTrue();
|
||||||
|
|
||||||
final Bundle savedInstanceState = new Bundle();
|
final Bundle savedInstanceState = new Bundle();
|
||||||
|
Reference in New Issue
Block a user