mirror of
https://github.com/moparisthebest/keepass2android
synced 2025-02-07 02:10:10 -05:00
Merge branch '1.0.0e'
Conflicts: src/java/JavaFileStorage/app/app.iml src/keepass2android/CreateDatabaseActivity.cs src/keepass2android/Properties/AndroidManifest_net.xml
This commit is contained in:
commit
f5d3aed721
@ -103,15 +103,7 @@ namespace keepass2android
|
|||||||
if (_restoringInstanceState)
|
if (_restoringInstanceState)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string defaulFilename = _keyfileFilename;
|
Util.ShowBrowseDialog(this, RequestCodeKeyFile, false, true);
|
||||||
if (_keyfileFilename == null)
|
|
||||||
{
|
|
||||||
defaulFilename = _keyfileFilename = SdDir + "keyfile.txt";
|
|
||||||
if (defaulFilename.StartsWith("file://") == false)
|
|
||||||
defaulFilename = "file://" + defaulFilename;
|
|
||||||
}
|
|
||||||
|
|
||||||
new FileSelectHelper(this, false, RequestCodeKeyFile).StartFileChooser(defaulFilename);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -193,7 +185,13 @@ namespace keepass2android
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
newKey.AddUserKey(new KcpKeyFile(_keyfileFilename));
|
var ioc = IOConnectionInfo.FromPath(_keyfileFilename);
|
||||||
|
using (var stream = App.Kp2a.GetFileStorage(ioc).OpenFileForRead(ioc))
|
||||||
|
{
|
||||||
|
byte[] keyfileData = Util.StreamToMemoryStream(stream).ToArray();
|
||||||
|
newKey.AddUserKey(new KcpKeyFile(keyfileData, ioc, true));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@ -343,14 +341,38 @@ namespace keepass2android
|
|||||||
{
|
{
|
||||||
if (requestCode == RequestCodeKeyFile)
|
if (requestCode == RequestCodeKeyFile)
|
||||||
{
|
{
|
||||||
string filename = Util.IntentToFilename(data, this);
|
if (data.Data.Scheme == "content")
|
||||||
if (filename != null)
|
|
||||||
{
|
{
|
||||||
|
if ((int)Build.VERSION.SdkInt >= 19)
|
||||||
|
{
|
||||||
|
//try to take persistable permissions
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Kp2aLog.Log("TakePersistableUriPermission");
|
||||||
|
var takeFlags = data.Flags
|
||||||
|
& (ActivityFlags.GrantReadUriPermission
|
||||||
|
| ActivityFlags.GrantWriteUriPermission);
|
||||||
|
this.ContentResolver.TakePersistableUriPermission(data.Data, takeFlags);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Kp2aLog.Log(e.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string filename = Util.IntentToFilename(data, this);
|
||||||
|
if (filename == null)
|
||||||
|
filename = data.DataString;
|
||||||
|
|
||||||
|
|
||||||
_keyfileFilename = ConvertFilenameToIocPath(filename);
|
_keyfileFilename = ConvertFilenameToIocPath(filename);
|
||||||
FindViewById<TextView>(Resource.Id.keyfile_filename).Text = _keyfileFilename;
|
FindViewById<TextView>(Resource.Id.keyfile_filename).Text = _keyfileFilename;
|
||||||
FindViewById(Resource.Id.keyfile_filename).Visibility = ViewStates.Visible;
|
FindViewById(Resource.Id.keyfile_filename).Visibility = ViewStates.Visible;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (requestCode == RequestCodeDbFilename)
|
if (requestCode == RequestCodeDbFilename)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1390,10 +1390,16 @@ namespace keepass2android
|
|||||||
private void PerformLoadDatabaseWithCompositeKey(CompositeKey compositeKey)
|
private void PerformLoadDatabaseWithCompositeKey(CompositeKey compositeKey)
|
||||||
{
|
{
|
||||||
CheckBox cbQuickUnlock = (CheckBox) FindViewById(Resource.Id.enable_quickunlock);
|
CheckBox cbQuickUnlock = (CheckBox) FindViewById(Resource.Id.enable_quickunlock);
|
||||||
|
if (cbQuickUnlock == null)
|
||||||
|
throw new NullPointerException("cpQuickUnlock");
|
||||||
App.Kp2a.SetQuickUnlockEnabled(cbQuickUnlock.Checked);
|
App.Kp2a.SetQuickUnlockEnabled(cbQuickUnlock.Checked);
|
||||||
|
|
||||||
if (App.Kp2a.OfflineMode != _loadDbTaskOffline)
|
if (App.Kp2a.OfflineMode != _loadDbTaskOffline)
|
||||||
{
|
{
|
||||||
|
if (_loadDbTask == null)
|
||||||
|
throw new NullPointerException("_loadDbTask");
|
||||||
|
if (App.Kp2a == null)
|
||||||
|
throw new NullPointerException("App.Kp2a");
|
||||||
//keep the loading result if we loaded in online-mode (now offline) and the task is completed
|
//keep the loading result if we loaded in online-mode (now offline) and the task is completed
|
||||||
if (!App.Kp2a.OfflineMode || !_loadDbTask.IsCompleted)
|
if (!App.Kp2a.OfflineMode || !_loadDbTask.IsCompleted)
|
||||||
{
|
{
|
||||||
@ -1532,11 +1538,11 @@ namespace keepass2android
|
|||||||
|
|
||||||
protected override void OnPause()
|
protected override void OnPause()
|
||||||
{
|
{
|
||||||
base.OnPause();
|
|
||||||
if (_fingerprintDec != null)
|
if (_fingerprintDec != null)
|
||||||
{
|
{
|
||||||
_fingerprintDec.StopListening();
|
_fingerprintDec.StopListening();
|
||||||
}
|
}
|
||||||
|
base.OnPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetPasswordTypeface(TextView textView)
|
private void SetPasswordTypeface(TextView textView)
|
||||||
@ -1607,21 +1613,7 @@ namespace keepass2android
|
|||||||
|
|
||||||
private static MemoryStream StreamToMemoryStream(Stream stream)
|
private static MemoryStream StreamToMemoryStream(Stream stream)
|
||||||
{
|
{
|
||||||
var memoryStream = stream as MemoryStream;
|
return Util.StreamToMemoryStream(stream);
|
||||||
if (memoryStream == null)
|
|
||||||
{
|
|
||||||
// Read the stream into memory
|
|
||||||
int capacity = 4096; // Default initial capacity, if stream can't report it.
|
|
||||||
if (stream.CanSeek)
|
|
||||||
{
|
|
||||||
capacity = (int) stream.Length;
|
|
||||||
}
|
|
||||||
memoryStream = new MemoryStream(capacity);
|
|
||||||
stream.CopyTo(memoryStream);
|
|
||||||
stream.Close();
|
|
||||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
|
||||||
}
|
|
||||||
return memoryStream;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSaveInstanceState(Bundle outState)
|
protected override void OnSaveInstanceState(Bundle outState)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:versionCode="83"
|
android:versionCode="84"
|
||||||
android:versionName="1.01-pre2"
|
android:versionName="1.01-pre2"
|
||||||
package="keepass2android.keepass2android"
|
package="keepass2android.keepass2android"
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
|
@ -361,12 +361,13 @@ namespace keepass2android
|
|||||||
|
|
||||||
protected override void OnPause()
|
protected override void OnPause()
|
||||||
{
|
{
|
||||||
base.OnPause();
|
|
||||||
if (_fingerprintIdentifier != null)
|
if (_fingerprintIdentifier != null)
|
||||||
{
|
{
|
||||||
Kp2aLog.Log("FP: Stop listening");
|
Kp2aLog.Log("FP: Stop listening");
|
||||||
_fingerprintIdentifier.StopListening();
|
_fingerprintIdentifier.StopListening();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base.OnPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDestroy()
|
protected override void OnDestroy()
|
||||||
|
@ -482,6 +482,27 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MemoryStream StreamToMemoryStream(Stream stream)
|
||||||
|
{
|
||||||
|
|
||||||
|
var memoryStream = stream as MemoryStream;
|
||||||
|
if (memoryStream == null)
|
||||||
|
{
|
||||||
|
// Read the stream into memory
|
||||||
|
int capacity = 4096; // Default initial capacity, if stream can't report it.
|
||||||
|
if (stream.CanSeek)
|
||||||
|
{
|
||||||
|
capacity = (int) stream.Length;
|
||||||
|
}
|
||||||
|
memoryStream = new MemoryStream(capacity);
|
||||||
|
stream.CopyTo(memoryStream);
|
||||||
|
stream.Close();
|
||||||
|
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||||
|
}
|
||||||
|
return memoryStream;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user