Small refactor

This commit is contained in:
Koitharu
2020-05-09 12:33:09 +03:00
parent 23412e5c17
commit f9ccd0851d
5 changed files with 17 additions and 17 deletions

View File

@@ -58,8 +58,8 @@ androidExtensions {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5'
implementation 'androidx.core:core-ktx:1.3.0-rc01'
implementation 'androidx.fragment:fragment-ktx:1.2.4'

View File

@@ -42,7 +42,8 @@ import org.koitharu.kotatsu.utils.ext.*
class ReaderActivity : BaseFullscreenActivity(), ReaderView, ChaptersDialog.OnChapterChangeListener,
GridTouchHelper.OnGridTouchListener, OnPageSelectListener, ReaderConfigDialog.Callback,
ReaderListener, SharedPreferences.OnSharedPreferenceChangeListener {
ReaderListener, SharedPreferences.OnSharedPreferenceChangeListener,
View.OnApplyWindowInsetsListener {
private val presenter by moxyPresenter(factory = ::ReaderPresenter)
private val settings by inject<AppSettings>()
@@ -66,7 +67,7 @@ class ReaderActivity : BaseFullscreenActivity(), ReaderView, ChaptersDialog.OnCh
toolbar_bottom.setOnMenuItemClickListener(::onOptionsItemSelected)
state = savedInstanceState?.getParcelable(EXTRA_STATE)
?: intent.getParcelableExtra<ReaderState>(EXTRA_STATE)
?: intent.getParcelableExtra(EXTRA_STATE)
?: let {
Toast.makeText(this, R.string.error_occurred, Toast.LENGTH_SHORT).show()
finish()
@@ -79,10 +80,7 @@ class ReaderActivity : BaseFullscreenActivity(), ReaderView, ChaptersDialog.OnCh
getString(R.string.chapter_d_of_d, state.chapter?.number ?: 0, size)
}
appbar_bottom.setOnApplyWindowInsetsListener { view, insets ->
view.updatePadding(bottom = insets.systemWindowInsetBottom)
insets
}
rootLayout.setOnApplyWindowInsetsListener(this)
settings.subscribe(this)
loadSettings()
@@ -356,6 +354,11 @@ class ReaderActivity : BaseFullscreenActivity(), ReaderView, ChaptersDialog.OnCh
}
}
override fun onApplyWindowInsets(v: View, insets: WindowInsets): WindowInsets {
appbar_top.updatePadding(top = insets.systemWindowInsetTop)
appbar_bottom.updatePadding(bottom = insets.systemWindowInsetBottom)
return insets.consumeSystemWindowInsets()
}
private fun loadSettings() {
settings.readerPageSwitch.let {

View File

@@ -27,7 +27,6 @@
android:layout_height="wrap_content"
android:background="@color/dim"
android:elevation="0dp"
android:fitsSystemWindows="true"
android:theme="@style/AppToolbarTheme"
app:elevation="0dp">
@@ -46,7 +45,6 @@
android:layout_gravity="bottom"
android:background="@color/dim"
android:elevation="0dp"
android:fitsSystemWindows="true"
android:theme="@style/AppToolbarTheme"
app:elevation="0dp">

View File

@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<style name="BaseAppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="windowActionModeOverlay">true</item>
</style>
<style name="AppTheme" parent="BaseAppTheme">
<item name="colorPrimary">@color/blue_primary</item>
<item name="colorPrimaryDark">@color/blue_primary_dark</item>
<item name="colorAccent">@color/red_accent</item>
<item name="windowActionModeOverlay">true</item>
</style>
</resources>

View File

@@ -1,6 +1,6 @@
#Sun May 03 16:59:44 EEST 2020
#Sat May 09 10:22:49 EEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-rc-4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-all.zip