You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
876 B
39 lines
876 B
9 years ago
|
package acr.browser.lightning;
|
||
|
|
||
|
import android.content.Intent;
|
||
|
import android.os.Bundle;
|
||
|
import android.support.v7.app.ActionBarActivity;
|
||
|
|
||
|
public abstract class ThemableSettingsActivity extends ActionBarActivity {
|
||
|
|
||
|
private boolean mDark;
|
||
|
|
||
|
@Override
|
||
|
protected void onCreate(Bundle savedInstanceState) {
|
||
9 years ago
|
mDark = PreferenceManager.getInstance().getUseDarkTheme();
|
||
9 years ago
|
|
||
|
// set the theme
|
||
|
if (mDark) {
|
||
|
setTheme(R.style.Theme_SettingsTheme_Dark);
|
||
|
}
|
||
|
super.onCreate(savedInstanceState);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected void onResume() {
|
||
|
super.onResume();
|
||
9 years ago
|
if (PreferenceManager.getInstance().getUseDarkTheme() != mDark) {
|
||
9 years ago
|
restart();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
protected void restart() {
|
||
|
final Bundle outState = new Bundle();
|
||
|
onSaveInstanceState(outState);
|
||
|
final Intent intent = new Intent(this, getClass());
|
||
|
finish();
|
||
|
overridePendingTransition(0, 0);
|
||
|
startActivity(intent);
|
||
|
}
|
||
|
}
|