mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
UI enhancements. Custom views refactored.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.keepass"
|
||||
android:versionCode="5" android:versionName="0.1.4">
|
||||
android:versionCode="6" android:versionName="0.1.5">
|
||||
<application android:label="@string/app_name" android:icon="@drawable/keepass_icon">
|
||||
<activity android:name=".KeePass"
|
||||
android:label="@string/app_name">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
KeePassDroid (0.2.0)
|
||||
KeePassDroid (0.1.5)
|
||||
|
||||
* Improve file selection
|
||||
* UI enhancements
|
||||
|
||||
KeePassDroid (0.1.4)
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with KeePassDroid. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<TextView android:id="@+id/text1" xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/entry_text"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="30sp"/>
|
||||
@@ -31,16 +31,18 @@
|
||||
<EditText android:id="@+id/file_filename"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"/>
|
||||
android:singleLine="true"
|
||||
android:text="/sdcard/keepass/keepass.kdb"/>
|
||||
<Button android:id="@+id/file_button"
|
||||
android:text="Open"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"/>
|
||||
android:layout_width="wrap_content"
|
||||
android:width="100sp"/>
|
||||
<ImageView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:tint="#0000dd"
|
||||
android:tint="@color/blue_highlight"
|
||||
android:src="@android:drawable/divider_horizontal_dark"/>
|
||||
<TextView android:id="@+id/file_listtop"
|
||||
android:layout_width="fill_parent"
|
||||
|
||||
37
res/layout/group_list_entry.xml
Normal file
37
res/layout/group_list_entry.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:stretchColumns="1">
|
||||
<TableRow android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView android:id="@+id/group_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="30sp"
|
||||
android:textColor="@color/blue_highlight"/>
|
||||
<View/>
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/blue_highlight"
|
||||
android:text="@string/group"/>
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
@@ -19,10 +19,25 @@
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView android:id="@+id/group_header"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:text="@string/current_group_root"
|
||||
android:textStyle="bold"
|
||||
android:layout_weight="0"/>
|
||||
<ImageView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
<TextView android:id="@android:id/empty"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -26,4 +26,9 @@
|
||||
<string name="entry_and_or">Enter a password and/or a key file to unlock your database:</string>
|
||||
<string name="entry_keyfile">Key file (optional):</string>
|
||||
|
||||
<color name="blue_highlight">#0000dd</color>
|
||||
<string name="group">Group</string>
|
||||
<string name="current_group">Current Group: </string>
|
||||
<string name="root">Root</string>
|
||||
<string name="current_group_root">Current Group: Root</string>
|
||||
</resources>
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class GroupActivity extends ListActivity {
|
||||
|
||||
@@ -58,15 +59,15 @@ public class GroupActivity extends ListActivity {
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
super.onListItemClick(l, v, position, id);
|
||||
int size = mGroup.childGroups.size();
|
||||
PwItemView iv;
|
||||
if (position < size ) {
|
||||
PwGroup group = (PwGroup) mGroup.childGroups.elementAt(position);
|
||||
iv = new PwGroupView(this, group);
|
||||
PwGroupView gv = new PwGroupView(this, group);
|
||||
gv.onClick();
|
||||
} else {
|
||||
PwEntry entry = (PwEntry) mGroup.childEntries.elementAt(position - size);
|
||||
iv = new PwEntryView(this, entry);
|
||||
PwEntryView pe = new PwEntryView(this, entry);
|
||||
pe.onClick();
|
||||
}
|
||||
iv.onClick();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,11 +87,23 @@ public class GroupActivity extends ListActivity {
|
||||
}
|
||||
assert(mGroup != null);
|
||||
|
||||
setGroupTitle();
|
||||
|
||||
setListAdapter(new PwListAdapter(this, mGroup));
|
||||
getListView().setTextFilterEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
private void setGroupTitle() {
|
||||
if ( mGroup != null ) {
|
||||
String name = mGroup.name;
|
||||
if ( name != null && name.length() > 0 ) {
|
||||
TextView tv = (TextView) findViewById(R.id.group_header);
|
||||
tv.setText(getText(R.string.current_group) + " " + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
|
||||
@@ -22,27 +22,30 @@ package com.android.keepass;
|
||||
import org.phoneid.keepassj2me.PwEntry;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class PwEntryView extends PwItemView {
|
||||
public class PwEntryView extends LinearLayout {
|
||||
|
||||
private Activity mAct;
|
||||
private PwEntry mPw;
|
||||
|
||||
public PwEntryView(Activity act, PwEntry pw) {
|
||||
super(act, pw.title);
|
||||
super(act);
|
||||
mAct = act;
|
||||
|
||||
mPw = pw;
|
||||
|
||||
View ev = View.inflate(mAct, R.layout.entry_list_entry, null);
|
||||
TextView tv = (TextView) ev.findViewById(R.id.entry_text);
|
||||
tv.setText(mPw.title);
|
||||
|
||||
LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
|
||||
|
||||
addView(ev, lp);
|
||||
|
||||
}
|
||||
|
||||
public void setEntry(PwEntry pw) {
|
||||
super.setTitle(pw.title);
|
||||
|
||||
mPw = pw;
|
||||
}
|
||||
|
||||
@Override
|
||||
void onClick() {
|
||||
EntryActivity.Launch(mAct, mPw);
|
||||
|
||||
|
||||
@@ -22,30 +22,33 @@ package com.android.keepass;
|
||||
import org.phoneid.keepassj2me.PwGroup;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class PwGroupView extends PwItemView {
|
||||
|
||||
public class PwGroupView extends LinearLayout {
|
||||
|
||||
private PwGroup mPw;
|
||||
private Activity mAct;
|
||||
|
||||
public PwGroupView(Activity act, PwGroup pw) {
|
||||
super(act, pw.name);
|
||||
super(act);
|
||||
mAct = act;
|
||||
mPw = pw;
|
||||
|
||||
getTextView().setTextColor(Color.BLUE);
|
||||
View gv = View.inflate(act, R.layout.group_list_entry, null);
|
||||
TextView tv = (TextView) gv.findViewById(R.id.group_text);
|
||||
tv.setText(pw.name);
|
||||
|
||||
LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
|
||||
|
||||
addView(gv, lp);
|
||||
|
||||
}
|
||||
|
||||
public void setGroup(PwGroup pw) {
|
||||
super.setTitle(pw.name);
|
||||
|
||||
mPw = pw;
|
||||
}
|
||||
|
||||
@Override
|
||||
void onClick() {
|
||||
|
||||
GroupActivity.Launch(mAct, mPw);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
package com.android.keepass;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
abstract public class PwItemView extends LinearLayout {
|
||||
private TextView mTitle;
|
||||
|
||||
PwItemView(Context context, String title) {
|
||||
super(context);
|
||||
|
||||
mTitle = new TextView(context);
|
||||
mTitle.setText(title);
|
||||
mTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
|
||||
addView(mTitle, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
|
||||
}
|
||||
|
||||
protected void setTitle(String title) {
|
||||
mTitle.setText(title);
|
||||
}
|
||||
|
||||
protected TextView getTextView() {
|
||||
return mTitle;
|
||||
}
|
||||
|
||||
abstract void onClick();
|
||||
}
|
||||
@@ -83,25 +83,26 @@ public class PwListAdapter extends BaseAdapter {
|
||||
|
||||
private View createGroupView(int position, View convertView) {
|
||||
PwGroupView gv;
|
||||
if (convertView == null || ! (convertView instanceof PwGroupView)) {
|
||||
//if (convertView == null || ! (convertView instanceof PwGroupView)) {
|
||||
PwGroup group = (PwGroup) mGroup.childGroups.elementAt(position);
|
||||
gv = new PwGroupView(mAct, group);
|
||||
/*
|
||||
} else {
|
||||
gv = (PwGroupView) convertView;
|
||||
gv.setGroup((PwGroup) mGroup.childGroups.elementAt(position));
|
||||
}
|
||||
|
||||
*/
|
||||
return gv;
|
||||
}
|
||||
|
||||
private PwEntryView createEntryView(int position, View convertView) {
|
||||
PwEntryView ev;
|
||||
if (convertView == null || ! (convertView instanceof PwEntryView) ) {
|
||||
// if (convertView == null || ! (convertView instanceof PwEntryView) ) {
|
||||
ev = new PwEntryView(mAct, filteredEntries.elementAt(position));
|
||||
} else {
|
||||
ev = (PwEntryView) convertView;
|
||||
ev.setEntry(filteredEntries.elementAt(position));
|
||||
}
|
||||
// } else {
|
||||
// ev = (PwEntryView) convertView;
|
||||
// ev.setEntry(filteredEntries.elementAt(position));
|
||||
// }
|
||||
return ev;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user