Remove lifecycle-extensions from Settings

Bug: 259352947
Test: Make Settings
Change-Id: Ide9749494ae89ca401120eb5ffee9c0d87043c48
This commit is contained in:
Chaohui Wang
2022-11-16 17:56:47 +08:00
parent 148774d287
commit f55f9932d9
7 changed files with 24 additions and 24 deletions

View File

@@ -38,7 +38,7 @@ import android.util.Log;
import android.util.Pair;
import androidx.appcompat.app.AlertDialog;
import androidx.lifecycle.ViewModelProviders;
import androidx.lifecycle.ViewModelProvider;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
@@ -208,7 +208,7 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
}
final TextToSpeechViewModel ttsViewModel =
ViewModelProviders.of(this).get(TextToSpeechViewModel.class);
new ViewModelProvider(this).get(TextToSpeechViewModel.class);
Pair<TextToSpeech, Boolean> ttsAndNew = ttsViewModel.getTtsAndWhetherNew(mInitListener);
mTts = ttsAndNew.first;
// If the TTS object is not newly created, we need to run the setup on the settings side to
@@ -237,7 +237,7 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
}
if (!mTts.getDefaultEngine().equals(mTts.getCurrentEngine())) {
final TextToSpeechViewModel ttsViewModel =
ViewModelProviders.of(this).get(TextToSpeechViewModel.class);
new ViewModelProvider(this).get(TextToSpeechViewModel.class);
try {
// If the current engine isn't the default engine shut down the current engine in
// preparation for creating the new engine.