Minor group layout tweaks.

This commit is contained in:
Brian Pellin
2009-01-26 23:41:14 -06:00
parent 9cf8127bbe
commit 4157d0c1ef
6 changed files with 20 additions and 7 deletions

View File

@@ -1,9 +1,9 @@
<?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:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<ListView android:id="@android:id/list" <ListView android:id="@android:id/list"
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
<TextView android:id="@android:id/empty" <TextView android:id="@android:id/empty"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@@ -18,4 +18,5 @@
<string name="menu_copy_user">Copy User</string> <string name="menu_copy_user">Copy User</string>
<string name="menu_copy_pass">Copy Password</string> <string name="menu_copy_pass">Copy Password</string>
<string name="pass_filename">Filename:</string> <string name="pass_filename">Filename:</string>
<color name="group">#FF00FF</color>
</resources> </resources>

View File

@@ -69,7 +69,6 @@ public class KeePass extends Activity {
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
saveDefaultPrefs();
} }
private void loadDefaultPrefs() { private void loadDefaultPrefs() {
@@ -113,6 +112,7 @@ public class KeePass extends Activity {
switch (result) { switch (result) {
case 0: case 0:
saveDefaultPrefs();
GroupActivity.Launch(mAct, null); GroupActivity.Launch(mAct, null);
break; break;
case -1: case -1:

View File

@@ -22,6 +22,9 @@ package com.android.keepass;
import org.phoneid.keepassj2me.PwGroup; import org.phoneid.keepassj2me.PwGroup;
import android.app.Activity; import android.app.Activity;
import android.graphics.Color;
import android.util.TypedValue;
import android.widget.TextView;
public class PwGroupView extends PwItemView { public class PwGroupView extends PwItemView {
@@ -33,6 +36,8 @@ public class PwGroupView extends PwItemView {
mAct = act; mAct = act;
mPw = pw; mPw = pw;
getTextView().setTextColor(Color.BLUE);
} }
public void setGroup(PwGroup pw) { public void setGroup(PwGroup pw) {

View File

@@ -29,16 +29,20 @@ abstract public class PwItemView extends LinearLayout {
PwItemView(Context context, String title) { PwItemView(Context context, String title) {
super(context); super(context);
mTitle = new TextView(context); mTitle = new TextView(context);
mTitle.setText(title); mTitle.setText(title);
mTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30); mTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
addView(mTitle, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); addView(mTitle, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
} }
void setTitle(String title) { protected void setTitle(String title) {
mTitle.setText(title); mTitle.setText(title);
} }
protected TextView getTextView() {
return mTitle;
}
abstract void onClick(); abstract void onClick();
} }

View File

@@ -25,6 +25,8 @@ import android.app.Activity;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import org.phoneid.keepassj2me.PwEntry; import org.phoneid.keepassj2me.PwEntry;
import org.phoneid.keepassj2me.PwGroup; import org.phoneid.keepassj2me.PwGroup;
@@ -67,7 +69,7 @@ public class PwListAdapter extends BaseAdapter {
} }
} }
private PwGroupView createGroupView(int position, View convertView) { private View createGroupView(int position, View convertView) {
PwGroupView gv; PwGroupView gv;
if (convertView == null || ! (convertView instanceof PwGroupView)) { if (convertView == null || ! (convertView instanceof PwGroupView)) {
PwGroup group = (PwGroup) mGroup.childGroups.elementAt(position); PwGroup group = (PwGroup) mGroup.childGroups.elementAt(position);
@@ -76,6 +78,7 @@ public class PwListAdapter extends BaseAdapter {
gv = (PwGroupView) convertView; gv = (PwGroupView) convertView;
gv.setGroup((PwGroup) mGroup.childGroups.elementAt(position)); gv.setGroup((PwGroup) mGroup.childGroups.elementAt(position));
} }
return gv; return gv;
} }