Improve: add sources code urls for flavor 'foss'

This commit is contained in:
kr328 2021-05-16 18:36:28 +08:00
parent d48b15afee
commit cc304de7a7
4 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,95 @@
package com.github.kr328.clash.design
import android.content.Context
import android.net.Uri
import android.view.View
import com.github.kr328.clash.common.compat.preferredLocale
import com.github.kr328.clash.design.databinding.DesignSettingsCommonBinding
import com.github.kr328.clash.design.preference.category
import com.github.kr328.clash.design.preference.clickable
import com.github.kr328.clash.design.preference.preferenceScreen
import com.github.kr328.clash.design.preference.tips
import com.github.kr328.clash.design.util.applyFrom
import com.github.kr328.clash.design.util.bindAppBarElevation
import com.github.kr328.clash.design.util.layoutInflater
import com.github.kr328.clash.design.util.root
class HelpDesign(
context: Context,
openLink: (Uri) -> Unit,
) : Design<Unit>(context) {
private val binding = DesignSettingsCommonBinding
.inflate(context.layoutInflater, context.root, false)
override val root: View
get() = binding.root
init {
binding.surface = surface
binding.activityBarLayout.applyFrom(context)
binding.scrollRoot.bindAppBarElevation(binding.activityBarLayout)
val screen = preferenceScreen(context) {
tips(R.string.tips_help)
category(R.string.document)
clickable(
title = R.string.clash_wiki,
summary = R.string.clash_wiki_url
) {
clicked {
openLink(Uri.parse(context.getString(R.string.clash_wiki_url)))
}
}
category(R.string.feedback)
clickable(
title = R.string.github_issues,
summary = R.string.github_issues_url
) {
clicked {
openLink(Uri.parse(context.getString(R.string.github_issues_url)))
}
}
category(R.string.sources)
clickable(
title = R.string.clash_for_android,
summary = R.string.github_url
) {
clicked {
openLink(Uri.parse(context.getString(R.string.github_url)))
}
}
clickable(
title = R.string.clash_core,
summary = R.string.clash_core_url
) {
clicked {
openLink(Uri.parse(context.getString(R.string.clash_core_url)))
}
}
if (context.resources.configuration.preferredLocale.language == "zh") {
category(R.string.donate)
clickable(
title = R.string.donate,
summary = R.string.donate_url
) {
clicked {
openLink(Uri.parse(context.getString(R.string.donate_url)))
}
}
}
}
binding.content.addView(screen.root)
}
}

View File

@ -208,4 +208,6 @@
<string name="active_unsaved_tips">配置文件需要在激活之前保存</string>
<string name="mode_switch_tips">仅在本次会话中有效</string>
<string name="import_">导入</string>
<string name="sources">源代码</string>
<string name="clash_core">Clash 核心</string>
</resources>

View File

@ -193,13 +193,17 @@
<string name="document">Document</string>
<string name="feedback">Feedback</string>
<string name="sources">Sources</string>
<string name="donate">Donate</string>
<string name="clash_wiki">Clash Wiki</string>
<string name="github_issues">Github Issues</string>
<string name="google_play">Google Play</string>
<string name="clash_core">Clash Core</string>
<string name="clash_wiki_url" translatable="false">https://github.com/Dreamacro/clash/wiki</string>
<string name="github_issues_url" translatable="false">https://github.com/Kr328/ClashForAndroid/issues</string>
<string name="donate_url" translatable="false">https://donate.kr328.app</string>
<string name="github_url" translatable="false">https://github.com/Kr328/ClashForAndroid</string>
<string name="clash_core_url" translatable="false">https://github.com/Dreamacro/clash</string>
<string name="tips_properties"><![CDATA[Accept Only <strong>Clash Config</strong>(including <strong>Proxy</strong>/<strong>Rules</strong>)]]></string>
<string name="tips_help"><![CDATA[Clash for Android is a <strong>freeware</strong> and we do <strong>NOT</strong> provide any service for it]]></string>