DroidFish: UI improvements from Aaro Korhonen.

- SeekBarPreference now uses Android system style (textAppearanceLarge) instead of custom attribute values.
- The dialog for filename has now the same visual style as the other dialogs.
- Added colons to the rest of the dialog labels.
- Added some padding to select_game.xml.
This commit is contained in:
Peter Osterlund 2011-11-28 17:22:00 +00:00
parent 09c270d533
commit 62e3ace1ab
10 changed files with 52 additions and 74 deletions

View File

@ -1,45 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:padding="10dp">
<TextView <TextView
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_weight="1" android:paddingRight="10dp"
android:text="Filename:"> android:text="@string/filename">
</TextView> </TextView>
<EditText <EditText
android:id="@+id/create_pgn_filename" android:id="@+id/create_pgn_filename"
android:background="@android:drawable/editbox_background"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:minEms="8" android:layout_weight="1"
android:inputType="text"> android:inputType="text">
</EditText> </EditText>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/create_pgn_ok"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Ok">
</Button>
<Button
android:id="@+id/create_pgn_cancel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Cancel">
</Button>
</LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -15,7 +15,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:paddingRight="10dp" android:paddingRight="10dp"
android:text="Before"> android:text="Before:">
</TextView> </TextView>
<EditText <EditText
android:id="@+id/ed_comments_pre" android:id="@+id/ed_comments_pre"
@ -32,10 +32,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:text="Move"> android:text="Move:">
</TextView> </TextView>
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -65,7 +64,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:text="After"> android:text="After:">
</TextView> </TextView>
<EditText <EditText
android:id="@+id/ed_comments_post" android:id="@+id/ed_comments_post"

View File

@ -13,7 +13,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Event"> android:text="Event:">
</TextView> </TextView>
<EditText <EditText
android:id="@+id/ed_header_event" android:id="@+id/ed_header_event"
@ -27,7 +27,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Site"> android:text="Site:">
</TextView> </TextView>
<EditText <EditText
android:id="@+id/ed_header_site" android:id="@+id/ed_header_site"
@ -41,7 +41,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Date"> android:text="Date:">
</TextView> </TextView>
<EditText <EditText
android:id="@+id/ed_header_date" android:id="@+id/ed_header_date"
@ -55,7 +55,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Round" android:text="Round:"
android:paddingRight="10dp"> android:paddingRight="10dp">
</TextView> </TextView>
<EditText <EditText
@ -70,7 +70,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="White"> android:text="White:">
</TextView> </TextView>
<EditText <EditText
android:id="@+id/ed_header_white" android:id="@+id/ed_header_white"
@ -84,7 +84,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Black"> android:text="Black:">
</TextView> </TextView>
<EditText <EditText
android:id="@+id/ed_header_black" android:id="@+id/ed_header_black"

View File

@ -12,7 +12,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingRight="10dp" android:paddingRight="10dp"
android:text="Halfmove clock"> android:text="@string/halfmove">
</TextView> </TextView>
<EditText <EditText
@ -32,7 +32,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingRight="10dp" android:paddingRight="10dp"
android:text="Fullmove counter"> android:text="@string/fullmove">
</TextView> </TextView>
<EditText <EditText

View File

@ -5,13 +5,13 @@
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical"> android:orientation="vertical">
<EditText <EditText
android:text=""
android:id="@+id/select_game_filter" android:id="@+id/select_game_filter"
android:hint="Filter text" android:hint="@string/filter_text"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:inputType="text"> android:inputType="text"
android:layout_margin="10dp">
</EditText> </EditText>
<ListView <ListView
android:id="@android:id/list" android:id="@android:id/list"

View File

@ -9,7 +9,7 @@
<TextView <TextView
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:text="Move number" android:text="@string/move_number"
android:paddingRight="10dp"> android:paddingRight="10dp">
</TextView> </TextView>

View File

@ -8,7 +8,7 @@
<TextView <TextView
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:text="Value (%)" android:text="Value (%):"
android:paddingRight="10dp"> android:paddingRight="10dp">
</TextView> </TextView>
<EditText <EditText

View File

@ -320,4 +320,11 @@ you are not actively using the program.\
<string name="load_next_game">Load Next Game</string> <string name="load_next_game">Load Next Game</string>
<string name="no_prev_game">No previous game</string> <string name="no_prev_game">No previous game</string>
<string name="no_next_game">No next game</string> <string name="no_next_game">No next game</string>
<string name="ok">Ok</string>
<string name="cancel">Cancel</string>
<string name="move_number">Move number:</string>
<string name="filename">Filename:</string>
<string name="halfmove">Halfmove clock:</string>
<string name="fullmove">Fullmove counter:</string>
<string name="filter_text">Filter text</string>
</resources> </resources>

View File

@ -1078,12 +1078,12 @@ public class DroidFish extends Activity implements GUIInterface {
} }
} }
}; };
builder.setPositiveButton("Ok", new Dialog.OnClickListener() { builder.setPositiveButton(R.string.ok, new Dialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
gotoMove.run(); gotoMove.run();
} }
}); });
builder.setNegativeButton("Cancel", null); builder.setNegativeButton(R.string.cancel, null);
final AlertDialog dialog = builder.create(); final AlertDialog dialog = builder.create();
@ -1217,12 +1217,11 @@ public class DroidFish extends Activity implements GUIInterface {
return alert; return alert;
} }
case SELECT_PGN_SAVE_NEWFILE_DIALOG: { case SELECT_PGN_SAVE_NEWFILE_DIALOG: {
final Dialog dialog = new Dialog(this); View content = View.inflate(this, R.layout.create_pgn_file, null);
dialog.setContentView(R.layout.create_pgn_file); final AlertDialog.Builder builder = new AlertDialog.Builder(this);
dialog.setTitle(R.string.select_pgn_file_save); builder.setView(content);
final EditText fileNameView = (EditText)dialog.findViewById(R.id.create_pgn_filename); builder.setTitle(R.string.select_pgn_file_save);
Button ok = (Button)dialog.findViewById(R.id.create_pgn_ok); final EditText fileNameView = (EditText)content.findViewById(R.id.create_pgn_filename);
Button cancel = (Button)dialog.findViewById(R.id.create_pgn_cancel);
fileNameView.setText(""); fileNameView.setText("");
final Runnable savePGN = new Runnable() { final Runnable savePGN = new Runnable() {
public void run() { public void run() {
@ -1230,28 +1229,26 @@ public class DroidFish extends Activity implements GUIInterface {
if ((pgnFile.length() > 0) && !pgnFile.contains(".")) if ((pgnFile.length() > 0) && !pgnFile.contains("."))
pgnFile += ".pgn"; pgnFile += ".pgn";
savePGNToFile(ctrl.getPGN(), pgnFile, false); savePGNToFile(ctrl.getPGN(), pgnFile, false);
dialog.cancel();
} }
}; };
builder.setPositiveButton(R.string.ok, new Dialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
savePGN.run();
}
});
builder.setNegativeButton(R.string.cancel, null);
final Dialog dialog = builder.create();
fileNameView.setOnKeyListener(new OnKeyListener() { fileNameView.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) { public boolean onKey(View v, int keyCode, KeyEvent event) {
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
savePGN.run(); savePGN.run();
dialog.cancel();
return true; return true;
} }
return false; return false;
} }
}); });
ok.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
savePGN.run();
}
});
cancel.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
dialog.cancel();
}
});
return dialog; return dialog;
} }
@ -1363,8 +1360,8 @@ public class DroidFish extends Activity implements GUIInterface {
white.setText(headers.get("White")); white.setText(headers.get("White"));
black.setText(headers.get("Black")); black.setText(headers.get("Black"));
builder.setNegativeButton("Cancel", null); builder.setNegativeButton(R.string.cancel, null);
builder.setPositiveButton("Ok", new Dialog.OnClickListener() { builder.setPositiveButton(R.string.ok, new Dialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
headers.put("Event", event.getText().toString().trim()); headers.put("Event", event.getText().toString().trim());
headers.put("Site", site .getText().toString().trim()); headers.put("Site", site .getText().toString().trim());
@ -1401,8 +1398,8 @@ public class DroidFish extends Activity implements GUIInterface {
nagStr = String.format("%d", commInfo.nag); nagStr = String.format("%d", commInfo.nag);
nag.setText(nagStr); nag.setText(nagStr);
builder.setNegativeButton("Cancel", null); builder.setNegativeButton(R.string.cancel, null);
builder.setPositiveButton("Ok", new Dialog.OnClickListener() { builder.setPositiveButton(R.string.ok, new Dialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
String pre = preComment.getText().toString().trim(); String pre = preComment.getText().toString().trim();
String post = postComment.getText().toString().trim(); String post = postComment.getText().toString().trim();

View File

@ -43,8 +43,7 @@ public class SeekBarPreference extends Preference
protected View onCreateView(ViewGroup parent) { protected View onCreateView(ViewGroup parent) {
TextView name = new TextView(getContext()); TextView name = new TextView(getContext());
name.setText(getTitle()); name.setText(getTitle());
name.setTextSize(20); name.setTextAppearance(getContext(), android.R.style.TextAppearance_Large);
name.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
name.setGravity(Gravity.LEFT); name.setGravity(Gravity.LEFT);
LinearLayout.LayoutParams lp = LinearLayout.LayoutParams lp =
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,