Remove SimpleSettingsActivity
parent
41fb351fe0
commit
85b992ca32
@ -1,81 +0,0 @@
|
|||||||
package org.koitharu.kotatsu.reader.ui
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.graphics.Insets
|
|
||||||
import androidx.core.view.updateLayoutParams
|
|
||||||
import androidx.core.view.updatePadding
|
|
||||||
import androidx.fragment.app.commit
|
|
||||||
import com.google.android.material.appbar.AppBarLayout
|
|
||||||
import org.koitharu.kotatsu.BuildConfig
|
|
||||||
import org.koitharu.kotatsu.R
|
|
||||||
import org.koitharu.kotatsu.base.ui.BaseActivity
|
|
||||||
import org.koitharu.kotatsu.databinding.ActivitySettingsSimpleBinding
|
|
||||||
import org.koitharu.kotatsu.main.ui.AppBarOwner
|
|
||||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
|
||||||
import org.koitharu.kotatsu.settings.*
|
|
||||||
|
|
||||||
@Deprecated("")
|
|
||||||
class SimpleSettingsActivity : BaseActivity<ActivitySettingsSimpleBinding>(), AppBarOwner {
|
|
||||||
|
|
||||||
override val appBar: AppBarLayout
|
|
||||||
get() = binding.appbar
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
setContentView(ActivitySettingsSimpleBinding.inflate(layoutInflater))
|
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
|
||||||
supportFragmentManager.commit {
|
|
||||||
replace(
|
|
||||||
R.id.container,
|
|
||||||
when (intent?.action) {
|
|
||||||
Intent.ACTION_MANAGE_NETWORK_USAGE -> NetworkSettingsFragment()
|
|
||||||
ACTION_READER -> ReaderSettingsFragment()
|
|
||||||
ACTION_SUGGESTIONS -> SuggestionsSettingsFragment()
|
|
||||||
ACTION_SOURCE -> SourceSettingsFragment.newInstance(
|
|
||||||
intent.getSerializableExtra(EXTRA_SOURCE) as? MangaSource ?: MangaSource.LOCAL
|
|
||||||
)
|
|
||||||
else -> SettingsHeadersFragment()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onWindowInsetsChanged(insets: Insets) {
|
|
||||||
with(binding.toolbar) {
|
|
||||||
updatePadding(
|
|
||||||
left = insets.left,
|
|
||||||
right = insets.right
|
|
||||||
)
|
|
||||||
updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
|
||||||
topMargin = insets.top
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
private const val ACTION_READER =
|
|
||||||
"${BuildConfig.APPLICATION_ID}.action.MANAGE_READER_SETTINGS"
|
|
||||||
private const val ACTION_SUGGESTIONS =
|
|
||||||
"${BuildConfig.APPLICATION_ID}.action.MANAGE_SUGGESTIONS"
|
|
||||||
private const val ACTION_SOURCE =
|
|
||||||
"${BuildConfig.APPLICATION_ID}.action.MANAGE_SOURCE_SETTINGS"
|
|
||||||
private const val EXTRA_SOURCE = "source"
|
|
||||||
|
|
||||||
fun newReaderSettingsIntent(context: Context) =
|
|
||||||
Intent(context, SimpleSettingsActivity::class.java)
|
|
||||||
.setAction(ACTION_READER)
|
|
||||||
|
|
||||||
fun newSuggestionsSettingsIntent(context: Context) =
|
|
||||||
Intent(context, SimpleSettingsActivity::class.java)
|
|
||||||
.setAction(ACTION_SUGGESTIONS)
|
|
||||||
|
|
||||||
fun newSourceSettingsIntent(context: Context, source: MangaSource) =
|
|
||||||
Intent(context, SimpleSettingsActivity::class.java)
|
|
||||||
.setAction(ACTION_SOURCE)
|
|
||||||
.putExtra(EXTRA_SOURCE, source)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
package org.koitharu.kotatsu.settings
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import org.koitharu.kotatsu.R
|
|
||||||
import org.koitharu.kotatsu.base.ui.BasePreferenceFragment
|
|
||||||
|
|
||||||
class NetworkSettingsFragment : BasePreferenceFragment(R.string.settings) {
|
|
||||||
|
|
||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
|
||||||
//TODO https://developer.android.com/training/basics/network-ops/managing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
|
||||||
android:id="@+id/appbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/toolbar_height_expanded"
|
|
||||||
app:toolbarId="@id/toolbar"
|
|
||||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
|
||||||
android:id="@id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/actionBarSize"
|
|
||||||
app:layout_collapseMode="pin" />
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
|
||||||
|
|
||||||
<androidx.fragment.app.FragmentContainerView
|
|
||||||
android:id="@id/container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
||||||
Loading…
Reference in New Issue