Add about section to settings, add some info stuff

This commit is contained in:
Zakhar Timoshenko
2021-08-03 18:10:09 +03:00
committed by Koitharu
parent 594c359f1c
commit 3a442817ce
18 changed files with 226 additions and 62 deletions

View File

@@ -87,7 +87,6 @@
<activity
android:name="org.koitharu.kotatsu.download.ui.DownloadsActivity"
android:label="@string/downloads" />
<activity android:name=".about.AboutActivity" />
<service
android:name="org.koitharu.kotatsu.download.ui.service.DownloadService"

View File

@@ -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)
}
}

View File

@@ -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"
}
}

View File

@@ -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
}
}

View File

@@ -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)

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M11.88,9.14c1.28,0.06 1.61,1.15 1.63,1.66h1.79c-0.08,-1.98 -1.49,-3.19 -3.45,-3.19C9.64,7.61 8,9 8,12.14c0,1.94 0.93,4.24 3.84,4.24c2.22,0 3.41,-1.65 3.44,-2.95h-1.79c-0.03,0.59 -0.45,1.38 -1.63,1.44C10.55,14.83 10,13.81 10,12.14C10,9.25 11.28,9.16 11.88,9.14zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10s10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8s8,3.59 8,8S16.41,20 12,20z"/>
</vector>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:textIsSelectable="true" />
</androidx.core.widget.NestedScrollView>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:textIsSelectable="true" />
</androidx.core.widget.NestedScrollView>

View File

@@ -37,9 +37,5 @@
android:id="@+id/nav_action_settings"
android:icon="@drawable/ic_settings"
android:title="@string/settings" />
<item
android:id="@+id/nav_action_about"
android:icon="@drawable/ic_info_outline"
android:title="@string/about" />
</group>
</menu>

View File

@@ -0,0 +1,5 @@
<b>Благодарности:</b><br>
<p><a href="https://github.com/ztimms73">Zakhar Timoshenko (Xtimms)</a> - активная помощь в разработке в плане пользовательского интерфейса и перевод на белорусский язык</p>
<p><a href="https://github.com/comradekingu">Allan Nordhøy (comradekingu)</a> - перевод на норвежский букмол</p>
<p><a href="https://github.com/sguinetti">sguinetti</a> - перевод на испанский</p>
<p>J. Lavoie - перевод на французский, итальянский и немецкий</p>

View File

@@ -0,0 +1,24 @@
<p><a href="https://github.com/nv95/Kotatsu">Kotatsu</a> is a free and open source manga reader for Android.</p>
<p>Copyright (C) 2020 by Koitharu</p>
<p>This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.</p>
<p>This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.</p>
<p>You should have received a copy of the GNU General Public License
along with this program. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p>
<h3>Open Source Licenses</h3>
<ul>
<li>AOSP: <a href="https://source.android.com/setup/start/licenses">APL 2.0</a></li>
<li>OkHttp: <a href="https://github.com/square/okhttp/blob/master/LICENSE.txt">APL 2.0</a></li>
<li>Okio: <a href="https://github.com/square/okio/blob/master/LICENSE.txt">APL 2.0</a></li>
<li>jsoup: <a href="https://github.com/jhy/jsoup/blob/master/LICENSE">MIT</a></li>
<li>AdapterDelegates: <a href="https://github.com/sockeqwe/AdapterDelegates/blob/master/LICENSE">APL 2.0</a></li>
<li>Koin: <a href="https://github.com/InsertKoinIO/koin/blob/master/LICENSE">APL 2.0</a></li>
<li>Coil: <a href="https://github.com/coil-kt/coil/blob/main/LICENSE.txt">APL 2.0</a></li>
<li>Subsampling Scale Image View: <a href="https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/LICENSE">APL 2.0</a></li>
<li>Disk LRU Cache: <a href="https://github.com/solkin/disk-lru-cache/blob/master/LICENSE">MIT</a></li>
</ul>

View File

@@ -0,0 +1,5 @@
<b>Thanks:</b><br>
<p><a href="https://github.com/ztimms73">Zakhar Timoshenko (Xtimms)</a> - active assistance in the development from the point of view of the UI and translation into the Belarusian language</p>
<p><a href="https://github.com/comradekingu">Allan Nordhøy (comradekingu)</a> - Norwegian Bokmål translation</p>
<p><a href="https://github.com/sguinetti">sguinetti</a> - Spanish translation</p>
<p>J. Lavoie - French, German and Italian translation</p>

View File

@@ -227,4 +227,10 @@
<string name="about_author">Автор</string>
<string name="about_feedback_4pda">Тема на 4PDA</string>
<string name="about_feedback">Обратная связь</string>
<string name="about_support_developer">Поддержать разработчика</string>
<string name="about_support_developer_summary">Если вам нравится это приложение, вы можете помочь финансово с помощью ЮMoney (бывш. Яндекс.Деньги)</string>
<string name="about_gratitudes">Благодарности</string>
<string name="about_gratitudes_summary">Эти люди помогают Kotatsu стать лучше!</string>
<string name="about_copyright_and_licenses">Авторские права и лицензии</string>
<string name="about_copyright">Авторские права</string>
</resources>

View File

@@ -230,4 +230,10 @@
<string name="about_author">Author</string>
<string name="about_feedback">Feedback</string>
<string name="about_feedback_4pda">Topic on 4PDA</string>
<string name="about_support_developer">Support the developer</string>
<string name="about_support_developer_summary">If you like this app, you can help financially through Yoomoney (ex. Yandex.Money)</string>
<string name="about_gratitudes">Gratitudes</string>
<string name="about_gratitudes_summary">These people make Kotatsu become better!</string>
<string name="about_copyright_and_licenses">Copyright &amp; Licenses</string>
<string name="about_copyright">Copyright</string>
</resources>

View File

@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
app:initialExpandedChildrenCount="5">
<PreferenceCategory
app:iconSpaceReserved="false"
@@ -27,6 +29,20 @@
app:key="about_app_translation"
app:summary="@string/about_app_translation_summary"
app:title="@string/about_app_translation" />
<Preference
app:iconSpaceReserved="false"
app:key="about_support_developer"
app:summary="@string/about_support_developer_summary"
app:title="@string/about_support_developer" />
<Preference
android:fragment="org.koitharu.kotatsu.settings.about.GratitudesFragment"
app:iconSpaceReserved="false"
app:key="about_gratitudes"
app:summary="@string/about_gratitudes_summary"
app:title="@string/about_gratitudes" />
</PreferenceCategory>
<PreferenceCategory
@@ -44,4 +60,18 @@
app:title="GitHub" />
</PreferenceCategory>
<PreferenceCategory
app:iconSpaceReserved="false"
app:key="copyright"
app:title="@string/about_copyright_and_licenses">
<Preference
android:fragment="org.koitharu.kotatsu.settings.about.CopyrightFragment"
app:icon="@drawable/ic_copyright"
app:iconSpaceReserved="false"
app:key="about_copyright"
app:title="@string/about_copyright" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -84,4 +84,9 @@
android:title="@string/backup_restore"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.about.AboutSettingsFragment"
android:title="@string/about"
app:iconSpaceReserved="false" />
</PreferenceScreen>