Collapse about links into a single row
(cherry picked from commit a410184e0a)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt
# app/src/main/java/eu/kanade/tachiyomi/util/CrashLogUtil.kt
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
package eu.kanade.tachiyomi.ui.more
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import androidx.preference.PreferenceViewHolder
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.mikepenz.aboutlibraries.LibsBuilder
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
@@ -18,14 +22,12 @@ import eu.kanade.tachiyomi.ui.setting.SettingsController
|
||||
import eu.kanade.tachiyomi.util.CrashLogUtil
|
||||
import eu.kanade.tachiyomi.util.lang.launchNow
|
||||
import eu.kanade.tachiyomi.util.lang.toDateTimestampString
|
||||
import eu.kanade.tachiyomi.util.preference.iconRes
|
||||
import eu.kanade.tachiyomi.util.preference.iconTint
|
||||
import eu.kanade.tachiyomi.util.preference.add
|
||||
import eu.kanade.tachiyomi.util.preference.onClick
|
||||
import eu.kanade.tachiyomi.util.preference.preference
|
||||
import eu.kanade.tachiyomi.util.preference.preferenceCategory
|
||||
import eu.kanade.tachiyomi.util.preference.titleRes
|
||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import exh.syDebugVersion
|
||||
import timber.log.Timber
|
||||
@@ -46,102 +48,36 @@ class AboutController : SettingsController() {
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
|
||||
titleRes = R.string.pref_category_about
|
||||
|
||||
val tintColor = context.getResourceColor(R.attr.colorAccent)
|
||||
|
||||
preference {
|
||||
key = "pref_about_version"
|
||||
titleRes = R.string.version
|
||||
summary = if (BuildConfig.DEBUG /* SY --> */ || syDebugVersion != "0" /* SY --> */) {
|
||||
"Preview r$syDebugVersion (${BuildConfig.COMMIT_SHA})"
|
||||
} else {
|
||||
"Stable ${BuildConfig.VERSION_NAME}"
|
||||
}
|
||||
|
||||
onClick { copyDebugInfo() }
|
||||
}
|
||||
preference {
|
||||
key = "pref_about_build_time"
|
||||
titleRes = R.string.build_time
|
||||
summary = getFormattedBuildTime()
|
||||
}
|
||||
if (isUpdaterEnabled) {
|
||||
preference {
|
||||
key = "pref_about_check_for_updates"
|
||||
titleRes = R.string.check_for_updates
|
||||
|
||||
onClick { checkVersion() }
|
||||
}
|
||||
}
|
||||
preference {
|
||||
key = "pref_about_whats_new"
|
||||
titleRes = R.string.whats_new
|
||||
|
||||
onClick {
|
||||
// SY -->
|
||||
WhatsNewDialogController().showDialog(router)
|
||||
// SY <--
|
||||
}
|
||||
}
|
||||
add(AboutLinksPreference(context))
|
||||
|
||||
preferenceCategory {
|
||||
preference {
|
||||
key = "pref_about_website"
|
||||
titleRes = R.string.website
|
||||
iconRes = R.drawable.ic_earth_24dp
|
||||
iconTint = tintColor
|
||||
"https://tachiyomi.org".also {
|
||||
summary = it
|
||||
onClick { openInBrowser(it) }
|
||||
key = "pref_about_version"
|
||||
titleRes = R.string.version
|
||||
summary = if (BuildConfig.DEBUG /* SY --> */ || syDebugVersion != "0" /* SY --> */) {
|
||||
"Preview r$syDebugVersion (${BuildConfig.COMMIT_SHA}, ${getFormattedBuildTime()})"
|
||||
} else {
|
||||
"Stable ${BuildConfig.VERSION_NAME} (${getFormattedBuildTime()})"
|
||||
}
|
||||
|
||||
onClick { copyDebugInfo() }
|
||||
}
|
||||
if (isUpdaterEnabled) {
|
||||
preference {
|
||||
key = "pref_about_check_for_updates"
|
||||
titleRes = R.string.check_for_updates
|
||||
|
||||
onClick { checkVersion() }
|
||||
}
|
||||
}
|
||||
preference {
|
||||
key = "pref_about_discord"
|
||||
title = "Discord"
|
||||
iconRes = R.drawable.ic_discord_24dp
|
||||
iconTint = tintColor
|
||||
"https://discord.gg/tachiyomi".also {
|
||||
summary = it
|
||||
onClick { openInBrowser(it) }
|
||||
}
|
||||
}
|
||||
preference {
|
||||
key = "pref_about_twitter"
|
||||
title = "Twitter"
|
||||
iconRes = R.drawable.ic_twitter_24dp
|
||||
iconTint = tintColor
|
||||
"https://twitter.com/tachiyomiorg".also {
|
||||
summary = it
|
||||
onClick { openInBrowser(it) }
|
||||
}
|
||||
}
|
||||
preference {
|
||||
key = "pref_about_facebook"
|
||||
title = "Facebook"
|
||||
iconRes = R.drawable.ic_facebook_24dp
|
||||
iconTint = tintColor
|
||||
"https://facebook.com/tachiyomiorg".also {
|
||||
summary = it
|
||||
onClick { openInBrowser(it) }
|
||||
}
|
||||
}
|
||||
preference {
|
||||
key = "pref_about_github_sy"
|
||||
title = "GitHub"
|
||||
iconRes = R.drawable.ic_github_24dp
|
||||
iconTint = tintColor
|
||||
"https://github.com/jobobby04/TachiyomiSY".also {
|
||||
summary = it
|
||||
onClick { openInBrowser(it) }
|
||||
}
|
||||
}
|
||||
preference {
|
||||
key = "pref_about_github"
|
||||
title = "Tachiyomi GitHub"
|
||||
iconRes = R.drawable.ic_github_24dp
|
||||
iconTint = tintColor
|
||||
"https://github.com/tachiyomiorg".also {
|
||||
summary = it
|
||||
onClick { openInBrowser(it) }
|
||||
key = "pref_about_whats_new"
|
||||
titleRes = R.string.whats_new
|
||||
|
||||
onClick {
|
||||
// SY -->
|
||||
WhatsNewDialogController().showDialog(router)
|
||||
// SY <--
|
||||
}
|
||||
}
|
||||
preference {
|
||||
@@ -243,3 +179,22 @@ class AboutController : SettingsController() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class AboutLinksPreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||
Preference(context, attrs) {
|
||||
|
||||
init {
|
||||
layoutResource = R.layout.pref_about_links
|
||||
isSelectable = false
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
||||
super.onBindViewHolder(holder)
|
||||
|
||||
// holder.findViewById(R.id.btn_website).setOnClickListener { openInBrowser("https://tachiyomi.org") }
|
||||
// holder.findViewById(R.id.btn_discord).setOnClickListener { openInBrowser("https://discord.gg/tachiyomi") }
|
||||
// holder.findViewById(R.id.btn_twitter).setOnClickListener { openInBrowser("https://twitter.com/tachiyomiorg") }
|
||||
// holder.findViewById(R.id.btn_facebook).setOnClickListener { openInBrowser("https://facebook.com/tachiyomiorg") }
|
||||
// holder.findViewById(R.id.btn_github).setOnClickListener { openInBrowser("https://github.com/tachiyomiorg") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class CrashLogUtil(private val context: Context) {
|
||||
|
||||
fun getDebugInfo(): String {
|
||||
return """
|
||||
App version: ${BuildConfig.VERSION_NAME} (${BuildConfig.FLAVOR}, ${BuildConfig.COMMIT_SHA}, ${BuildConfig.VERSION_CODE})
|
||||
App version: ${BuildConfig.VERSION_NAME} (${BuildConfig.FLAVOR}, ${BuildConfig.COMMIT_SHA}, ${BuildConfig.VERSION_CODE}, ${BuildConfig.BUILD_TIME})
|
||||
Preview build: $syDebugVersion
|
||||
Android version: ${Build.VERSION.RELEASE} (SDK ${Build.VERSION.SDK_INT})
|
||||
Android build ID: ${Build.DISPLAY}
|
||||
|
||||
Reference in New Issue
Block a user