mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
code re-structure, mostly nitpicks :)
This commit is contained in:
@@ -13,49 +13,47 @@ import roboguice.activity.RoboActivity;
|
||||
|
||||
public abstract class BaseActivity extends RoboActivity {
|
||||
|
||||
private final static String PREFS_DB = "db";
|
||||
private final static String KEY_DB_KEY = "key";
|
||||
private final static String PREFS_DB = "db";
|
||||
private final static String KEY_DB_KEY = "key";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (PREVENT_SCREENSHOTS) getWindow().addFlags(FLAG_SECURE);
|
||||
}
|
||||
if (PREVENT_SCREENSHOTS) getWindow().addFlags(FLAG_SECURE);
|
||||
}
|
||||
|
||||
private SharedPreferences getBriarPrefs(String prefsName) {
|
||||
return getSharedPreferences(prefsName, MODE_PRIVATE);
|
||||
}
|
||||
private SharedPreferences getBriarPrefs(String prefsName) {
|
||||
return getSharedPreferences(prefsName, MODE_PRIVATE);
|
||||
}
|
||||
|
||||
protected String getDbKeyInHex() {
|
||||
return getBriarPrefs(PREFS_DB).getString(KEY_DB_KEY, null);
|
||||
}
|
||||
protected String getDbKeyInHex() {
|
||||
return getBriarPrefs(PREFS_DB).getString(KEY_DB_KEY, null);
|
||||
}
|
||||
|
||||
private void clearPrefs(String prefsName) {
|
||||
SharedPreferences.Editor editor = getBriarPrefs(prefsName).edit();
|
||||
editor.clear();
|
||||
editor.apply();
|
||||
}
|
||||
private void clearPrefs(String prefsName) {
|
||||
SharedPreferences.Editor editor = getBriarPrefs(prefsName).edit();
|
||||
editor.clear();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
protected void clearDbPrefs() {
|
||||
this.clearPrefs(PREFS_DB);
|
||||
}
|
||||
protected void clearDbPrefs() {
|
||||
this.clearPrefs(PREFS_DB);
|
||||
}
|
||||
|
||||
protected void gotoAndFinish(Class classInstance, int resultCode) {
|
||||
if (resultCode != Integer.MIN_VALUE)
|
||||
this.setResult(resultCode);
|
||||
this.startActivity(new Intent(this, classInstance));
|
||||
this.finish();
|
||||
}
|
||||
protected void gotoAndFinish(Class classInstance, int resultCode) {
|
||||
if (resultCode != Integer.MIN_VALUE)
|
||||
setResult(resultCode);
|
||||
startActivity(new Intent(this, classInstance));
|
||||
finish();
|
||||
}
|
||||
|
||||
protected void gotoAndFinish(Class classInstance)
|
||||
{
|
||||
this.gotoAndFinish(classInstance, Integer.MIN_VALUE);
|
||||
}
|
||||
protected void gotoAndFinish(Class classInstance) {
|
||||
gotoAndFinish(classInstance, Integer.MIN_VALUE);
|
||||
}
|
||||
|
||||
protected void hideSoftKeyboard()
|
||||
{
|
||||
Object o = getSystemService(INPUT_METHOD_SERVICE);
|
||||
((InputMethodManager) o).toggleSoftInput(HIDE_IMPLICIT_ONLY, 0);
|
||||
}
|
||||
protected void hideSoftKeyboard() {
|
||||
Object o = getSystemService(INPUT_METHOD_SERVICE);
|
||||
((InputMethodManager) o).toggleSoftInput(HIDE_IMPLICIT_ONLY, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user