Minor UI bug fixes

This commit is contained in:
Philipp Crocoll 2013-11-25 21:06:37 +01:00
parent f2e2a2045c
commit 08093531e9
6 changed files with 553 additions and 534 deletions

View File

@ -67,7 +67,6 @@ namespace keepass2android
private void OnItemSelected(string protocolId) private void OnItemSelected(string protocolId)
{ {
ReturnProtocol(protocolId); ReturnProtocol(protocolId);
} }
private void ReturnProtocol(string protocolId) private void ReturnProtocol(string protocolId)

View File

@ -562,7 +562,8 @@ namespace keepass2android
_keyFileOrProvider = null; _keyFileOrProvider = null;
break; break;
case 1: case 1:
_keyFileOrProvider = ""; //don't set to "" to prevent losing the filename. (ItemSelected is also called during recreation!)
_keyFileOrProvider = FindViewById<EditText>(Resource.Id.pass_keyfile).Text;
break; break;
case 2: case 2:
_keyFileOrProvider = KeyProviderIdOtp; _keyFileOrProvider = KeyProviderIdOtp;
@ -683,9 +684,8 @@ namespace keepass2android
//no need to check for validity of password because if this method is called, the Ok button was enabled (i.e. there was a valid password) //no need to check for validity of password because if this method is called, the Ok button was enabled (i.e. there was a valid password)
CompositeKey compositeKey = new CompositeKey(); CompositeKey compositeKey = new CompositeKey();
compositeKey.AddUserKey(new KcpPassword(_password)); compositeKey.AddUserKey(new KcpPassword(_password));
if (KeyProviderType == KeyProviders.KeyFile) if ((KeyProviderType == KeyProviders.KeyFile) && (_keyFileOrProvider != ""))
{ {
try try
{ {
compositeKey.AddUserKey(new KcpKeyFile(_keyFileOrProvider)); compositeKey.AddUserKey(new KcpKeyFile(_keyFileOrProvider));
@ -970,6 +970,8 @@ namespace keepass2android
MakePasswordMaskedOrVisible(); MakePasswordMaskedOrVisible();
UpdateOkButtonState();
// OnResume is run every time the activity comes to the foreground. This code should only run when the activity is started (OnStart), but must // OnResume is run every time the activity comes to the foreground. This code should only run when the activity is started (OnStart), but must
// be run in OnResume rather than OnStart so that it always occurrs after OnActivityResult (when re-creating a killed activity, OnStart occurs before OnActivityResult) // be run in OnResume rather than OnStart so that it always occurrs after OnActivityResult (when re-creating a killed activity, OnStart occurs before OnActivityResult)
if (_starting && !IsFinishing) //use !IsFinishing to make sure we're not starting another activity when we're already finishing (e.g. due to TaskComplete in OnActivityResult) if (_starting && !IsFinishing) //use !IsFinishing to make sure we're not starting another activity when we're already finishing (e.g. due to TaskComplete in OnActivityResult)
@ -1007,7 +1009,10 @@ namespace keepass2android
private String GetKeyFile(String filename) { private String GetKeyFile(String filename) {
if ( _rememberKeyfile ) { if ( _rememberKeyfile ) {
return App.Kp2a.FileDbHelper.GetKeyFileForFile(filename); string keyfile = App.Kp2a.FileDbHelper.GetKeyFileForFile(filename);
if (keyfile == "")
return null; //signal no key file
return keyfile;
} else { } else {
return null; return null;
} }

File diff suppressed because it is too large Load Diff

View File

@ -58,6 +58,7 @@
android:id="@+id/no_results" android:id="@+id/no_results"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="12dp"
android:layout_below="@id/top" android:layout_below="@id/top"
android:text="@string/no_results" /> android:text="@string/no_results" />
<ListView <ListView

View File

@ -238,6 +238,13 @@ namespace keepass2android
Kp2aLog.Log("AppTask " +task+" in OnActivityResult"); Kp2aLog.Log("AppTask " +task+" in OnActivityResult");
return true; return true;
} }
protected void RemoveTaskFromIntent(Activity act)
{
if (act.Intent != null)
act.Intent.RemoveExtra(AppTaskKey);
}
} }
/// <summary> /// <summary>
@ -275,7 +282,10 @@ namespace keepass2android
public override void AfterUnlockDatabase(PasswordActivity act) public override void AfterUnlockDatabase(PasswordActivity act)
{ {
ShareUrlResults.Launch(act, this); ShareUrlResults.Launch(act, this);
RemoveTaskFromIntent(act);
act.AppTask = new NullTask();
} }
public override bool CloseEntryActivityAfterCreate public override bool CloseEntryActivityAfterCreate
{ {
get { return true;} get { return true;}

View File

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