diff options
author | Aidan Follestad <drummer.aidan@gmail.com> | 2016-02-03 18:23:02 -0600 |
---|---|---|
committer | Aidan Follestad <drummer.aidan@gmail.com> | 2016-02-03 18:23:02 -0600 |
commit | 82c8f1c0998f69b3107ac6c92c0a8f544118332d (patch) | |
tree | 63e3442e9f4b0d061ca2abe0c7db420ba68d4dfe | |
parent | 6546e6c13e74517114b6046ae8490a56f0af834f (diff) | |
parent | ffe972a07593b41d5392e1f9269d6eb5cdcde9ba (diff) | |
download | afollestad-82c8f1c0998f69b3107ac6c92c0a8f544118332d.tar.gz |
Merge branch 'master' of github.com:afollestad/material-dialogs
11 files changed, 22 insertions, 10 deletions
diff --git a/LICENSE.txt b/LICENSE.txt index f6bf779..e14e349 100644 --- a/LICENSE.txt +++ b/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 @@ -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 diff --git a/core/src/main/java/com/afollestad/materialdialogs/DialogInit.java b/core/src/main/java/com/afollestad/materialdialogs/DialogInit.java index 5d643de..24043ca 100644 --- a/core/src/main/java/com/afollestad/materialdialogs/DialogInit.java +++ b/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) { diff --git a/core/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java b/core/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java index f46eadd..a9f0b8c 100644 --- a/core/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java +++ b/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 diff --git a/core/src/main/res/layout-ldrtl/md_listitem_multichoice.xml b/core/src/main/res/layout-ldrtl/md_listitem_multichoice.xml index e2afe4d..3344c48 100644 --- a/core/src/main/res/layout-ldrtl/md_listitem_multichoice.xml +++ b/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" diff --git a/core/src/main/res/layout-ldrtl/md_listitem_singlechoice.xml b/core/src/main/res/layout-ldrtl/md_listitem_singlechoice.xml index 157fb1c..742bdd5 100644 --- a/core/src/main/res/layout-ldrtl/md_listitem_singlechoice.xml +++ b/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" diff --git a/core/src/main/res/layout-v14/md_stub_progress_indeterminate.xml b/core/src/main/res/layout-v14/md_stub_progress_indeterminate.xml index 199abdd..3fe4dc5 100644 --- a/core/src/main/res/layout-v14/md_stub_progress_indeterminate.xml +++ b/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" /> diff --git a/core/src/main/res/layout/md_listitem_multichoice.xml b/core/src/main/res/layout/md_listitem_multichoice.xml index 915a9b7..d0fce8e 100644 --- a/core/src/main/res/layout/md_listitem_multichoice.xml +++ b/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" /> diff --git a/core/src/main/res/layout/md_listitem_singlechoice.xml b/core/src/main/res/layout/md_listitem_singlechoice.xml index d020656..9614acd 100644 --- a/core/src/main/res/layout/md_listitem_singlechoice.xml +++ b/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" diff --git a/core/src/main/res/layout/md_stub_progress_indeterminate.xml b/core/src/main/res/layout/md_stub_progress_indeterminate.xml index b4a3e9f..48ede34 100644 --- a/core/src/main/res/layout/md_stub_progress_indeterminate.xml +++ b/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" /> diff --git a/sample/src/main/java/com/afollestad/materialdialogssample/MainActivity.java b/sample/src/main/java/com/afollestad/materialdialogssample/MainActivity.java index cb875ee..002f1bf 100644 --- a/sample/src/main/java/com/afollestad/materialdialogssample/MainActivity.java +++ b/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(); } } } |