Fixed crash when sending nothing to the Uploader activity; slightly more prettier UI
authorDavid A. Velasco <dvelasco@solidgear.es>
Wed, 22 Aug 2012 11:53:03 +0000 (13:53 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Wed, 22 Aug 2012 11:53:03 +0000 (13:53 +0200)
res/layout/uploader_list_item_layout.xml
res/values/strings.xml
src/com/owncloud/android/Uploader.java

index 12ac1ed..a5688e0 100644 (file)
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
  -->
 <LinearLayout
   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>
 </LinearLayout>
index 89e749f..750f460 100644 (file)
@@ -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_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>
     <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>
index c3414b3..6f650d7 100644 (file)
@@ -85,7 +85,7 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
     private final static int DIALOG_WAITING = 1;\r
     private final static int DIALOG_NO_STREAM = 2;\r
     private final static int DIALOG_MULTIPLE_ACCOUNT = 3;\r
     private final static int DIALOG_WAITING = 1;\r
     private final static int DIALOG_NO_STREAM = 2;\r
     private final static int DIALOG_MULTIPLE_ACCOUNT = 3;\r
-    private final static int DIALOG_GET_DIRNAME = 4;\r
+    //private final static int DIALOG_GET_DIRNAME = 4;\r
 \r
     private final static int REQUEST_CODE_SETUP_ACCOUNT = 0;\r
 \r
 \r
     private final static int REQUEST_CODE_SETUP_ACCOUNT = 0;\r
 \r
@@ -107,7 +107,6 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
                 showDialog(DIALOG_MULTIPLE_ACCOUNT);\r
             } else {\r
                 mAccount = accounts[0];\r
                 showDialog(DIALOG_MULTIPLE_ACCOUNT);\r
             } else {\r
                 mAccount = accounts[0];\r
-                setContentView(R.layout.uploader_layout);\r
                 mStorageManager = new FileDataStorageManager(mAccount, getContentResolver());\r
                 populateDirectoryList();\r
             }\r
                 mStorageManager = new FileDataStorageManager(mAccount, getContentResolver());\r
                 populateDirectoryList();\r
             }\r
@@ -202,6 +201,17 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
                 }\r
             });\r
             return builder.create();\r
                 }\r
             });\r
             return builder.create();\r
+        case DIALOG_NO_STREAM:\r
+            builder.setIcon(android.R.drawable.ic_dialog_alert);\r
+            builder.setTitle(R.string.uploader_wrn_no_content_title);\r
+            builder.setMessage(R.string.uploader_wrn_no_content_text);\r
+            builder.setCancelable(false);\r
+            builder.setNegativeButton(R.string.common_cancel, new OnClickListener() {\r
+                public void onClick(DialogInterface dialog, int which) {\r
+                    finish();\r
+                }\r
+            });\r
+            return builder.create();\r
         default:\r
             throw new IllegalArgumentException("Unknown dialog id: " + id);\r
         }\r
         default:\r
             throw new IllegalArgumentException("Unknown dialog id: " + id);\r
         }\r
@@ -264,9 +274,9 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
             uploadFiles();\r
 \r
             break;\r
             uploadFiles();\r
 \r
             break;\r
-        case android.R.id.button1: // dynamic action for create aditional dir\r
+        /*case android.R.id.button1: // dynamic action for create aditional dir\r
             showDialog(DIALOG_GET_DIRNAME);\r
             showDialog(DIALOG_GET_DIRNAME);\r
-            break;\r
+            break;*/\r
         default:\r
             throw new IllegalArgumentException("Wrong element clicked");\r
         }\r
         default:\r
             throw new IllegalArgumentException("Wrong element clicked");\r
         }\r