Add about section to settings, add some info stuff
This commit is contained in:
committed by
Koitharu
parent
594c359f1c
commit
3a442817ce
@@ -1,45 +0,0 @@
|
||||
package org.koitharu.kotatsu.about
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import androidx.core.graphics.Insets
|
||||
import androidx.core.view.updatePadding
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.base.ui.BaseActivity
|
||||
import org.koitharu.kotatsu.databinding.ActivityAboutBinding
|
||||
|
||||
class AboutActivity : BaseActivity<ActivityAboutBinding>() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(ActivityAboutBinding.inflate(layoutInflater))
|
||||
supportActionBar?.apply {
|
||||
setDisplayHomeAsUpEnabled(true)
|
||||
setTitle(R.string.about)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onWindowInsetsChanged(insets: Insets) {
|
||||
binding.toolbar.updatePadding(
|
||||
top = insets.top,
|
||||
left = insets.left,
|
||||
right = insets.right
|
||||
)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
if (item.itemId == android.R.id.home) {
|
||||
onBackPressed()
|
||||
return true
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun newIntent(context: Context) = Intent(context, AboutActivity::class.java)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -167,8 +167,6 @@ class AppSettings private constructor(private val prefs: SharedPreferences) :
|
||||
const val KEY_READER_SWITCHERS = "reader_switchers"
|
||||
const val KEY_TRACK_SOURCES = "track_sources"
|
||||
const val KEY_TRACK_WARNING = "track_warning"
|
||||
const val KEY_APP_UPDATE = "app_update"
|
||||
const val KEY_APP_UPDATE_AUTO = "app_update_auto"
|
||||
const val KEY_TRACKER_NOTIFICATIONS = "tracker_notifications"
|
||||
const val KEY_NOTIFICATIONS_SETTINGS = "notifications_settings"
|
||||
const val KEY_NOTIFICATIONS_SOUND = "notifications_sound"
|
||||
@@ -186,8 +184,11 @@ class AppSettings private constructor(private val prefs: SharedPreferences) :
|
||||
const val KEY_REVERSE_CHAPTERS = "reverse_chapters"
|
||||
|
||||
// About
|
||||
const val KEY_APP_UPDATE = "app_update"
|
||||
const val KEY_APP_UPDATE_AUTO = "app_update_auto"
|
||||
const val KEY_APP_TRANSLATION = "about_app_translation"
|
||||
const val KEY_FEEDBACK_4PDA = "about_feedback_4pda"
|
||||
const val KEY_FEEDBACK_GITHUB = "about_feedback_github"
|
||||
const val KEY_SUPPORT_DEVELOPER = "about_support_developer"
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@ import com.google.android.material.snackbar.Snackbar
|
||||
import org.koin.android.ext.android.get
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.about.AboutActivity
|
||||
import org.koitharu.kotatsu.base.ui.BaseActivity
|
||||
import org.koitharu.kotatsu.core.model.Manga
|
||||
import org.koitharu.kotatsu.core.model.MangaSource
|
||||
@@ -196,9 +195,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(),
|
||||
startActivity(SettingsActivity.newIntent(this))
|
||||
return true
|
||||
}
|
||||
R.id.nav_action_about -> {
|
||||
startActivity(AboutActivity.newIntent(this))
|
||||
}
|
||||
else -> return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.about
|
||||
package org.koitharu.kotatsu.settings.about
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
@@ -12,7 +12,7 @@ import org.koitharu.kotatsu.core.prefs.AppSettings
|
||||
import org.koitharu.kotatsu.settings.AppUpdateChecker
|
||||
import org.koitharu.kotatsu.utils.ext.viewLifecycleScope
|
||||
|
||||
class AboutFragment : BasePreferenceFragment(R.string.about) {
|
||||
class AboutSettingsFragment : BasePreferenceFragment(R.string.about) {
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
addPreferencesFromResource(R.xml.pref_about)
|
||||
@@ -37,15 +37,27 @@ class AboutFragment : BasePreferenceFragment(R.string.about) {
|
||||
true
|
||||
}
|
||||
AppSettings.KEY_APP_TRANSLATION -> {
|
||||
startActivity(context?.let { BrowserActivity.newIntent(it, "https://hosted.weblate.org/engage/kotatsu", resources.getString(R.string.about_app_translation)) })
|
||||
startActivity(context?.let { BrowserActivity.newIntent(it,
|
||||
"https://hosted.weblate.org/engage/kotatsu",
|
||||
resources.getString(R.string.about_app_translation)) })
|
||||
true
|
||||
}
|
||||
AppSettings.KEY_FEEDBACK_4PDA -> {
|
||||
startActivity(context?.let { BrowserActivity.newIntent(it, "https://4pda.to/forum/index.php?showtopic=697669", resources.getString(R.string.about_feedback_4pda)) })
|
||||
startActivity(context?.let { BrowserActivity.newIntent(it,
|
||||
"https://4pda.to/forum/index.php?showtopic=697669",
|
||||
resources.getString(R.string.about_feedback_4pda)) })
|
||||
true
|
||||
}
|
||||
AppSettings.KEY_FEEDBACK_GITHUB -> {
|
||||
startActivity(context?.let { BrowserActivity.newIntent(it, "https://github.com/nv95/Kotatsu/issues", "GitHub") })
|
||||
startActivity(context?.let { BrowserActivity.newIntent(it,
|
||||
"https://4pda.to/forum/index.php?showtopic=697669",
|
||||
resources.getString(R.string.about_feedback_4pda)) })
|
||||
true
|
||||
}
|
||||
AppSettings.KEY_SUPPORT_DEVELOPER -> {
|
||||
startActivity(context?.let { BrowserActivity.newIntent(it,
|
||||
"https://4pda.to/forum/index.php?showtopic=697669",
|
||||
resources.getString(R.string.about_support_developer)) })
|
||||
true
|
||||
}
|
||||
else -> super.onPreferenceTreeClick(preference)
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.koitharu.kotatsu.settings.about
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.graphics.Insets
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.core.text.parseAsHtml
|
||||
import androidx.core.view.updatePadding
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.base.ui.BaseFragment
|
||||
import org.koitharu.kotatsu.databinding.FragmentCopyrightBinding
|
||||
|
||||
class CopyrightFragment : BaseFragment<FragmentCopyrightBinding>() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
binding.textView.apply {
|
||||
text =
|
||||
SpannableStringBuilder(resources.openRawResource(R.raw.copyright).bufferedReader()
|
||||
.readText()
|
||||
.parseAsHtml(HtmlCompat.FROM_HTML_SEPARATOR_LINE_BREAK_LIST))
|
||||
movementMethod = LinkMovementMethod.getInstance()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onInflateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?
|
||||
) = FragmentCopyrightBinding.inflate(inflater, container, false)
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
activity?.setTitle(R.string.about_copyright)
|
||||
}
|
||||
|
||||
override fun onWindowInsetsChanged(insets: Insets) = Unit
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.koitharu.kotatsu.settings.about
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.graphics.Insets
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.core.text.parseAsHtml
|
||||
import androidx.core.view.updatePadding
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.base.ui.BaseFragment
|
||||
import org.koitharu.kotatsu.databinding.FragmentGratitudesBinding
|
||||
|
||||
class GratitudesFragment : BaseFragment<FragmentGratitudesBinding>() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
binding.textView.apply {
|
||||
text =
|
||||
SpannableStringBuilder(resources.openRawResource(R.raw.gratitudes).bufferedReader()
|
||||
.readText()
|
||||
.parseAsHtml(HtmlCompat.FROM_HTML_SEPARATOR_LINE_BREAK_LIST))
|
||||
movementMethod = LinkMovementMethod.getInstance()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onInflateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?
|
||||
) = FragmentGratitudesBinding.inflate(inflater, container, false)
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
activity?.setTitle(R.string.about_gratitudes)
|
||||
}
|
||||
|
||||
override fun onWindowInsetsChanged(insets: Insets) = Unit
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user