Skip to content

Commit

Permalink
Merge pull request #5 from U1F4F1/sampleapp
Browse files Browse the repository at this point in the history
Sampleapp
  • Loading branch information
AppacheCodesandra authored Sep 14, 2017
2 parents 0a856aa + b83c35c commit f7fa698
Show file tree
Hide file tree
Showing 70 changed files with 743 additions and 934 deletions.
11 changes: 11 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.1.4'
ext.kotlin_version = '1.1.4-3'
repositories {
jcenter()
}
Expand Down
9 changes: 7 additions & 2 deletions powerbottomsheet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@ apply plugin: 'com.android.library'
apply plugin: 'de.mobilej.unmock'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'maven-publish'

androidExtensions {
experimental = true
}

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
versionCode 2
versionName "1.2"
versionName "1.5"
}
buildTypes {
release {
Expand Down Expand Up @@ -60,7 +65,7 @@ publishing {
maven(MavenPublication) {
groupId 'com.u1f4f1.powerbetterbottomsheet'
artifactId 'powerbetterbottomsheet'
version '3.0'
version '1.5'
artifact("$buildDir/outputs/aar/powerbottomsheet-release.aar")
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,4 @@ fun error(throwable: Throwable, message: String) {
Log.e(LOG_TAG, message, throwable)
}

private fun shouldSkipMessage(level: Int) : Boolean {
return logLevel > level
}
private fun shouldSkipMessage(level: Int) : Boolean = logLevel > level

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import java.util.concurrent.LinkedBlockingDeque

abstract class BottomSheetAdapter(val behavior: AnchorPointBottomSheetBehavior<*>?) : EpoxyAdapter() {
val updates = LinkedBlockingDeque<Runnable>()
lateinit var recyclerViewTransitionRunnable: Runnable
protected lateinit var recyclerViewTransitionRunnable: Runnable

init {
val onBottomSheetStateChanged = object : AnchorPointBottomSheetBehavior.BottomSheetStateCallback {
override fun onStateChanged(bottomSheet: View, newState: BottomSheetState) {
for (i in 0..updates.size - 1) {
for (i in 0 until updates.size) {
updates.pop()?.run()
}
}
Expand All @@ -27,19 +27,8 @@ abstract class BottomSheetAdapter(val behavior: AnchorPointBottomSheetBehavior<*
behavior?.addBottomSheetStateCallback(onBottomSheetStateChanged)
}

override fun notifyModelChanged(model: EpoxyModel<*>?) {
if (!(behavior?.isStable ?: false)) {
updates.add(Runnable {
super.notifyModelChanged(model)
})
return
}

super.notifyModelChanged(model)
}

override fun notifyModelsChanged() {
if (!(behavior?.isStable ?: false)) {
if (behavior?.isStable != true) {
updates.add(Runnable {
super.notifyModelsChanged()
})
Expand All @@ -54,11 +43,10 @@ abstract class BottomSheetAdapter(val behavior: AnchorPointBottomSheetBehavior<*
super.onAttachedToRecyclerView(recyclerView)

trace("BottomSheetAdapter.onAttachedToRecyclerView(recyclerView: RecyclerView?)")
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
recyclerViewTransitionRunnable = Runnable { TransitionManager.beginDelayedTransition(recyclerView) }
recyclerViewTransitionRunnable = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Runnable { TransitionManager.beginDelayedTransition(recyclerView) }
} else {
// I would rather invoke an empty lambda than have to check for null everywhere
recyclerViewTransitionRunnable = Runnable { }
Runnable { /* no op */ }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
package com.u1f4f1.powerbottomsheet.bottomsheet

import android.os.Parcel
import android.os.Parcelable
import com.u1f4f1.powerbottomsheet.createParcel
import kotlinx.android.parcel.Parcelize

data class SavedState(var bottomSheetState: BottomSheetState) : Parcelable {
companion object {
@JvmField @Suppress("unused")
val CREATOR = createParcel { SavedState(it) }
}

constructor(parcelIn: Parcel) : this(BottomSheetState.fromInt(parcelIn.readInt()))

override fun writeToParcel(dest: Parcel, flags: Int) {
dest.writeInt(bottomSheetState.ordinal)
}

override fun describeContents() = 0
}
@Parcelize
class SavedState(var bottomSheetState: BottomSheetState) : Parcelable
Loading

0 comments on commit f7fa698

Please sign in to comment.