瀏覽代碼

Fixed crash when sending nothing to the Uploader activity; slightly more prettier UI

David A. Velasco 12 年之前
父節點
當前提交
4e57c008b7
共有 3 個文件被更改,包括 39 次插入10 次删除
  1. 23 6
      res/layout/uploader_list_item_layout.xml
  2. 2 0
      res/values/strings.xml
  3. 14 4
      src/com/owncloud/android/Uploader.java

+ 23 - 6
res/layout/uploader_list_item_layout.xml

@@ -17,10 +17,27 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
  -->
 <LinearLayout
-  xmlns:android="http://schemas.android.com/apk/res/android"
-  android:layout_width="fill_parent"
-  android:layout_height="fill_parent"
-  android:background="#fefefe">
-    <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_menu_archive" android:id="@+id/imageView1"></ImageView>
-    <TextView android:text="TextView" android:layout_width="fill_parent" android:id="@+id/textView1" android:layout_height="wrap_content" android:textColor="@android:color/black" android:textSize="20dip"/>
+	xmlns:android="http://schemas.android.com/apk/res/android"
+	android:layout_width="fill_parent"
+	android:background="#fefefe"
+	android:orientation="horizontal"
+	android:layout_height="56dp"  >
+  
+    <ImageView 
+        android:layout_width="20dp"
+        android:layout_height="20dp"
+        android:layout_gravity="center_vertical|center"
+        android:layout_margin="4dp"
+        android:src="@drawable/ic_menu_archive" 
+        android:id="@+id/imageView1" />
+    
+    <TextView 
+        android:text="TextView" 
+        android:layout_width="fill_parent" 
+        android:id="@+id/textView1" 
+        android:layout_height="wrap_content" 
+        android:textColor="@android:color/black"
+		android:layout_gravity="center_vertical"
+        android:textSize="20dip"/>
+    
 </LinearLayout>

+ 2 - 0
res/values/strings.xml

@@ -60,6 +60,8 @@
     <string name="uploader_wrn_no_account_text">There are no ownCloud accounts on your device. Please setup an account first.</string>
     <string name="uploader_wrn_no_account_setup_btn_text">Setup</string>
     <string name="uploader_wrn_no_account_quit_btn_text">Quit</string>
+	<string name="uploader_wrn_no_content_title">No content to upload</string>
+	<string name="uploader_wrn_no_content_text">No content was received. Nothing to upload.</string>
     <string name="uploader_error_forbidden_content">ownCloud is not allowed to access the shared content</string>
     <string name="uploader_info_uploading">Uploading</string>
     <string name="uploader_btn_create_dir_text">Create directory for upload</string>

+ 14 - 4
src/com/owncloud/android/Uploader.java

@@ -85,7 +85,7 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
     private final static int DIALOG_WAITING = 1;
     private final static int DIALOG_NO_STREAM = 2;
     private final static int DIALOG_MULTIPLE_ACCOUNT = 3;
-    private final static int DIALOG_GET_DIRNAME = 4;
+    //private final static int DIALOG_GET_DIRNAME = 4;
 
     private final static int REQUEST_CODE_SETUP_ACCOUNT = 0;
 
@@ -107,7 +107,6 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
                 showDialog(DIALOG_MULTIPLE_ACCOUNT);
             } else {
                 mAccount = accounts[0];
-                setContentView(R.layout.uploader_layout);
                 mStorageManager = new FileDataStorageManager(mAccount, getContentResolver());
                 populateDirectoryList();
             }
@@ -202,6 +201,17 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
                 }
             });
             return builder.create();
+        case DIALOG_NO_STREAM:
+            builder.setIcon(android.R.drawable.ic_dialog_alert);
+            builder.setTitle(R.string.uploader_wrn_no_content_title);
+            builder.setMessage(R.string.uploader_wrn_no_content_text);
+            builder.setCancelable(false);
+            builder.setNegativeButton(R.string.common_cancel, new OnClickListener() {
+                public void onClick(DialogInterface dialog, int which) {
+                    finish();
+                }
+            });
+            return builder.create();
         default:
             throw new IllegalArgumentException("Unknown dialog id: " + id);
         }
@@ -264,9 +274,9 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
             uploadFiles();
 
             break;
-        case android.R.id.button1: // dynamic action for create aditional dir
+        /*case android.R.id.button1: // dynamic action for create aditional dir
             showDialog(DIALOG_GET_DIRNAME);
-            break;
+            break;*/
         default:
             throw new IllegalArgumentException("Wrong element clicked");
         }