Fixes ApnEditor not restoring previous UI

ApnEditor tries read and set the UI in onCreate, before the previous
bundle is restored. This caused problems when the configuration has
changed (such as switching to Dark Theme).

This moves the UI changes to onViewRestored

Fixes: 146399432
Test: make SettingsGoogle and manual test UI
Change-Id: I8147ec96569fa28867c088d6c36584aa344f40ed
Merged-In: I8147ec96569fa28867c088d6c36584aa344f40ed
This commit is contained in:
Lee Chou
2020-02-27 12:33:16 +08:00
parent aaee4539c7
commit 80d8c3bc83

View File

@@ -39,6 +39,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.View.OnKeyListener;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.EditTextPreference;
@@ -369,8 +370,12 @@ public class ApnEditor extends SettingsPreferenceFragment
for (int i = 0; i < getPreferenceScreen().getPreferenceCount(); i++) {
getPreferenceScreen().getPreference(i).setOnPreferenceChangeListener(this);
}
}
fillUI(icicle == null);
@Override
public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
super.onViewStateRestored(savedInstanceState);
fillUI(savedInstanceState == null);
}
@VisibleForTesting