Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Commit

Permalink
R3.3.4
Browse files Browse the repository at this point in the history
彻底修复无障碍服务攻击漏洞
开放OpenSourceLibDependency活动
试图缩减代码行数
  • Loading branch information
ryuunoakaihitomi committed Nov 4, 2020
1 parent 1e6bddd commit 63c205f
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 29 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ android {
//targetSdkVersion compileSdkVersion
targetSdkVersion 30
// 版本号:发布日期
versionCode 20201103
versionCode 20201104
/*
版本名说明:
R3.0.0
Refactoring 第三次重构+功能更新+缺陷修复
*/
versionName "R3.3.3"
versionName "R3.3.4"
resConfigs "en", "zh-rCN"
// 致用户:可以在这里禁用Firebase,将以下值设为true
final def disableFirebase = false
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

<activity
android:name=".ui.OpenSourceLibDependencyActivity"
android:exported="true"
android:label="@string/open_source_lib_dependency"
android:theme="@style/Theme.AppCompat.NoActionBar" />

<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ class MainActivity : AppCompatActivity() {
mainDialog = AlertDialog.Builder(this).apply {
setTitle(powerViewModel.title.value)
setAdapter(
PowerItemAdapter(
this@MainActivity,
it.getLabelArray(),
it.getIconResIdArray()
)
PowerItemAdapter(this@MainActivity, it.getLabelArray(), it.getIconResIdArray())
) { dialog, which ->
val item = it[which]
/* 如果为特权模式且不为锁屏,再次确认 */
Expand All @@ -99,10 +95,7 @@ class MainActivity : AppCompatActivity() {
and (item.labelResId != R.string.func_lock_screen_privileged)
) {
setTitle(
String.format(
getString(R.string.title_dialog_confirm_op),
item.label
)
String.format(getString(R.string.title_dialog_confirm_op), item.label)
)
// 再次确认
setAdapter(null, null)
Expand All @@ -128,16 +121,14 @@ class MainActivity : AppCompatActivity() {
}
setNeutralButton(null, null)
setPositiveButton(null, null)
show()
show().listView.rootView.hideFromAccessibilityService()
} else {
powerViewModel.call(item.labelResId)
dialog.dismiss()
}
}
if (powerViewModel.rootMode.value == true) {
setNeutralButton(R.string.btn_dialog_switch_mode) { _, _ ->
powerViewModel.reverseForceMode()
}
setNeutralButton(R.string.btn_dialog_switch_mode) { _, _ -> powerViewModel.reverseForceMode() }
}
setPositiveButton(R.string.btn_dialog_help) { _, _ ->
/* --- 帮助界面逻辑 ---*/
Expand All @@ -153,7 +144,7 @@ class MainActivity : AppCompatActivity() {
finish()
}

setNeutralButton(getString(R.string.btn_dialog_open_source_lib_dependency)) { _, _ ->
setNeutralButton(getString(R.string.open_source_lib_dependency)) { _, _ ->
this@MainActivity.startActivity(
Intent(application, OpenSourceLibDependencyActivity::class.java)
)
Expand All @@ -176,7 +167,10 @@ class MainActivity : AppCompatActivity() {
//alertDialogMessageView.setTextIsSelectable(true)
Toasty.normal(
this@MainActivity,
"${BuildConfig.VERSION_NAME}\n${BuildConfig.VERSION_CODE}",
"""
${BuildConfig.VERSION_NAME}
${BuildConfig.VERSION_CODE}
""".trimIndent(),
Toasty.LENGTH_LONG
).show()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,7 @@ class PowerViewModel : AndroidViewModel(MyApplication.getInstance()) {
if (isOnForceMode(info)) {
val range = 0..forceLabel.length
forceLabel[range] = ForegroundColorSpan(
ResourcesCompat.getColor(
app().resources,
R.color.colorForceModeItem, null
)
ResourcesCompat.getColor(app().resources, R.color.colorForceModeItem, null)
)
forceLabel[range] = StyleSpan(Typeface.BOLD)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ class PowerDialogTileService : TileService() {
Timber.w("locked!")
qsTile?.run {
updateState(Tile.STATE_UNAVAILABLE)
unlockAndRun {
updateState(Tile.STATE_ACTIVE)
}
unlockAndRun { updateState(Tile.STATE_ACTIVE) }
}
} else {
/* 打开电源菜单 */
Expand All @@ -38,8 +36,6 @@ class PowerDialogTileService : TileService() {

// 这是一个随时可用的磁贴,因此应该在可见时时刻保持“活跃状态”(对比突出图标),但在锁屏时没有使用的理由
override fun onStartListening() {
qsTile?.run {
if (!isLocked) updateState(Tile.STATE_ACTIVE)
}
qsTile?.run { if (!isLocked) updateState(Tile.STATE_ACTIVE) }
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
<string name="title_dialog_confirm_op">确认操作 “%s”</string>
<string name="toast_shortcut_added">已经尝试添加快捷方式</string>
<string name="btn_dialog_feedback">反馈</string>
<string name="btn_dialog_open_source_lib_dependency">开源库依赖项</string>
<string name="open_source_lib_dependency">开源库依赖项</string>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
<string name="title_dialog_confirm_op">Confirm operation \"%s\"</string>
<string name="toast_shortcut_added">Have tried to add shortcut</string>
<string name="btn_dialog_feedback">Feedback</string>
<string name="btn_dialog_open_source_lib_dependency">Open Source Library Dependency</string>
<string name="open_source_lib_dependency">Open Source Library Dependency</string>
</resources>

0 comments on commit 63c205f

Please sign in to comment.