Browse Source

Switch to Bintray release, resolves #1501

Aidan Follestad 7 years ago
parent
commit
1e60f6911c

+ 2 - 1
build.gradle

@@ -9,7 +9,8 @@ buildscript {
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:' + versions.gradlePlugin
-        classpath "com.diffplug.spotless:spotless-plugin-gradle:" + versions.spotlessPlugin
+        classpath 'com.diffplug.spotless:spotless-plugin-gradle:' + versions.spotlessPlugin
+        classpath 'com.novoda:bintray-release:' + versions.bintrayRelease
     }
 }
 

+ 8 - 7
commons/build.gradle

@@ -1,11 +1,6 @@
 apply plugin: 'com.android.library'
 apply from: '../dependencies.gradle'
-
-ext {
-    PUBLISH_GROUP_ID = 'com.afollestad.material-dialogs'
-    PUBLISH_ARTIFACT_ID = 'commons'
-    PUBLISH_VERSION = versions.publishVersion
-}
+apply plugin: 'com.novoda.bintray-release'
 
 android {
     compileSdkVersion versions.compileSdk
@@ -37,4 +32,10 @@ dependencies {
     implementation project(':core')
 }
 
-apply from: 'https://raw.githubusercontent.com/afollestad/aidanfollestad.com/master/android-lib-release.gradle'
+publish {
+    userOrg = 'novoda'
+    groupId = 'com.afollestad.material-dialogs'
+    artifactId = 'commons'
+    publishVersion = versions.publishVersion
+    website = 'https://github.com/afollestad/material-dialogs'
+}

+ 8 - 7
core/build.gradle

@@ -1,11 +1,6 @@
 apply plugin: 'com.android.library'
 apply from: '../dependencies.gradle'
-
-ext {
-    PUBLISH_GROUP_ID = 'com.afollestad.material-dialogs'
-    PUBLISH_ARTIFACT_ID = 'core'
-    PUBLISH_VERSION = versions.publishVersion
-}
+apply plugin: 'com.novoda.bintray-release'
 
 android {
     compileSdkVersion versions.compileSdk
@@ -38,4 +33,10 @@ dependencies {
     implementation 'me.zhanghai.android.materialprogressbar:library:' + versions.mdProgressBar
 }
 
-apply from: 'https://raw.githubusercontent.com/afollestad/aidanfollestad.com/master/android-lib-release.gradle'
+publish {
+    userOrg = 'novoda'
+    groupId = 'com.afollestad.material-dialogs'
+    artifactId = 'core'
+    publishVersion = versions.publishVersion
+    website = 'https://github.com/afollestad/material-dialogs'
+}

+ 7 - 0
core/src/main/java/com/afollestad/materialdialogs/internal/MDRootLayout.java

@@ -16,6 +16,7 @@ import android.view.ViewGroup;
 import android.view.ViewTreeObserver;
 import android.webkit.WebView;
 import android.widget.AdapterView;
+import android.widget.CheckBox;
 import android.widget.ScrollView;
 import com.afollestad.materialdialogs.GravityEnum;
 import com.afollestad.materialdialogs.R;
@@ -36,6 +37,7 @@ public class MDRootLayout extends ViewGroup {
   private int maxHeight;
   private View titleBar;
   private View content;
+  private CheckBox checkPrompt;
   private boolean drawTopDivider = false;
   private boolean drawBottomDivider = false;
   private StackingBehavior stackBehavior = StackingBehavior.ADAPTIVE;
@@ -212,6 +214,8 @@ public class MDRootLayout extends ViewGroup {
         buttons[INDEX_NEGATIVE] = (MDButton) v;
       } else if (v.getId() == R.id.md_buttonDefaultPositive) {
         buttons[INDEX_POSITIVE] = (MDButton) v;
+      } else if (v.getId() == R.id.md_promptCheckbox) {
+        checkPrompt = (CheckBox) v;
       } else {
         content = v;
       }
@@ -325,6 +329,9 @@ public class MDRootLayout extends ViewGroup {
 
       if (drawBottomDivider) {
         int y = content.getBottom();
+        if (checkPrompt != null && checkPrompt.getVisibility() == View.GONE) {
+          y = checkPrompt.getTop();
+        }
         canvas.drawRect(0, y, getMeasuredWidth(), y + dividerWidth, dividerPaint);
       }
     }

+ 42 - 41
core/src/main/res/layout/md_dialog_list_check.xml

@@ -1,63 +1,64 @@
 <com.afollestad.materialdialogs.internal.MDRootLayout
-  xmlns:android="http://schemas.android.com/apk/res/android"
-  xmlns:tools="http://schemas.android.com/tools"
-  android:layout_width="match_parent"
-  android:layout_height="wrap_content"
-  android:orientation="vertical">
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
 
   <include layout="@layout/md_stub_titleframe_lesspadding"/>
 
   <LinearLayout
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical">
-
-    <ScrollView
-      android:id="@+id/md_contentScrollView"
       android:layout_width="match_parent"
-      android:layout_height="wrap_content"
-      android:clipToPadding="false">
+      android:layout_height="match_parent"
+      android:orientation="vertical">
 
-      <TextView
-        android:id="@+id/md_content"
+    <ScrollView
+        android:id="@+id/md_contentScrollView"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:paddingBottom="@dimen/md_content_padding_bottom"
-        android:paddingLeft="@dimen/md_dialog_frame_margin"
-        android:paddingRight="@dimen/md_dialog_frame_margin"
-        android:paddingTop="@dimen/md_content_padding_top"
-        android:textSize="@dimen/md_content_textsize"
-        tools:text="Content"/>
+        android:clipToPadding="false">
+
+      <TextView
+          android:id="@+id/md_content"
+          android:layout_width="match_parent"
+          android:layout_height="wrap_content"
+          android:paddingBottom="@dimen/md_content_padding_bottom"
+          android:paddingLeft="@dimen/md_dialog_frame_margin"
+          android:paddingRight="@dimen/md_dialog_frame_margin"
+          android:paddingTop="@dimen/md_content_padding_top"
+          android:textSize="@dimen/md_content_textsize"
+          tools:text="Content"/>
 
     </ScrollView>
 
     <FrameLayout
-      android:id="@+id/md_contentListViewFrame"
-      android:layout_width="match_parent"
-      android:layout_height="wrap_content">
+        android:id="@+id/md_contentListViewFrame"
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1">
 
       <android.support.v7.widget.RecyclerView
-        android:id="@+id/md_contentRecyclerView"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:clipToPadding="false"
-        android:paddingBottom="@dimen/md_content_padding_bottom"
-        android:paddingTop="@dimen/md_content_padding_top"
-        android:scrollbarStyle="outsideOverlay"
-        android:scrollbars="vertical"/>
+          android:id="@+id/md_contentRecyclerView"
+          android:layout_width="match_parent"
+          android:layout_height="wrap_content"
+          android:clipToPadding="false"
+          android:paddingBottom="@dimen/md_content_padding_bottom"
+          android:paddingTop="@dimen/md_content_padding_top"
+          android:scrollbarStyle="outsideOverlay"
+          android:scrollbars="vertical"/>
 
     </FrameLayout>
 
     <CheckBox
-      android:id="@+id/md_promptCheckbox"
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:layout_gravity="start"
-      android:layout_marginLeft="@dimen/md_notitle_vertical_padding"
-      android:layout_marginRight="@dimen/md_notitle_vertical_padding"
-      android:focusable="true"
-      android:gravity="start|center_vertical"
-      tools:text="Don't ask again"/>
+        android:id="@+id/md_promptCheckbox"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="start"
+        android:layout_marginLeft="@dimen/md_notitle_vertical_padding"
+        android:layout_marginRight="@dimen/md_notitle_vertical_padding"
+        android:focusable="true"
+        android:gravity="start|center_vertical"
+        tools:text="Don't ask again"/>
 
   </LinearLayout>
 

+ 1 - 0
dependencies.gradle

@@ -7,6 +7,7 @@ ext.versions = [
         gradlePlugin      : '3.0.1',
         spotlessPlugin    : '3.6.0',
         findBugs          : '3.0.2',
+        bintrayRelease    : '0.8.0',
 
         supportLib        : '27.0.2',
         mdProgressBar     : '1.4.2',

+ 14 - 11
sample/src/main/java/com/afollestad/materialdialogssample/MainActivity.java

@@ -25,7 +25,8 @@ import android.view.View;
 import android.widget.CheckBox;
 import android.widget.EditText;
 import android.widget.Toast;
-
+import butterknife.ButterKnife;
+import butterknife.OnClick;
 import com.afollestad.materialdialogs.DialogAction;
 import com.afollestad.materialdialogs.GravityEnum;
 import com.afollestad.materialdialogs.MaterialDialog;
@@ -40,12 +41,8 @@ import com.afollestad.materialdialogs.internal.ThemeSingleton;
 import com.afollestad.materialdialogs.simplelist.MaterialSimpleListAdapter;
 import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem;
 import com.afollestad.materialdialogs.util.DialogUtils;
-
 import java.io.File;
 
-import butterknife.ButterKnife;
-import butterknife.OnClick;
-
 /** @author Aidan Follestad (afollestad) */
 public class MainActivity extends AppCompatActivity
     implements FolderChooserDialog.FolderCallback,
@@ -246,8 +243,10 @@ public class MainActivity extends AppCompatActivity
   public void showListCheckPrompt() {
     new MaterialDialog.Builder(this)
         .title(R.string.socialNetworks)
-        .items(R.array.socialNetworks)
-        .itemsCallback((dialog, view, which, text) -> showToast(which + ": " + text))
+        .items(R.array.states)
+        .itemsCallback(
+            (dialog, view, which, text) ->
+                showToast(which + ": " + text + ", prompt: " + dialog.isPromptCheckBoxChecked()))
         .checkBoxPromptRes(R.string.example_prompt, true, null)
         .negativeText(android.R.string.cancel)
         .show();
@@ -348,14 +347,16 @@ public class MainActivity extends AppCompatActivity
             (dialog, which, text) -> {
               boolean allowSelectionChange =
                   which.length
-                      <= 2; // limit selection to 2, the new (un)selection is included in the which array
+                      <= 2; // limit selection to 2, the new (un)selection is included in the which
+              // array
               if (!allowSelectionChange) {
                 showToast(R.string.selection_limit_reached);
               }
               return allowSelectionChange;
             })
         .positiveText(R.string.dismiss)
-        .alwaysCallMultiChoiceCallback() // the callback will always be called, to check if (un)selection is still allowed
+        .alwaysCallMultiChoiceCallback() // the callback will always be called, to check if
+        // (un)selection is still allowed
         .show();
   }
 
@@ -369,14 +370,16 @@ public class MainActivity extends AppCompatActivity
             (dialog, which, text) -> {
               boolean allowSelectionChange =
                   which.length
-                      >= 1; // selection count must stay above 1, the new (un)selection is included in the which array
+                      >= 1; // selection count must stay above 1, the new (un)selection is included
+              // in the which array
               if (!allowSelectionChange) {
                 showToast(R.string.selection_min_limit_reached);
               }
               return allowSelectionChange;
             })
         .positiveText(R.string.dismiss)
-        .alwaysCallMultiChoiceCallback() // the callback will always be called, to check if (un)selection is still allowed
+        .alwaysCallMultiChoiceCallback() // the callback will always be called, to check if
+        // (un)selection is still allowed
         .show();
   }