Refactor out common view.

This commit is contained in:
Brian Pellin committed 2010-12-08 22:11:46 -06:00
1 parent c7e1927574
commit 29ea14034d
4 files changed
+157 -168

No files matched your search

+2 -84
View File
@@ -59,90 +59,8 @@
android:layout_height="fill_parent"
android:layout_above="@id/entry_divider2"
android:layout_below="@id/title_block">
<TableLayout android:id="@+id/entry_table"
<com.keepassdroid.view.EntryContentsView android:id="@+id/entry_table"
android:layout_height="fill_parent"
android:layout_width="wrap_content">
<!-- Username -->
<TableRow>
<TextView android:id="@+id/entry_user_name_label"
android:layout_width="100px"
android:layout_height="wrap_content"
android:text="@string/entry_user_name" />
<TextView android:id="@+id/entry_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- URL -->
<TableRow>
<TextView android:id="@+id/entry_url_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_url" />
<TextView android:id="@+id/entry_url"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Password -->
<TableRow>
<TextView android:id="@+id/entry_password_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_password" />
<TextView android:id="@+id/entry_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:password="true"/>
</TableRow>
<!-- Created -->
<TableRow>
<TextView android:id="@+id/entry_created_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_created" />
<TextView android:id="@+id/entry_created"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Modified -->
<TableRow>
<TextView android:id="@+id/entry_modified_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_modified" />
<TextView android:id="@+id/entry_modified"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Accessed -->
<TableRow>
<TextView android:id="@+id/entry_accessed_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_accessed" />
<TextView android:id="@+id/entry_accessed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Expires -->
<TableRow>
<TextView android:id="@+id/entry_expires_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_expires" />
<TextView android:id="@+id/entry_expires"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Comment -->
<TableRow>
<TextView android:id="@+id/entry_comment_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_comment" />
<TextView android:id="@+id/entry_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
android:layout_width="wrap_content" />
</ScrollView>
</RelativeLayout>
+105
View File
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2009 Brian Pellin.
This file is part of KeePassDroid.
KeePassDroid is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KeePassDroid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with KeePassDroid. If not, see <http://www.gnu.org/licenses/>.
-->
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/entry_table"
android:layout_height="fill_parent"
android:layout_width="wrap_content">
<!-- Username -->
<TableRow>
<TextView android:id="@+id/entry_user_name_label"
android:layout_width="100px"
android:layout_height="wrap_content"
android:text="@string/entry_user_name" />
<TextView android:id="@+id/entry_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- URL -->
<TableRow>
<TextView android:id="@+id/entry_url_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_url" />
<TextView android:id="@+id/entry_url"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Password -->
<TableRow>
<TextView android:id="@+id/entry_password_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_password" />
<TextView android:id="@+id/entry_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:password="true"/>
</TableRow>
<!-- Created -->
<TableRow>
<TextView android:id="@+id/entry_created_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_created" />
<TextView android:id="@+id/entry_created"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Modified -->
<TableRow>
<TextView android:id="@+id/entry_modified_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_modified" />
<TextView android:id="@+id/entry_modified"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Accessed -->
<TableRow>
<TextView android:id="@+id/entry_accessed_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_accessed" />
<TextView android:id="@+id/entry_accessed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Expires -->
<TableRow>
<TextView android:id="@+id/entry_expires_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_expires" />
<TextView android:id="@+id/entry_expires"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Comment -->
<TableRow>
<TextView android:id="@+id/entry_comment_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_comment" />
<TextView android:id="@+id/entry_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
+2 -84
View File
@@ -48,90 +48,8 @@
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_below="@id/title_block">
<TableLayout android:id="@+id/entry_table"
<com.keepassdroid.view.EntryContentsView android:id="@+id/entry_table"
android:layout_height="fill_parent"
android:layout_width="wrap_content">
<!-- Username -->
<TableRow>
<TextView android:id="@+id/entry_user_name_label"
android:layout_width="100px"
android:layout_height="wrap_content"
android:text="@string/entry_user_name" />
<TextView android:id="@+id/entry_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- URL -->
<TableRow>
<TextView android:id="@+id/entry_url_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_url" />
<TextView android:id="@+id/entry_url"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Password -->
<TableRow>
<TextView android:id="@+id/entry_password_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_password" />
<TextView android:id="@+id/entry_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:password="true"/>
</TableRow>
<!-- Created -->
<TableRow>
<TextView android:id="@+id/entry_created_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_created" />
<TextView android:id="@+id/entry_created"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Modified -->
<TableRow>
<TextView android:id="@+id/entry_modified_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_modified" />
<TextView android:id="@+id/entry_modified"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Accessed -->
<TableRow>
<TextView android:id="@+id/entry_accessed_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_accessed" />
<TextView android:id="@+id/entry_accessed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Expires -->
<TableRow>
<TextView android:id="@+id/entry_expires_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_expires" />
<TextView android:id="@+id/entry_expires"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<!-- Comment -->
<TableRow>
<TextView android:id="@+id/entry_comment_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/entry_comment" />
<TextView android:id="@+id/entry_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
android:layout_width="wrap_content" />
</ScrollView>
</RelativeLayout>
@@ -0,0 +1,48 @@
/*
* Copyright 2010 Brian Pellin.
*
* This file is part of KeePassDroid.
*
* KeePassDroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* KeePassDroid is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with KeePassDroid. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.keepassdroid.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.TableLayout;
import com.android.keepass.R;
public class EntryContentsView extends TableLayout {
public EntryContentsView(Context context) {
super(context);
inflate(context);
}
public EntryContentsView(Context context, AttributeSet attrs) {
super(context, attrs);
inflate(context);
}
private void inflate(Context context) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.entry_view_contents, this);
}
}