|
|
|
@ -4,9 +4,11 @@ import android.content.Context
|
|
|
|
import android.content.Intent
|
|
|
|
import android.content.Intent
|
|
|
|
import android.os.Bundle
|
|
|
|
import android.os.Bundle
|
|
|
|
import androidx.fragment.app.commit
|
|
|
|
import androidx.fragment.app.commit
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.BuildConfig
|
|
|
|
import org.koitharu.kotatsu.R
|
|
|
|
import org.koitharu.kotatsu.R
|
|
|
|
import org.koitharu.kotatsu.ui.common.BaseActivity
|
|
|
|
import org.koitharu.kotatsu.ui.common.BaseActivity
|
|
|
|
import org.koitharu.kotatsu.ui.settings.MainSettingsFragment
|
|
|
|
import org.koitharu.kotatsu.ui.settings.MainSettingsFragment
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.ui.settings.NetworkSettingsFragment
|
|
|
|
import org.koitharu.kotatsu.ui.settings.ReaderSettingsFragment
|
|
|
|
import org.koitharu.kotatsu.ui.settings.ReaderSettingsFragment
|
|
|
|
|
|
|
|
|
|
|
|
class SimpleSettingsActivity : BaseActivity() {
|
|
|
|
class SimpleSettingsActivity : BaseActivity() {
|
|
|
|
@ -15,10 +17,10 @@ class SimpleSettingsActivity : BaseActivity() {
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
setContentView(R.layout.activity_settings_simple)
|
|
|
|
setContentView(R.layout.activity_settings_simple)
|
|
|
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
|
|
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
|
|
|
val section = intent?.getIntExtra(EXTRA_SECTION, 0)
|
|
|
|
|
|
|
|
supportFragmentManager.commit {
|
|
|
|
supportFragmentManager.commit {
|
|
|
|
replace(R.id.container, when(section) {
|
|
|
|
replace(R.id.container, when(intent?.action) {
|
|
|
|
SECTION_READER -> ReaderSettingsFragment()
|
|
|
|
Intent.ACTION_MANAGE_NETWORK_USAGE -> NetworkSettingsFragment()
|
|
|
|
|
|
|
|
ACTION_READER -> ReaderSettingsFragment()
|
|
|
|
else -> MainSettingsFragment()
|
|
|
|
else -> MainSettingsFragment()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -26,10 +28,9 @@ class SimpleSettingsActivity : BaseActivity() {
|
|
|
|
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
companion object {
|
|
|
|
|
|
|
|
|
|
|
|
private const val EXTRA_SECTION = "section"
|
|
|
|
private const val ACTION_READER = "${BuildConfig.APPLICATION_ID}.action.MANAGE_READER_SETTINGS"
|
|
|
|
private const val SECTION_READER = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun newReaderSettingsIntent(context: Context) = Intent(context, SimpleSettingsActivity::class.java)
|
|
|
|
fun newReaderSettingsIntent(context: Context) = Intent(context, SimpleSettingsActivity::class.java)
|
|
|
|
.putExtra(EXTRA_SECTION, SECTION_READER)
|
|
|
|
.setAction(ACTION_READER)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|