mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 14:31:52 +01:00
Add link to official subreddit
This commit is contained in:
parent
a1a4916abf
commit
8af8c57bb4
@ -21,7 +21,6 @@ import eu.kanade.tachiyomi.util.lang.toDateTimestampString
|
||||
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.openInBrowser
|
||||
@ -46,60 +45,58 @@ class AboutController : SettingsController(), NoToolbarElevationController {
|
||||
|
||||
add(MoreHeaderPreference(context))
|
||||
|
||||
add(AboutLinksPreference(context))
|
||||
|
||||
preferenceCategory {
|
||||
preference {
|
||||
key = "pref_about_version"
|
||||
titleRes = R.string.version
|
||||
summary = if (BuildConfig.DEBUG) {
|
||||
"Preview r${BuildConfig.COMMIT_COUNT} (${BuildConfig.COMMIT_SHA}, ${getFormattedBuildTime()})"
|
||||
} else {
|
||||
"Stable ${BuildConfig.VERSION_NAME} (${getFormattedBuildTime()})"
|
||||
}
|
||||
|
||||
onClick {
|
||||
activity?.let {
|
||||
val deviceInfo = CrashLogUtil(it).getDebugInfo()
|
||||
it.copyToClipboard("Debug information", deviceInfo)
|
||||
}
|
||||
}
|
||||
preference {
|
||||
key = "pref_about_version"
|
||||
titleRes = R.string.version
|
||||
summary = if (BuildConfig.DEBUG) {
|
||||
"Preview r${BuildConfig.COMMIT_COUNT} (${BuildConfig.COMMIT_SHA}, ${getFormattedBuildTime()})"
|
||||
} else {
|
||||
"Stable ${BuildConfig.VERSION_NAME} (${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 {
|
||||
val url = if (BuildConfig.DEBUG) {
|
||||
"https://github.com/tachiyomiorg/tachiyomi-preview/releases/tag/r${BuildConfig.COMMIT_COUNT}"
|
||||
} else {
|
||||
"https://github.com/tachiyomiorg/tachiyomi/releases/tag/v${BuildConfig.VERSION_NAME}"
|
||||
}
|
||||
openInBrowser(url)
|
||||
}
|
||||
}
|
||||
preference {
|
||||
key = "pref_about_licenses"
|
||||
titleRes = R.string.licenses
|
||||
onClick {
|
||||
LibsBuilder()
|
||||
.withActivityTitle(activity!!.getString(R.string.licenses))
|
||||
.withAboutIconShown(false)
|
||||
.withAboutVersionShown(false)
|
||||
.withLicenseShown(true)
|
||||
.withEdgeToEdge(true)
|
||||
.start(activity!!)
|
||||
onClick {
|
||||
activity?.let {
|
||||
val deviceInfo = CrashLogUtil(it).getDebugInfo()
|
||||
it.copyToClipboard("Debug information", deviceInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
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 {
|
||||
val url = if (BuildConfig.DEBUG) {
|
||||
"https://github.com/tachiyomiorg/tachiyomi-preview/releases/tag/r${BuildConfig.COMMIT_COUNT}"
|
||||
} else {
|
||||
"https://github.com/tachiyomiorg/tachiyomi/releases/tag/v${BuildConfig.VERSION_NAME}"
|
||||
}
|
||||
openInBrowser(url)
|
||||
}
|
||||
}
|
||||
preference {
|
||||
key = "pref_about_licenses"
|
||||
titleRes = R.string.licenses
|
||||
onClick {
|
||||
LibsBuilder()
|
||||
.withActivityTitle(activity!!.getString(R.string.licenses))
|
||||
.withAboutIconShown(false)
|
||||
.withAboutVersionShown(false)
|
||||
.withLicenseShown(true)
|
||||
.withEdgeToEdge(true)
|
||||
.start(activity!!)
|
||||
}
|
||||
}
|
||||
|
||||
add(AboutLinksPreference(context))
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,6 +6,7 @@ import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceViewHolder
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||
import eu.kanade.tachiyomi.util.view.setTooltip
|
||||
|
||||
class AboutLinksPreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||
Preference(context, attrs) {
|
||||
@ -18,10 +19,29 @@ class AboutLinksPreference @JvmOverloads constructor(context: Context, attrs: At
|
||||
override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
||||
super.onBindViewHolder(holder)
|
||||
|
||||
holder.findViewById(R.id.btn_website).setOnClickListener { context.openInBrowser("https://tachiyomi.org") }
|
||||
holder.findViewById(R.id.btn_discord).setOnClickListener { context.openInBrowser("https://discord.gg/tachiyomi") }
|
||||
holder.findViewById(R.id.btn_twitter).setOnClickListener { context.openInBrowser("https://twitter.com/tachiyomiorg") }
|
||||
holder.findViewById(R.id.btn_facebook).setOnClickListener { context.openInBrowser("https://facebook.com/tachiyomiorg") }
|
||||
holder.findViewById(R.id.btn_github).setOnClickListener { context.openInBrowser("https://github.com/tachiyomiorg") }
|
||||
holder.findViewById(R.id.btn_website).apply {
|
||||
setTooltip(contentDescription.toString())
|
||||
setOnClickListener { context.openInBrowser("https://tachiyomi.org") }
|
||||
}
|
||||
holder.findViewById(R.id.btn_discord).apply {
|
||||
setTooltip(contentDescription.toString())
|
||||
setOnClickListener { context.openInBrowser("https://discord.gg/tachiyomi") }
|
||||
}
|
||||
holder.findViewById(R.id.btn_twitter).apply {
|
||||
setTooltip(contentDescription.toString())
|
||||
setOnClickListener { context.openInBrowser("https://twitter.com/tachiyomiorg") }
|
||||
}
|
||||
holder.findViewById(R.id.btn_facebook).apply {
|
||||
setTooltip(contentDescription.toString())
|
||||
setOnClickListener { context.openInBrowser("https://facebook.com/tachiyomiorg") }
|
||||
}
|
||||
holder.findViewById(R.id.btn_reddit).apply {
|
||||
setTooltip(contentDescription.toString())
|
||||
setOnClickListener { context.openInBrowser("https://www.reddit.com/r/Tachiyomi") }
|
||||
}
|
||||
holder.findViewById(R.id.btn_github).apply {
|
||||
setTooltip(contentDescription.toString())
|
||||
setOnClickListener { context.openInBrowser("https://github.com/tachiyomiorg") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,16 @@ inline fun View.snack(
|
||||
* @param stringRes String resource for tooltip.
|
||||
*/
|
||||
inline fun View.setTooltip(@StringRes stringRes: Int) {
|
||||
TooltipCompat.setTooltipText(this, context.getString(stringRes))
|
||||
setTooltip(context.getString(stringRes))
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a tooltip shown on long press.
|
||||
*
|
||||
* @param text Text for tooltip.
|
||||
*/
|
||||
inline fun View.setTooltip(text: String) {
|
||||
TooltipCompat.setTooltipText(this, text)
|
||||
}
|
||||
|
||||
/**
|
||||
|
9
app/src/main/res/drawable/ic_reddit_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_reddit_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/black"
|
||||
android:pathData="M14.5 15.41C14.58 15.5 14.58 15.69 14.5 15.8C13.77 16.5 12.41 16.56 12 16.56C11.61 16.56 10.25 16.5 9.54 15.8C9.44 15.69 9.44 15.5 9.54 15.41C9.65 15.31 9.82 15.31 9.92 15.41C10.38 15.87 11.33 16 12 16C12.69 16 13.66 15.87 14.1 15.41C14.21 15.31 14.38 15.31 14.5 15.41M10.75 13.04C10.75 12.47 10.28 12 9.71 12C9.14 12 8.67 12.47 8.67 13.04C8.67 13.61 9.14 14.09 9.71 14.08C10.28 14.08 10.75 13.61 10.75 13.04M14.29 12C13.72 12 13.25 12.5 13.25 13.05S13.72 14.09 14.29 14.09C14.86 14.09 15.33 13.61 15.33 13.05C15.33 12.5 14.86 12 14.29 12M22 12C22 17.5 17.5 22 12 22S2 17.5 2 12C2 6.5 6.5 2 12 2S22 6.5 22 12M18.67 12C18.67 11.19 18 10.54 17.22 10.54C16.82 10.54 16.46 10.7 16.2 10.95C15.2 10.23 13.83 9.77 12.3 9.71L12.97 6.58L15.14 7.05C15.16 7.6 15.62 8.04 16.18 8.04C16.75 8.04 17.22 7.57 17.22 7C17.22 6.43 16.75 5.96 16.18 5.96C15.77 5.96 15.41 6.2 15.25 6.55L12.82 6.03C12.75 6 12.68 6.03 12.63 6.07C12.57 6.11 12.54 6.17 12.53 6.24L11.79 9.72C10.24 9.77 8.84 10.23 7.82 10.96C7.56 10.71 7.2 10.56 6.81 10.56C6 10.56 5.35 11.21 5.35 12C5.35 12.61 5.71 13.11 6.21 13.34C6.19 13.5 6.18 13.62 6.18 13.78C6.18 16 8.79 17.85 12 17.85C15.23 17.85 17.85 16.03 17.85 13.78C17.85 13.64 17.84 13.5 17.81 13.34C18.31 13.11 18.67 12.6 18.67 12Z" />
|
||||
</vector>
|
@ -4,70 +4,71 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp">
|
||||
android:gravity="center">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
<ImageButton
|
||||
android:id="@+id/btn_website"
|
||||
style="@style/Theme.Widget.Button.Action"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/website"
|
||||
app:icon="@drawable/ic_public_24dp"
|
||||
app:iconTint="?attr/colorAccent" />
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/website"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_public_24dp"
|
||||
app:tint="?attr/colorAccent" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
<ImageButton
|
||||
android:id="@+id/btn_discord"
|
||||
style="@style/Theme.Widget.Button.Action"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="Discord"
|
||||
app:icon="@drawable/ic_discord_24dp"
|
||||
app:iconTint="?attr/colorAccent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="Discord"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_discord_24dp"
|
||||
app:tint="?attr/colorAccent"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
<ImageButton
|
||||
android:id="@+id/btn_twitter"
|
||||
style="@style/Theme.Widget.Button.Action"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="Twitter"
|
||||
app:icon="@drawable/ic_twitter_24dp"
|
||||
app:iconTint="?attr/colorAccent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="Twitter"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_twitter_24dp"
|
||||
app:tint="?attr/colorAccent"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
<ImageButton
|
||||
android:id="@+id/btn_facebook"
|
||||
style="@style/Theme.Widget.Button.Action"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="Facebook"
|
||||
app:icon="@drawable/ic_facebook_24dp"
|
||||
app:iconTint="?attr/colorAccent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="Facebook"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_facebook_24dp"
|
||||
app:tint="?attr/colorAccent"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
<ImageButton
|
||||
android:id="@+id/btn_reddit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="Reddit"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_reddit_24dp"
|
||||
app:tint="?attr/colorAccent"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn_github"
|
||||
style="@style/Theme.Widget.Button.Action"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="GitHub"
|
||||
app:icon="@drawable/ic_github_24dp"
|
||||
app:iconTint="?attr/colorAccent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="GitHub"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_github_24dp"
|
||||
app:tint="?attr/colorAccent"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
</LinearLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user