mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-26 03:02:24 -05:00
Simplified Options Menu (moved rate, translate, suggest and change master password to about dialog or db settings, removed Goto URL, is now in the "field menu")
Added option to remove the "Donate a beer" option Added cancel button in entry edit activity Fixed button icon size in holo dark theme
This commit is contained in:
parent
7a40368ed3
commit
c5064d26bf
@ -19,6 +19,7 @@ using System;
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.OS;
|
||||
using Android.Runtime;
|
||||
using Android.Widget;
|
||||
using Android.Content.PM;
|
||||
|
||||
@ -29,6 +30,16 @@ namespace keepass2android
|
||||
|
||||
public AboutDialog(Context context):base (context) {
|
||||
}
|
||||
public AboutDialog(Context context, int theme)
|
||||
: base(context, theme)
|
||||
{
|
||||
}
|
||||
|
||||
public AboutDialog(IntPtr javaRef, JniHandleOwnership transfer) : base(javaRef, transfer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected override void OnCreate(Bundle savedInstanceState) {
|
||||
base.OnCreate(savedInstanceState);
|
||||
@ -38,7 +49,43 @@ namespace keepass2android
|
||||
SetVersion();
|
||||
SetContributors();
|
||||
|
||||
FindViewById(Resource.Id.suggest).Click += delegate
|
||||
{
|
||||
try
|
||||
{
|
||||
Util.GotoUrl(Context, Resource.String.SuggestionsURL);
|
||||
}
|
||||
catch (ActivityNotFoundException)
|
||||
{
|
||||
Toast.MakeText(Context, Resource.String.no_url_handler, ToastLength.Long).Show();
|
||||
}
|
||||
|
||||
};
|
||||
FindViewById(Resource.Id.rate).Click += delegate
|
||||
{
|
||||
try
|
||||
{
|
||||
Util.GotoMarket(Context);
|
||||
}
|
||||
catch (ActivityNotFoundException)
|
||||
{
|
||||
Toast.MakeText(Context, Resource.String.no_url_handler, ToastLength.Long).Show();
|
||||
}
|
||||
};
|
||||
FindViewById(Resource.Id.translate).Click += delegate
|
||||
{
|
||||
try
|
||||
{
|
||||
Util.GotoUrl(Context, Resource.String.TranslationURL);
|
||||
}
|
||||
catch (ActivityNotFoundException)
|
||||
{
|
||||
Toast.MakeText(Context, Resource.String.no_url_handler, ToastLength.Long).Show();
|
||||
}
|
||||
}; FindViewById(Resource.Id.donate).Click += delegate
|
||||
{
|
||||
Util.GotoDonateUrl(Context);
|
||||
};
|
||||
}
|
||||
|
||||
private void SetContributors()
|
||||
|
@ -845,40 +845,17 @@ namespace keepass2android
|
||||
|
||||
UpdateTogglePasswordMenu();
|
||||
|
||||
IMenuItem gotoUrl = menu.FindItem(Resource.Id.menu_goto_url);
|
||||
//Disabled IMenuItem copyUser = menu.FindItem(Resource.Id.menu_copy_user);
|
||||
//Disabled IMenuItem copyPass = menu.FindItem(Resource.Id.menu_copy_pass);
|
||||
|
||||
// In API >= 11 onCreateOptionsMenu may be called before onCreate completes
|
||||
// so _entry may not be set
|
||||
if (Entry == null)
|
||||
{
|
||||
gotoUrl.SetVisible(false);
|
||||
//Disabled copyUser.SetVisible(false);
|
||||
//Disabled copyPass.SetVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
String url = Entry.Strings.ReadSafe(PwDefs.UrlField);
|
||||
if (String.IsNullOrEmpty(url))
|
||||
{
|
||||
// disable button if url is not available
|
||||
gotoUrl.SetVisible(false);
|
||||
}
|
||||
if (String.IsNullOrEmpty(Entry.Strings.ReadSafe(PwDefs.UserNameField)))
|
||||
{
|
||||
// disable button if username is not available
|
||||
//Disabled copyUser.SetVisible(false);
|
||||
}
|
||||
if (String.IsNullOrEmpty(Entry.Strings.ReadSafe(PwDefs.PasswordField)))
|
||||
{
|
||||
// disable button if password is not available
|
||||
//Disabled copyPass.SetVisible(false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnPrepareOptionsMenu(IMenu menu)
|
||||
{
|
||||
Util.PrepareDonateOptionMenu(menu, this);
|
||||
return base.OnPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void UpdateTogglePasswordMenu()
|
||||
{
|
||||
IMenuItem togglePassword = _menu.FindItem(Resource.Id.menu_toggle_pass);
|
||||
@ -943,17 +920,7 @@ namespace keepass2android
|
||||
switch (item.ItemId)
|
||||
{
|
||||
case Resource.Id.menu_donate:
|
||||
try
|
||||
{
|
||||
Util.GotoDonateUrl(this);
|
||||
}
|
||||
catch (ActivityNotFoundException)
|
||||
{
|
||||
Toast.MakeText(this, Resource.String.error_failed_to_launch_link, ToastLength.Long).Show();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return Util.GotoDonateUrl(this);
|
||||
case Resource.Id.menu_toggle_pass:
|
||||
if (_showPassword)
|
||||
{
|
||||
@ -969,48 +936,8 @@ namespace keepass2android
|
||||
|
||||
return true;
|
||||
|
||||
case Resource.Id.menu_goto_url:
|
||||
return GotoUrl();
|
||||
/* TODO: required?
|
||||
case Resource.Id.menu_copy_user:
|
||||
timeoutCopyToClipboard(_entry.Strings.ReadSafe (PwDefs.UserNameField));
|
||||
return true;
|
||||
|
||||
case Resource.Id.menu_copy_pass:
|
||||
timeoutCopyToClipboard(_entry.Strings.ReadSafe (PwDefs.UserNameField));
|
||||
return true;
|
||||
*/
|
||||
case Resource.Id.menu_rate:
|
||||
try
|
||||
{
|
||||
Util.GotoMarket(this);
|
||||
}
|
||||
catch (ActivityNotFoundException)
|
||||
{
|
||||
Toast.MakeText(this, Resource.String.no_url_handler, ToastLength.Long).Show();
|
||||
}
|
||||
return true;
|
||||
case Resource.Id.menu_suggest_improvements:
|
||||
try
|
||||
{
|
||||
Util.GotoUrl(this, Resource.String.SuggestionsURL);
|
||||
}
|
||||
catch (ActivityNotFoundException)
|
||||
{
|
||||
Toast.MakeText(this, Resource.String.no_url_handler, ToastLength.Long).Show();
|
||||
}
|
||||
return true;
|
||||
case Resource.Id.menu_lock:
|
||||
return true;
|
||||
case Resource.Id.menu_translate:
|
||||
try
|
||||
{
|
||||
Util.GotoUrl(this, Resource.String.TranslationURL);
|
||||
}
|
||||
catch (ActivityNotFoundException)
|
||||
{
|
||||
Toast.MakeText(this, Resource.String.no_url_handler, ToastLength.Long).Show();
|
||||
}
|
||||
App.Kp2a.LockDatabase();
|
||||
return true;
|
||||
case Android.Resource.Id.Home:
|
||||
//Currently the action bar only displays the home button when we come from a previous activity.
|
||||
|
@ -221,10 +221,6 @@ namespace keepass2android
|
||||
|
||||
|
||||
// Save button
|
||||
View save = FindViewById(Resource.Id.entry_save);
|
||||
if (save == null)
|
||||
{
|
||||
//save is not part of layout for API >= 14 -> use action bar
|
||||
ActionBar.SetCustomView(Resource.Layout.SaveButton);
|
||||
ActionBar.SetDisplayShowCustomEnabled(true);
|
||||
ActionBar.SetDisplayShowTitleEnabled(false);
|
||||
@ -232,15 +228,14 @@ namespace keepass2android
|
||||
ActionBar.SetDisplayShowHomeEnabled(false);
|
||||
ActionBar.SetDisplayOptions(ActionBarDisplayOptions.ShowCustom,
|
||||
ActionBarDisplayOptions.ShowCustom);
|
||||
save = FindViewById(Resource.Id.entry_save);
|
||||
|
||||
}
|
||||
var save = FindViewById(Resource.Id.entry_save);
|
||||
save.Click += (sender, e) =>
|
||||
{
|
||||
SaveEntry();
|
||||
|
||||
};
|
||||
|
||||
FindViewById(Resource.Id.entry_save_cancel).Click += (sender, args) => Finish();
|
||||
|
||||
// Respect mask password setting
|
||||
MakePasswordVisibleOrHidden();
|
||||
|
||||
@ -696,6 +691,13 @@ namespace keepass2android
|
||||
if (binariesLabel != null)
|
||||
binariesLabel.Visibility = State.Entry.Binaries.UCount > 0 ? ViewStates.Visible : ViewStates.Gone;
|
||||
}
|
||||
|
||||
public override bool OnPrepareOptionsMenu(IMenu menu)
|
||||
{
|
||||
Util.PrepareDonateOptionMenu(menu, this);
|
||||
return base.OnPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
public override bool OnCreateOptionsMenu(IMenu menu) {
|
||||
base.OnCreateOptionsMenu(menu);
|
||||
|
||||
@ -709,36 +711,7 @@ namespace keepass2android
|
||||
public override bool OnOptionsItemSelected(IMenuItem item) {
|
||||
switch ( item.ItemId ) {
|
||||
case Resource.Id.menu_donate:
|
||||
try {
|
||||
Util.GotoDonateUrl(this);
|
||||
} catch (ActivityNotFoundException) {
|
||||
Toast.MakeText(this, Resource.String.error_failed_to_launch_link, ToastLength.Long).Show();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
case Resource.Id.menu_rate:
|
||||
try {
|
||||
Util.GotoMarket(this);
|
||||
} catch (ActivityNotFoundException) {
|
||||
Toast.MakeText(this, Resource.String.no_url_handler, ToastLength.Long).Show();
|
||||
}
|
||||
return true;
|
||||
case Resource.Id.menu_suggest_improvements:
|
||||
try {
|
||||
Util.GotoUrl(this, Resource.String.SuggestionsURL);
|
||||
} catch (ActivityNotFoundException) {
|
||||
Toast.MakeText(this, Resource.String.no_url_handler, ToastLength.Long).Show();
|
||||
}
|
||||
return true;
|
||||
case Resource.Id.menu_translate:
|
||||
try {
|
||||
Util.GotoUrl(this, Resource.String.TranslationURL);
|
||||
} catch (ActivityNotFoundException) {
|
||||
Toast.MakeText(this, Resource.String.no_url_handler, ToastLength.Long).Show();
|
||||
}
|
||||
return true;
|
||||
|
||||
return Util.GotoDonateUrl(this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -321,11 +321,7 @@ namespace keepass2android
|
||||
else
|
||||
item.SetVisible(true);
|
||||
}
|
||||
item = menu.FindItem(Resource.Id.menu_change_master_key);
|
||||
if (item != null)
|
||||
{
|
||||
item.SetVisible(App.Kp2a.GetDb().CanWrite);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -348,6 +344,7 @@ namespace keepass2android
|
||||
return false;
|
||||
}
|
||||
|
||||
Util.PrepareDonateOptionMenu(menu, this);
|
||||
SetSortMenuText(menu);
|
||||
|
||||
return true;
|
||||
@ -356,14 +353,7 @@ namespace keepass2android
|
||||
public override bool OnOptionsItemSelected(IMenuItem item) {
|
||||
switch ( item.ItemId ) {
|
||||
case Resource.Id.menu_donate:
|
||||
try {
|
||||
Util.GotoDonateUrl(this);
|
||||
} catch (ActivityNotFoundException) {
|
||||
Toast.MakeText(this, Resource.String.error_failed_to_launch_link, ToastLength.Long).Show();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return Util.GotoDonateUrl(this);
|
||||
case Resource.Id.menu_lock:
|
||||
App.Kp2a.LockDatabase();
|
||||
return true;
|
||||
@ -377,10 +367,6 @@ namespace keepass2android
|
||||
DatabaseSettingsActivity.Launch(this);
|
||||
return true;
|
||||
|
||||
case Resource.Id.menu_change_master_key:
|
||||
SetPassword();
|
||||
return true;
|
||||
|
||||
case Resource.Id.menu_sync:
|
||||
Synchronize();
|
||||
return true;
|
||||
@ -388,27 +374,6 @@ namespace keepass2android
|
||||
case Resource.Id.menu_sort:
|
||||
ToggleSort();
|
||||
return true;
|
||||
case Resource.Id.menu_rate:
|
||||
try {
|
||||
Util.GotoMarket(this);
|
||||
} catch (ActivityNotFoundException) {
|
||||
Toast.MakeText(this, Resource.String.no_url_handler, ToastLength.Long).Show();
|
||||
}
|
||||
return true;
|
||||
case Resource.Id.menu_suggest_improvements:
|
||||
try {
|
||||
Util.GotoUrl(this, Resource.String.SuggestionsURL);
|
||||
} catch (ActivityNotFoundException) {
|
||||
Toast.MakeText(this, Resource.String.no_url_handler, ToastLength.Long).Show();
|
||||
}
|
||||
return true;
|
||||
case Resource.Id.menu_translate:
|
||||
try {
|
||||
Util.GotoUrl(this, Resource.String.TranslationURL);
|
||||
} catch (ActivityNotFoundException) {
|
||||
Toast.MakeText(this, Resource.String.no_url_handler, ToastLength.Long).Show();
|
||||
}
|
||||
return true;
|
||||
case Android.Resource.Id.Home:
|
||||
//Currently the action bar only displays the home button when we come from a previous activity.
|
||||
//So we can simply Finish. See this page for information on how to do this in more general (future?) cases:
|
||||
@ -523,11 +488,6 @@ namespace keepass2android
|
||||
|
||||
}
|
||||
|
||||
private void SetPassword() {
|
||||
SetPasswordDialog dialog = new SetPasswordDialog(this);
|
||||
dialog.Show();
|
||||
}
|
||||
|
||||
public class RefreshTask : OnFinish {
|
||||
readonly GroupBaseActivity _act;
|
||||
public RefreshTask(Handler handler, GroupBaseActivity act):base(handler) {
|
||||
|
4121
src/keepass2android/Resources/Resource.designer.cs
generated
4121
src/keepass2android/Resources/Resource.designer.cs
generated
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 924 B |
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1023 B |
@ -1,5 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:divider="?android:attr/dividerVertical"
|
||||
android:showDividers="middle"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:dividerPadding="12dp"
|
||||
android:baselineAligned="false">
|
||||
<FrameLayout
|
||||
style="?android:actionButtonStyle"
|
||||
android:id="@+id/entry_save"
|
||||
android:layout_width="wrap_content"
|
||||
@ -16,3 +25,22 @@
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/entry_save" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
style="?android:actionButtonStyle"
|
||||
android:id="@+id/entry_save_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
<TextView
|
||||
style="?android:actionBarTabTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:paddingRight="20dp"
|
||||
android:drawableLeft="?attr/CancelDrawable"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/cancel" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
@ -66,11 +66,43 @@
|
||||
android:text="@string/issues"
|
||||
android:layout_below="@id/feedback_title"
|
||||
android:autoLink="web" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/suggest"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/feedback"
|
||||
android:text="@string/suggest_improvements"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/rate"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/suggest"
|
||||
android:text="@string/rate_app"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/translate"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rate"
|
||||
android:text="@string/translate_app"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/donate"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/translate"
|
||||
android:text="@string/menu_donate"
|
||||
/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/divider3"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/feedback"
|
||||
android:layout_below="@id/donate"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@android:drawable/divider_horizontal_dark" />
|
||||
<TextView
|
||||
|
@ -30,30 +30,4 @@
|
||||
android:title="@string/menu_donate"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/menu_goto_url"
|
||||
android:title="@string/menu_url"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<!--item android:id="@+id/menu_copy_user"
|
||||
android:title="@string/menu_copy_user"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/menu_copy_pass"
|
||||
android:title="@string/menu_copy_pass"
|
||||
android:showAsAction="ifRoom"
|
||||
/-->
|
||||
<item android:id="@+id/menu_suggest_improvements"
|
||||
android:icon="@android:drawable/ic_menu_directions"
|
||||
android:title="@string/suggest_improvements"
|
||||
android:showAsAction="never"
|
||||
/>
|
||||
<item android:id="@+id/menu_rate"
|
||||
android:icon="@android:drawable/star_off"
|
||||
android:title="@string/rate_app"
|
||||
android:showAsAction="never"
|
||||
/>
|
||||
<item android:id="@+id/menu_translate"
|
||||
android:title="@string/translate_app"
|
||||
android:showAsAction="never"
|
||||
/>
|
||||
</menu>
|
||||
|
@ -18,20 +18,6 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/menu_donate"
|
||||
android:title="@string/menu_donate"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/menu_suggest_improvements"
|
||||
android:icon="@android:drawable/ic_menu_directions"
|
||||
android:title="@string/suggest_improvements"
|
||||
android:showAsAction="never"
|
||||
/>
|
||||
<item android:id="@+id/menu_rate"
|
||||
android:icon="@android:drawable/star_off"
|
||||
android:title="@string/rate_app"
|
||||
android:showAsAction="never"
|
||||
/>
|
||||
<item android:id="@+id/menu_translate"
|
||||
android:title="@string/translate_app"
|
||||
android:showAsAction="never"
|
||||
/>
|
||||
</menu>
|
@ -40,10 +40,6 @@
|
||||
android:icon="@android:drawable/ic_menu_preferences"
|
||||
android:title="@string/menu_app_settings"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/menu_change_master_key"
|
||||
android:title="@string/menu_change_key"
|
||||
android:showAsAction="never"
|
||||
/>
|
||||
<item android:id="@+id/menu_sync"
|
||||
android:icon="@android:drawable/ic_popup_sync"
|
||||
@ -57,13 +53,5 @@
|
||||
android:showAsAction="never"
|
||||
/>
|
||||
|
||||
<item android:id="@+id/menu_suggest_improvements"
|
||||
android:icon="@android:drawable/ic_menu_directions"
|
||||
android:title="@string/suggest_improvements"
|
||||
android:showAsAction="never"
|
||||
/>
|
||||
<item android:id="@+id/menu_translate"
|
||||
android:title="@string/translate_app"
|
||||
android:showAsAction="never"
|
||||
/>
|
||||
|
||||
</menu>
|
||||
|
@ -50,6 +50,7 @@
|
||||
<string name="clipboard_timeout_key">clip_timeout_key</string>
|
||||
<string name="db_key">db</string>
|
||||
<string name="rounds_key">rounds</string>
|
||||
<string name="master_pwd_key">change_master_pwd</string>
|
||||
<string name="keyfile_key">keyfile</string>
|
||||
<string name="maskpass_key">maskpass</string>
|
||||
<string name="omitbackup_key">omitbackup</string>
|
||||
@ -92,10 +93,14 @@
|
||||
<string name="LockWhenScreenOff_key">LockWhenScreenOff</string>
|
||||
<string name="LockWhenNavigateBack_key">LockWhenNavigateBack</string>
|
||||
|
||||
<string name="NoDonateOption_key">NoDonateOption</string>
|
||||
|
||||
<string name="UseOfflineCache_key">UseOfflineCache</string>
|
||||
<string name="AcceptAllServerCertificates_key">AcceptAllServerCertificates</string>
|
||||
<string name="CheckForFileChangesOnSave_key">CheckForFileChangesOnSave</string>
|
||||
|
||||
<string name="about_prefs_key">about_prefs</string>
|
||||
|
||||
<string name="MarketURL">market://details?id=</string>
|
||||
<string name="SuggestionsURL">https://keepass2android.codeplex.com/workitem/list/basic</string>
|
||||
<string name="TranslationURL">http://crowdin.net/project/keepass2android</string>
|
||||
|
@ -255,6 +255,10 @@
|
||||
<string name="LockWhenNavigateBack_title">Lock when leaving app</string>
|
||||
<string name="LockWhenNavigateBack_summary">Lock the database when leaving the app by pressing the back button.</string>
|
||||
|
||||
<string name="NoDonateOption_title">Hide donation option</string>
|
||||
<string name="NoDonateOption_summary">This setting is for donators. It is available after using Keepass2Android for a while only.</string>
|
||||
<string name="NoDonateOption_question">Without donations, this app would not exist and would not be improved continually! If you have not yet donated, please consider making a donation now.</string>
|
||||
|
||||
|
||||
<string name="UseOfflineCache_title">Database caching</string>
|
||||
<string name="UseOfflineCache_summary">Keep a copy of remote database files in the application cache directory. This allows to use remote databases even when offline.</string>
|
||||
|
@ -44,6 +44,10 @@
|
||||
android:persistent="false"
|
||||
android:key="@string/default_username_key"/>
|
||||
|
||||
<Preference android:key="@string/master_pwd_key"
|
||||
android:title="@string/menu_change_key"
|
||||
/>
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="export_prefs"
|
||||
android:title="@string/export_prefs"
|
||||
@ -154,6 +158,14 @@
|
||||
android:entryValues="@array/design_values"
|
||||
android:dialogTitle="@string/design_title"
|
||||
android:defaultValue="@string/design_default"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:enabled="true"
|
||||
android:persistent="true"
|
||||
android:summary="@string/NoDonateOption_summary"
|
||||
android:defaultValue="false"
|
||||
android:title="@string/NoDonateOption_title"
|
||||
android:key="@string/NoDonateOption_key" />
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen
|
||||
@ -296,4 +308,12 @@
|
||||
<PreferenceScreen android:key="plugin_key" android:title="@string/plugins">
|
||||
<intent android:action="keepass2android.PluginListActivity"/>
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="@string/about_prefs_key"
|
||||
android:title="@string/menu_about"
|
||||
>
|
||||
<intent android:action="keepass2android.AboutActivity"/>
|
||||
</PreferenceScreen>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
@ -40,7 +40,7 @@ namespace keepass2android
|
||||
|
||||
}
|
||||
|
||||
private bool UseDarkTheme
|
||||
public bool UseDarkTheme
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -21,6 +21,7 @@ using System.Collections.Generic;
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Database;
|
||||
using Android.Preferences;
|
||||
using Android.Provider;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
@ -73,13 +74,23 @@ namespace keepass2android
|
||||
GotoUrl(context, context.GetString(Resource.String.MarketURL)+context.PackageName);
|
||||
}
|
||||
|
||||
public static void GotoDonateUrl(Context context)
|
||||
public static bool GotoDonateUrl(Context context)
|
||||
{
|
||||
string donateUrl = context.GetString(Resource.String.donate_url,
|
||||
new Java.Lang.Object[]{context.Resources.Configuration.Locale.Language,
|
||||
context.PackageName
|
||||
});
|
||||
try
|
||||
{
|
||||
GotoUrl(context, donateUrl);
|
||||
return true;
|
||||
}
|
||||
catch (ActivityNotFoundException)
|
||||
{
|
||||
Toast.MakeText(context, Resource.String.error_failed_to_launch_link, ToastLength.Long).Show();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String GetEditText(Activity act, int resId) {
|
||||
@ -329,6 +340,49 @@ namespace keepass2android
|
||||
activity.StartActivity(i);
|
||||
activity.Finish();
|
||||
}
|
||||
|
||||
public static void PrepareNoDonatePreference(Context ctx, Preference preference)
|
||||
{
|
||||
ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(ctx);
|
||||
|
||||
long usageCount = prefs.GetLong(ctx.GetString(Resource.String.UsageCount_key), 0);
|
||||
|
||||
#if DEBUG
|
||||
preference.Enabled = (usageCount > 1);
|
||||
#else
|
||||
preference.Enabled = (usageCount > 50);
|
||||
#endif
|
||||
preference.PreferenceChange += delegate(object sender, Preference.PreferenceChangeEventArgs args)
|
||||
{
|
||||
if ((bool) args.NewValue)
|
||||
{
|
||||
new AlertDialog.Builder(ctx)
|
||||
.SetTitle(AppNames.AppName)
|
||||
.SetCancelable(false)
|
||||
.SetPositiveButton(Android.Resource.String.Ok, delegate(object o, DialogClickEventArgs eventArgs)
|
||||
{
|
||||
GotoDonateUrl(ctx);
|
||||
((Dialog) o).Dismiss();
|
||||
})
|
||||
.SetMessage(Resource.String.NoDonateOption_question)
|
||||
.Create().Show();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public static void PrepareDonateOptionMenu(IMenu menu, Context ctx)
|
||||
{
|
||||
var donateItem = menu.FindItem(Resource.Id.menu_donate);
|
||||
if (donateItem != null)
|
||||
{
|
||||
donateItem.SetVisible(
|
||||
!PreferenceManager.GetDefaultSharedPreferences(ctx)
|
||||
.GetBoolean(ctx.GetString(Resource.String.NoDonateOption_key), false)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -507,15 +507,7 @@ namespace keepass2android
|
||||
public override bool OnOptionsItemSelected(IMenuItem item) {
|
||||
switch (item.ItemId) {
|
||||
case Resource.Id.menu_donate:
|
||||
try {
|
||||
Util.GotoDonateUrl(this);
|
||||
} catch (ActivityNotFoundException) {
|
||||
Toast.MakeText(this, Resource.String.error_failed_to_launch_link, ToastLength.Long).Show();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
return Util.GotoDonateUrl(this);
|
||||
case Resource.Id.menu_about:
|
||||
AboutDialog dialog = new AboutDialog(this);
|
||||
dialog.Show();
|
||||
|
@ -97,6 +97,7 @@
|
||||
<Compile Include="addons\OtpKeyProv\OtpUtil.cs" />
|
||||
<Compile Include="app\NoFileStorageFoundException.cs" />
|
||||
<Compile Include="app\OtpAuxCacheSupervisor.cs" />
|
||||
<Compile Include="AboutActivity.cs" />
|
||||
<Compile Include="CreateDatabaseActivity.cs" />
|
||||
<Compile Include="CreateNewFilename.cs" />
|
||||
<Compile Include="EntryActivityClasses\CopyToClipboardPopupMenuIcon.cs" />
|
||||
@ -202,7 +203,6 @@
|
||||
<AndroidResource Include="Resources\drawable-mdpi\Thumbs.db" />
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\Thumbs.db" />
|
||||
<AndroidResource Include="Resources\drawable-xxhdpi\Thumbs.db" />
|
||||
<AndroidResource Include="Resources\drawable-hdpi\Thumbs.db" />
|
||||
<None Include="Resources\drawable\launcher.png">
|
||||
<Visible>False</Visible>
|
||||
</None>
|
||||
@ -561,7 +561,6 @@
|
||||
<AndroidResource Include="Resources\drawable-mdpi\navigation_previous_item_dark.png" />
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\navigation_previous_item_dark.png" />
|
||||
<AndroidResource Include="Resources\drawable\device_access_new_account.png" />
|
||||
<AndroidResource Include="Resources\drawable\device_access_new_account_dark.png" />
|
||||
<AndroidResource Include="Resources\drawable\BlueButton.xml" />
|
||||
<AndroidResource Include="Resources\drawable\GreenButton.xml" />
|
||||
<AndroidResource Include="Resources\drawable\btn_new_group.png" />
|
||||
@ -969,4 +968,7 @@
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\xml\searchable_debug.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-hdpi\device_access_new_account_holodark.png" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -70,6 +70,7 @@ namespace keepass2android
|
||||
designPref.PreferenceChange += (sender, args) => Recreate();
|
||||
}
|
||||
|
||||
Util.PrepareNoDonatePreference(this, FindPreference(GetString(Resource.String.NoDonateOption_key)));
|
||||
|
||||
Preference cachingPreference = FindPreference(GetString(Resource.String.UseOfflineCache_key));
|
||||
cachingPreference.PreferenceChange += OnUseOfflineCacheChanged;
|
||||
|
@ -55,6 +55,7 @@ namespace keepass2android
|
||||
// Re-use the change handlers for the application settings
|
||||
FindPreference(GetString(Resource.String.keyfile_key)).PreferenceChange += AppSettingsActivity.OnRememberKeyFileHistoryChanged;
|
||||
FindPreference(GetString(Resource.String.ShowUnlockedNotification_key)).PreferenceChange += AppSettingsActivity.OnShowUnlockedNotificationChanged;
|
||||
Util.PrepareNoDonatePreference(this, FindPreference(GetString(Resource.String.NoDonateOption_key)));
|
||||
Preference designPref = FindPreference(GetString(Resource.String.design_key));
|
||||
if (!_design.HasThemes())
|
||||
{
|
||||
@ -131,6 +132,15 @@ namespace keepass2android
|
||||
pt.Run();
|
||||
};
|
||||
|
||||
Preference changeMaster = FindPreference(GetString(Resource.String.master_pwd_key));
|
||||
if (App.Kp2a.GetDb().CanWrite)
|
||||
{
|
||||
changeMaster.Enabled = true;
|
||||
changeMaster.PreferenceClick += delegate {
|
||||
new SetPasswordDialog(this).Show();
|
||||
};
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
//depending on Android version, we offer to use a transparent icon for QuickUnlock or use the notification priority (since API level 16)
|
||||
|
Loading…
Reference in New Issue
Block a user