Fix export dialog UI

bug:10889576
bug:10712083

Change-Id: I7921c06365775625a85e3d0a997d844c42586b01
diff --git a/res/layout/filtershow_export_dialog.xml b/res/layout/filtershow_export_dialog.xml
index bfa302d..4e13f39 100644
--- a/res/layout/filtershow_export_dialog.xml
+++ b/res/layout/filtershow_export_dialog.xml
@@ -40,7 +40,8 @@
 
         <TextView
                 android:text="@string/size"
-                android:layout_gravity="right|center_vertical"/>
+                android:layout_marginLeft="8dp"
+                android:layout_gravity="start|center_vertical"/>
 
         <EditText
                 android:id="@+id/editableWidth"
@@ -60,27 +61,41 @@
 
         <TextView
                 android:id="@+id/estimadedSize"
-                android:layout_gravity="center"/>
+                android:layout_marginRight="8dp"
+                android:layout_gravity="end|center_vertical"/>
 
-        <TextView
+        <LinearLayout
+                android:layout_columnSpan="5"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+
+            <TextView
                 android:text="@string/quality"
-                android:layout_margin="7dp"
-                android:layout_gravity="right|center_vertical" />
+                android:layout_width="wrap_content"
+                android:layout_height="fill_parent"
+                android:layout_margin="8dp" />
 
-        <SeekBar
+            <SeekBar
                 android:id="@+id/qualitySeekBar"
-                android:layout_margin="7dp"
+                android:layout_margin="8dp"
                 android:layout_gravity="center"
                 android:max="100"
                 android:progress="100"
-                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_width="0dp"
+                android:layout_weight="1"
                 android:layout_columnSpan="3"
-                android:minWidth="250dp"/>
+                android:minWidth="250dp" />
 
-        <TextView
+            <TextView
                 android:id="@+id/qualityTextView"
-                android:layout_margin="7dp"
-                android:layout_gravity="left|center_vertical"/>
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_margin="8dp"
+                android:layout_gravity="end|center_vertical" />
+
+        </LinearLayout>
+
 
     </GridLayout>
 
diff --git a/src/com/android/gallery3d/filtershow/ui/ExportDialog.java b/src/com/android/gallery3d/filtershow/ui/ExportDialog.java
index 7e0d107..2edd55c 100644
--- a/src/com/android/gallery3d/filtershow/ui/ExportDialog.java
+++ b/src/com/android/gallery3d/filtershow/ui/ExportDialog.java
@@ -170,6 +170,9 @@
 
     public void updateCompressionFactor() {
         Bitmap bitmap = MasterImage.getImage().getFilteredImage();
+        if (bitmap == null) {
+            return;
+        }
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         bitmap.compress(Bitmap.CompressFormat.JPEG, mQuality, out);
         mCompressedSize = out.size();