Modify merge to new notification icon rules urls in IconRuleManagerTool, ConfigureActivity, dia_source_from

This commit is contained in:
2023-02-06 02:17:35 +08:00
parent 9e53e0ddba
commit 896322361e
3 changed files with 77 additions and 7 deletions

View File

@@ -173,8 +173,8 @@ class ConfigureActivity : BaseActivity<ActivityConfigBinding>() {
showDialog { showDialog {
title = "感谢你的贡献" title = "感谢你的贡献"
msg = "通知图标优化名单需要大家的共同维护才能得以完善,请选择你的贡献方式。" msg = "通知图标优化名单需要大家的共同维护才能得以完善,请选择你的贡献方式。"
confirmButton(text = "贡献规则") { openBrowser(url = "https://github.com/fankes/AndroidNotifyIconAdapt/blob/main/CONTRIBUTING.md") } confirmButton(text = "贡献规则") { openBrowser(IconRuleManagerTool.RULES_CONTRIBUTING_URL) }
cancelButton(text = "请求适配") { openBrowser(url = "https://github.com/fankes/AndroidNotifyIconAdapt/issues/new/choose") } cancelButton(text = "请求适配") { openBrowser(IconRuleManagerTool.RULES_FEEDBACK_URL) }
neutralButton(text = "暂时不用") neutralButton(text = "暂时不用")
} }
} }

View File

@@ -45,10 +45,7 @@ import com.fankes.coloros.notify.databinding.DiaSourceFromBinding
import com.fankes.coloros.notify.databinding.DiaSourceFromStringBinding import com.fankes.coloros.notify.databinding.DiaSourceFromStringBinding
import com.fankes.coloros.notify.param.IconPackParams import com.fankes.coloros.notify.param.IconPackParams
import com.fankes.coloros.notify.ui.activity.ConfigureActivity import com.fankes.coloros.notify.ui.activity.ConfigureActivity
import com.fankes.coloros.notify.utils.factory.delayedRun import com.fankes.coloros.notify.utils.factory.*
import com.fankes.coloros.notify.utils.factory.safeOfNull
import com.fankes.coloros.notify.utils.factory.showDialog
import com.fankes.coloros.notify.utils.factory.snake
import com.highcapable.yukihookapi.hook.log.loggerD import com.highcapable.yukihookapi.hook.log.loggerD
import okhttp3.* import okhttp3.*
import java.io.IOException import java.io.IOException
@@ -76,6 +73,18 @@ object IconRuleManagerTool {
/** 同步地址 - Github Raw (直连) */ /** 同步地址 - Github Raw (直连) */
private const val SYNC_DIRECT_URL = "https://raw.githubusercontent.com/fankes/AndroidNotifyIconAdapt/main" private const val SYNC_DIRECT_URL = "https://raw.githubusercontent.com/fankes/AndroidNotifyIconAdapt/main"
/** 云端规则展示地址 (OS) */
private const val RULES_TRAVELER_OS_URL = "https://fankes.github.io/AndroidNotifyIconAdapt/?notify-rules-coloros"
/** 云端规则展示地址 (APP) */
private const val RULES_TRAVELER_APP_URL = "https://fankes.github.io/AndroidNotifyIconAdapt/?notify-rules-app"
/** 请求适配通知图标优化名单地址 */
internal const val RULES_FEEDBACK_URL = "https://fankes.github.io/AndroidNotifyIconAdapt/?feedback"
/** 贡献通知图标优化名单地址 */
internal const val RULES_CONTRIBUTING_URL = "https://fankes.github.io/AndroidNotifyIconAdapt/?contribute"
/** /**
* 从在线地址手动同步规则 * 从在线地址手动同步规则
* @param context 实例 * @param context 实例
@@ -94,21 +103,27 @@ object IconRuleManagerTool {
doOnTextChanged { text, _, _, _ -> customUrl = text.toString() } doOnTextChanged { text, _, _, _ -> customUrl = text.toString() }
} }
binding.sourceFromTextLin.isVisible = sourceType == IconRuleSourceSyncType.CUSTOM_URL binding.sourceFromTextLin.isVisible = sourceType == IconRuleSourceSyncType.CUSTOM_URL
binding.sourceTravelerLin.isVisible = sourceType != IconRuleSourceSyncType.CUSTOM_URL
binding.sourceRadio1.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY binding.sourceRadio1.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY
binding.sourceRadio2.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_DIRECT binding.sourceRadio2.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_DIRECT
binding.sourceRadio3.isChecked = sourceType == IconRuleSourceSyncType.CUSTOM_URL binding.sourceRadio3.isChecked = sourceType == IconRuleSourceSyncType.CUSTOM_URL
binding.sourceRadio1.setOnClickListener { binding.sourceRadio1.setOnClickListener {
binding.sourceFromTextLin.isVisible = false binding.sourceFromTextLin.isVisible = false
binding.sourceTravelerLin.isVisible = true
sourceType = IconRuleSourceSyncType.GITHUB_RAW_PROXY sourceType = IconRuleSourceSyncType.GITHUB_RAW_PROXY
} }
binding.sourceRadio2.setOnClickListener { binding.sourceRadio2.setOnClickListener {
binding.sourceFromTextLin.isVisible = false binding.sourceFromTextLin.isVisible = false
binding.sourceTravelerLin.isVisible = true
sourceType = IconRuleSourceSyncType.GITHUB_RAW_DIRECT sourceType = IconRuleSourceSyncType.GITHUB_RAW_DIRECT
} }
binding.sourceRadio3.setOnClickListener { binding.sourceRadio3.setOnClickListener {
binding.sourceFromTextLin.isVisible = true binding.sourceFromTextLin.isVisible = true
binding.sourceTravelerLin.isVisible = false
sourceType = IconRuleSourceSyncType.CUSTOM_URL sourceType = IconRuleSourceSyncType.CUSTOM_URL
} }
binding.sourceTravelerOsButton.setOnClickListener { context.openBrowser(RULES_TRAVELER_OS_URL) }
binding.sourceTravelerAppButton.setOnClickListener { context.openBrowser(RULES_TRAVELER_APP_URL) }
confirmButton { confirmButton {
ConfigData.iconRuleSourceSyncType = sourceType ConfigData.iconRuleSourceSyncType = sourceType
ConfigData.iconRuleSourceSyncCustomUrl = customUrl ConfigData.iconRuleSourceSyncCustomUrl = customUrl
@@ -117,7 +132,7 @@ object IconRuleManagerTool {
cancelButton() cancelButton()
neutralButton(text = "自定义规则") { neutralButton(text = "自定义规则") {
context.showDialog<DiaSourceFromStringBinding> { context.showDialog<DiaSourceFromStringBinding> {
title = "自定义规则(调试)" title = "自定义规则 (调试)"
binding.jsonRuleEdit.apply { binding.jsonRuleEdit.apply {
requestFocus() requestFocus()
invalidate() invalidate()

View File

@@ -50,6 +50,7 @@
android:id="@+id/source_from_text_lin" android:id="@+id/source_from_text_lin"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:visibility="gone"> android:visibility="gone">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
@@ -60,4 +61,58 @@
android:hint="请输入在线地址 URL" android:hint="请输入在线地址 URL"
android:singleLine="true" /> android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:id="@+id/source_traveler_lin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8.5dp"
android:layout_marginRight="8.5dp"
android:layout_marginBottom="15dp"
android:singleLine="true"
android:text="查看云端规则数据"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6.5dp"
android:layout_marginRight="6.5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/source_traveler_os_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_weight="1"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="OS"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:id="@+id/source_traveler_app_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_weight="1"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="APP"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>