Handle configuration changes in preferences activity

This commit is contained in:
Peter Osterlund 2020-03-21 17:50:13 +01:00
parent 287f2dae4a
commit b35437dd3e
2 changed files with 8 additions and 1 deletions

View File

@ -94,7 +94,8 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".activities.Preferences" <activity android:name=".activities.Preferences"
android:label="@string/preferences"> android:label="@string/preferences"
android:configChanges="orientation|screenSize|keyboardHidden|screenLayout|smallestScreenSize">
</activity> </activity>
<activity android:name=".activities.EditBoard" <activity android:name=".activities.EditBoard"
android:label="@string/edit_board" android:label="@string/edit_board"

View File

@ -26,6 +26,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor; import android.content.SharedPreferences.Editor;
import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
@ -105,6 +106,11 @@ public class Preferences extends PreferenceActivity {
editor.apply(); editor.apply();
} }
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
public interface ActivityHandler { public interface ActivityHandler {
void handleResult(int resultCode, Intent data); void handleResult(int resultCode, Intent data);
} }