diff --git a/.buildscript/deploy_snapshot.sh b/.buildscript/deploy_snapshot.sh new file mode 100755 index 0000000..5d1e15b --- /dev/null +++ b/.buildscript/deploy_snapshot.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# Deploy a jar, source jar, and javadoc jar to Sonatype's snapshot repo. +# +# Adapted from https://coderwall.com/p/9b_lfq and +# http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/ + +SLUG="fengdai/AlertDialogPro" +JDK="oraclejdk8" +BRANCH="master" + +set -e + +if [ "$TRAVIS_REPO_SLUG" != "$SLUG" ]; then + echo "Skipping snapshot deployment: wrong repository. Expected '$SLUG' but was '$TRAVIS_REPO_SLUG'." +elif [ "$TRAVIS_JDK_VERSION" != "$JDK" ]; then + echo "Skipping snapshot deployment: wrong JDK. Expected '$JDK' but was '$TRAVIS_JDK_VERSION'." +elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + echo "Skipping snapshot deployment: was pull request." +elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then + echo "Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'." +else + echo "Deploying snapshot..." + ./gradlew clean uploadArchives + echo "Snapshot deployed!" +fi diff --git a/.travis.yml b/.travis.yml index c30f46d..afc9925 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,12 +2,29 @@ language: android android: components: - - build-tools-21.0.0 - - android-21 - - extra + - android-23 + - build-tools-23.0.1 + - extra-android-m2repository + +licenses: + - android-sdk-license-5be876d5 + +jdk: + - oraclejdk8 + +after_success: + - .buildscript/deploy_snapshot.sh + +env: + global: + - secure: "VQg2/lK4JyCM/HJXec7qTnDeYDgMpIOhXChBMNU+TIHdAm+nQFQ26dOpXqv5VH8/NNoHNQ0Lm3xy5mUnOWqZgbJLsPbqmXM86wOqqp/Iegqtj7uOiUjSxRXbnk+iHTk/T/YojGzRxVVudCz6D/uaEkHppid7454CH8hj7Pz+hWU=" + - secure: "Pd7uLJkxNfG/YcUxZlA4uOC7+MCrLZb9bKoHJxfRe8LajTCspF7pxihGj30ZFsLFpRHEU1JjZ3vXLYFJM4YzlQ6s7SV2TaiUAuFxUy3JdkBlOEo8pf08XEwWI/gDAxe5yHQNclSPWW90KsvpcEV23H2+Vn34CWJ2ssceGwfRc9o=" notifications: email: false -script: - ./gradlew clean build \ No newline at end of file +sudo: false + +cache: + directories: + - $HOME/.gradle diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2fb8325 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,25 @@ +# Change Log +#### v0.2.6 +* Upgrade to AppCompat 23.1.1 + +#### v0.2.5 +* Upgrade to AppCompat 23.1.0 + +#### v0.2.4 +* Upgrade to AppCompat 23.0.0 + +#### v0.2.3 +* Add support for AppCompat 22.1.0 + +#### v0.2.2 +* Fix issue [#45](https://github.com/fengdai/AlertDialogPro/issues/45) + +#### v0.2.1 +* Workaround for issue [#17](https://github.com/fengdai/AlertDialogPro/issues/17) + +#### v0.2.0 +* Add ProgressDialogPro +* Fix bug of CheckedTextedView [#30](https://github.com/fengdai/AlertDialogPro/issues/30) + +#### v0.1.0 +* Initial version diff --git a/README.md b/README.md index 7993ab6..b2a0cc7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ [![Build Status](https://travis-ci.org/fengdai/AlertDialogPro.svg?branch=master)](https://travis-ci.org/fengdai/AlertDialogPro) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AlertDialogPro-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1178) -#AlertDialogPro +# Deprecated + +Please use `android.support.v7.app.AlertDialog` of support-v7. + +# AlertDialogPro Why AlertDialogPro? @@ -12,29 +16,29 @@ Theming Android's AlertDialog is not an easy thing. Because some of its attribut ![flavored-mtrl-light](https://github.com/fengdai/AlertDialogPro/raw/master/image/flavored_material_light.png) ![mtrl-dark](https://github.com/fengdai/AlertDialogPro/raw/master/image/material_dark_dialog_only.png) -#Structure +# Structure -###alertdialogpro-core +### alertdialogpro-core Contains core codes for building an AlertDialogPro. Most of it's codes are ported from the latest Android Platform. It doesn't contain any resource file. If you want to implement a brand new theme, use this project directly. Otherwise, you should use alertdialogpro-theme-material or alertdialogpro-theme-holo. -###alertdialogpro-theme-material +### alertdialogpro-theme-material Based on alertdialogpro-core, gives AlertDialogPro a Material theme. -###alertdialogpro-theme-holo (Obsolete) +### alertdialogpro-theme-holo (Obsolete) Also based on alertdialogpro-core, gives AlertDialogPro a Holo theme. -#Quick Start +# Quick Start Take **alertdialogpro-theme-material** for example. -###Download +### Download -Grab [latest version](#Current Version) via Gradle: +Grab latest version via Gradle: ```groovy dependencies { - compile 'com.github.fengdai:alertdialogpro-theme-material:(latest version)' + compile 'com.github.fengdai:alertdialogpro-theme-material:0.2.6' } ``` @@ -43,11 +47,11 @@ or Maven: com.github.fengdai alertdialogpro-theme-material - (latest version) + 0.2.6 ``` -###Specify AlertDialogPro's theme +### Specify AlertDialogPro's theme In your app's xml file, use attribute ```alertDialogProTheme``` to specify your AlertDialogPro's theme. **alertdialogpro-theme-material** contains two built-in theme: ```Theme.AlertDialogPro.Material``` and ```Theme.AlertDialogPro.Material.Light```. Here, we use the light version: ```xml @@ -57,7 +61,7 @@ In your app's xml file, use attribute ```alertDialogProTheme``` to specify your ``` -###Build an AlertDialogPro +### Build an AlertDialogPro Use ```AlertDialogPro.Builder``` to build an AlertDialogPro: ```java @@ -72,7 +76,7 @@ builder.setIcon(R.drawable.icon). ``` With the example codes above, you can create an AlertDialogPro which has an icon, a title, a message body and three option buttons. Look into the [sample](https://github.com/fengdai/AlertDialogPro/blob/master/alertdialogpro-demo/src/main/java/com/alertdialogpro/demo/MainActivity.java) to see more usages. -###Flavor built-in themes +### Flavor built-in themes Built-in themes can't meet your requirement? There are [several attributes](https://github.com/fengdai/AlertDialogPro/blob/master/alertdialogpro-core/src/main/res/values/adp_core_attrs.xml) that you can use to make some slight changes. Here is an example to show how to change the positive button's color: @@ -97,7 +101,7 @@ Built-in themes can't meet your requirement? There are [several attributes](http Look into [here](https://github.com/fengdai/AlertDialogPro/blob/master/alertdialogpro-core/src/main/res/values/adp_core_attrs.xml) to see all attributes. -###Advanced customization +### Advanced customization You can specify your own layout to AlertDialogPro. This can be very useful when you want to use custom views or you want a special dialog layout. Remember to keep your views' ids consistant with [AlertDialogPro's ids](https://github.com/fengdai/AlertDialogPro/blob/master/alertdialogpro-core/src/main/res/values/adp_core_ids.xml). 1. Define your AlertDialogPro's style: @@ -128,33 +132,23 @@ You can specify your own layout to AlertDialogPro. This can be very useful when @style/YourAlertDialogProTheme ``` -#Migrate From AlertDialog +# Migrate From AlertDialog AlertDialogPro's Java API is exactly the same as [AlertDialog's](http://developer.android.com/reference/android/app/AlertDialog.Builder.html). In fact, most of AlertDialogPro's codes are ported from the latest AlertDialog. So the only thing you need to do in your Java codes is replacing ```AlertDialog.Builder``` with ```AlertDialogPro.Builder```. -#Current Version -Version 0.2.0 - -#Change Log -####v0.2.0 -* Add ProgressDialogPro -* Fix bug of CheckedTextedView #30 - -####v0.1.0 -* Initial version - -#Requirements +# Requirements AlertDialogPro requires at minimum Android 2.1 (API level 7). -#Thanks +# Thanks * This project contains some code ported from The Android Open Source Project. [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) * Thank [vbauer](https://github.com/vbauer) and his awesome site [Android-Arsenal](https://android-arsenal.com/) -#License +# License - Copyright 2014 Feng Dai + Copyright (C) 2014 Feng Dai + Copyright (C) 2007 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/alertdialogpro-core/build.gradle b/alertdialogpro-core/build.gradle index 2bce612..b83dba2 100644 --- a/alertdialogpro-core/build.gradle +++ b/alertdialogpro-core/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' apply from: "$rootDir/android.gradle" dependencies { - compile 'com.android.support:appcompat-v7:21.0.2' + compile 'com.android.support:appcompat-v7:23.2.1' } apply from: "$rootDir/maven_push.gradle" diff --git a/alertdialogpro-core/lint.xml b/alertdialogpro-core/lint.xml deleted file mode 100644 index ee0eead..0000000 --- a/alertdialogpro-core/lint.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/alertdialogpro-core/pom.xml b/alertdialogpro-core/pom.xml deleted file mode 100644 index 458a7a0..0000000 --- a/alertdialogpro-core/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - 4.0.0 - - - com.github.fengdai - alertdialogpro-parent - 0.2.0 - ../pom.xml - - - alertdialogpro-core - AlertDialogPro Core - aar - - - - android - android - provided - - - com.google.android.annotations - annotations - provided - - - com.android.support - appcompat-v7 - aar - - - - - - - com.simpligility.maven.plugins - android-maven-plugin - true - - - - diff --git a/alertdialogpro-core/src/main/AndroidManifest.xml b/alertdialogpro-core/src/main/AndroidManifest.xml index 879a8c2..03af7e1 100644 --- a/alertdialogpro-core/src/main/AndroidManifest.xml +++ b/alertdialogpro-core/src/main/AndroidManifest.xml @@ -1,5 +1,2 @@ - - - - \ No newline at end of file + + diff --git a/alertdialogpro-core/src/main/java/com/alertdialogpro/AlertDialogPro.java b/alertdialogpro-core/src/main/java/com/alertdialogpro/AlertDialogPro.java index 930d8fe..014c474 100644 --- a/alertdialogpro-core/src/main/java/com/alertdialogpro/AlertDialogPro.java +++ b/alertdialogpro-core/src/main/java/com/alertdialogpro/AlertDialogPro.java @@ -42,13 +42,13 @@ static int resolveDialogTheme(Context context, int resid) { } /** - * Gets one of the buttons used in the dialog. - *

- * If a button does not exist in the dialog, null will be returned. + * Gets one of the buttons used in the dialog. Returns null if the specified + * button does not exist or the dialog has not yet been fully created (for + * example, via {@link #show()} or {@link #create()}). * * @param whichButton The identifier of the button that should be returned. - * For example, this can be - * {@link DialogInterface#BUTTON_POSITIVE}. + * For example, this can be + * {@link DialogInterface#BUTTON_POSITIVE}. * @return The button from the dialog, or null if a button does not exist. */ public Button getButton(int whichButton) { @@ -398,16 +398,16 @@ public Builder setCancelable(boolean cancelable) { /** * Sets the callback that will be called if the dialog is canceled. - *

+ * *

Even in a cancelable dialog, the dialog may be dismissed for reasons other than * being canceled or one of the supplied choices being selected. * If you are interested in listening for all cases where the dialog is dismissed * and not just when it is canceled, see * {@link #setOnDismissListener(android.content.DialogInterface.OnDismissListener) setOnDismissListener}.

- * - * @return This Builder object to allow for chaining of calls to set methods * @see #setCancelable(boolean) * @see #setOnDismissListener(android.content.DialogInterface.OnDismissListener) + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setOnCancelListener(OnCancelListener onCancelListener) { P.mOnCancelListener = onCancelListener; diff --git a/alertdialogpro-core/src/main/res/values/adp_core_themes.xml b/alertdialogpro-core/src/main/res/values/adp_core_themes.xml index 9818cac..8757945 100644 --- a/alertdialogpro-core/src/main/res/values/adp_core_themes.xml +++ b/alertdialogpro-core/src/main/res/values/adp_core_themes.xml @@ -1,7 +1,7 @@ - +