Directly use BaseIndexableProvider

- Add function getXmlResourceId, Fragments don't need to write
xml resource id twice.
- Remove getPreferenceControllers from Indexable.java. Because it will
move to SettingsLib later for other apps which don't need this function

Bug: 135053028
Test: robolectric
Change-Id: I1e74519aecdea3dde64a5aea79f08d766dbc0003
This commit is contained in:
Raff Tsai
2019-09-19 17:06:45 +08:00
parent 5ff9517f23
commit ac3e0d0988
122 changed files with 199 additions and 440 deletions

View File

@@ -7,7 +7,6 @@ import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.provider.SearchIndexableResource;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.EngineInfo;
import android.speech.tts.TtsEngines;
@@ -17,13 +16,11 @@ import androidx.appcompat.app.AlertDialog;
import com.android.settings.R;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settings.widget.RadioButtonPickerFragment;
import com.android.settingslib.search.SearchIndexable;
import com.android.settingslib.widget.CandidateInfo;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -141,7 +138,7 @@ public class TtsEnginePreferenceFragment extends RadioButtonPickerFragment {
@Override
protected int getPreferenceScreenResId() {
return R.xml.tts_engine_picker;
return SEARCH_INDEX_DATA_PROVIDER.getXmlResourceId();
}
private boolean shouldDisplayDataAlert(EngineCandidateInfo info) {
@@ -221,6 +218,6 @@ public class TtsEnginePreferenceFragment extends RadioButtonPickerFragment {
}
}
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.tts_engine_picker);
}