OSDN Git Service

Move Gallery2 to androidx.
[android-x86/packages-apps-Gallery2.git] / src / com / android / gallery3d / filtershow / ui / ExportDialog.java
index f6a84ce..9f726b4 100644 (file)
@@ -22,7 +22,7 @@ import android.graphics.Rect;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
-import android.support.v4.app.DialogFragment;
+import androidx.fragment.app.DialogFragment;
 import android.text.Editable;
 import android.text.TextWatcher;
 import android.view.LayoutInflater;
@@ -202,8 +202,8 @@ public class ExportDialog extends DialogFragment implements View.OnClickListener
             return;
         }
         mEditing = true;
-        int width = 0;
-        int height = 0;
+        int width = 1;
+        int height = 1;
         if (text.getId() == R.id.editableWidth) {
             if (mWidthText.getText() != null) {
                 String value = String.valueOf(mWidthText.getText());
@@ -213,6 +213,10 @@ public class ExportDialog extends DialogFragment implements View.OnClickListener
                         width = mOriginalBounds.width();
                         mWidthText.setText("" + width);
                     }
+                    if (width <= 0) {
+                        width = (int) Math.ceil(mRatio);
+                        mWidthText.setText("" + width);
+                    }
                     height = (int) (width / mRatio);
                 }
                 mHeightText.setText("" + height);
@@ -226,6 +230,10 @@ public class ExportDialog extends DialogFragment implements View.OnClickListener
                         height = mOriginalBounds.height();
                         mHeightText.setText("" + height);
                     }
+                    if (height <= 0) {
+                        height = 1;
+                        mHeightText.setText("" + height);
+                    }
                     width = (int) (height * mRatio);
                 }
                 mWidthText.setText("" + width);