|
|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package org.koitharu.kotatsu.core.ui
|
|
|
|
|
|
|
|
|
|
import android.content.ActivityNotFoundException
|
|
|
|
|
import android.content.Intent
|
|
|
|
|
import android.os.Bundle
|
|
|
|
|
import android.view.View
|
|
|
|
|
import androidx.annotation.CallSuper
|
|
|
|
|
@ -8,7 +10,9 @@ import androidx.core.graphics.Insets
|
|
|
|
|
import androidx.core.view.updatePadding
|
|
|
|
|
import androidx.preference.PreferenceFragmentCompat
|
|
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
|
|
import com.google.android.material.snackbar.Snackbar
|
|
|
|
|
import dagger.hilt.android.AndroidEntryPoint
|
|
|
|
|
import org.koitharu.kotatsu.R
|
|
|
|
|
import org.koitharu.kotatsu.core.prefs.AppSettings
|
|
|
|
|
import org.koitharu.kotatsu.core.ui.util.RecyclerViewOwner
|
|
|
|
|
import org.koitharu.kotatsu.core.ui.util.WindowInsetsDelegate
|
|
|
|
|
@ -62,4 +66,12 @@ abstract class BasePreferenceFragment(@StringRes private val titleId: Int) :
|
|
|
|
|
protected fun setTitle(title: CharSequence?) {
|
|
|
|
|
(activity as? SettingsActivity)?.setSectionTitle(title)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected fun startActivitySafe(intent: Intent) {
|
|
|
|
|
try {
|
|
|
|
|
startActivity(intent)
|
|
|
|
|
} catch (_: ActivityNotFoundException) {
|
|
|
|
|
Snackbar.make(listView, R.string.operation_not_supported, Snackbar.LENGTH_SHORT).show()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|