Skip to content

Commit

Permalink
Make hint more user-friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
KyuubiRan committed Nov 15, 2020
1 parent 4b94d6b commit c5d9f1e
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 20 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "me.kyuubiran.qqcleaner"
minSdkVersion 21
targetSdkVersion 30
versionCode 12
versionName "1.2"
versionCode 13
versionName "1.2.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import me.kyuubiran.qqcleaner.utils.*
import me.kyuubiran.qqcleaner.utils.ConfigManager.CFG_AUTO_CLEAN_ENABLED
import me.kyuubiran.qqcleaner.utils.ConfigManager.CFG_CURRENT_CLEANED_TIME
import me.kyuubiran.qqcleaner.utils.ConfigManager.CFG_CUSTOMER_CLEAN_LIST
import java.lang.Exception
import java.text.SimpleDateFormat


Expand Down Expand Up @@ -71,7 +72,12 @@ class SettingsActivity : AppCompatTransferActivity() {
true
}
customerCleanList.setOnPreferenceChangeListener { _, newValue ->
ConfigManager.setConfig(CFG_CUSTOMER_CLEAN_LIST, newValue)
try {
ConfigManager.setConfig(CFG_CUSTOMER_CLEAN_LIST, newValue)
qqContext?.showToastBySystem("好耶 保存自定义瘦身列表成功了!")
} catch (e: Exception) {
loge(e)
}
true
}
doCustomerClean.setOnPreferenceClickListener {
Expand Down Expand Up @@ -100,6 +106,7 @@ class SettingsActivity : AppCompatTransferActivity() {
} else {
clicked = 0
ConfigManager.setConfig(CFG_CURRENT_CLEANED_TIME, 0)
cleanedTime.setSummary(R.string.auto_clean_time_hint)
qqContext?.showToastBySystem("已重置清理时间")
}
true
Expand Down
15 changes: 13 additions & 2 deletions app/src/main/java/me/kyuubiran/qqcleaner/dialog/CleanDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,21 @@ const val FULL_MODE = 1
const val CUSTOMER_MODE = 2

object CleanDialog {
private fun getMessage(mode: Int): String {
return when (mode) {
HALF_MODE -> "一键瘦身"
FULL_MODE -> "完全瘦身"
CUSTOMER_MODE -> "自定义瘦身"
else -> ""
}
}

fun showConfirmDialog(mode: Int, context: Context) {
val msg = getMessage(mode)
if (msg.isEmpty()) throw IllegalAccessException("你不对劲 你有问题")
AlertDialog.Builder(context)
.setTitle("Tips")
.setMessage("你确定要清除吗?")
.setTitle("注意")
.setMessage("你确定要执行${msg}?")
.setNegativeButton("取消") { _, _ -> }
.setPositiveButton("确定") { _, _ ->
when (mode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object SupportMeDialog {

private fun gotoAliPay(context: Context) {
try {
qqContext?.showToastBySystem("感谢资瓷> <")
qqContext?.showToastBySystem("感谢资瓷~")
val urlCode = "fkx10658svai9rgm46mk9de"
val intent = Intent.parseUri(
"intent://platformapi/startapp?saId=10000007&clientVersion=3.7.0.0718&qrcode=https%3A%2F%2Fqr.alipay.com%2F{urlCode}%3F_s%3Dweb-other&_t=1472443966571#Intent;scheme=alipayqr;package=com.eg.android.AlipayGphone;end".replace(
Expand All @@ -44,9 +44,10 @@ object SupportMeDialog {
}

private fun gotoWeChat(context: Context) {
qqContext?.showToastBySystem("感谢资瓷> <")
qqContext?.showToastBySystem("感谢资瓷~")
AlertDialog.Builder(context)
.setView(R.layout.wechat_pay_image)
.setTitle("使用微信扫一扫")
.create()
.show()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ class ModuleEntryHook {
val vg = item?.parent as ViewGroup
vg.addView(entry, 2)
entry.setOnClickListener {
val intent = Intent(qqContext, SettingsActivity::class.java)
context?.startActivity(intent)
try {
val intent = Intent(qqContext, SettingsActivity::class.java)
context?.startActivity(intent)
} catch (e: Exception) {
qqContext?.showToastBySystem("坏耶 启动失败了 请尝试重启QQ")
loge(e)
}
}
} catch (e: Exception) {
loge(e)
Expand Down
33 changes: 24 additions & 9 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,42 @@
<string name="title_activity_settings">QQ瘦身</string>
<string name="res_inject_success">注入资源成功</string>

<string name="auto_clean_switch_title">定时清理</string>
<string name="auto_clean_switch_key">启用定时清理</string>
<string name="auto_clean_time">上次清理时间</string>
<string name="auto_clean_mode">清理方案</string>
<string name="auto_clean_switch_title">自动瘦身</string>

<string name="auto_clean_switch_hint">自动瘦身将会重启QQ后执行\n两次清理的时间间隔不小于24小时</string>
<string name="auto_clean_switch_key">启用自动瘦身</string>
<string name="auto_clean_time">上次自动瘦身时间</string>
<string name="auto_clean_mode">瘦身方案</string>
<string name="auto_clean_time_hint">还没有记录哦~</string>
<string name="auto_clean_mode_hint">三选一哦</string>

<string name="clean_title">清理缓存</string>

<string name="clean_half">一键瘦身</string>
<string name="clean_half_hint">清理QQ的部分缓存</string>
<string name="clean_full">全面瘦身</string>
<string name="clean_full_hint">把QQ能清理的都给他清理了</string>
<string name="clean_full_hint">比上面那个更全面一点</string>
<string name="clean_cus">自定义瘦身</string>
<string name="clean_cus_hint">我要自己选!</string>
<string name="clean_cus_hint">我的瘦身我做主!</string>
<string name="do_clean_cus">执行自定义瘦身</string>
<string name="do_clean_cus_hint">芜湖~</string>

<string name="other_title">其他</string>

<string name="module_version">模块版本</string>
<string name="version_name">1.2</string>
<string name="version_name">1.2.1</string>
<string name="goto_github">点我前往项目地址</string>
<string name="author">模块作者:KyuubiRan</string>
<string name="support_me">扶贫</string>
<string name="support_me_hint">本模块完全免费 喜欢的话可以捐赠我 谢谢支持~</string>
<string name="support_me">点我扶贫</string>
<string name="support_me_hint">本模块完全免费开源 一切开发旨在学习 请勿用于非法用途 喜欢本模块的可以捐赠支持我 谢谢~</string>
<string name="about">公告</string>
<string name="about_hint">注意:本模块不会清理聊天记录以及接收文件等重要东西\n
[更新日志]\n
-1.2.1\n
修改提示\n
-1.2\n
修改UI 增加自动瘦身\n
-1.1\n
增加自定义瘦身
</string>
</resources>
11 changes: 9 additions & 2 deletions app/src/main/res/xml/root_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
app:title="@string/auto_clean_switch_title">
<SwitchPreferenceCompat
app:key="AutoClean"
app:title="@string/auto_clean_switch_key"/>
app:title="@string/auto_clean_switch_key"
app:summary="@string/auto_clean_switch_hint"/>
<ListPreference
app:entries="@array/auto_clean_mode"
app:entryValues="@array/auto_clean_mode_value"
app:defaultValue="half_mode"
app:key="AutoCleanMode"
app:title="@string/auto_clean_mode"
app:summary="@string/auto_clean_mode_hint"
app:isPreferenceVisible="false"/>
<Preference
app:key="CleanedTime"
Expand All @@ -37,7 +39,8 @@
app:summary="@string/clean_cus_hint"/>
<Preference
app:key="DoCustomerClean"
app:title="@string/do_clean_cus"/>
app:title="@string/do_clean_cus"
app:summary="@string/do_clean_cus_hint"/>
</PreferenceCategory>
<PreferenceCategory
app:title="@string/other_title">
Expand All @@ -53,5 +56,9 @@
app:key="SupportMe"
app:title="@string/support_me"
app:summary="@string/support_me_hint"/>
<Preference
app:key="About"
app:title="@string/about"
app:summary="@string/about_hint"/>
</PreferenceCategory>
</PreferenceScreen>

0 comments on commit c5d9f1e

Please sign in to comment.