Merge "Add the extra style of the reset button to align SuW style."
This commit is contained in:
@@ -37,6 +37,7 @@ import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -168,6 +169,9 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
|
||||
v -> showDialog(DialogEnums.DIALOG_RESET_SETTINGS));
|
||||
resetController.setEntryPoint(mEntryPoint);
|
||||
controllers.add(resetController);
|
||||
if (WizardManagerHelper.isAnySetupWizard(getIntent())) {
|
||||
resetController.setSetupWizardStyle();
|
||||
}
|
||||
|
||||
return controllers;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.accessibility.TextReadingPreferenceFragment.EntryPoint;
|
||||
import com.android.settings.accessibility.TextReadingResetPreference.ButtonStyle;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.core.instrumentation.SettingsStatsLog;
|
||||
|
||||
@@ -30,6 +31,8 @@ import com.android.settings.core.instrumentation.SettingsStatsLog;
|
||||
* The controller of the reset button in the text and reading options page.
|
||||
*/
|
||||
class TextReadingResetController extends BasePreferenceController {
|
||||
@ButtonStyle
|
||||
private int mButtonStyle;
|
||||
private final View.OnClickListener mOnResetClickListener;
|
||||
|
||||
@EntryPoint
|
||||
@@ -63,6 +66,12 @@ class TextReadingResetController extends BasePreferenceController {
|
||||
AccessibilityStatsLogUtils.convertToEntryPoint(mEntryPoint));
|
||||
}
|
||||
});
|
||||
|
||||
resetPreference.setSetupWizardStyle(mButtonStyle);
|
||||
}
|
||||
|
||||
void setSetupWizardStyle() {
|
||||
mButtonStyle = ButtonStyle.SUW;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,11 +20,15 @@ import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* The preference which is used for resetting the status of all preferences in the display size
|
||||
* and text page.
|
||||
@@ -32,10 +36,20 @@ import com.android.settings.R;
|
||||
public class TextReadingResetPreference extends Preference {
|
||||
private View.OnClickListener mOnResetClickListener;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({
|
||||
ButtonStyle.DEFAULT,
|
||||
ButtonStyle.SUW,
|
||||
})
|
||||
@interface ButtonStyle {
|
||||
int DEFAULT = 0;
|
||||
int SUW = 1;
|
||||
}
|
||||
|
||||
public TextReadingResetPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
setLayoutResource(R.layout.accessibility_text_reading_reset_button);
|
||||
setSetupWizardStyle(ButtonStyle.DEFAULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,6 +60,13 @@ public class TextReadingResetPreference extends Preference {
|
||||
view.setOnClickListener(mOnResetClickListener);
|
||||
}
|
||||
|
||||
void setSetupWizardStyle(@ButtonStyle int style) {
|
||||
final int layoutResId = (style == ButtonStyle.SUW)
|
||||
? R.layout.accessibility_text_reading_reset_button_suw
|
||||
: R.layout.accessibility_text_reading_reset_button;
|
||||
setLayoutResource(layoutResId);
|
||||
}
|
||||
|
||||
void setOnResetClickListener(View.OnClickListener resetClickListener) {
|
||||
mOnResetClickListener = resetClickListener;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user