Support autoclick secondary action (8/n)

Modify options description logic from 5 types to 3 types.

Bug: 149884746
Test: manual
Merged-In: I714db2a450e34d33e5728cf355136d26bef77e11
Change-Id: I714db2a450e34d33e5728cf355136d26bef77e11
(cherry picked from commit b6d6d9da46)
This commit is contained in:
ChenJean
2020-02-21 15:46:49 +08:00
committed by Menghan Li
parent 9266fe32f7
commit 9e1bb0def1
2 changed files with 15 additions and 27 deletions

View File

@@ -64,12 +64,10 @@ public class ToggleAutoclickPreferenceFragment extends DashboardFragment
* Resource ids from which autoclick preference summaries should be derived. The strings have
* placeholder for integer delay value.
*/
private static final int[] mAutoclickPreferenceSummaries = {
R.plurals.accessibilty_autoclick_preference_subtitle_extremely_short_delay,
R.plurals.accessibilty_autoclick_preference_subtitle_very_short_delay,
private static final int[] AUTOCLICK_PREFERENCE_SUMMARIES = {
R.plurals.accessibilty_autoclick_preference_subtitle_short_delay,
R.plurals.accessibilty_autoclick_preference_subtitle_long_delay,
R.plurals.accessibilty_autoclick_preference_subtitle_very_long_delay
R.plurals.accessibilty_autoclick_preference_subtitle_medium_delay,
R.plurals.accessibilty_autoclick_preference_subtitle_long_delay
};
/**
@@ -86,7 +84,7 @@ public class ToggleAutoclickPreferenceFragment extends DashboardFragment
// Only show integer when delay time is 1.
final String decimalFormat = (delaySecond == 1) ? "%.0f" : "%.1f";
return resources.getQuantityString(mAutoclickPreferenceSummaries[summaryIndex],
return resources.getQuantityString(AUTOCLICK_PREFERENCE_SUMMARIES[summaryIndex],
quantity, String.format(decimalFormat, delaySecond));
}
@@ -98,10 +96,10 @@ public class ToggleAutoclickPreferenceFragment extends DashboardFragment
return 0;
}
if (delay >= MAX_AUTOCLICK_DELAY_MS) {
return mAutoclickPreferenceSummaries.length - 1;
return AUTOCLICK_PREFERENCE_SUMMARIES.length - 1;
}
int delayRange = MAX_AUTOCLICK_DELAY_MS - MIN_AUTOCLICK_DELAY_MS;
int rangeSize = (delayRange) / (mAutoclickPreferenceSummaries.length - 1);
int rangeSize = (delayRange) / (AUTOCLICK_PREFERENCE_SUMMARIES.length - 1);
return (delay - MIN_AUTOCLICK_DELAY_MS) / rangeSize;
}