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,42 +1,69 @@
<?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_user_name_label" android:id="@+id/entry_group_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_user_name" android:text="@string/entry_group_name"
style="@style/EntryFieldHeader" />
style="@style/EntryFieldHeader" <RelativeLayout
/> android:id="@+id/groupname_container"
android:layout_height="wrap_content"
<!-- Username --> android:layout_width="fill_parent"
<RelativeLayout android:id="@+id/username_container" android:orientation="horizontal"
android:clickable="true"
android:background="?android:attr/selectableItemBackground">
<ImageView
android:id="@+id/group_name_vdots"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:src="@drawable/vdots"
android:gravity="right|bottom"
android:layout_alignParentRight="true" />
<TextView
android:id="@+id/entry_group_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/group_name_vdots"
style="@style/EntryItem" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/entryfield_container_username"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/entry_user_name_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_user_name"
style="@style/EntryFieldHeader" />
<!-- Username -->
<RelativeLayout
android:id="@+id/username_container"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:orientation="horizontal" android:orientation="horizontal"
android:clickable="true" android:clickable="true"
android:background="?android:attr/selectableItemBackground"> android:background="?android:attr/selectableItemBackground">
<ImageView <ImageView
android:id="@+id/username_vdots" android:id="@+id/username_vdots"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="15dp" android:layout_height="15dp"
android:src="@drawable/vdots" android:src="@drawable/vdots"
android:gravity="right|bottom" android:gravity="right|bottom"
android:layout_alignParentRight="true" android:layout_alignParentRight="true" />
/>
<TextView <TextView
android:id="@+id/entry_user_name" android:id="@+id/entry_user_name"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -45,21 +72,20 @@
style="@style/EntryItem" /> style="@style/EntryItem" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
<LinearLayout
<LinearLayout android:id="@+id/entryfield_container_url" android:id="@+id/entryfield_container_url"
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">
<!-- URL --> <!-- URL -->
<TextView <TextView
android:id="@+id/entry_url_label" android:id="@+id/entry_url_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_url" android:text="@string/entry_url"
style="@style/EntryFieldHeader" style="@style/EntryFieldHeader" />
/> <RelativeLayout
<RelativeLayout android:id="@+id/url_container" android:id="@+id/url_container"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:orientation="horizontal" android:orientation="horizontal"
@ -71,8 +97,7 @@
android:layout_height="15dp" android:layout_height="15dp"
android:src="@drawable/vdots" android:src="@drawable/vdots"
android:gravity="right|bottom" android:gravity="right|bottom"
android:layout_alignParentRight="true" android:layout_alignParentRight="true" />
/>
<TextView <TextView
android:id="@+id/entry_url" android:id="@+id/entry_url"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -82,20 +107,20 @@
style="@style/EntryItem" /> style="@style/EntryItem" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/entryfield_container_password" <LinearLayout
android:id="@+id/entryfield_container_password"
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">
<!-- Password --> <!-- Password -->
<TextView <TextView
android:id="@+id/entry_password_label" android:id="@+id/entry_password_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_password" android:text="@string/entry_password"
style="@style/EntryFieldHeader" style="@style/EntryFieldHeader" />
/> <RelativeLayout
<RelativeLayout android:id="@+id/password_container" android:id="@+id/password_container"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:orientation="horizontal" android:orientation="horizontal"
@ -107,8 +132,7 @@
android:layout_height="15dp" android:layout_height="15dp"
android:src="@drawable/vdots" android:src="@drawable/vdots"
android:gravity="right|bottom" android:gravity="right|bottom"
android:layout_alignParentRight="true" android:layout_alignParentRight="true" />
/>
<TextView <TextView
android:id="@+id/entry_password" android:id="@+id/entry_password"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -119,19 +143,18 @@
style="@style/EntryItem" /> style="@style/EntryItem" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/entryfield_container_comment" <LinearLayout
android:id="@+id/entryfield_container_comment"
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">
<!-- Comment --> <!-- Comment -->
<TextView <TextView
android:id="@+id/entry_comment_label" android:id="@+id/entry_comment_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_comment" android:text="@string/entry_comment"
style="@style/EntryFieldHeader" style="@style/EntryFieldHeader" />
/>
<TextView <TextView
android:id="@+id/entry_comment" android:id="@+id/entry_comment"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -139,7 +162,6 @@
android:textIsSelectable="true" android:textIsSelectable="true"
style="@style/EntryItem" /> style="@style/EntryItem" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/extra_strings" android:id="@+id/extra_strings"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -152,26 +174,24 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/entry_binaries" android:text="@string/entry_binaries"
style="@style/EntryFieldHeader" style="@style/EntryFieldHeader" />
/>
<LinearLayout <LinearLayout
android:id="@+id/binaries" android:id="@+id/binaries"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" /> android:orientation="vertical" />
<!--Tags --> <!--Tags -->
<LinearLayout android:id="@+id/entryfield_container_tags" <LinearLayout
android:id="@+id/entryfield_container_tags"
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">
<TextView <TextView
android:id="@+id/entry_tags_label" android:id="@+id/entry_tags_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_tags" android:text="@string/entry_tags"
style="@style/EntryFieldHeader" style="@style/EntryFieldHeader" />
/>
<TextView <TextView
android:id="@+id/entry_tags" android:id="@+id/entry_tags"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -179,19 +199,18 @@
android:textIsSelectable="true" android:textIsSelectable="true"
style="@style/EntryItem" /> style="@style/EntryItem" />
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/entryfield_container_overrideurl" <LinearLayout
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--> <!--Override URL-->
<TextView <TextView
android:id="@+id/entry_override_url_label" android:id="@+id/entry_override_url_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_override_url" android:text="@string/entry_override_url"
style="@style/EntryFieldHeader" style="@style/EntryFieldHeader" />
/>
<TextView <TextView
android:id="@+id/entry_override_url" android:id="@+id/entry_override_url"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -200,58 +219,54 @@
android:textIsSelectable="true" android:textIsSelectable="true"
style="@style/EntryItem" /> style="@style/EntryItem" />
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/entryfield_container_created" <LinearLayout
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 --> <!-- Created -->
<TextView <TextView
android:id="@+id/entry_created_label" android:id="@+id/entry_created_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_created"
style="@style/EntryFieldHeader" style="@style/EntryFieldHeader" />
/>
<TextView <TextView
android:id="@+id/entry_created" android:id="@+id/entry_created"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/EntryItem" /> style="@style/EntryItem" />
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/entryfield_container_modified" <LinearLayout
android:id="@+id/entryfield_container_modified"
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 --> <!-- Modified -->
<TextView <TextView
android:id="@+id/entry_modified_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_modified" android:text="@string/entry_modified"
style="@style/EntryFieldHeader" style="@style/EntryFieldHeader" />
/>
<TextView <TextView
android:id="@+id/entry_modified" android:id="@+id/entry_modified"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/EntryItem" /> style="@style/EntryItem" />
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/entryfield_container_expires" <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">
<!-- Expires --> <!-- Expires -->
<TextView <TextView
android:id="@+id/entry_expires_label" android:id="@+id/entry_expires_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_expires" android:text="@string/entry_expires"
style="@style/EntryFieldHeader" style="@style/EntryFieldHeader" />
/>
<TextView <TextView
android:id="@+id/entry_expires" android:id="@+id/entry_expires"
android:layout_width="fill_parent" android:layout_width="fill_parent"

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>