aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt16
-rw-r--r--docs/Changelog.md3
-rw-r--r--sample/src/main/res/xml/changelog.xml3
3 files changed, 20 insertions, 2 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt b/core/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt
index 32e8745..77dbef1 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt
@@ -35,10 +35,11 @@ import java.security.InvalidParameterException
* This contains all the necessary layouts, and can be extended and configured using the [configBuilder]
* The [rClass] is necessary to generate the list of libraries used in your app, and should point to your app's
* R.string::class.java
+ * If you don't need auto detect, you can pass null instead
* Note that for the auto detection to work, the R fields must be excluded from Proguard
* Manual lib listings and other extra modifications can be done so by overriding the open functions
*/
-abstract class AboutActivityBase(val rClass: Class<*>, val configBuilder: Configs.() -> Unit = {}) : AppCompatActivity(), ViewPager.OnPageChangeListener {
+abstract class AboutActivityBase(val rClass: Class<*>?, val configBuilder: Configs.() -> Unit = {}) : AppCompatActivity(), ViewPager.OnPageChangeListener {
val draggableFrame: ElasticDragDismissFrameLayout by bindView(R.id.about_draggable_frame)
val pager: ViewPager by bindView(R.id.about_pager)
@@ -73,6 +74,13 @@ abstract class AboutActivityBase(val rClass: Class<*>, val configBuilder: Config
* Holds the adapter for the library page; this is generated later because it uses the config colors
*/
lateinit var libAdapter: FastItemThemedAdapter<IItem<*, *>>
+ /**
+ * Global reference of the library recycler
+ * This is set by default through [inflateLibPage] and is used to stop scrolling
+ * When the draggable frame exits
+ * It is not required, hence its nullability
+ */
+ private var libRecycler: RecyclerView? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -95,6 +103,7 @@ abstract class AboutActivityBase(val rClass: Class<*>, val configBuilder: Config
window.returnTransition = TransitionInflater.from(this@AboutActivityBase)
.inflateTransition(configs.transitionExitReversed)
}
+ libRecycler?.stopScroll()
finishAfterTransition()
}
})
@@ -167,12 +176,15 @@ abstract class AboutActivityBase(val rClass: Class<*>, val configBuilder: Config
libPage = position
val v = layoutInflater.inflate(R.layout.kau_recycler_detached_background, parent, false)
val recycler = v.findViewById<RecyclerView>(R.id.kau_recycler_detached)
+ libRecycler = recycler
recycler.adapter = libAdapter
recycler.itemAnimator = FadeScaleAnimator(itemDelayFactor = 0.2f).apply { addDuration = 300; interpolator = AnimHolder.decelerateInterpolator(this@AboutActivityBase) }
val background = v.findViewById<View>(R.id.kau_recycler_detached_background)
if (configs.backgroundColor != null) background.setBackgroundColor(configs.backgroundColor!!.colorToForeground())
doAsync {
- libItems = getLibraries(Libs(this@AboutActivityBase, Libs.toStringArray(rClass.fields))).map { LibraryIItem(it) }
+ libItems = getLibraries(
+ if (rClass == null) Libs(this@AboutActivityBase) else Libs(this@AboutActivityBase, Libs.toStringArray(rClass.fields))
+ ).map { LibraryIItem(it) }
if (libPage >= 0 && pageStatus[libPage] == 1)
uiThread { addLibItems() }
}
diff --git a/docs/Changelog.md b/docs/Changelog.md
index 7e99a63..c78f853 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -1,6 +1,9 @@
# Changelog
## v1.6
+* Reorder KauIItem arguments to support optional id
+* Create KPrefSeekbar, which binds an int kpref to a seekbar
+* Open all kpref item binders so they may be extended
## v1.5
* Change snackbar builder
diff --git a/sample/src/main/res/xml/changelog.xml b/sample/src/main/res/xml/changelog.xml
index 7599e97..ca55a60 100644
--- a/sample/src/main/res/xml/changelog.xml
+++ b/sample/src/main/res/xml/changelog.xml
@@ -10,6 +10,9 @@
<item text="Reorder KauIItem arguments to support optional id" />
<item text="Create KPrefSeekbar, which binds an int kpref to a seekbar" />
<item text="Open all kpref item binders so they may be extended" />
+ <item text="Fix scrolling issue on about dismiss" />
+ <item text="Make rClass optional in about activity" />
+ <item text="" />
<item text="" />
<item text="" />