mobile: use onConfigurationChanged instead of restoring savedInstanceState
This commit is contained in:
parent
f45ee1162a
commit
529f7fa254
@ -17,6 +17,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.OnSharedPreferenceChangeListener;
|
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@ -51,12 +52,6 @@ public class IITC_Mobile extends Activity {
|
|||||||
};
|
};
|
||||||
sharedPref.registerOnSharedPreferenceChangeListener(listener);
|
sharedPref.registerOnSharedPreferenceChangeListener(listener);
|
||||||
|
|
||||||
// we do not want to reload our page every time we switch orientations...
|
|
||||||
// so restore state if activity was already created
|
|
||||||
if(savedInstanceState != null) {
|
|
||||||
iitc_view.restoreState(savedInstanceState);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// load new iitc web view with ingress intel page
|
// load new iitc web view with ingress intel page
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
@ -76,7 +71,6 @@ public class IITC_Mobile extends Activity {
|
|||||||
iitc_view.loadUrl(addUrlParam("https://www.ingress.com/intel"));
|
iitc_view.loadUrl(addUrlParam("https://www.ingress.com/intel"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
@ -104,10 +98,10 @@ public class IITC_Mobile extends Activity {
|
|||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// save instance state to avoid reloading on orientation change
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
iitc_view.saveState(outState);
|
Log.d("iitcm", "configuration changed...restoring...");
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we want a self defined behavior for the back button
|
// we want a self defined behavior for the back button
|
||||||
|
Loading…
x
Reference in New Issue
Block a user