|
|
|
|
@ -22,6 +22,7 @@ import org.koitharu.kotatsu.base.ui.util.RecyclerViewOwner
|
|
|
|
|
import org.koitharu.kotatsu.databinding.ActivitySettingsBinding
|
|
|
|
|
import org.koitharu.kotatsu.main.ui.AppBarOwner
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaSource
|
|
|
|
|
import org.koitharu.kotatsu.tracker.domain.Tracker
|
|
|
|
|
import org.koitharu.kotatsu.utils.ext.isScrolledToTop
|
|
|
|
|
|
|
|
|
|
class SettingsActivity :
|
|
|
|
|
@ -89,7 +90,7 @@ class SettingsActivity :
|
|
|
|
|
val fm = supportFragmentManager
|
|
|
|
|
val fragment = fm.fragmentFactory.instantiate(classLoader, pref.fragment ?: return false)
|
|
|
|
|
fragment.arguments = pref.extras
|
|
|
|
|
// fragment.setTargetFragment(caller, 0)
|
|
|
|
|
fragment.setTargetFragment(caller, 0)
|
|
|
|
|
openFragment(fragment)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
@ -118,6 +119,7 @@ class SettingsActivity :
|
|
|
|
|
val fragment = when (intent?.action) {
|
|
|
|
|
ACTION_READER -> ReaderSettingsFragment()
|
|
|
|
|
ACTION_SUGGESTIONS -> SuggestionsSettingsFragment()
|
|
|
|
|
ACTION_TRACKER -> TrackerSettingsFragment()
|
|
|
|
|
ACTION_SOURCE -> SourceSettingsFragment.newInstance(
|
|
|
|
|
intent.getSerializableExtra(EXTRA_SOURCE) as? MangaSource ?: MangaSource.LOCAL
|
|
|
|
|
)
|
|
|
|
|
@ -133,6 +135,7 @@ class SettingsActivity :
|
|
|
|
|
|
|
|
|
|
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_TRACKER = "${BuildConfig.APPLICATION_ID}.action.MANAGE_TRACKER"
|
|
|
|
|
private const val ACTION_SOURCE = "${BuildConfig.APPLICATION_ID}.action.MANAGE_SOURCE_SETTINGS"
|
|
|
|
|
private const val EXTRA_SOURCE = "source"
|
|
|
|
|
|
|
|
|
|
@ -146,6 +149,10 @@ class SettingsActivity :
|
|
|
|
|
Intent(context, SettingsActivity::class.java)
|
|
|
|
|
.setAction(ACTION_SUGGESTIONS)
|
|
|
|
|
|
|
|
|
|
fun newTrackerSettingsIntent(context: Context) =
|
|
|
|
|
Intent(context, SettingsActivity::class.java)
|
|
|
|
|
.setAction(ACTION_TRACKER)
|
|
|
|
|
|
|
|
|
|
fun newSourceSettingsIntent(context: Context, source: MangaSource) =
|
|
|
|
|
Intent(context, SettingsActivity::class.java)
|
|
|
|
|
.setAction(ACTION_SOURCE)
|
|
|
|
|
|