Add settings to enable screenshots (special features)
This commit is contained in:
parent
acadf4f369
commit
7c4b058904
6 changed files with 41 additions and 2 deletions
|
@ -279,7 +279,10 @@ public class MainActivity extends BaseActivity
|
|||
super.onCreate(savedInstanceState);
|
||||
|
||||
setTitle(R.string.app_name);
|
||||
|
||||
if (! settings.getScreenshotsEnabled())
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
|
@ -434,7 +437,8 @@ public class MainActivity extends BaseActivity
|
|||
key.equals(getString(R.string.settings_key_thumbnail_size))) {
|
||||
adapter.notifyDataSetChanged();
|
||||
} else if (key.equals(getString(R.string.settings_key_theme)) ||
|
||||
key.equals(getString(R.string.settings_key_lang))) {
|
||||
key.equals(getString(R.string.settings_key_lang)) ||
|
||||
key.equals(getString(R.string.settings_key_enable_screenshot))) {
|
||||
recreate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,6 +147,8 @@ public class SettingsActivity extends BaseActivity
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity().getBaseContext());
|
||||
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
|
||||
// Authentication
|
||||
|
@ -191,6 +193,12 @@ public class SettingsActivity extends BaseActivity
|
|||
}
|
||||
});
|
||||
pgpKey.setDefaultUserId("Alice <alice@example.com>");
|
||||
|
||||
|
||||
if (sharedPref.contains(getString(R.string.settings_key_special_features)) &&
|
||||
sharedPref.getBoolean(getString(R.string.settings_key_special_features), false)) {
|
||||
addPreferencesFromResource(R.xml.preferences_special);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -360,4 +360,8 @@ public class Settings {
|
|||
return context.getResources().getDimensionPixelSize(R.dimen.card_thumbnail_size);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getScreenshotsEnabled() {
|
||||
return getBoolean(R.string.settings_key_enable_screenshot, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
<string name="settings_key_no_tags_toggle" translatable="false">pref_no_tags_toggle</string>
|
||||
<string name="settings_key_tags_toggles" translatable="false">pref_tags_toggles</string>
|
||||
|
||||
<string name="settings_key_enable_screenshot" translatable="false">pref_enable_screenshot</string>
|
||||
|
||||
<!-- Default values -->
|
||||
<string name="settings_default_auth" translatable="false">none</string>
|
||||
<string name="settings_default_lang" translatable="false">system</string>
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
<string name="settings_title_openpgp_sign">Sign encrypted backups</string>
|
||||
<string name="settings_title_openpgp_verify">Verify encrypted backups</string>
|
||||
|
||||
<string name="settings_title_enable_screenshot">Enable screenshots</string>
|
||||
|
||||
<!-- Descriptions -->
|
||||
<string name="settings_desc_tap_to_reveal">Hide the OTP tokens by default, requiring them to be
|
||||
revealed manually</string>
|
||||
|
@ -48,6 +50,9 @@
|
|||
<string name="settings_desc_openpgp_verify">Encrypted backups are only imported if they are
|
||||
signed with a valid key</string>
|
||||
|
||||
<string name="settings_desc_enable_screenshot">Allow to take screenshots of the main screen
|
||||
(disabled by default for security reasons)</string>
|
||||
|
||||
<!-- Toasts -->
|
||||
<string name="settings_toast_auth_device_pre_lollipop">This feature requires at least Android 5.0
|
||||
(Lollipop) to work</string>
|
||||
|
|
16
app/src/main/res/xml/preferences_special.xml
Normal file
16
app/src/main/res/xml/preferences_special.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/about_title_special_features" >
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="@string/settings_key_enable_screenshot"
|
||||
android:title="@string/settings_title_enable_screenshot"
|
||||
android:summary="@string/settings_desc_enable_screenshot"
|
||||
android:defaultValue="false" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in a new issue