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.
38 lines
876 B
38 lines
876 B
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) { |
|
mDark = PreferenceManager.getInstance().getUseDarkTheme(); |
|
|
|
// set the theme |
|
if (mDark) { |
|
setTheme(R.style.Theme_SettingsTheme_Dark); |
|
} |
|
super.onCreate(savedInstanceState); |
|
} |
|
|
|
@Override |
|
protected void onResume() { |
|
super.onResume(); |
|
if (PreferenceManager.getInstance().getUseDarkTheme() != mDark) { |
|
restart(); |
|
} |
|
} |
|
|
|
protected void restart() { |
|
final Bundle outState = new Bundle(); |
|
onSaveInstanceState(outState); |
|
final Intent intent = new Intent(this, getClass()); |
|
finish(); |
|
overridePendingTransition(0, 0); |
|
startActivity(intent); |
|
} |
|
}
|
|
|