Skip to content

Commit

Permalink
Merge pull request #261 from AllanWang/versions
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanWang authored Apr 17, 2021
2 parents 3ec7519 + 1057b6a commit 12f4725
Show file tree
Hide file tree
Showing 27 changed files with 346 additions and 341 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@
.idea/modules.xml
.idea/modules
.idea/vcs.xml
.idea/compiler.xml
.idea/misc.xml
.idea/codeStyles/Project.xml
1 change: 0 additions & 1 deletion .idea/codeStyles/codeStyleConfig.xml

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

6 changes: 0 additions & 6 deletions .idea/compiler.xml

This file was deleted.

48 changes: 0 additions & 48 deletions .idea/misc.xml

This file was deleted.

1 change: 1 addition & 0 deletions .idea/runConfigurations.xml

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

27 changes: 17 additions & 10 deletions about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import android.view.View
import android.view.ViewGroup
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager
import ca.allanwang.kau.about.databinding.KauActivityAboutBinding
import ca.allanwang.kau.adapters.FastItemThemedAdapter
import ca.allanwang.kau.adapters.ThemableIItemColors
import ca.allanwang.kau.adapters.ThemableIItemColorsDelegate
Expand All @@ -34,7 +35,6 @@ import ca.allanwang.kau.utils.dimenPixelSize
import com.mikepenz.aboutlibraries.Libs
import com.mikepenz.aboutlibraries.entity.Library
import com.mikepenz.fastadapter.GenericItem
import kotlinx.android.synthetic.main.kau_activity_about.*

/**
* Created by Allan Wang on 2017-06-28.
Expand All @@ -51,7 +51,7 @@ abstract class AboutActivityBase(val rClass: Class<*>?) :
KauBaseActivity(), ViewPager.OnPageChangeListener {

val currentPage: Int
get() = about_pager.currentItem
get() = binding.aboutPager.currentItem

/**
* Holds some common configurations that may be added directly from the constructor
Expand All @@ -77,31 +77,38 @@ abstract class AboutActivityBase(val rClass: Class<*>?) :
defaultPanels
}

private lateinit var binding: KauActivityAboutBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.kau_activity_about)
binding = KauActivityAboutBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.init()
}

private fun KauActivityAboutBinding.init() {
pageStatus = IntArray(panels.size)
pageStatus[0] = 2 // the first page is instantly visible
if (configs.textColor != null) {
about_indicator.setColour(configs.textColor!!)
aboutIndicator.setColour(configs.textColor!!)
}
with(about_pager) {
with(aboutPager) {
adapter = AboutPagerAdapter()
pageMargin = dimenPixelSize(R.dimen.kau_spacing_normal)
offscreenPageLimit = panels.size - 1
addOnPageChangeListener(this@AboutActivityBase)
}
about_indicator.setViewPager(about_pager)
about_draggable_frame.addListener(object :
ElasticDragDismissFrameLayout.SystemChromeFader(this) {
aboutIndicator.setViewPager(aboutPager)
aboutDraggableFrame.addListener(object :
ElasticDragDismissFrameLayout.SystemChromeFader(this@AboutActivityBase) {
override fun onDragDismissed() {
window.returnTransition = TransitionInflater.from(this@AboutActivityBase)
.inflateTransition(if (about_draggable_frame.translationY > 0) R.transition.kau_exit_slide_bottom else R.transition.kau_exit_slide_top)
.inflateTransition(if (aboutDraggableFrame.translationY > 0) R.transition.kau_exit_slide_bottom else R.transition.kau_exit_slide_top)
panels[currentPage].recycler?.stopScroll()
finishAfterTransition()
}
})
panels.forEachIndexed { index, contract -> contract.loadItems(this, index) }
panels.forEachIndexed { index, contract -> contract.loadItems(this@AboutActivityBase, index) }
}

class Configs : ThemableIItemColors by ThemableIItemColorsDelegate() {
Expand Down
9 changes: 7 additions & 2 deletions android-lib.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import kau.Versions

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-parcelize'
apply plugin: 'com.github.dcendents.android-maven'
//apply plugin: 'com.getkeepsafe.dexcount'
group = "ca.allanwang"
Expand Down Expand Up @@ -36,6 +36,10 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildFeatures {
viewBinding = true
}

buildTypes {
release {
minifyEnabled false
Expand All @@ -44,7 +48,7 @@ android {
}

lintOptions {
warningsAsErrors true
// warningsAsErrors true
disable 'UnusedResources',
'ContentDescription',
'RtlSymmetry',
Expand All @@ -62,6 +66,7 @@ android {
pickFirst 'META-INF/core_release.kotlin_module'
pickFirst 'META-INF/library_release.kotlin_module'
pickFirst 'META-INF/library-core_release.kotlin_module'
exclude "**/module-info.class"
}

compileOptions {
Expand Down
5 changes: 4 additions & 1 deletion buildSrc/src/main/kotlin/kau/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ object Dependencies {
@JvmStatic
fun hilt(type: String) = "com.google.dagger:hilt-android-$type:${Versions.hilt}"

@JvmStatic
fun compose(type: String) = "androidx.ui:ui-$type:${Versions.compose}"

const val junit = "junit:junit:${Versions.junit}"
const val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines}"

Expand All @@ -86,7 +89,7 @@ object Dependencies {

const val iconics = "com.mikepenz:iconics-core:${Versions.iconics}"
const val iconicsGoogle =
"com.mikepenz:google-material-typeface:${Versions.iconicsGoogle}.original-kotlin@aar"
"com.mikepenz:google-material-typeface:${Versions.iconicsGoogle}-kotlin@aar"
const val iconicsMaterial =
"com.mikepenz:material-design-iconic-typeface:${Versions.iconicsMaterial}-kotlin@aar"
const val iconicsCommunity =
Expand Down
54 changes: 30 additions & 24 deletions buildSrc/src/main/kotlin/kau/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ object Versions {
const val targetSdk = 29

// https://mvnrepository.com/artifact/androidx.appcompat/appcompat?repo=google
const val appcompat = "1.2.0"
const val appcompat = "1.3.0-rc01"

// https://mvnrepository.com/artifact/com.google.android.material/material
const val googleMaterial = "1.2.1"
const val googleMaterial = "1.3.0"

// https://mvnrepository.com/artifact/androidx.recyclerview/recyclerview
const val recyclerView = "1.1.0"
const val recyclerView = "1.2.0"

// https://mvnrepository.com/artifact/androidx.swiperefreshlayout/swiperefreshlayout
const val swipeRefreshLayout = "1.1.0"
Expand All @@ -21,46 +21,50 @@ object Versions {
const val cardView = "1.0.0"

// https://mvnrepository.com/artifact/androidx.constraintlayout/constraintlayout
const val constraintLayout = "2.0.1"
const val constraintLayout = "2.1.0-beta01"

// https://mvnrepository.com/artifact/androidx.core/core-ktx
const val coreKtx = "1.3.1"
const val coreKtx = "1.5.0-rc01"

// https://kotlinlang.org/docs/reference/using-gradle.html
const val kotlin = "1.4.10"
const val kotlin = "1.4.32"

// https://github.com/Kotlin/kotlinx.coroutines/releases
const val coroutines = "1.3.9"
const val coroutines = "1.4.3"

// https://github.com/mikepenz/AboutLibraries/releases
const val aboutLibraries = "8.3.1"
const val aboutLibraries = "8.8.5"

// https://github.com/wasabeef/Blurry/releases
const val blurry = "3.0.0"

// https://github.com/mikepenz/FastAdapter/releases
const val fastAdapter = "5.2.3"
const val fastAdapter = "5.4.1"

// https://github.com/bumptech/glide/releases
const val glide = "4.11.0"
const val glide = "4.12.0"

// https://github.com/mikepenz/Android-Iconics#1-provide-the-gradle-dependency
const val iconics = "5.0.3"
const val iconicsGoogle = "3.0.1.4"
const val iconicsMaterial = "2.2.0.6"
const val iconicsCommunity = "5.3.45.1"
const val iconics = "5.3.0-b01"
const val iconicsGoogle = "4.0.0.1"
const val iconicsMaterial = "2.2.0.8"
const val iconicsCommunity = "5.8.55.0"

// https://github.com/afollestad/material-dialogs/releases
const val materialDialog = "3.3.0"

// https://github.com/InsertKoinIO/koin/blob/master/CHANGELOG.md
const val koin = "2.2.0-beta-1"
const val koin = "3.0.1"

// https://github.com/google/dagger/releases
// https://mvnrepository.com/artifact/com.google.dagger/hilt-android
const val hilt = "2.29.1-alpha"
const val hilt = "2.34.1-beta"

// https://mvnrepository.com/artifact/androidx.ui/ui-core?repo=google
const val compose = "0.1.0-dev14"

// https://square.github.io/leakcanary/changelog/
const val leakCanary = "2.4"
const val leakCanary = "2.7"

// https://mvnrepository.com/artifact/androidx.test.espresso/espresso-core?repo=google
const val espresso = "3.3.0"
Expand All @@ -75,24 +79,26 @@ object Versions {
const val testRules = "1.3.0"

// https://github.com/diffplug/spotless/blob/master/plugin-gradle/CHANGES.md
const val spotless = "5.5.1"
const val spotless = "5.7.0"

// https://github.com/bugsnag/bugsnag-android/releases
const val bugsnag = "5.2.0"
const val bugsnag = "5.9.0"

// https://github.com/bugsnag/bugsnag-android-gradle-plugin/releases
const val bugsnagPlugin="5.2.0"
const val bugsnagPlugin="5.7.6"

// https://mvnrepository.com/artifact/com.android.tools.build/gradle?repo=google
const val gradlePlugin = "4.1.0-rc03"
const val gradlePlugin = "4.2.0-rc01"

// https://github.com/dcendents/android-maven-gradle-plugin/releases
const val mavenPlugin = "2.1"

// https://github.com/Triple-T/gradle-play-publisher/releases
const val playPublishPlugin = "3.0.0"
const val playPublishPlugin = "3.4.0-agp7.0"

// https://github.com/KeepSafe/dexcount-gradle-plugin/releases
const val dexCountPlugin = "2.0.0-RC1"
const val dexCountPlugin = "2.0.0"

// https://github.com/gladed/gradle-android-git-version/releases
const val gitVersionPlugin = "0.4.13"
const val gitVersionPlugin = "0.4.14"
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import androidx.appcompat.widget.Toolbar
import androidx.recyclerview.widget.RecyclerView
import ca.allanwang.kau.internal.KauBaseActivity
import ca.allanwang.kau.ui.R
import ca.allanwang.kau.ui.databinding.KauElasticRecyclerActivityBinding
import ca.allanwang.kau.ui.widgets.ElasticDragDismissFrameLayout
import kotlinx.android.synthetic.main.kau_elastic_recycler_activity.*

/**
* Created by Allan Wang on 2017-07-17.
Expand All @@ -41,8 +41,11 @@ import kotlinx.android.synthetic.main.kau_elastic_recycler_activity.*
abstract class ElasticRecyclerActivity : KauBaseActivity() {

private val configs = Configs()
protected val toolbar: Toolbar get() = kau_toolbar
protected val recycler: RecyclerView get() = kau_recycler

private lateinit var binding: KauElasticRecyclerActivityBinding

protected val toolbar: Toolbar get() = binding.kauToolbar
protected val recycler: RecyclerView get() = binding.kauRecycler

class Configs {
var exitTransitionBottom = R.transition.kau_exit_slide_bottom
Expand All @@ -51,17 +54,22 @@ abstract class ElasticRecyclerActivity : KauBaseActivity() {

final override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.kau_elastic_recycler_activity)
setSupportActionBar(kau_toolbar)
binding = KauElasticRecyclerActivityBinding.inflate(layoutInflater)
setContentView(binding.root)
setSupportActionBar(binding.kauToolbar)
if (!onCreate(savedInstanceState, configs)) {
return
}

kau_draggable.addListener(object : ElasticDragDismissFrameLayout.SystemChromeFader(this) {
binding.init()
}

private fun KauElasticRecyclerActivityBinding.init() {
kauDraggable.addListener(object : ElasticDragDismissFrameLayout.SystemChromeFader(this@ElasticRecyclerActivity) {
override fun onDragDismissed() {
window.returnTransition = TransitionInflater.from(this@ElasticRecyclerActivity)
.inflateTransition(if (kau_draggable.translationY > 0) configs.exitTransitionBottom else configs.exitTransitionTop)
kau_recycler.stopScroll()
.inflateTransition(if (kauDraggable.translationY > 0) configs.exitTransitionBottom else configs.exitTransitionTop)
kauRecycler.stopScroll()
finishAfterTransition()
}
})
Expand All @@ -79,6 +87,6 @@ abstract class ElasticRecyclerActivity : KauBaseActivity() {
* Receive actions when the a click event is received outside of the coordinator
*/
fun setOutsideTapListener(listener: () -> Unit) {
kau_draggable.setOnClickListener { listener() }
binding.kauDraggable.setOnClickListener { listener() }
}
}
2 changes: 1 addition & 1 deletion core-ui/src/main/res-public/values/public.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources xmlns:tools='http://schemas.android.com/tools' tools:ignore='ResourceName'>
<!-- AUTO-GENERATED FILE. DO NOT MODIFY. public.xml is generated by the generatepublicxml gradle task -->
<public name='kau_recycler_detached_background' type='layout' />
<public name='kau_elastic_recycler_activity' type='layout' />
<public name='kau_recycler_detached_background' type='layout' />
<public name='kau_recycler_textslider' type='layout' />
<public name='Kau.Translucent' type='style' />
<public name='Kau.Translucent.NoAnimation' type='style' />
Expand Down
Loading

0 comments on commit 12f4725

Please sign in to comment.