Permalink
Browse files

Refine layout

Signed-off-by: Shaka Huang <shaka@cs03.org>
  • Loading branch information...
1 parent ed8b8dc commit 3476b634c1ba17a5e24e2a0e4634e3ccd2e16cfe @shakalaca committed Feb 11, 2012
Showing with 42 additions and 64 deletions.
  1. +20 −29 res/layout-land/main.xml
  2. +16 −26 res/layout/main.xml
  3. +1 −1 res/values/strings.xml
  4. +5 −8 src/com/corner23/android/usb_otg_manager/Main.java
View
@@ -1,48 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal"
android:gravity="center" >
- <TextView
- android:id="@+id/textView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/str_fstype"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-
- <Spinner
- android:id="@+id/spinner_fstype"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal"
- android:gravity="center" >
-
+<!--
<ImageView
android:id="@+id/iv_mount_status"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_margin="20dip"
android:src="@drawable/usb_android" />
-
+-->
+
+ <TextView
+ android:id="@+id/tv_mountstatus"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:text="@string/str_unmounted"
+ android:drawableTop="@drawable/usb_android"
+ android:gravity="center" />
+
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:gravity="left|center_vertical" >
-
- <TextView
- android:id="@+id/tv_mountstatus"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/str_unmounted" />
+
+ <Spinner
+ android:id="@+id/spinner_fstype"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
<CheckBox
android:id="@+id/chkbox_readonly"
@@ -56,6 +48,5 @@
android:layout_height="wrap_content"
android:text="@string/str_close_app" />
</LinearLayout>
- </LinearLayout>
</LinearLayout>
View
@@ -1,41 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical"
- android:gravity="center" >
-
- <TextView
- android:id="@+id/textView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/str_fstype"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-
- <Spinner
- android:id="@+id/spinner_fstype"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <ImageView
- android:id="@+id/iv_mount_status"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_margin="20dip"
- android:src="@drawable/usb_android" />
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:baselineAligned="false"
+ android:orientation="vertical" >
<TextView
android:id="@+id/tv_mountstatus"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/str_unmounted" />
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:text="@string/str_unmounted"
+ android:drawableTop="@drawable/usb_android"
+ android:gravity="center" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:layout_weight="1"
android:orientation="vertical"
android:gravity="left" >
+ <Spinner
+ android:id="@+id/spinner_fstype"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
<CheckBox
android:id="@+id/chkbox_readonly"
android:layout_width="wrap_content"
View
@@ -10,7 +10,7 @@
<string name="str_mounting">Mounting..</string>
<string name="str_unmount">Unmount storage</string>
<string name="str_unmounting">Unmounting..</string>
- <string name="str_mounted_path">Mounted at \n\n%s</string>
+ <string name="str_mounted_path">Mounted at:%s</string>
<string name="str_unmounted">No storage mounted</string>
<string name="str_mounted_notify">Storage mounted</string>
@@ -29,7 +29,6 @@
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
-import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
@@ -48,6 +47,7 @@
private final static String STORAGE_DEVICE_PATH = "/dev/block/sda1";
private final static String[] fsTypes = {"vfat"/*, "ntfs" */};
+ private final static String[] fsTypesInView = {"Filesystem: vfat"/*, "ntfs" */};
private int fsType;
private final static boolean bIsXperiaSeries = android.os.Build.MODEL.equals("LT18i") || // arc s
@@ -66,7 +66,6 @@
private Context mContext = this;
ArrayAdapter<String> adapter = null;
TextView tvMountStatus = null;
- ImageView ivMountStatus = null;
CheckBox cbCloseOnMount = null;
CheckBox cbReadOnly = null;
@@ -261,10 +260,10 @@ public static boolean doUnmount() {
private void updateUI() {
if (isMounted()) {
tvMountStatus.setText(getResources().getString(R.string.str_mounted_path, MOUNT_PATH));
- ivMountStatus.setImageResource(R.drawable.usb_android_connected);
+ tvMountStatus.setCompoundDrawablesWithIntrinsicBounds(null, getResources().getDrawable(R.drawable.usb_android_connected), null, null);
} else {
tvMountStatus.setText(R.string.str_unmounted);
- ivMountStatus.setImageResource(R.drawable.usb_android);
+ tvMountStatus.setCompoundDrawablesWithIntrinsicBounds(null, getResources().getDrawable(R.drawable.usb_android), null, null);
}
}
@@ -400,11 +399,9 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
});
tvMountStatus = (TextView) findViewById(R.id.tv_mountstatus);
+ tvMountStatus.setOnClickListener(btnMountOnClickListener);
- ivMountStatus = (ImageView) findViewById(R.id.iv_mount_status);
- ivMountStatus.setOnClickListener(btnMountOnClickListener);
-
- adapter = new ArrayAdapter<String>(mContext, android.R.layout.simple_spinner_item, fsTypes);
+ adapter = new ArrayAdapter<String>(mContext, android.R.layout.simple_spinner_item, fsTypesInView);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Spinner spinner = (Spinner) findViewById(R.id.spinner_fstype);

0 comments on commit 3476b63

Please sign in to comment.