* show toast for cache messages in the center of the screen to avoid hiding the keyboard when entering passwords

* Bug fix with FTP access
* Bug fix with Group editing/adding
* Integrated Input Language Selection for keyboard
-> 0.9.3-r3
This commit is contained in:
Philipp Crocoll 2014-02-19 21:49:18 +01:00
parent ccde65d233
commit 736bbd5ec3
16 changed files with 133 additions and 47 deletions

View File

@ -20,7 +20,7 @@
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;INCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE;INCLUDE_KEYTRANSFORM</DefineConstants>
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE;EXCLUDE_KEYTRANSFORM</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>

View File

@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.34003
// Laufzeitversion:4.0.30319.34011
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.

View File

@ -362,22 +362,56 @@ namespace KeePassLib.Serialization
public override void Close()
{
base.Close();
RepeatWithDigestOnFail(ioc, req =>
WebRequest testReq = WebRequest.Create(ioc.Path);
if (testReq is HttpWebRequest)
{
req.Headers.Add("Translate: f");
if (method != null)
req.Method = method;
var data = this.ToArray();
using (Stream s = req.GetRequestStream())
RepeatWithDigestOnFail(ioc, req =>
{
s.Write(data, 0, data.Length);
req.GetResponse();
s.Close();
req.Headers.Add("Translate: f");
if (method != null)
req.Method = method;
var data = this.ToArray();
using (Stream s = req.GetRequestStream())
{
s.Write(data, 0, data.Length);
req.GetResponse();
s.Close();
}
});
}
else
{
try
{
uploadData(IOConnection.CreateWebClient(ioc, false));
}
});
catch (WebException ex)
{
//todo: does this make sense for FTP at all? Remove?
if ((ex.Response is HttpWebResponse) && (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.Unauthorized))
uploadData(IOConnection.CreateWebClient(ioc, true));
else
throw;
}
}
}
void uploadData(WebClient webClient)
{
if (method != null)
{
webClient.UploadData(destinationFilePath, method, this.ToArray());
}
else
{
webClient.UploadData(destinationFilePath, this.ToArray());
}
}

View File

@ -20,7 +20,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;INCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE;INCLUDE_KEYTRANSFORM</DefineConstants>
<DefineConstants>TRACE;DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE;EXCLUDE_KEYTRANSFORM</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

View File

@ -18,15 +18,15 @@ namespace Kp2aUnitTests
{
TestRunner runner = new TestRunner();
// Run all tests from this assembly
//runner.AddTests(Assembly.GetExecutingAssembly());
runner.AddTests(Assembly.GetExecutingAssembly());
//runner.AddTests(new List<Type> { typeof(TestSynchronizeCachedDatabase)});
//runner.AddTests(typeof(TestLoadDb).GetMethod("LoadErrorWithCertificateTrustFailure"));
//runner.AddTests(typeof(TestLoadDb).GetMethod("LoadWithAcceptedCertificateTrustFailure"));
runner.AddTests(new List<Type> { typeof(TestLoadDb) });
//runner.AddTests(new List<Type> { typeof(TestLoadDb) });
//runner.AddTests(new List<Type> { typeof(TestCachingFileStorage) });
//runner.AddTests(typeof(TestLoadDb).GetMethod("TestLoadKdb1"));
//runner.AddTests(typeof(TestLoadDb).GetMethod("TestLoadWithKeyfileOnly"));
//runner.AddTests(typeof(TestLoadDb).GetMethod("LoadAndSaveFromRemote1And1Ftp"));
//runner.AddTests(typeof(TestLoadDb).GetMethod("TestLoadKdbpWithPasswordOnly"));
//runner.AddTests(typeof(TestSaveDb).GetMethod("TestLoadKdbxAndSaveKdbp_TestIdenticalFiles"));
return runner;

View File

@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.34003
// Laufzeitversion:4.0.30319.34011
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.

View File

@ -200,6 +200,32 @@ namespace Kp2aUnitTests
}
[TestMethod]
public void LoadAndSaveFromRemote1And1Ftp()
{
var ioc = RemoteIoc1and1Ftp; //note: this property is defined in "TestLoadDbCredentials.cs" which is deliberately excluded from Git because the credentials are not public!
var app = new TestKp2aApp();
app.CreateNewDatabase();
bool loadSuccesful = false;
LoadDb task = new LoadDb(app, ioc, null, CreateKey("test"), null, new ActionOnFinish((success, message) =>
{
if (!success)
Android.Util.Log.Debug("KP2ATest", "error loading db: " + message);
loadSuccesful = success;
})
);
ProgressTask pt = new ProgressTask(app, Application.Context, task);
Android.Util.Log.Debug("KP2ATest", "Running ProgressTask");
pt.Run();
pt.JoinWorkerThread();
Android.Util.Log.Debug("KP2ATest", "PT.run finished");
Assert.IsTrue(loadSuccesful, "didn't succesfully load database :-(");
Assert.IsTrue(TrySaveDatabase(app), "didn't successfully save database.");
}
[TestMethod]
public void LoadFromRemote1And1NonExisting()

View File

@ -53,6 +53,13 @@
android:persistent="true"
android:defaultValue="true"
/>
<PreferenceScreen
android:title="@string/language_selection_title"
android:summary="@string/language_selection_summary">
<intent
android:action="keepass2android.softkeyboard.INPUT_LANGUAGE_SELECTION"/>
</PreferenceScreen>
<PreferenceCategory

View File

@ -112,24 +112,20 @@ public class InputLanguageSelection extends PreferenceActivity {
conf.locale = locale;
res.updateConfiguration(conf, res.getDisplayMetrics());
int[] dictionaries = KP2AKeyboard.getDictionary(res, ctx);
BinaryDictionary bd = new BinaryDictionary(this, dictionaries, Suggest.DIC_MAIN);
// Is the dictionary larger than a placeholder? Arbitrarily chose a lower limit of
// 4000-5000 words, whereas the LARGE_DICTIONARY is about 20000+ words.
if (bd.getSize() > Suggest.LARGE_DICTIONARY_THRESHOLD / 4) {
haveDictionary = true;
//somewhat a hack. But simply querying the dictionary will always return an English
//dictionary in KP2A so if we get a dict, we wouldn't know if it's language specific
if (locale.getLanguage().equals("en"))
{
haveDictionary = true;
}
else
{
BinaryDictionary plug = PluginManager.getDictionary(getApplicationContext(), locale.getLanguage());
if (plug != null) {
bd.close();
bd = plug;
haveDictionary = true;
plug.close();
haveDictionary = true;
}
}
bd.close();
conf.locale = saveLocale;
res.updateConfiguration(conf, res.getDisplayMetrics());
return haveDictionary;

View File

@ -145,7 +145,8 @@ namespace keepass2android
protected override void OnResume()
{
base.OnResume();
_design.ReapplyTheme();
//DON'T: _design.ReapplyTheme();
// (This causes endless loop creating/recreating. More correct: ReapplyDialogTheme (which doesn't exist) Not required anyways...)
}
}
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="36" android:versionName="0.9.3-pre3" package="keepass2android.keepass2android" android:installLocation="auto">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="39" android:versionName="0.9.3-release-3" package="keepass2android.keepass2android" android:installLocation="auto">
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
<permission android:description="@string/permission_desc" android:icon="@drawable/ic_launcher" android:label="KP2A internal file browsing" android:name="keepass2android.keepass2android.permission.KP2aInternalFileBrowsing" android:protectionLevel="signature" />
<application android:label="keepass2android" android:icon="@drawable/ic_launcher">
@ -44,6 +44,15 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="keepass2android.softkeyboard.InputLanguageSelection"
android:label="@string/language_selection_title">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="keepass2android.softkeyboard.INPUT_LANGUAGE_SELECTION"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:configChanges="keyboardHidden|orientation" android:label="@string/app_name" android:theme="@style/Base" android:name="keepass2android.PasswordActivity">
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />

View File

@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.34003
// Laufzeitversion:4.0.30319.34011
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
@ -6384,6 +6384,9 @@ namespace keepass2android
// aapt resource value: 0x7f0e00c3
public const int BaseLight = 2131624131;
// aapt resource value: 0x7f0e00c5
public const int BaseLight_Dialog = 2131624133;
// aapt resource value: 0x7f0e00b5
public const int BottomBarActionButton = 2131624117;
@ -6393,8 +6396,8 @@ namespace keepass2android
// aapt resource value: 0x7f0e00c1
public const int DialogDark = 2131624129;
// aapt resource value: 0x7f0e00c5
public const int DialogLight = 2131624133;
// aapt resource value: 0x7f0e00c6
public const int DialogLight = 2131624134;
// aapt resource value: 0x7f0e00b1
public const int EditEntryButton = 2131624113;
@ -6648,8 +6651,8 @@ namespace keepass2android
// aapt resource value: 0x7f0e00c2
public const int ThemeDark = 2131624130;
// aapt resource value: 0x7f0e00c6
public const int ThemeLight = 2131624134;
// aapt resource value: 0x7f0e00c7
public const int ThemeLight = 2131624135;
// aapt resource value: 0x7f0e00a8
public const int WhiteOnBlack = 2131624104;

View File

@ -35,7 +35,11 @@
</style>
<style name="NoTitleBarLight" parent="BaseLight">
</style>
<style name="DialogLight" parent="BaseLight"></style>
<style name="BaseLight_Dialog" parent="android:Theme.Holo.Light.Dialog" />
<style name="DialogLight" parent="BaseLight_Dialog"></style>
<style name="ThemeLight" parent="BaseLight"></style>
<!-- "default" for Preference activity etc.:-->

View File

@ -27,13 +27,17 @@ namespace keepass2android
public void ReapplyTheme()
{
int newTheme = UseDarkTheme ? Resource.Style.ThemeDark : Resource.Style.ThemeLight;
if (newTheme != _currentThemeId)
if (HasThemes())
{
Kp2aLog.Log("recreating due to theme change.");
_activity.Recreate();
int newTheme = UseDarkTheme ? Resource.Style.ThemeDark : Resource.Style.ThemeLight;
if (newTheme != _currentThemeId)
{
Kp2aLog.Log("recreating due to theme change.");
_activity.Recreate();
}
}
}
private bool UseDarkTheme

View File

@ -24,6 +24,7 @@ using Android.Content;
using Android.Graphics.Drawables;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using KeePassLib;
using KeePassLib.Cryptography.Cipher;
@ -517,7 +518,10 @@ namespace keepass2android
internal void ShowToast(string message)
{
var handler = new Handler(Looper.MainLooper);
handler.Post(() => { Toast.MakeText(Application.Context, message, ToastLength.Long).Show(); });
handler.Post(() => { var toast = Toast.MakeText(Application.Context, message, ToastLength.Long);
toast.SetGravity(GravityFlags.Center, 0, 0);
toast.Show();
});
}
public void CouldntSaveToRemote(IOConnectionInfo ioc, Exception e)

View File

@ -30,7 +30,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE;EXCLUDE_KEYTRANSFORM</DefineConstants>
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE;EXCLUDE_KEYTRANSFORM</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
@ -576,8 +576,6 @@
<AndroidResource Include="Resources\values-ko\strings.xml" />
<AndroidResource Include="Resources\values-no\strings.xml" />
<AndroidResource Include="Resources\values-pt-rPT\strings.xml" />
<AndroidResource Include="Resources\values-iw\strings.xml" />
<AndroidResource Include="Resources\values-ko\strings.xml" />
<AndroidResource Include="Resources\values-ro\strings.xml" />
<AndroidResource Include="Resources\values-sl\strings.xml" />
<AndroidResource Include="Resources\values-sr\strings.xml" />