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"?>
<LinearLayout
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:layout_width="fill_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:padding="10dp">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1"
android:text="Filename:">
android:paddingRight="10dp"
android:text="@string/filename">
</TextView>
<EditText
android:id="@+id/create_pgn_filename"
android:background="@android:drawable/editbox_background"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:minEms="8"
android:layout_weight="1"
android:inputType="text">
</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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Value (%)"
android:text="Value (%):"
android:paddingRight="10dp">
</TextView>
<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="no_prev_game">No previous 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>

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) {
gotoMove.run();
}
});
builder.setNegativeButton("Cancel", null);
builder.setNegativeButton(R.string.cancel, null);
final AlertDialog dialog = builder.create();
@ -1217,12 +1217,11 @@ public class DroidFish extends Activity implements GUIInterface {
return alert;
}
case SELECT_PGN_SAVE_NEWFILE_DIALOG: {
final Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.create_pgn_file);
dialog.setTitle(R.string.select_pgn_file_save);
final EditText fileNameView = (EditText)dialog.findViewById(R.id.create_pgn_filename);
Button ok = (Button)dialog.findViewById(R.id.create_pgn_ok);
Button cancel = (Button)dialog.findViewById(R.id.create_pgn_cancel);
View content = View.inflate(this, R.layout.create_pgn_file, null);
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(content);
builder.setTitle(R.string.select_pgn_file_save);
final EditText fileNameView = (EditText)content.findViewById(R.id.create_pgn_filename);
fileNameView.setText("");
final Runnable savePGN = new Runnable() {
public void run() {
@ -1230,28 +1229,26 @@ public class DroidFish extends Activity implements GUIInterface {
if ((pgnFile.length() > 0) && !pgnFile.contains("."))
pgnFile += ".pgn";
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() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
savePGN.run();
dialog.cancel();
return true;
}
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;
}
@ -1363,8 +1360,8 @@ public class DroidFish extends Activity implements GUIInterface {
white.setText(headers.get("White"));
black.setText(headers.get("Black"));
builder.setNegativeButton("Cancel", null);
builder.setPositiveButton("Ok", new Dialog.OnClickListener() {
builder.setNegativeButton(R.string.cancel, null);
builder.setPositiveButton(R.string.ok, new Dialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
headers.put("Event", event.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);
nag.setText(nagStr);
builder.setNegativeButton("Cancel", null);
builder.setPositiveButton("Ok", new Dialog.OnClickListener() {
builder.setNegativeButton(R.string.cancel, null);
builder.setPositiveButton(R.string.ok, new Dialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String pre = preComment.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) {
TextView name = new TextView(getContext());
name.setText(getTitle());
name.setTextSize(20);
name.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
name.setTextAppearance(getContext(), android.R.style.TextAppearance_Large);
name.setGravity(Gravity.LEFT);
LinearLayout.LayoutParams lp =
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,