mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-26 03:02:24 -05:00
* added possibility to select another entry or create a new one from the Share-Url-Results activity
* KP2A keyboard: allows to search for the current app * KP2A keyboard: when clicking "select (another) entry", KP2A is started an now closes automatically after selecting an entry
This commit is contained in:
parent
bf139d9059
commit
40286f4f43
@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.18033
|
||||
// Laufzeitversion:4.0.30319.18046
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
|
@ -4,5 +4,6 @@
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
|
@ -11,5 +11,5 @@
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-14
|
||||
target=android-17
|
||||
android.library=true
|
||||
|
Binary file not shown.
@ -26,6 +26,7 @@
|
||||
|
||||
<string name="change_entry">Select another entry</string>
|
||||
<string name="open_entry">Select entry</string>
|
||||
<string name="open_entry_for_app">Search for entry with "%1$s"</string>
|
||||
|
||||
<!-- Labels on soft keys -->
|
||||
<string name="label_go_key">Go</string>
|
||||
|
@ -76,6 +76,8 @@ public class KP2AKeyboard extends InputMethodService implements
|
||||
|
||||
private String mWordSeparators;
|
||||
|
||||
private String mClientPackageName;
|
||||
|
||||
/**
|
||||
* Main initialization of the input method component. Be sure to call to
|
||||
* super class.
|
||||
@ -154,6 +156,8 @@ public class KP2AKeyboard extends InputMethodService implements
|
||||
// Clear shift states.
|
||||
mMetaState = 0;
|
||||
}
|
||||
|
||||
mClientPackageName = attribute.packageName;
|
||||
|
||||
mPredictionOn = false;
|
||||
mCompletionOn = false;
|
||||
@ -466,7 +470,7 @@ public class KP2AKeyboard extends InputMethodService implements
|
||||
if (keepass2android.kbbridge.KeyboardData.entryName == null)
|
||||
{
|
||||
items.add(getString(R.string.open_entry));
|
||||
values.add("");
|
||||
values.add("KP2ASPECIAL_SelectEntryTask");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -474,6 +478,13 @@ public class KP2AKeyboard extends InputMethodService implements
|
||||
items.add(getString(R.string.change_entry));
|
||||
values.add("");
|
||||
}
|
||||
|
||||
if ((mClientPackageName != null) && (mClientPackageName != ""))
|
||||
{
|
||||
items.add(getString(R.string.open_entry_for_app,mClientPackageName));
|
||||
values.add("KP2ASPECIAL_SearchUrlTask");
|
||||
}
|
||||
|
||||
builder.setTitle(title);
|
||||
|
||||
// builder.setMessage("What do you want to type securely?");
|
||||
@ -481,13 +492,21 @@ public class KP2AKeyboard extends InputMethodService implements
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int item) {
|
||||
|
||||
if (item == items.size() - 1) {
|
||||
if (values.get(item).startsWith("KP2ASPECIAL")) {
|
||||
//change entry
|
||||
Intent startKp2aIntent = getPackageManager().getLaunchIntentForPackage(getApplicationContext().getPackageName());
|
||||
//Intent startKp2aIntent = getPackageManager().getLaunchIntentForPackage("keepass2android.keepass2android");
|
||||
if (startKp2aIntent != null)
|
||||
{
|
||||
startKp2aIntent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
startKp2aIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startKp2aIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
String value = values.get(item);
|
||||
String taskName = value.substring("KP2ASPECIAL_".length());
|
||||
startKp2aIntent.putExtra("KP2A_APPTASK", taskName);
|
||||
if (taskName.equals("SearchUrlTask"))
|
||||
{
|
||||
startKp2aIntent.putExtra("UrlToSearch", "androidapp://"+mClientPackageName);
|
||||
}
|
||||
startActivity(startKp2aIntent);
|
||||
Settings.Secure.getString(
|
||||
getContentResolver(),
|
||||
|
@ -4,5 +4,6 @@
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
|
@ -10,6 +10,6 @@
|
||||
# Indicates whether an apk should be generated for each density.
|
||||
split.density=false
|
||||
# Project target.
|
||||
target=android-12
|
||||
target=android-17
|
||||
apk-configurations=
|
||||
android.library=true
|
||||
|
@ -79,7 +79,7 @@ namespace keepass2android
|
||||
protected void setupEditButtons() {
|
||||
View edit = FindViewById(Resource.Id.entry_edit);
|
||||
edit.Click += (sender, e) => {
|
||||
EntryEditActivity.Launch(this, mEntry);
|
||||
EntryEditActivity.Launch(this, mEntry,mAppTask);
|
||||
};
|
||||
}
|
||||
|
||||
@ -159,6 +159,7 @@ namespace keepass2android
|
||||
|
||||
if (closeAfterCreate)
|
||||
{
|
||||
SetResult(KeePass.EXIT_CLOSE_AFTER_TASK_COMPLETE);
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
|
@ -53,20 +53,24 @@ namespace keepass2android
|
||||
get { return App.entryEditActivityState; }
|
||||
}
|
||||
|
||||
public static void Launch(Activity act, PwEntry pw) {
|
||||
public static void Launch(Activity act, PwEntry pw, AppTask appTask) {
|
||||
Intent i = new Intent(act, typeof(EntryEditActivity));
|
||||
|
||||
i.PutExtra(KEY_ENTRY, pw.Uuid.ToHexString());
|
||||
|
||||
appTask.ToIntent(i);
|
||||
|
||||
act.StartActivityForResult(i, 0);
|
||||
}
|
||||
|
||||
public static void Launch(Activity act, PwGroup pw) {
|
||||
public static void Launch(Activity act, PwGroup pw, AppTask appTask) {
|
||||
Intent i = new Intent(act, typeof(EntryEditActivity));
|
||||
|
||||
PwGroup parent = pw;
|
||||
i.PutExtra(KEY_PARENT, parent.Uuid.ToHexString());
|
||||
|
||||
|
||||
appTask.ToIntent(i);
|
||||
|
||||
act.StartActivityForResult(i, 0);
|
||||
}
|
||||
|
||||
@ -170,6 +174,7 @@ namespace keepass2android
|
||||
}
|
||||
}
|
||||
}*/
|
||||
mAppTask.PrepareNewEntry(State.mEntryInDatabase);
|
||||
State.mIsNew = true;
|
||||
State.mEntryModified = true;
|
||||
|
||||
@ -383,7 +388,7 @@ namespace keepass2android
|
||||
ActionOnFinish afterAddEntry = new ActionOnFinish((success, message) =>
|
||||
{
|
||||
if (success)
|
||||
mAppTask.AfterAddNewEntry(this);
|
||||
mAppTask.AfterAddNewEntry(this, newEntry);
|
||||
},closeOrShowError);
|
||||
|
||||
if ( State.mIsNew ) {
|
||||
|
@ -67,6 +67,7 @@ namespace keepass2android
|
||||
if ( g != null ) {
|
||||
i.PutExtra(KEY_ENTRY, g.Uuid.ToHexString());
|
||||
}
|
||||
appTask.ToIntent(i);
|
||||
|
||||
act.StartActivityForResult(i,0);
|
||||
}
|
||||
@ -138,7 +139,7 @@ namespace keepass2android
|
||||
// Add Entry button
|
||||
View addEntry = FindViewById (Resource.Id.add_entry);
|
||||
addEntry.Click += (object sender, EventArgs e) => {
|
||||
EntryEditActivity.Launch (this, mGroup);
|
||||
EntryEditActivity.Launch (this, mGroup, mAppTask);
|
||||
|
||||
};
|
||||
}
|
||||
@ -188,8 +189,9 @@ namespace keepass2android
|
||||
pt.run();
|
||||
break;
|
||||
|
||||
case Result.Canceled:
|
||||
default:
|
||||
case Result.Canceled:
|
||||
default:
|
||||
base.OnActivityResult(requestCode, resultCode, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,19 @@ namespace keepass2android
|
||||
base.OnSaveInstanceState(outState);
|
||||
mAppTask.ToBundle(outState);
|
||||
}
|
||||
|
||||
|
||||
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
|
||||
{
|
||||
base.OnActivityResult(requestCode, resultCode, data);
|
||||
|
||||
if (resultCode == KeePass.EXIT_CLOSE_AFTER_TASK_COMPLETE)
|
||||
{
|
||||
SetResult(KeePass.EXIT_CLOSE_AFTER_TASK_COMPLETE);
|
||||
Finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ISharedPreferences prefs;
|
||||
|
||||
|
@ -42,14 +42,17 @@ namespace keepass2android
|
||||
public const Android.App.Result EXIT_REFRESH_TITLE = Android.App.Result.FirstUser+3;
|
||||
public const Android.App.Result EXIT_FORCE_LOCK = Android.App.Result.FirstUser+4;
|
||||
public const Android.App.Result EXIT_QUICK_UNLOCK = Android.App.Result.FirstUser+5;
|
||||
public const Android.App.Result EXIT_CLOSE_AFTER_SEARCH = Android.App.Result.FirstUser+6;
|
||||
public const Android.App.Result EXIT_CLOSE_AFTER_TASK_COMPLETE = Android.App.Result.FirstUser+6;
|
||||
public const Android.App.Result EXIT_CHANGE_DB = Android.App.Result.FirstUser+7;
|
||||
public const Android.App.Result EXIT_FORCE_LOCK_AND_CHANGE_DB = Android.App.Result.FirstUser+8;
|
||||
public const Android.App.Result EXIT_RELOAD_DB = Android.App.Result.FirstUser+9;
|
||||
|
||||
AppTask mAppTask;
|
||||
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
base.OnCreate (bundle);
|
||||
mAppTask = AppTask.GetTaskInOnCreate(bundle, Intent);
|
||||
Android.Util.Log.Debug("DEBUG","KeePass.OnCreate");
|
||||
}
|
||||
|
||||
@ -161,10 +164,12 @@ namespace keepass2android
|
||||
//Intent intent = new Intent(this, typeof(SearchActivity));
|
||||
//Intent intent = new Intent(this, typeof(QuickUnlock));
|
||||
|
||||
mAppTask.ToIntent(intent);
|
||||
|
||||
|
||||
StartActivityForResult(intent, 0);
|
||||
Finish();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -195,7 +195,7 @@ namespace keepass2android
|
||||
startedWithActivityResult = true;
|
||||
Android.Util.Log.Debug("DEBUG","PasswordActivity.OnActivityResult "+resultCode+"/"+requestCode);
|
||||
|
||||
if (resultCode != KeePass.EXIT_CLOSE_AFTER_SEARCH)
|
||||
if (resultCode != KeePass.EXIT_CLOSE_AFTER_TASK_COMPLETE)
|
||||
{
|
||||
//Stop service when app activity is left
|
||||
StopService(new Intent(this, typeof(CopyToClipboardService)));
|
||||
@ -229,8 +229,8 @@ namespace keepass2android
|
||||
case KeePass.EXIT_CHANGE_DB:
|
||||
lockAndClose();
|
||||
break;
|
||||
case KeePass.EXIT_CLOSE_AFTER_SEARCH:
|
||||
SetResult(KeePass.EXIT_CLOSE_AFTER_SEARCH);
|
||||
case KeePass.EXIT_CLOSE_AFTER_TASK_COMPLETE:
|
||||
SetResult(KeePass.EXIT_CLOSE_AFTER_TASK_COMPLETE);
|
||||
Finish();
|
||||
break;
|
||||
case KeePass.EXIT_QUICK_UNLOCK:
|
||||
|
1547
src/keepass2android/Resources/Resource.designer.cs
generated
1547
src/keepass2android/Resources/Resource.designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
android:id="@+id/top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="horizontal" />
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_bar"
|
||||
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
|
||||
android:id="@+id/select_other_entry"
|
||||
style="@style/BottomBarActionButton"
|
||||
android:layout_width="0dp"
|
||||
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:gravity="center_vertical"
|
||||
android:text="@string/select_other_entry" />
|
||||
</FrameLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/add_url_entry"
|
||||
style="@style/BottomBarActionButton"
|
||||
android:layout_width="0dp"
|
||||
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:gravity="center_vertical"
|
||||
android:text="@string/add_url_entry" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:id="@+id/divider2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_above="@id/bottom_bar"
|
||||
android:background="#b8b8b8" />
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/divider2"
|
||||
android:layout_below="@id/top"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="8dp" />
|
||||
</RelativeLayout>
|
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
android:id="@+id/top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="horizontal" />
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_bar"
|
||||
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
|
||||
android:id="@+id/select_other_entry"
|
||||
style="@style/BottomBarActionButton"
|
||||
android:layout_width="0dp"
|
||||
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:gravity="center_vertical"
|
||||
android:text="@string/select_other_entry" />
|
||||
</FrameLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/add_url_entry"
|
||||
style="@style/BottomBarActionButton"
|
||||
android:layout_width="0dp"
|
||||
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:gravity="center_vertical"
|
||||
android:text="@string/add_url_entry" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:id="@+id/divider2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_above="@id/bottom_bar"
|
||||
android:background="#b8b8b8" />
|
||||
<TextView
|
||||
android:id="@+id/no_results"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/top"
|
||||
android:text="@string/no_results" />
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/divider2"
|
||||
android:layout_below="@id/no_results"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="8dp" />
|
||||
</RelativeLayout>
|
48
src/keepass2android/Resources/layout/searchurlresults.xml
Normal file
48
src/keepass2android/Resources/layout/searchurlresults.xml
Normal file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<keepass2android.view.GroupHeaderView
|
||||
android:id="@+id/group_header"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_bar"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="2dp"
|
||||
style="@style/GroupAndEntryHeader">
|
||||
<Button
|
||||
android:id="@+id/select_other_entry"
|
||||
android:layout_width="0px"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:text="@string/select_other_entry"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/add_url_entry"
|
||||
android:layout_width="0px"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/select_other_entry"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:text="@string/add_url_entry"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/divider2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/bottom_bar"
|
||||
android:scaleType="fitXY"
|
||||
android:tint="@color/blue_highlight"
|
||||
android:src="@android:drawable/divider_horizontal_dark" />
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/divider2"
|
||||
android:layout_below="@id/group_header" />
|
||||
</RelativeLayout>
|
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<keepass2android.view.GroupHeaderView
|
||||
android:id="@+id/group_header"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_bar"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="2dp"
|
||||
style="@style/GroupAndEntryHeader">
|
||||
<Button
|
||||
android:id="@+id/select_other_entry"
|
||||
android:layout_width="0px"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:text="@string/select_other_entry" />
|
||||
<Button
|
||||
android:id="@+id/add_url_entry"
|
||||
android:layout_width="0px"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/select_other_entry"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:text="@string/add_url_entry" />
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/divider2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/bottom_bar"
|
||||
android:scaleType="fitXY"
|
||||
android:tint="@color/blue_highlight"
|
||||
android:src="@android:drawable/divider_horizontal_dark" />
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/divider2"
|
||||
android:layout_below="@id/group_header" />
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@android:id/list"
|
||||
android:text="@string/no_results" />
|
||||
</RelativeLayout>
|
@ -7,6 +7,7 @@
|
||||
<string name="CreditsText">The User Interface is based on a port of KeepassDroid developed by Brian Pellin. Code for database operations is based on KeePass by Dominik Reichl. The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.</string>
|
||||
<string name="accept">Accept</string>
|
||||
<string name="add_entry">Add entry</string>
|
||||
<string name="add_url_entry">Create entry for URL</string>
|
||||
<string name="add_group">Add group</string>
|
||||
<string name="add_group_title">Add Group</string>
|
||||
<string name="algorithm">Algorithm</string>
|
||||
@ -163,6 +164,8 @@
|
||||
<string name="search_hint">Find what</string>
|
||||
<string name="search_results">Search results</string>
|
||||
<string name="search_in">Search in</string>
|
||||
<string name="select_other_entry">Select another entry</string>
|
||||
<string name="select_group_then_add">Open the desired group, then press "%1$s"!</string>
|
||||
<string name="twofish">Twofish</string>
|
||||
<string name="underline">Underline</string>
|
||||
<string name="unsupported_db_version">Unsupported database version.</string>
|
||||
|
@ -61,7 +61,7 @@ namespace keepass2android
|
||||
{
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
||||
SetResult(KeePass.EXIT_CLOSE_AFTER_SEARCH);
|
||||
SetResult(KeePass.EXIT_CLOSE_AFTER_TASK_COMPLETE);
|
||||
|
||||
mDb = App.getDB();
|
||||
|
||||
@ -137,25 +137,41 @@ namespace keepass2android
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//if there is exactly one match: open the entry
|
||||
if (mGroup.Entries.Count() == 1)
|
||||
{
|
||||
LaunchActivityForEntry(mGroup.Entries.Single(),0);
|
||||
return;
|
||||
}
|
||||
|
||||
//show results:
|
||||
if (mGroup == null || (mGroup.Entries.Count() < 1))
|
||||
{
|
||||
SetContentView(new GroupEmptyView(this));
|
||||
//SetContentView(new GroupEmptyView(this));
|
||||
SetContentView(Resource.Layout.searchurlresults_empty);
|
||||
} else
|
||||
{
|
||||
SetContentView(new GroupViewOnlyView(this));
|
||||
SetContentView(Resource.Layout.searchurlresults);
|
||||
//SetContentView(new GroupViewOnlyView(this));
|
||||
}
|
||||
|
||||
setGroupTitle();
|
||||
|
||||
ListAdapter = new PwGroupListAdapter(this, mGroup);
|
||||
|
||||
//if there is exactly one match: open the entry
|
||||
if (mGroup.Entries.Count() == 1)
|
||||
{
|
||||
LaunchActivityForEntry(mGroup.Entries.Single(),0);
|
||||
}
|
||||
View selectOtherEntry = FindViewById (Resource.Id.select_other_entry);
|
||||
selectOtherEntry.Click += (object sender, EventArgs e) => {
|
||||
GroupActivity.Launch (this, new SelectEntryTask());
|
||||
};
|
||||
|
||||
|
||||
View createUrlEntry = FindViewById (Resource.Id.add_url_entry);
|
||||
createUrlEntry.Click += (object sender, EventArgs e) => {
|
||||
GroupActivity.Launch (this, new CreateEntryThenCloseTask() { Url = url } );
|
||||
Toast.MakeText(this, GetString(Resource.String.select_group_then_add, new Java.Lang.Object[]{GetString(Resource.String.add_entry)}), ToastLength.Long ).Show();
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
private String getSearchUrl(Intent queryIntent) {
|
||||
|
@ -44,8 +44,23 @@ namespace keepass2android
|
||||
|
||||
public static void gotoUrl(Context context, String url) {
|
||||
if ( url != null && url.Length > 0 ) {
|
||||
Android.Net.Uri uri = Android.Net.Uri.Parse(url);
|
||||
context.StartActivity(new Intent(Intent.ActionView, uri));
|
||||
|
||||
if (url.StartsWith("androidapp://"))
|
||||
{
|
||||
string packageName = url.Substring("androidapp://".Length);
|
||||
Intent startKp2aIntent = context.PackageManager.GetLaunchIntentForPackage(packageName);
|
||||
if (startKp2aIntent != null)
|
||||
{
|
||||
startKp2aIntent.AddCategory(Intent.CategoryLauncher);
|
||||
startKp2aIntent.AddFlags(ActivityFlags.NewTask);
|
||||
context.StartActivity(startKp2aIntent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Android.Net.Uri uri = Android.Net.Uri.Parse(url);
|
||||
context.StartActivity(new Intent(Intent.ActionView, uri));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,8 @@ using Android.App;
|
||||
using Android.Content;
|
||||
using Android.OS;
|
||||
using System.Collections.Generic;
|
||||
using KeePassLib;
|
||||
using KeePassLib.Security;
|
||||
|
||||
namespace keepass2android
|
||||
{
|
||||
@ -88,7 +90,7 @@ namespace keepass2android
|
||||
GroupActivity.Launch(act, this);
|
||||
}
|
||||
|
||||
public virtual void AfterAddNewEntry(EntryEditActivity entryEditActivity)
|
||||
public virtual void AfterAddNewEntry(EntryEditActivity entryEditActivity, PwEntry newEntry)
|
||||
{
|
||||
}
|
||||
|
||||
@ -97,6 +99,12 @@ namespace keepass2android
|
||||
get { return false;}
|
||||
}
|
||||
|
||||
|
||||
public virtual void PrepareNewEntry(PwEntry newEntry)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public const String AppTask_key = "KP2A_APPTASK";
|
||||
|
||||
/// <summary>
|
||||
@ -105,14 +113,17 @@ namespace keepass2android
|
||||
/// </summary>
|
||||
public static AppTask GetTaskInOnCreate(Bundle savedInstanceState, Intent intent)
|
||||
{
|
||||
AppTask task;
|
||||
if (savedInstanceState != null)
|
||||
{
|
||||
return AppTask.CreateFromBundle(savedInstanceState);
|
||||
task = AppTask.CreateFromBundle(savedInstanceState);
|
||||
}
|
||||
else
|
||||
{
|
||||
return AppTask.CreateFromIntent(intent);
|
||||
task = AppTask.CreateFromIntent(intent);
|
||||
}
|
||||
Android.Util.Log.Debug("DEBUG", "Loaded task " + task.ToString());
|
||||
return task;
|
||||
}
|
||||
|
||||
public static AppTask CreateFromIntent(Intent i)
|
||||
@ -125,24 +136,23 @@ namespace keepass2android
|
||||
if (b == null)
|
||||
return new NullTask();
|
||||
|
||||
string taskType = b.GetString("KP2A_APP_TASK_TYPE");
|
||||
string taskType = b.GetString(AppTask_key);
|
||||
|
||||
if (string.IsNullOrEmpty(taskType))
|
||||
return new NullTask();
|
||||
|
||||
Type[] types = {typeof(SearchUrlTask), typeof(NullTask)};
|
||||
|
||||
foreach (Type type in types)
|
||||
try
|
||||
{
|
||||
if (taskType == type.Name)
|
||||
{
|
||||
AppTask task = (AppTask)Activator.CreateInstance(type);
|
||||
task.Setup(b);
|
||||
return task;
|
||||
}
|
||||
AppTask task = (AppTask)Activator.CreateInstance(Type.GetType("keepass2android."+taskType));
|
||||
task.Setup(b);
|
||||
return task;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Android.Util.Log.Debug("DEBUG", "Cannot convert " + taskType + " in task: " + e.ToString());
|
||||
return new NullTask();
|
||||
}
|
||||
|
||||
return new NullTask();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -177,7 +187,7 @@ namespace keepass2android
|
||||
/// </summary>
|
||||
static IExtra GetTypeExtra(Type type)
|
||||
{
|
||||
return new StringExtra() { Key="KP2A_APP_TASK_TYPE", Value=type.Name};
|
||||
return new StringExtra() { Key=AppTask_key, Value=type.Name};
|
||||
}
|
||||
|
||||
}
|
||||
@ -264,6 +274,21 @@ namespace keepass2android
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void PrepareNewEntry(PwEntry newEntry)
|
||||
{
|
||||
newEntry.Strings.Set(PwDefs.UrlField, new ProtectedString(false, Url));
|
||||
|
||||
}
|
||||
|
||||
public override void AfterAddNewEntry(EntryEditActivity entryEditActivity, PwEntry newEntry)
|
||||
{
|
||||
EntryActivity.Launch(entryEditActivity, newEntry, -1, new SelectEntryTask());
|
||||
entryEditActivity.SetResult(KeePass.EXIT_CLOSE_AFTER_TASK_COMPLETE);
|
||||
//no need to call Finish here, that's done in EntryEditActivity ("closeOrShowError")
|
||||
}
|
||||
|
||||
public override bool CloseEntryActivityAfterCreate
|
||||
{
|
||||
//if the user selects an entry before creating the new one, we're not closing the app
|
||||
|
@ -204,7 +204,7 @@ namespace keepass2android
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
||||
Android.Util.Log.Debug("DEBUG", "FileSelect.OnCreate");
|
||||
Android.Util.Log.Debug("DEBUG", "FileSelect:apptask="+Intent.GetStringExtra("KP2A_APP_TASK_TYPE"));
|
||||
Android.Util.Log.Debug("DEBUG", "FileSelect:apptask="+Intent.GetStringExtra("KP2A_APPTASK"));
|
||||
|
||||
if (Intent.Action == Intent.ActionSend)
|
||||
{
|
||||
@ -427,7 +427,7 @@ namespace keepass2android
|
||||
|
||||
createdWithActivityResult = true;
|
||||
|
||||
if (resultCode == KeePass.EXIT_CLOSE_AFTER_SEARCH)
|
||||
if (resultCode == KeePass.EXIT_CLOSE_AFTER_TASK_COMPLETE)
|
||||
{
|
||||
Finish();
|
||||
return;
|
||||
|
@ -34,6 +34,7 @@
|
||||
<Command type="BeforeBuild" command="UseManifestNet.bat" />
|
||||
</CustomCommands>
|
||||
</CustomCommands>
|
||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
@ -644,6 +645,10 @@
|
||||
<AndroidResource Include="Resources\anim\anim_leave.xml" />
|
||||
<AndroidResource Include="Resources\anim\anim_enter_back.xml" />
|
||||
<AndroidResource Include="Resources\anim\anim_leave_back.xml" />
|
||||
<AndroidResource Include="Resources\layout\searchurlresults.xml" />
|
||||
<AndroidResource Include="Resources\layout\searchurlresults_empty.xml" />
|
||||
<AndroidResource Include="Resources\layout-v14\searchurlresults.xml" />
|
||||
<AndroidResource Include="Resources\layout-v14\searchurlresults_empty.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
@ -37,7 +37,6 @@ namespace keepass2android.search
|
||||
{
|
||||
private Database mDb;
|
||||
|
||||
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
base.OnCreate (bundle);
|
||||
|
Loading…
Reference in New Issue
Block a user