Added new GitHub proxy url

This commit is contained in:
2023-04-18 00:31:55 +08:00
parent 6fe1f0572c
commit 883325dc2f
4 changed files with 29 additions and 9 deletions

View File

@@ -36,8 +36,11 @@ object PackageName {
*/
object IconRuleSourceSyncType {
/** GitHub Raw (代理) */
const val GITHUB_RAW_PROXY = 1000
/** GitHub Raw (代理 - GitHub Proxy) */
const val GITHUB_RAW_PROXY_1 = 500
/** GitHub Raw (代理 - 7ED Services) */
const val GITHUB_RAW_PROXY_2 = 1000
/** GitHub Raw (直连) */
const val GITHUB_RAW_DIRECT = 2000

View File

@@ -85,7 +85,7 @@ object ConfigData {
val NOTIFY_ICONS_DATA = PrefsData("_notify_icon_datas", "")
/** 通知图标优化名单同步方式 */
val ICON_RULE_SOURCE_SYNC_TYPE = PrefsData("_rule_source_sync_way", IconRuleSourceSyncType.GITHUB_RAW_PROXY)
val ICON_RULE_SOURCE_SYNC_TYPE = PrefsData("_rule_source_sync_way", IconRuleSourceSyncType.GITHUB_RAW_PROXY_1)
/** 通知图标优化名单同步地址 */
val ICON_RULE_SOURCE_SYNC_CUSTOM_URL = PrefsData("_rule_source_sync_way_custom_url", "")

View File

@@ -67,12 +67,15 @@ object IconRuleManagerTool {
/** 当前规则的通知图标颜色 */
private const val OS_COLOR = 0xFFE06818.toInt()
/** 同步地址 - GitHub Raw (代理) */
private const val SYNC_PROXY_URL = "https://raw.githubusercontentS.com/fankes/AndroidNotifyIconAdapt/main"
/** 同步地址 - GitHub Raw (直连) */
private const val SYNC_DIRECT_URL = "https://raw.githubusercontent.com/fankes/AndroidNotifyIconAdapt/main"
/** 同步地址 - GitHub Raw (代理 - GitHub Proxy) */
private const val SYNC_PROXY_1_URL = "https://ghproxy.com/$SYNC_DIRECT_URL"
/** 同步地址 - GitHub Raw (代理 - 7ED Services) */
private const val SYNC_PROXY_2_URL = "https://raw.githubusercontentS.com/fankes/AndroidNotifyIconAdapt/main"
/** 云端规则展示地址 (OS) */
private const val RULES_TRAVELER_OS_URL = "https://fankes.github.io/AndroidNotifyIconAdapt/?notify-rules-miui"
@@ -104,13 +107,19 @@ object IconRuleManagerTool {
}
binding.sourceFromTextLin.isVisible = sourceType == IconRuleSourceSyncType.CUSTOM_URL
binding.sourceTravelerLin.isVisible = sourceType != IconRuleSourceSyncType.CUSTOM_URL
binding.sourceRadio1.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY
binding.sourceRadio0.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY_1
binding.sourceRadio1.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY_2
binding.sourceRadio2.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_DIRECT
binding.sourceRadio3.isChecked = sourceType == IconRuleSourceSyncType.CUSTOM_URL
binding.sourceRadio0.setOnClickListener {
binding.sourceFromTextLin.isVisible = false
binding.sourceTravelerLin.isVisible = true
sourceType = IconRuleSourceSyncType.GITHUB_RAW_PROXY_1
}
binding.sourceRadio1.setOnClickListener {
binding.sourceFromTextLin.isVisible = false
binding.sourceTravelerLin.isVisible = true
sourceType = IconRuleSourceSyncType.GITHUB_RAW_PROXY
sourceType = IconRuleSourceSyncType.GITHUB_RAW_PROXY_2
}
binding.sourceRadio2.setOnClickListener {
binding.sourceFromTextLin.isVisible = false
@@ -189,7 +198,8 @@ object IconRuleManagerTool {
callback: () -> Unit
) {
when (sourceType) {
IconRuleSourceSyncType.GITHUB_RAW_PROXY -> onRefreshing(context, SYNC_PROXY_URL, callback)
IconRuleSourceSyncType.GITHUB_RAW_PROXY_1 -> onRefreshing(context, SYNC_PROXY_1_URL, callback)
IconRuleSourceSyncType.GITHUB_RAW_PROXY_2 -> onRefreshing(context, SYNC_PROXY_2_URL, callback)
IconRuleSourceSyncType.GITHUB_RAW_DIRECT -> onRefreshing(context, SYNC_DIRECT_URL, callback)
IconRuleSourceSyncType.CUSTOM_URL ->
if (customUrl.isNotBlank())

View File

@@ -24,6 +24,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/source_radio_0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GitHub Raw (GitHub Proxy)"
app:buttonTint="@color/colorPrimaryAccent" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/source_radio_1"
android:layout_width="wrap_content"