Skip to content

Commit

Permalink
Merge pull request #259 from GuoXiCheng/dev-c
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
GuoXiCheng authored Sep 26, 2024
2 parents 2cc3a5b + 9601e93 commit 8218065
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 6 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## 未发布

### 新增

- 基于 Android MVVM 架构重构项目
- 新增「发生故障」标识,方便判断无障碍是否发生故障
- 新增「布局检查」功能
- 新增「自定义配置」功能 [#188](https://github.com/GuoXiCheng/SKIP/issues/188) [#237](https://github.com/GuoXiCheng/SKIP/issues/237)
- 新的可配置项:`activityName``click`
- 新增「后台隐藏」选项 [#196](https://github.com/GuoXiCheng/SKIP/issues/196)
- 应用保活新增常驻通知栏功能
- 新增「严格模式」启用开关
- 页面右上角新增「功能介绍」入口
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SKIP 是一款免费开源的安卓应用,旨在利用 Android 无障碍服务

## 主界面预览

<img src="https://guoxicheng.top/assets/image/skip-docs/main-interface-light.png" alt="https://guoxicheng.top/assets/image/skip-docs/main-interface-light.png" style="width: 30%;" />
<img src="https://skip.guoxicheng.top//images/main-interface-light.png" alt="https://skip.guoxicheng.top//images/main-interface-light.png" style="width: 30%;" />

## 使用说明

Expand All @@ -26,4 +26,4 @@ SKIP 是一款免费开源的安卓应用,旨在利用 Android 无障碍服务

## 许可证

[GNU AFFERO GENERAL PUBLIC LICENSE Version 3](https://github.com/GuoXiCheng/SKIP/blob/main/LICENSE)
[AGPL-3.0 license](https://github.com/GuoXiCheng/SKIP/blob/main/LICENSE)
2 changes: 1 addition & 1 deletion app/src/main/java/com/android/skip/MyApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MyApp : Application(), Configuration.Provider {

Utils.init(this)
LogUtils.getConfig()
.setLogSwitch(true) // 是否输出日志开关
.setLogSwitch(false) // 是否输出日志开关
.setConsoleSwitch(true) // 是否在控制台输出日志开关
.setGlobalTag("SKIP_APP") // 全局标签
.setLog2FileSwitch(true) // 是否写入日志文件开关
Expand Down
27 changes: 26 additions & 1 deletion app/src/main/java/com/android/skip/ui/main/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ import com.android.skip.ui.components.RowContent
import com.android.skip.ui.inspect.InspectActivity
import com.android.skip.ui.main.start.StartAccessibilityViewModel
import com.android.skip.ui.main.start.StartButton
import com.android.skip.ui.main.tutorial.TutorialDialog
import com.android.skip.ui.main.tutorial.TutorialViewModel
import com.android.skip.ui.settings.SettingsActivity
import com.android.skip.ui.settings.theme.SwitchThemeViewModel
import com.android.skip.ui.theme.AppTheme
import com.android.skip.ui.webview.WebViewActivity
import com.android.skip.ui.whitelist.WhiteListActivity
import com.android.skip.util.DataStoreUtils
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
Expand All @@ -47,6 +51,8 @@ class MainActivity : AppCompatActivity() {

private val apkVersionViewModel by viewModels<ApkVersionViewModel>()

private val tutorialViewModel by viewModels<TutorialViewModel>()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
Expand All @@ -60,7 +66,15 @@ class MainActivity : AppCompatActivity() {
) {
AppTitle()
StartButton(startAccessibilityViewModel = startAccessibilityViewModel) {
startActivity(Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS))
if (DataStoreUtils.getSyncData(
getString(R.string.store_show_tutorial),
true
)
) {
tutorialViewModel.changeDialogState(true)
} else {
startActivity(Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS))
}
}
KeepAliveButton {
startActivity(Intent(MyApp.context, AliveActivity::class.java))
Expand All @@ -78,6 +92,17 @@ class MainActivity : AppCompatActivity() {
startActivity(Intent(MyApp.context, AboutActivity::class.java))
}
}
TutorialDialog(tutorialViewModel, {
tutorialViewModel.changeDialogState(false)
DataStoreUtils.putSyncData(getString(R.string.store_show_tutorial), false)
startActivity(Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS))
}, {
tutorialViewModel.changeDialogState(false)
val intent = Intent(MyApp.context, WebViewActivity::class.java).apply {
putExtra("url", R.string.tutorial_url)
}
startActivity(intent)
})
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.android.skip.ui.main.tutorial

import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.ui.res.stringResource
import com.android.skip.R

@Composable
fun TutorialDialog(
tutorialViewModel: TutorialViewModel,
onDismiss: () -> Unit,
onConfirm: () -> Unit
) {
val isShowDialog = tutorialViewModel.isShowDialog.observeAsState()
if (isShowDialog.value == true) {
AlertDialog(
containerColor = MaterialTheme.colorScheme.background,
title = {
Text(text = stringResource(id = R.string.dialog_get_started))
},
text = {
Text(text = stringResource(id = R.string.dialog_get_started_content))
},
onDismissRequest = {},
confirmButton = {
Button(
onClick = onConfirm
) {
Text(stringResource(id = R.string.dialog_go_at_once))
}
},
dismissButton = {
TextButton(
onClick = onDismiss
) {
Text(stringResource(id = R.string.dialog_no_more_reminders))
}
}
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.android.skip.ui.main.tutorial

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class TutorialViewModel @Inject constructor() : ViewModel() {
private val _isShowDialog = MutableLiveData<Boolean>()
val isShowDialog: LiveData<Boolean> = _isShowDialog

fun changeDialogState(showDialog: Boolean) {
_isShowDialog.postValue(showDialog)
}
}
8 changes: 7 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<string name="app_name">SKIP</string>
<string name="accessibility_description">SKIP 可以帮您自动跳过应用开屏广告</string>
<string name="worker_sync">MySyncWorker</string>
<string name="tutorial_url">https://skip.guoxicheng.top/guide/intro/getting-started</string>

<string name="inspect">布局检查</string>
<string name="inspect_start_title">是否启用布局检查</string>
Expand Down Expand Up @@ -65,7 +66,6 @@
<string name="about_docs_url">https://skip.guoxicheng.top/guide/intro/what-is-skip</string>
<string name="about_app_version">应用版本号</string>
<string name="about_config_version">配置版本号</string>
<string name="checking">检查中…</string>
<string name="invalid_config">未检测到有效的配置</string>
<string name="about_function_intro">功能介绍</string>
<string name="about_function_intro_url">https://skip.guoxicheng.top/guide/about/intro</string>
Expand Down Expand Up @@ -95,6 +95,10 @@
<string name="dialog_new_version_released">新版本已发布</string>
<string name="dialog_update_version">更新应用: v%1$s 至 v%2$s</string>
<string name="dialog_downloading">下载中: %1$s%%</string>
<string name="dialog_get_started">提示</string>
<string name="dialog_get_started_content">是否需要前往查看「开始使用」教程</string>
<string name="dialog_go_at_once">立即前往</string>
<string name="dialog_no_more_reminders">不再提醒</string>

<string name="store_custom_config">CUSTOM_CONFIG</string>
<string name="store_default_config">https://skip.guoxicheng.top/skip_config_v3.yaml</string>
Expand All @@ -105,9 +109,11 @@
<string name="store_auto_update">AUTO_UPDATE</string>
<string name="store_current_theme">CURRENT_THEME</string>
<string name="store_not_update">NOT_UPDATE</string>
<string name="store_show_tutorial">SHOW_TUTORIAL</string>

<string name="notification_accessibility_service_running">无障碍服务运行中</string>
<string name="notification_inspect_service_running">布局检查服务运行中</string>

<string name="loading">加载中…</string>
<string name="checking">检查中…</string>
</resources>
4 changes: 4 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export default defineConfig(
text: "下载 APP",
link: "/guide/intro/download-app",
},
{
text: "开始使用",
link: "/guide/intro/getting-started",
},
],
},
{
Expand Down
9 changes: 9 additions & 0 deletions docs/guide/intro/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 开始使用

## 1. 点击屏幕中央按钮

![](/click-button-on-the-screen-dark.png)

## 2. 点击「使用“SKIP”」

![](/use-accessibility-dark.png)
2 changes: 1 addition & 1 deletion docs/guide/intro/what-is-skip.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ SKIP 是一款免费开源的安卓应用,旨在利用 Android 无障碍服务

## 主界面预览

![主界面预览](/main-interface-dark.png)
![主界面预览](/images/main-interface-light.png)
Binary file added docs/public/images/main-interface-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8218065

Please sign in to comment.