@@ -289,6 +289,52 @@ namespace keepass2android
|
||||
}
|
||||
}
|
||||
|
||||
void AddBinaryOrAsk(Uri filename)
|
||||
{
|
||||
|
||||
string strItem = GetFileName(filename);
|
||||
if (String.IsNullOrEmpty(strItem))
|
||||
strItem = "attachment.bin";
|
||||
|
||||
if (State.Entry.Binaries.Get(strItem) != null)
|
||||
{
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.SetTitle(GetString(Resource.String.AskOverwriteBinary_title));
|
||||
|
||||
builder.SetMessage(GetString(Resource.String.AskOverwriteBinary));
|
||||
|
||||
builder.SetPositiveButton(GetString(Resource.String.AskOverwriteBinary_yes), (dlgSender, dlgEvt) =>
|
||||
{
|
||||
AddBinary(filename, true);
|
||||
});
|
||||
|
||||
builder.SetNegativeButton(GetString(Resource.String.AskOverwriteBinary_no), (dlgSender, dlgEvt) =>
|
||||
{
|
||||
AddBinary(filename, false);
|
||||
});
|
||||
|
||||
builder.SetNeutralButton(GetString(Android.Resource.String.Cancel),
|
||||
(dlgSender, dlgEvt) => { });
|
||||
|
||||
Dialog dialog = builder.Create();
|
||||
dialog.Show();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
AddBinary(filename, true);
|
||||
}
|
||||
|
||||
protected override void OnResume()
|
||||
{
|
||||
if (_uriToAddOrAsk != null)
|
||||
{
|
||||
AddBinaryOrAsk(_uriToAddOrAsk);
|
||||
_uriToAddOrAsk = null;
|
||||
}
|
||||
base.OnResume();
|
||||
}
|
||||
|
||||
private void CreateNewFromKpEntryTemplate(Database db, PwEntry templateEntry)
|
||||
{
|
||||
var entry = new PwEntry(true, true);
|
||||
@@ -574,41 +620,7 @@ namespace keepass2android
|
||||
return result;
|
||||
}
|
||||
|
||||
void AddBinaryOrAsk(Uri filename)
|
||||
{
|
||||
|
||||
string strItem = GetFileName(filename);
|
||||
if (String.IsNullOrEmpty(strItem))
|
||||
strItem = "attachment.bin";
|
||||
|
||||
if(State.Entry.Binaries.Get(strItem) != null)
|
||||
{
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.SetTitle(GetString(Resource.String.AskOverwriteBinary_title));
|
||||
|
||||
builder.SetMessage(GetString(Resource.String.AskOverwriteBinary));
|
||||
|
||||
builder.SetPositiveButton(GetString(Resource.String.AskOverwriteBinary_yes), (dlgSender, dlgEvt) =>
|
||||
{
|
||||
AddBinary(filename, true);
|
||||
});
|
||||
|
||||
builder.SetNegativeButton(GetString(Resource.String.AskOverwriteBinary_no), (dlgSender, dlgEvt) =>
|
||||
{
|
||||
AddBinary(filename, false);
|
||||
});
|
||||
|
||||
builder.SetNeutralButton(GetString(Android.Resource.String.Cancel),
|
||||
(dlgSender, dlgEvt) => {});
|
||||
|
||||
Dialog dialog = builder.Create();
|
||||
dialog.Show();
|
||||
|
||||
|
||||
} else
|
||||
AddBinary(filename, true);
|
||||
}
|
||||
|
||||
|
||||
void AddBinary(Uri filename, bool overwrite)
|
||||
{
|
||||
string strItem = GetFileName(filename);
|
||||
@@ -762,12 +774,8 @@ namespace keepass2android
|
||||
}
|
||||
uri = Uri.Parse(s);
|
||||
}
|
||||
AddBinaryOrAsk(uri);
|
||||
|
||||
_uriToAddOrAsk = uri; //we can't launch a dialog in onActivityResult, so delay this to onResume
|
||||
}
|
||||
Reload();
|
||||
|
||||
|
||||
break;
|
||||
case Result.Canceled:
|
||||
Reload();
|
||||
@@ -905,6 +913,7 @@ namespace keepass2android
|
||||
|
||||
private string[] _additionalKeys = null;
|
||||
private List<View> _editModeHiddenViews;
|
||||
private Uri _uriToAddOrAsk;
|
||||
|
||||
public string[] AdditionalKeys
|
||||
{
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
<provider android:name="group.pals.android.lib.ui.filechooser.providers.localfile.LocalFileProvider" android:authorities="keepass2android.keepass2android_debug.android-filechooser.localfile" android:exported="false" />
|
||||
<provider android:name="group.pals.android.lib.ui.filechooser.providers.history.HistoryProvider" android:authorities="keepass2android.keepass2android_debug.android-filechooser.history" android:exported="false" />
|
||||
<activity android:name="group.pals.android.lib.ui.filechooser.FileChooserActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:screenOrientation="user" android:theme="@style/Afc.Theme.Light">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GET_CONTENT" />
|
||||
<data android:mimeType="*/*" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.OPENABLE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<service android:name="keepass2android.softkeyboard.KP2AKeyboard" android:permission="android.permission.BIND_INPUT_METHOD">
|
||||
<intent-filter>
|
||||
@@ -123,6 +117,7 @@
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
|
||||
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
|
||||
<uses-permission android:name="keepass2android.keepass2android_debug.permission.KP2aInternalFileBrowsing" />
|
||||
|
||||
@@ -33,12 +33,6 @@
|
||||
<provider android:name="group.pals.android.lib.ui.filechooser.providers.localfile.LocalFileProvider" android:authorities="keepass2android.keepass2android.android-filechooser.localfile" android:exported="false" />
|
||||
<provider android:name="group.pals.android.lib.ui.filechooser.providers.history.HistoryProvider" android:authorities="keepass2android.keepass2android.android-filechooser.history" android:exported="false" />
|
||||
<activity android:name="group.pals.android.lib.ui.filechooser.FileChooserActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:screenOrientation="user" android:theme="@style/Afc.Theme.Light">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GET_CONTENT" />
|
||||
<data android:mimeType="*/*" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.OPENABLE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service android:name="keepass2android.softkeyboard.KP2AKeyboard" android:permission="android.permission.BIND_INPUT_METHOD">
|
||||
@@ -149,6 +143,7 @@
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.USE_CREDENTIALS" android:maxSdkVersion="22" />
|
||||
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" android:maxSdkVersion="22" />
|
||||
<uses-permission android:name="keepass2android.keepass2android.permission.KP2aInternalFileBrowsing" />
|
||||
|
||||
@@ -15,12 +15,6 @@
|
||||
<provider android:name="group.pals.android.lib.ui.filechooser.providers.localfile.LocalFileProvider" android:authorities="keepass2android.keepass2android_nonet.android-filechooser.localfile" android:exported="false" />
|
||||
<provider android:name="group.pals.android.lib.ui.filechooser.providers.history.HistoryProvider" android:authorities="keepass2android.keepass2android_nonet.android-filechooser.history" android:exported="false" />
|
||||
<activity android:name="group.pals.android.lib.ui.filechooser.FileChooserActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:screenOrientation="user" android:theme="@style/Afc.Theme.Light">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GET_CONTENT" />
|
||||
<data android:mimeType="*/*" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.OPENABLE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service android:name="keepass2android.softkeyboard.KP2AKeyboard" android:permission="android.permission.BIND_INPUT_METHOD">
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
|
||||
|
||||
<!-- Preference settings -->
|
||||
<string name="algorithm_key">algorithm</string>
|
||||
<string name="AutoReturnFromQuery_key">AutoReturnFromQuery_key</string>
|
||||
<string name="algorithm_key">algorithm</string>
|
||||
<string name="app_key">app</string>
|
||||
<string name="app_timeout_key">app_timeout_key</string>
|
||||
<string name="show_kill_app_key">show_kill_app_key</string>
|
||||
|
||||
@@ -221,6 +221,8 @@
|
||||
<string name="edit">Edit</string>
|
||||
<string name="rijndael">Rijndael (AES)</string>
|
||||
<string name="root">Root</string>
|
||||
<string name="AutoReturnFromQuery_title">Automatically return from query screen</string>
|
||||
<string name="AutoReturnFromQuery_summary">When looking up an entry for an app or website: automatically return from query screen if there is only one matching entry in the database.</string>
|
||||
|
||||
<string name="KeyDerivFunc">Key derivation function</string>
|
||||
|
||||
|
||||
@@ -402,6 +402,14 @@
|
||||
|
||||
</Preference>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:enabled="true"
|
||||
android:persistent="true"
|
||||
android:summary="@string/AutoReturnFromQuery_summary"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/AutoReturnFromQuery_title"
|
||||
android:key="@string/AutoReturnFromQuery_key" />
|
||||
|
||||
</PreferenceScreen>
|
||||
<PreferenceScreen
|
||||
android:key="@string/QuickUnlock_prefs_key"
|
||||
|
||||
@@ -25,6 +25,7 @@ using Android.Runtime;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Android.Content.PM;
|
||||
using Android.Preferences;
|
||||
using KeePassLib.Utility;
|
||||
|
||||
namespace keepass2android
|
||||
@@ -134,7 +135,7 @@ namespace keepass2android
|
||||
}
|
||||
|
||||
//if there is exactly one match: open the entry
|
||||
if ((Group.Entries.Count() == 1) && autoReturnFromQuery)
|
||||
if ((Group.Entries.Count() == 1) && autoReturnFromQuery && PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean(GetString(Resource.String.AutoReturnFromQuery_key),true))
|
||||
{
|
||||
LaunchActivityForEntry(Group.Entries.Single(),0);
|
||||
return;
|
||||
|
||||
@@ -385,7 +385,16 @@ namespace keepass2android
|
||||
{
|
||||
|
||||
var intent = new Intent(Settings.ActionRequestSetAutofillService);
|
||||
intent.SetData(Android.Net.Uri.Parse("package:" + Context.PackageName));
|
||||
if (((AutofillManager) Activity.GetSystemService(Java.Lang.Class.FromType(typeof(AutofillManager))))
|
||||
.HasEnabledAutofillServices)
|
||||
{
|
||||
intent.SetData(Android.Net.Uri.Parse("package:" + Context.PackageName + "notexisting")); //if we use our package name, the activity won't launch
|
||||
}
|
||||
else
|
||||
{
|
||||
intent.SetData(Android.Net.Uri.Parse("package:" + Context.PackageName));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Context.StartActivity(intent);
|
||||
@@ -401,6 +410,10 @@ namespace keepass2android
|
||||
.Show();
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Kp2aLog.LogUnexpectedError(e);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -527,11 +540,6 @@ namespace keepass2android
|
||||
else
|
||||
{
|
||||
autofillPref.Summary = Activity.GetString(Resource.String.not_enabled);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user