Avoid the reset item having inconsistent alignment with the others under SuW.

Replaces the LayoutPreference with native Preference for the reset preference which is used for resettings the status of all preferences.

Bug: 232528123
Test: make RunSettingsRoboTests ROBOTEST_FILTER=TextReadingResetControllerTest,TextReadingResetPreferenceTest
Change-Id: I00719f13dc78039269ee373c6b35e12e7ff595ce
This commit is contained in:
Peter_Liang
2022-07-05 12:57:21 +08:00
parent fd6c0f6a45
commit 772e114438
6 changed files with 142 additions and 51 deletions

View File

@@ -22,11 +22,9 @@ import android.view.View;
import androidx.annotation.Nullable;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.accessibility.TextReadingPreferenceFragment.EntryPoint;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.instrumentation.SettingsStatsLog;
import com.android.settingslib.widget.LayoutPreference;
/**
* The controller of the reset button in the text and reading options page.
@@ -52,9 +50,9 @@ class TextReadingResetController extends BasePreferenceController {
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
final LayoutPreference layoutPreference = screen.findPreference(getPreferenceKey());
final View view = layoutPreference.findViewById(R.id.reset_button);
view.setOnClickListener(v -> {
final TextReadingResetPreference resetPreference =
(TextReadingResetPreference) screen.findPreference(getPreferenceKey());
resetPreference.setOnResetClickListener(v -> {
if (mOnResetClickListener != null) {
mOnResetClickListener.onClick(v);