diff --git a/app/build.gradle b/app/build.gradle index 2844f79..d25204d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.android.tools.build:gradle:3.2.1' } } @@ -20,14 +20,14 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 27 - buildToolsVersion '27.0.3' + compileSdkVersion 28 + buildToolsVersion '28.0.3' defaultConfig { applicationId "uk.co.markormesher.android_fab.app" minSdkVersion 14 - targetSdkVersion 27 + targetSdkVersion 28 versionCode properties['version_code'] versionName properties['version_name'] @@ -82,9 +82,8 @@ repositories { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.android.support:support-v4:27.1.1' - implementation 'com.android.support:design:27.1.1' - implementation 'com.android.support:appcompat-v7:27.1.1' + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'com.google.android.material:material:1.1.0-alpha03' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation project(':fab') } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index aeb5322..57628c5 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -13,7 +13,6 @@ -keepattributes *Annotation* -keep public class com.google.vending.licensing.ILicensingService -keep public class com.android.vending.licensing.ILicensingService --dontwarn android.support.** # hide warnings caused by Retrolamdba -dontwarn java.lang.invoke.* @@ -47,4 +46,4 @@ # keep line numbers intact -renamesourcefileattribute SourceFile --keepattributes SourceFile,LineNumberTable \ No newline at end of file +-keepattributes SourceFile,LineNumberTable diff --git a/app/src/main/kotlin/uk/co/markormesher/android_fab/app/DemoActivity.kt b/app/src/main/kotlin/uk/co/markormesher/android_fab/app/DemoActivity.kt index fb8b124..b52f8a6 100644 --- a/app/src/main/kotlin/uk/co/markormesher/android_fab/app/DemoActivity.kt +++ b/app/src/main/kotlin/uk/co/markormesher/android_fab/app/DemoActivity.kt @@ -3,15 +3,15 @@ package uk.co.markormesher.android_fab.app import android.content.Context import android.graphics.Typeface import android.os.* -import android.support.annotation.StringRes -import android.support.design.widget.Snackbar -import android.support.v7.app.AppCompatActivity import android.view.KeyEvent import android.view.Menu import android.view.MenuItem import android.view.MotionEvent import android.widget.TextView import android.widget.Toast +import androidx.annotation.StringRes +import androidx.appcompat.app.AppCompatActivity +import com.google.android.material.snackbar.Snackbar import kotlinx.android.synthetic.main.demo_activity.* import uk.co.markormesher.android_fab.FloatingActionButton import uk.co.markormesher.android_fab.SpeedDialMenuAdapter diff --git a/app/src/main/res/layout/demo_activity.xml b/app/src/main/res/layout/demo_activity.xml index 4afbce5..5a05f83 100644 --- a/app/src/main/res/layout/demo_activity.xml +++ b/app/src/main/res/layout/demo_activity.xml @@ -1,5 +1,5 @@ - - + diff --git a/build.gradle b/build.gradle index 84e7726..210a67c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.2.60' + ext.kotlin_version = '1.3.21' repositories { jcenter() @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.android.tools.build:gradle:3.2.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -21,6 +21,8 @@ allprojects { } } +apply plugin: "idea" + @SuppressWarnings("GroovyUnusedDeclaration") static def getSecrets() { try { diff --git a/fab/build.gradle b/fab/build.gradle index 893aa6b..74591ef 100644 --- a/fab/build.gradle +++ b/fab/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.2' + classpath 'com.android.tools.build:gradle:3.2.1' } } @@ -19,12 +19,12 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 27 - buildToolsVersion '27.0.3' + compileSdkVersion 28 + buildToolsVersion '28.0.3' defaultConfig { minSdkVersion 14 - targetSdkVersion 27 + targetSdkVersion 28 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } @@ -40,10 +40,9 @@ repositories { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.android.support:support-annotations:27.1.1' - implementation 'com.android.support:support-v4:27.1.1' - implementation 'com.android.support:design:27.1.1' - implementation 'com.android.support:cardview-v7:27.1.1' + implementation 'androidx.annotation:annotation:1.0.1' + implementation 'androidx.cardview:cardview:1.0.0' + implementation 'com.google.android.material:material:1.1.0-alpha03' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } @@ -87,14 +86,13 @@ task zipRelease(type: Zip) { archiveName "release-${properties['version_name']}.zip" } -task generateRelease << { - println "Release ${properties['version_name']} can be found at ${localReleaseDest}/" - println "Release ${properties['version_name']} zipped can be found ${buildDir}/release-${properties['version_name']}.zip" +task generateRelease(dependsOn: [uploadArchives, zipRelease]) { + doLast { + println "Release ${properties['version_name']} can be found at ${localReleaseDest}/" + println "Release ${properties['version_name']} zipped can be found ${buildDir}/release-${properties['version_name']}.zip" + } } -generateRelease.dependsOn(uploadArchives) -generateRelease.dependsOn(zipRelease) - artifacts { archives androidSourcesJar archives androidJavadocsJar diff --git a/fab/proguard-rules.pro b/fab/proguard-rules.pro index aeb5322..57628c5 100644 --- a/fab/proguard-rules.pro +++ b/fab/proguard-rules.pro @@ -13,7 +13,6 @@ -keepattributes *Annotation* -keep public class com.google.vending.licensing.ILicensingService -keep public class com.android.vending.licensing.ILicensingService --dontwarn android.support.** # hide warnings caused by Retrolamdba -dontwarn java.lang.invoke.* @@ -47,4 +46,4 @@ # keep line numbers intact -renamesourcefileattribute SourceFile --keepattributes SourceFile,LineNumberTable \ No newline at end of file +-keepattributes SourceFile,LineNumberTable diff --git a/fab/src/main/kotlin/uk/co/markormesher/android_fab/FloatingActionButton.kt b/fab/src/main/kotlin/uk/co/markormesher/android_fab/FloatingActionButton.kt index af03d8a..24a23c7 100644 --- a/fab/src/main/kotlin/uk/co/markormesher/android_fab/FloatingActionButton.kt +++ b/fab/src/main/kotlin/uk/co/markormesher/android_fab/FloatingActionButton.kt @@ -9,19 +9,19 @@ import android.graphics.drawable.GradientDrawable import android.os.Build import android.os.Bundle import android.os.Parcelable -import android.support.annotation.ColorInt -import android.support.annotation.Dimension -import android.support.annotation.DrawableRes -import android.support.design.widget.CoordinatorLayout -import android.support.design.widget.Snackbar -import android.support.v4.view.ViewCompat -import android.support.v7.widget.CardView import android.util.AttributeSet import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.LinearLayout import android.widget.RelativeLayout +import androidx.annotation.ColorInt +import androidx.annotation.Dimension +import androidx.annotation.DrawableRes +import androidx.cardview.widget.CardView +import androidx.coordinatorlayout.widget.CoordinatorLayout +import androidx.core.view.ViewCompat +import com.google.android.material.snackbar.Snackbar import kotlinx.android.synthetic.main.fab_container.view.* import kotlinx.android.synthetic.main.floating_action_button.view.* import kotlinx.android.synthetic.main.menu_item.view.* @@ -173,6 +173,11 @@ class FloatingActionButton: RelativeLayout { content_cover.alpha = 0f + isShown = visibility == View.VISIBLE + if (!isShown) { + hide(true) + } + addOnLayoutChangeListener { _, _, _, _, _, _, _, _, _ -> if (layoutParams is CoordinatorLayout.LayoutParams) { val lp = (layoutParams as CoordinatorLayout.LayoutParams) @@ -397,7 +402,7 @@ class FloatingActionButton: RelativeLayout { } closeSpeedDialMenu() - fab_card.visibility = View.VISIBLE + visibility = View.VISIBLE fab_card.clearAnimation() fab_card.animate() .scaleX(1f) @@ -422,7 +427,7 @@ class FloatingActionButton: RelativeLayout { .setDuration(if (immediate) 0L else HIDE_SHOW_ANIMATION_DURATION) .setListener(object: AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator) { - fab_card.visibility = View.GONE + visibility = View.GONE isShown = false } }) diff --git a/fab/src/main/kotlin/uk/co/markormesher/android_fab/SpeedDialMenuAdapter.kt b/fab/src/main/kotlin/uk/co/markormesher/android_fab/SpeedDialMenuAdapter.kt index be0fb9b..d07708b 100644 --- a/fab/src/main/kotlin/uk/co/markormesher/android_fab/SpeedDialMenuAdapter.kt +++ b/fab/src/main/kotlin/uk/co/markormesher/android_fab/SpeedDialMenuAdapter.kt @@ -2,10 +2,10 @@ package uk.co.markormesher.android_fab import android.content.Context import android.graphics.Color -import android.support.annotation.ColorInt import android.view.View import android.widget.LinearLayout import android.widget.TextView +import androidx.annotation.ColorInt abstract class SpeedDialMenuAdapter { @@ -37,7 +37,8 @@ abstract class SpeedDialMenuAdapter { * Note: this method should return an aRGB colour integer, *not* a colour resource ID. * @return the colour of the card behind the icon at the specified position */ - @ColorInt open fun getBackgroundColour(position: Int): Int = Color.argb(255, 192, 192, 192) + @ColorInt + open fun getBackgroundColour(position: Int): Int = Color.argb(255, 192, 192, 192) /** * Apply formatting to the `TextView` used for the label of the menu item at the given position. diff --git a/fab/src/main/kotlin/uk/co/markormesher/android_fab/SpeedDialMenuItem.kt b/fab/src/main/kotlin/uk/co/markormesher/android_fab/SpeedDialMenuItem.kt index 7a93f20..95f8d6e 100644 --- a/fab/src/main/kotlin/uk/co/markormesher/android_fab/SpeedDialMenuItem.kt +++ b/fab/src/main/kotlin/uk/co/markormesher/android_fab/SpeedDialMenuItem.kt @@ -3,8 +3,8 @@ package uk.co.markormesher.android_fab import android.content.Context import android.graphics.drawable.Drawable import android.os.Build -import android.support.annotation.DrawableRes -import android.support.annotation.StringRes +import androidx.annotation.DrawableRes +import androidx.annotation.StringRes /** * Represents an item to display in the speed-dial menu. diff --git a/fab/src/main/res/layout-v21/floating_action_button.xml b/fab/src/main/res/layout-v21/floating_action_button.xml index 41dbbb6..a1eb31a 100644 --- a/fab/src/main/res/layout-v21/floating_action_button.xml +++ b/fab/src/main/res/layout-v21/floating_action_button.xml @@ -1,9 +1,9 @@ +> - + > + /> - + diff --git a/fab/src/main/res/layout-v21/menu_item_icon.xml b/fab/src/main/res/layout-v21/menu_item_icon.xml index ab1d310..d2311ba 100644 --- a/fab/src/main/res/layout-v21/menu_item_icon.xml +++ b/fab/src/main/res/layout-v21/menu_item_icon.xml @@ -1,9 +1,9 @@ +> - + > + /> - + diff --git a/fab/src/main/res/layout/fab_container.xml b/fab/src/main/res/layout/fab_container.xml index ee5a107..8a1101a 100644 --- a/fab/src/main/res/layout/fab_container.xml +++ b/fab/src/main/res/layout/fab_container.xml @@ -9,7 +9,7 @@ android:clipChildren="false" android:clipToPadding="false" android:padding="@dimen/fab_offset" - > +> + /> diff --git a/fab/src/main/res/layout/floating_action_button.xml b/fab/src/main/res/layout/floating_action_button.xml index a46591f..b1b832a 100644 --- a/fab/src/main/res/layout/floating_action_button.xml +++ b/fab/src/main/res/layout/floating_action_button.xml @@ -7,7 +7,7 @@ android:layout_height="@dimen/fab_size" android:layout_margin="@dimen/fab_padding" style="@style/fab_card" - > + > + /> diff --git a/fab/src/main/res/layout/menu_item.xml b/fab/src/main/res/layout/menu_item.xml index 1782e60..198bb2c 100644 --- a/fab/src/main/res/layout/menu_item.xml +++ b/fab/src/main/res/layout/menu_item.xml @@ -6,13 +6,13 @@ android:orientation="horizontal" android:gravity="center_vertical" android:padding="@dimen/speed_dial_disc_offset" - > +> + /> diff --git a/fab/src/main/res/layout/menu_item_icon.xml b/fab/src/main/res/layout/menu_item_icon.xml index ef5554d..62dfa39 100644 --- a/fab/src/main/res/layout/menu_item_icon.xml +++ b/fab/src/main/res/layout/menu_item_icon.xml @@ -1,6 +1,6 @@ +> + > + /> diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 91c3de6..23d7542 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sun Aug 05 12:38:20 BST 2018 +#Wed Feb 20 08:48:43 GMT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip