Add groupname in entry view

This commit is contained in:
Jareth Lomson 2014-05-26 12:09:41 +02:00
parent 96b5aba684
commit 917dc585b0
4 changed files with 1477 additions and 1430 deletions

View File

@ -50,6 +50,7 @@ namespace keepass2android
public const String KeyEntry = "entry"; public const String KeyEntry = "entry";
public const String KeyRefreshPos = "refresh_pos"; public const String KeyRefreshPos = "refresh_pos";
public const String KeyCloseAfterCreate = "close_after_create"; public const String KeyCloseAfterCreate = "close_after_create";
public const String KeyGroupFullPath = "groupfullpath_key";
public static void Launch(Activity act, PwEntry pw, int pos, AppTask appTask, ActivityFlags? flags = null) public static void Launch(Activity act, PwEntry pw, int pos, AppTask appTask, ActivityFlags? flags = null)
{ {
@ -669,14 +670,20 @@ namespace keepass2android
ActionBar.Title = Entry.Strings.ReadSafe(PwDefs.TitleField); ActionBar.Title = Entry.Strings.ReadSafe(PwDefs.TitleField);
ActionBar.SetDisplayHomeAsUpEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true);
PopulateGroupText (Resource.Id.entry_group_name, Resource.Id.entryfield_group_container, KeyGroupFullPath);
PopulateStandardText(Resource.Id.entry_user_name, Resource.Id.entryfield_container_username, PwDefs.UserNameField); PopulateStandardText(Resource.Id.entry_user_name, Resource.Id.entryfield_container_username, PwDefs.UserNameField);
PopulateStandardText(Resource.Id.entry_url, Resource.Id.entryfield_container_url, PwDefs.UrlField); PopulateStandardText(Resource.Id.entry_url, Resource.Id.entryfield_container_url, PwDefs.UrlField);
PopulateStandardText(Resource.Id.entry_password, Resource.Id.entryfield_container_password, PwDefs.PasswordField); PopulateStandardText(Resource.Id.entry_password, Resource.Id.entryfield_container_password, PwDefs.PasswordField);
RegisterProtectedTextView(FindViewById<TextView>(Resource.Id.entry_password)); RegisterProtectedTextView(FindViewById<TextView>(Resource.Id.entry_password));
SetPasswordTypeface(FindViewById<TextView>(Resource.Id.entry_password)); SetPasswordTypeface(FindViewById<TextView>(Resource.Id.entry_password));
RegisterTextPopup(FindViewById<RelativeLayout> (Resource.Id.groupname_container),
FindViewById (Resource.Id.entry_group_name), KeyGroupFullPath);
RegisterTextPopup(FindViewById<RelativeLayout>(Resource.Id.username_container), RegisterTextPopup(FindViewById<RelativeLayout>(Resource.Id.username_container),
FindViewById(Resource.Id.username_vdots), PwDefs.UserNameField); FindViewById(Resource.Id.username_vdots), PwDefs.UserNameField);
RegisterTextPopup(FindViewById<RelativeLayout>(Resource.Id.url_container), RegisterTextPopup(FindViewById<RelativeLayout>(Resource.Id.url_container),
FindViewById(Resource.Id.url_vdots), PwDefs.UrlField) FindViewById(Resource.Id.url_vdots), PwDefs.UrlField)
.Add(new GotoUrlMenuItem(this)); .Add(new GotoUrlMenuItem(this));
@ -796,6 +803,12 @@ namespace keepass2android
_stringViews.Add(key, new StandardStringView(viewId, containerViewId, this)); _stringViews.Add(key, new StandardStringView(viewId, containerViewId, this));
} }
private void PopulateGroupText(int viewId, int containerViewId, String key)
{
PopulateText(viewId, containerViewId, Entry.ParentGroup.GetFullPath());
_stringViews.Add (key, new StandardStringView (viewId, containerViewId, this));
}
private void RequiresRefresh() private void RequiresRefresh()
{ {
Intent ret = new Intent(); Intent ret = new Intent();

File diff suppressed because it is too large Load Diff

View File

@ -1,261 +1,276 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/entry_table" android:id="@+id/entry_table"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:id="@+id/entryfield_group_container"
<LinearLayout android:id="@+id/entryfield_container_username" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:layout_width="fill_parent" android:orientation="vertical">
android:orientation="vertical"> <!-- Group -->
<TextView
<TextView android:id="@+id/entry_group_name_label"
android:id="@+id/entry_user_name_label" android:layout_width="fill_parent"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:text="@string/entry_group_name"
android:text="@string/entry_user_name" style="@style/EntryFieldHeader" />
<RelativeLayout
style="@style/EntryFieldHeader" android:id="@+id/groupname_container"
/> android:layout_height="wrap_content"
android:layout_width="fill_parent"
<!-- Username --> android:orientation="horizontal"
<RelativeLayout android:id="@+id/username_container" android:clickable="true"
android:layout_height="wrap_content" android:background="?android:attr/selectableItemBackground">
android:layout_width="fill_parent" <ImageView
android:orientation="horizontal" android:id="@+id/group_name_vdots"
android:clickable="true" android:layout_width="wrap_content"
android:background="?android:attr/selectableItemBackground"> android:layout_height="15dp"
android:src="@drawable/vdots"
android:gravity="right|bottom"
<ImageView android:layout_alignParentRight="true" />
android:id="@+id/username_vdots" <TextView
android:layout_width="wrap_content" android:id="@+id/entry_group_name"
android:layout_height="15dp" android:layout_width="fill_parent"
android:src="@drawable/vdots" android:layout_height="wrap_content"
android:gravity="right|bottom" android:layout_toLeftOf="@id/group_name_vdots"
android:layout_alignParentRight="true" style="@style/EntryItem" />
/> </RelativeLayout>
<TextView </LinearLayout>
android:id="@+id/entry_user_name" <LinearLayout
android:layout_width="fill_parent" android:id="@+id/entryfield_container_username"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toLeftOf="@id/username_vdots" android:layout_width="fill_parent"
style="@style/EntryItem" /> android:orientation="vertical">
</RelativeLayout> <TextView
</LinearLayout> android:id="@+id/entry_user_name_label"
android:layout_width="fill_parent"
<LinearLayout android:id="@+id/entryfield_container_url" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:text="@string/entry_user_name"
android:layout_width="fill_parent" style="@style/EntryFieldHeader" />
android:orientation="vertical"> <!-- Username -->
<RelativeLayout
<!-- URL --> android:id="@+id/username_container"
<TextView android:layout_height="wrap_content"
android:id="@+id/entry_url_label" android:layout_width="fill_parent"
android:layout_width="fill_parent" android:orientation="horizontal"
android:layout_height="wrap_content" android:clickable="true"
android:text="@string/entry_url" android:background="?android:attr/selectableItemBackground">
style="@style/EntryFieldHeader" <ImageView
/> android:id="@+id/username_vdots"
<RelativeLayout android:id="@+id/url_container" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="15dp"
android:layout_width="fill_parent" android:src="@drawable/vdots"
android:orientation="horizontal" android:gravity="right|bottom"
android:clickable="true" android:layout_alignParentRight="true" />
android:background="?android:attr/selectableItemBackground"> <TextView
<ImageView android:id="@+id/entry_user_name"
android:id="@+id/url_vdots" android:layout_width="fill_parent"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="15dp" android:layout_toLeftOf="@id/username_vdots"
android:src="@drawable/vdots" style="@style/EntryItem" />
android:gravity="right|bottom" </RelativeLayout>
android:layout_alignParentRight="true" </LinearLayout>
/> <LinearLayout
<TextView android:id="@+id/entryfield_container_url"
android:id="@+id/entry_url" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="vertical">
android:autoLink="all" <!-- URL -->
android:layout_toLeftOf="@id/url_vdots" <TextView
style="@style/EntryItem" /> android:id="@+id/entry_url_label"
</RelativeLayout> android:layout_width="fill_parent"
</LinearLayout> android:layout_height="wrap_content"
<LinearLayout android:id="@+id/entryfield_container_password" android:text="@string/entry_url"
android:layout_height="wrap_content" style="@style/EntryFieldHeader" />
android:layout_width="fill_parent" <RelativeLayout
android:orientation="vertical"> android:id="@+id/url_container"
android:layout_height="wrap_content"
<!-- Password --> android:layout_width="fill_parent"
<TextView android:orientation="horizontal"
android:id="@+id/entry_password_label" android:clickable="true"
android:layout_width="fill_parent" android:background="?android:attr/selectableItemBackground">
android:layout_height="wrap_content" <ImageView
android:text="@string/entry_password" android:id="@+id/url_vdots"
style="@style/EntryFieldHeader" android:layout_width="wrap_content"
/> android:layout_height="15dp"
<RelativeLayout android:id="@+id/password_container" android:src="@drawable/vdots"
android:layout_height="wrap_content" android:gravity="right|bottom"
android:layout_width="fill_parent" android:layout_alignParentRight="true" />
android:orientation="horizontal" <TextView
android:clickable="true" android:id="@+id/entry_url"
android:background="?android:attr/selectableItemBackground"> android:layout_width="fill_parent"
<ImageView android:layout_height="wrap_content"
android:id="@+id/password_vdots" android:autoLink="all"
android:layout_width="wrap_content" android:layout_toLeftOf="@id/url_vdots"
android:layout_height="15dp" style="@style/EntryItem" />
android:src="@drawable/vdots" </RelativeLayout>
android:gravity="right|bottom" </LinearLayout>
android:layout_alignParentRight="true" <LinearLayout
/> android:id="@+id/entryfield_container_password"
<TextView android:layout_height="wrap_content"
android:id="@+id/entry_password" android:layout_width="fill_parent"
android:layout_width="fill_parent" android:orientation="vertical">
android:layout_height="wrap_content" <!-- Password -->
android:password="true" <TextView
android:typeface="monospace" android:id="@+id/entry_password_label"
android:layout_toLeftOf="@id/password_vdots" android:layout_width="fill_parent"
style="@style/EntryItem" /> android:layout_height="wrap_content"
</RelativeLayout> android:text="@string/entry_password"
</LinearLayout> style="@style/EntryFieldHeader" />
<LinearLayout android:id="@+id/entryfield_container_comment" <RelativeLayout
android:layout_height="wrap_content" android:id="@+id/password_container"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical"> android:layout_width="fill_parent"
android:orientation="horizontal"
<!-- Comment --> android:clickable="true"
<TextView android:background="?android:attr/selectableItemBackground">
android:id="@+id/entry_comment_label" <ImageView
android:layout_width="fill_parent" android:id="@+id/password_vdots"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:text="@string/entry_comment" android:layout_height="15dp"
style="@style/EntryFieldHeader" android:src="@drawable/vdots"
/> android:gravity="right|bottom"
<TextView android:layout_alignParentRight="true" />
android:id="@+id/entry_comment" <TextView
android:layout_width="fill_parent" android:id="@+id/entry_password"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:textIsSelectable="true" android:layout_height="wrap_content"
style="@style/EntryItem" /> android:password="true"
</LinearLayout> android:typeface="monospace"
android:layout_toLeftOf="@id/password_vdots"
<LinearLayout style="@style/EntryItem" />
android:id="@+id/extra_strings" </RelativeLayout>
android:layout_width="fill_parent" </LinearLayout>
android:layout_height="wrap_content" <LinearLayout
android:layout_marginTop="8dp" android:id="@+id/entryfield_container_comment"
android:orientation="vertical" /> android:layout_height="wrap_content"
<!-- file attachments --> android:layout_width="fill_parent"
<TextView android:orientation="vertical">
android:id="@+id/entry_binaries_label" <!-- Comment -->
android:layout_width="fill_parent" <TextView
android:layout_height="wrap_content" android:id="@+id/entry_comment_label"
android:text="@string/entry_binaries" android:layout_width="fill_parent"
style="@style/EntryFieldHeader" android:layout_height="wrap_content"
/> android:text="@string/entry_comment"
<LinearLayout style="@style/EntryFieldHeader" />
android:id="@+id/binaries" <TextView
android:layout_width="fill_parent" android:id="@+id/entry_comment"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:orientation="vertical" /> android:layout_height="wrap_content"
<!--Tags --> android:textIsSelectable="true"
<LinearLayout android:id="@+id/entryfield_container_tags" style="@style/EntryItem" />
android:layout_height="wrap_content" </LinearLayout>
android:layout_width="fill_parent" <LinearLayout
android:orientation="vertical"> android:id="@+id/extra_strings"
android:layout_width="fill_parent"
<TextView android:layout_height="wrap_content"
android:id="@+id/entry_tags_label" android:layout_marginTop="8dp"
android:layout_width="fill_parent" android:orientation="vertical" />
android:layout_height="wrap_content" <!-- file attachments -->
android:text="@string/entry_tags" <TextView
style="@style/EntryFieldHeader" android:id="@+id/entry_binaries_label"
/> android:layout_width="fill_parent"
<TextView android:layout_height="wrap_content"
android:id="@+id/entry_tags" android:text="@string/entry_binaries"
android:layout_width="fill_parent" style="@style/EntryFieldHeader" />
android:layout_height="wrap_content" <LinearLayout
android:textIsSelectable="true" android:id="@+id/binaries"
style="@style/EntryItem" /> android:layout_width="fill_parent"
</LinearLayout> android:layout_height="wrap_content"
<LinearLayout android:id="@+id/entryfield_container_overrideurl" android:orientation="vertical" />
android:layout_height="wrap_content" <!--Tags -->
android:layout_width="fill_parent" <LinearLayout
android:orientation="vertical"> android:id="@+id/entryfield_container_tags"
android:layout_height="wrap_content"
<!--Override URL--> android:layout_width="fill_parent"
<TextView android:orientation="vertical">
android:id="@+id/entry_override_url_label" <TextView
android:layout_width="fill_parent" android:id="@+id/entry_tags_label"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:text="@string/entry_override_url" android:layout_height="wrap_content"
style="@style/EntryFieldHeader" android:text="@string/entry_tags"
/> style="@style/EntryFieldHeader" />
<TextView <TextView
android:id="@+id/entry_override_url" android:id="@+id/entry_tags"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autoLink="all" android:textIsSelectable="true"
android:textIsSelectable="true" style="@style/EntryItem" />
style="@style/EntryItem" /> </LinearLayout>
</LinearLayout> <LinearLayout
<LinearLayout android:id="@+id/entryfield_container_created" android:id="@+id/entryfield_container_overrideurl"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:orientation="vertical"> android:orientation="vertical">
<!--Override URL-->
<TextView
<!-- Created --> android:id="@+id/entry_override_url_label"
<TextView android:layout_width="fill_parent"
android:id="@+id/entry_created_label" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:text="@string/entry_override_url"
android:layout_height="wrap_content" style="@style/EntryFieldHeader" />
android:text="@string/entry_created" <TextView
style="@style/EntryFieldHeader" android:id="@+id/entry_override_url"
/> android:layout_width="fill_parent"
<TextView android:layout_height="wrap_content"
android:id="@+id/entry_created" android:autoLink="all"
android:layout_width="fill_parent" android:textIsSelectable="true"
android:layout_height="wrap_content" style="@style/EntryItem" />
style="@style/EntryItem" /> </LinearLayout>
</LinearLayout> <LinearLayout
<LinearLayout android:id="@+id/entryfield_container_modified" android:id="@+id/entryfield_container_created"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:orientation="vertical"> android:orientation="vertical">
<!-- Created -->
<!-- Modified --> <TextView
<TextView android:id="@+id/entry_created_label"
android:id="@+id/entry_modified_label" android:layout_width="fill_parent"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:text="@string/entry_created"
android:text="@string/entry_modified" style="@style/EntryFieldHeader" />
style="@style/EntryFieldHeader" <TextView
/> android:id="@+id/entry_created"
<TextView android:layout_width="fill_parent"
android:id="@+id/entry_modified" android:layout_height="wrap_content"
android:layout_width="fill_parent" style="@style/EntryItem" />
android:layout_height="wrap_content" </LinearLayout>
style="@style/EntryItem" /> <LinearLayout
</LinearLayout> android:id="@+id/entryfield_container_modified"
<LinearLayout android:id="@+id/entryfield_container_expires" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:layout_width="fill_parent" android:orientation="vertical">
android:orientation="vertical"> <!-- Modified -->
<TextView
<!-- Expires --> android:id="@+id/entry_modified_label"
<TextView android:layout_width="fill_parent"
android:id="@+id/entry_expires_label" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:text="@string/entry_modified"
android:layout_height="wrap_content" style="@style/EntryFieldHeader" />
android:text="@string/entry_expires" <TextView
style="@style/EntryFieldHeader" android:id="@+id/entry_modified"
/> android:layout_width="fill_parent"
<TextView android:layout_height="wrap_content"
android:id="@+id/entry_expires" style="@style/EntryItem" />
android:layout_width="fill_parent" </LinearLayout>
android:layout_height="wrap_content" <LinearLayout
style="@style/EntryItem" /> android:id="@+id/entryfield_container_expires"
</LinearLayout> android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical">
<!-- Expires -->
<TextView
android:id="@+id/entry_expires_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_expires"
style="@style/EntryFieldHeader" />
<TextView
android:id="@+id/entry_expires"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/EntryItem" />
</LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -65,6 +65,7 @@
<string name="entry_confpassword">Confirm password</string> <string name="entry_confpassword">Confirm password</string>
<string name="entry_created">Created</string> <string name="entry_created">Created</string>
<string name="entry_expires">Expires</string> <string name="entry_expires">Expires</string>
<string name="entry_group_name">Group Name</string>
<string name="entry_keyfile">Key file (optional)</string> <string name="entry_keyfile">Key file (optional)</string>
<string name="entry_modified">Modified</string> <string name="entry_modified">Modified</string>
<string name="entry_password">Password</string> <string name="entry_password">Password</string>