Selaa lähdekoodia

Merge branch 'master' of github.com:afollestad/material-dialogs

Aidan Follestad 9 vuotta sitten
vanhempi
commit
82c8f1c099

+ 1 - 1
LICENSE.txt

@@ -1,6 +1,6 @@
 The MIT License (MIT)
 
-Copyright (c) 2015 Aidan Michael Follestad
+Copyright (c) 2014-2016 Aidan Michael Follestad
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal

+ 2 - 2
README.md

@@ -72,9 +72,9 @@ You can download the latest sample APK from this repo here: https://github.com/a
 
 It's also on Google Play:
 
-<a href="https://play.google.com/store/apps/details?id=com.afollestad.materialdialogssample">
+<a href="https://play.google.com/store/apps/details?id=com.afollestad.materialdialogssample" target="_blank">
   <img alt="Get it on Google Play"
-       src="https://developer.android.com/images/brand/en_generic_rgb_wo_60.png" />
+       src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png" height="60"/>
 </a>
 
 Having the sample project installed is a good way to be notified of new releases. Although Watching this 

+ 1 - 1
core/src/main/java/com/afollestad/materialdialogs/DialogInit.java

@@ -74,7 +74,7 @@ class DialogInit {
 
         // Set cancelable flag and dialog background color
         dialog.setCancelable(builder.cancelable);
-        dialog.setCanceledOnTouchOutside(builder.cancelable);
+        dialog.setCanceledOnTouchOutside(builder.canceledOnTouchOutside);
         if (builder.backgroundColor == 0)
             builder.backgroundColor = DialogUtils.resolveColor(builder.context, R.attr.md_background_color);
         if (builder.backgroundColor != 0) {

+ 6 - 0
core/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java

@@ -404,6 +404,7 @@ public class MaterialDialog extends DialogBase implements
         protected boolean alwaysCallSingleChoiceCallback = false;
         protected Theme theme = Theme.LIGHT;
         protected boolean cancelable = true;
+        protected boolean canceledOnTouchOutside = true;
         protected float contentLineSpacingMultiplier = 1.2f;
         protected int selectedIndex = -1;
         protected Integer[] selectedIndices = null;
@@ -1162,6 +1163,11 @@ public class MaterialDialog extends DialogBase implements
             return this;
         }
 
+        public Builder canceledOnTouchOutside(boolean canceledOnTouchOutside) {
+            this.canceledOnTouchOutside = canceledOnTouchOutside;
+            return this;
+        }
+
         /**
          * This defaults to true. If set to false, the dialog will not automatically be dismissed
          * when an action button is pressed, and not automatically dismissed when the user selects

+ 1 - 0
core/src/main/res/layout-ldrtl/md_listitem_multichoice.xml

@@ -29,6 +29,7 @@
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
         android:button="@drawable/abc_btn_check_material"
+        android:background="@null"
         android:clickable="false"
         android:focusable="false"
         android:focusableInTouchMode="false"

+ 1 - 0
core/src/main/res/layout-ldrtl/md_listitem_singlechoice.xml

@@ -29,6 +29,7 @@
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
         android:button="@drawable/abc_btn_radio_material"
+        android:background="@null"
         android:clickable="false"
         android:focusable="false"
         android:focusableInTouchMode="false"

+ 1 - 1
core/src/main/res/layout-v14/md_stub_progress_indeterminate.xml

@@ -26,7 +26,7 @@
         android:paddingLeft="16dp"
         android:paddingStart="16dp"
         android:textAlignment="viewStart"
-        android:textSize="16sp"
+        android:textSize="@dimen/md_content_textsize"
         tools:ignore="NewApi,RtlSymmetry,UnusedAttribute"
         tools:text="Message" />
 

+ 1 - 0
core/src/main/res/layout/md_listitem_multichoice.xml

@@ -17,6 +17,7 @@
         android:layout_height="match_parent"
         android:clickable="false"
         android:button="@drawable/abc_btn_check_material"
+        android:background="@null"
         android:focusable="false"
         android:focusableInTouchMode="false"
         android:gravity="center_vertical" />

+ 1 - 0
core/src/main/res/layout/md_listitem_singlechoice.xml

@@ -16,6 +16,7 @@
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
         android:button="@drawable/abc_btn_radio_material"
+        android:background="@null"
         android:clickable="false"
         android:focusable="false"
         android:focusableInTouchMode="false"

+ 1 - 1
core/src/main/res/layout/md_stub_progress_indeterminate.xml

@@ -25,7 +25,7 @@
         android:paddingLeft="16dp"
         android:paddingStart="16dp"
         android:textAlignment="viewStart"
-        android:textSize="16sp"
+        android:textSize="@dimen/md_content_textsize"
         tools:ignore="NewApi,RtlSymmetry,UnusedAttribute"
         tools:text="Message" />
 

+ 6 - 4
sample/src/main/java/com/afollestad/materialdialogssample/MainActivity.java

@@ -9,14 +9,12 @@ import android.graphics.Color;
 import android.graphics.drawable.ColorDrawable;
 import android.os.Build;
 import android.os.Bundle;
-import android.os.Environment;
 import android.os.Handler;
 import android.support.annotation.ColorInt;
 import android.support.annotation.NonNull;
 import android.support.annotation.StringRes;
 import android.support.v4.app.ActivityCompat;
 import android.support.v4.content.ContextCompat;
-import android.support.v4.os.EnvironmentCompat;
 import android.support.v7.app.AppCompatActivity;
 import android.text.Editable;
 import android.text.InputType;
@@ -70,6 +68,8 @@ public class MainActivity extends AppCompatActivity implements
     private final static int STORAGE_PERMISSION_RC = 69;
     private Handler mHandler;
 
+    private int chooserDialog;
+
     private void showToast(String message) {
         if (mToast != null) {
             mToast.cancel();
@@ -585,6 +585,7 @@ public class MainActivity extends AppCompatActivity implements
     @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
     @OnClick(R.id.file_chooser)
     public void showFileChooser() {
+        chooserDialog = R.id.file_chooser;
         if (ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
                 PackageManager.PERMISSION_GRANTED) {
             ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, STORAGE_PERMISSION_RC);
@@ -602,6 +603,7 @@ public class MainActivity extends AppCompatActivity implements
     @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
     @OnClick(R.id.folder_chooser)
     public void showFolderChooser() {
+        chooserDialog = R.id.folder_chooser;
         if (ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
                 PackageManager.PERMISSION_GRANTED) {
             ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, STORAGE_PERMISSION_RC);
@@ -755,11 +757,11 @@ public class MainActivity extends AppCompatActivity implements
                 mHandler.postDelayed(new Runnable() {
                     @Override
                     public void run() {
-                        findViewById(R.id.folder_chooser).performClick();
+                        findViewById(chooserDialog).performClick();
                     }
                 }, 1000);
             } else {
-                Toast.makeText(this, "The folder chooser will not work without permission to read external storage.", Toast.LENGTH_LONG).show();
+                Toast.makeText(this, "The folder or file chooser will not work without permission to read external storage.", Toast.LENGTH_LONG).show();
             }
         }
     }