Skip to content

Commit

Permalink
Add join telegram channel button
Browse files Browse the repository at this point in the history
  • Loading branch information
KyuubiRan committed Mar 10, 2021
1 parent e8d7e4e commit a5a8545
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 19 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "me.kyuubiran.qqcleaner"
minSdkVersion 21
targetSdkVersion 30
versionCode 23
versionName "1.4.0"
versionCode 24
versionName "1.4.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class SettingsActivity : AppCompatTransferActivity() {
private lateinit var supportMe: Preference
private lateinit var gotoGithub: Preference
private lateinit var joinQQGroup: Preference
private lateinit var joinTelegram: Preference
private lateinit var moduleInfo: Preference

//重置清理时间计数器
Expand All @@ -71,6 +72,7 @@ class SettingsActivity : AppCompatTransferActivity() {
gotoGithub = findPreference("GotoGithub")!!
supportMe = findPreference("SupportMe")!!
joinQQGroup = findPreference("JoinQQGroup")!!
joinTelegram = findPreference("JoinTelegram")!!
moduleInfo = findPreference("ModuleInfo")!!
init()
}
Expand Down Expand Up @@ -126,16 +128,16 @@ class SettingsActivity : AppCompatTransferActivity() {
true
}
gotoGithub.setOnPreferenceClickListener {
val uri = Uri.parse("https://github.com/KyuubiRan/QQCleaner")
val intent = Intent(Intent.ACTION_VIEW, uri)
startActivity(intent)
openUrl("https://github.com/KyuubiRan/QQCleaner")
appContext?.makeToast("喜欢的话给我点个小星星吧~")
true
}
joinQQGroup.setOnPreferenceClickListener {
val uri = Uri.parse("https://jq.qq.com/?_wv=1027&k=VnwmAAGA")
val intent = Intent(Intent.ACTION_VIEW, uri)
startActivity(intent)
openUrl("https://jq.qq.com/?_wv=1027&k=VnwmAAGA")
true
}
joinTelegram.setOnPreferenceClickListener {
openUrl("https://t.me/QQCleanerCh")
true
}
supportMe.setOnPreferenceClickListener {
Expand Down Expand Up @@ -169,6 +171,12 @@ class SettingsActivity : AppCompatTransferActivity() {
}
}

private fun openUrl(url: String) {
val uri = Uri.parse(url)
val intent = Intent(Intent.ACTION_VIEW, uri)
startActivity(intent)
}

//切换自动瘦身时间是否显示
private fun toggleCleanedTimeShow() {
val currentCleanedTime = getLong(CFG_CURRENT_CLEANED_TIME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ class ModuleEntryHook {
"check",
contains = true,
ignoreCase = true
) ?: TextView(appContext)
) ?: TextView(appContext).also { tv ->
tv.setPadding(15, 15, 15, 15)
tv.textSize = 16F
}
title.doAfterTextChanged { v ->
if (v.toString() != "${hostInfo.hostName}瘦身")
title.text = "${hostInfo.hostName}瘦身"
Expand Down
13 changes: 5 additions & 8 deletions app/src/main/java/me/kyuubiran/qqcleaner/utils/ViewUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,11 @@ internal inline fun <reified T : TextView> ViewGroup.findViewByText(
contains: Boolean = false,
ignoreCase: Boolean = false
): T? {
for (str in text.withIndex()) {
val v = this.findViewByText<T>(str.value, contains = contains, ignoreCase = ignoreCase)
if (str.index < text.size) {
if (v == null) continue
} else {
return null
for (str in text) {
val v = this.findViewByText<T>(str, contains = contains, ignoreCase = ignoreCase)
v?.let {
return v
}
return v
}
return null
}
}
7 changes: 5 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@
<string name="about">公告</string>
<string name="about_hint">注意:本模块不会清理聊天记录、接收文件、保存的图片、表情收藏等重要东西\n
[更新日志]\n
-1.4.0(23)\n
1.初步适配微信(目录可能不全 也可能存在错误 请酌情使用)
-1.4.1(24)\n
1.解决微信处于英文环境下点击关于会崩溃的问题\n
2.添加加入Telegram按钮 频道: @QQCleanerCh
</string>
<string name="join_qq_group">点击加入QQ群</string>
<string name="join_qq_group_hint">有问题可以来群里反馈哦~</string>
<string name="auto_clean_delay">自动瘦身间隔</string>
<string name="auto_clean_delay_hint">单位:小时 默认24小时(即一天) 设置为0时默认24小时</string>
<string name="join_tg_channel">点击加入Telegram频道</string>
<string name="join_tg_channel_hint">频道:@QQCleanerCh\n聊天群组:@QQCleanerChat</string>
</resources>
4 changes: 4 additions & 0 deletions app/src/main/res/xml/root_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
app:key="JoinQQGroup"
app:title="@string/join_qq_group"
app:summary="@string/join_qq_group_hint" />
<Preference
app:key="JoinTelegram"
app:title="@string/join_tg_channel"
app:summary="@string/join_tg_channel_hint" />
<Preference
app:key="SupportMe"
app:title="@string/support_me"
Expand Down

0 comments on commit a5a8545

Please sign in to comment.