Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoXiCheng committed Sep 23, 2024
1 parent 50866d4 commit cabf10b
Show file tree
Hide file tree
Showing 21 changed files with 80 additions and 27 deletions.
3 changes: 2 additions & 1 deletion app/src/main/java/com/android/skip/ui/about/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.android.skip.R
import com.android.skip.data.config.ConfigViewModel
import com.android.skip.ui.about.config.ConfigVersionButton
import com.android.skip.ui.components.FlatButton
import com.android.skip.ui.components.ResourceIcon
import com.android.skip.ui.components.RowContent
import com.android.skip.ui.components.ScaffoldPage
import com.android.skip.ui.settings.theme.SwitchThemeViewModel
Expand Down Expand Up @@ -53,7 +54,7 @@ class AboutActivity : AppCompatActivity() {
ConfigVersionButton(configViewModel)
}, {
DropdownMenuItem(
leadingIcon = { Icon(Icons.Outlined.Info, contentDescription = null) },
leadingIcon = { ResourceIcon(iconResource = R.drawable.help) },
text = { Text(stringResource(id = R.string.about_function_intro)) },
onClick = {
val intent = Intent(MyApp.context, WebViewActivity::class.java).apply {
Expand Down
5 changes: 1 addition & 4 deletions app/src/main/java/com/android/skip/ui/alive/AliveActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import android.provider.Settings
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Info
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
Expand Down Expand Up @@ -90,7 +87,7 @@ class AliveActivity : AppCompatActivity() {
}
}, {
DropdownMenuItem(
leadingIcon = { Icon(Icons.Outlined.Info, contentDescription = null) },
leadingIcon = { ResourceIcon(iconResource = R.drawable.help) },
text = { Text(stringResource(id = R.string.alive_function_intro)) },
onClick = {
val intent = Intent(MyApp.context, WebViewActivity::class.java).apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import androidx.activity.compose.setContent
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Info
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.ui.res.stringResource
import androidx.core.app.NotificationManagerCompat
Expand All @@ -20,6 +17,7 @@ import com.android.skip.MyApp
import com.android.skip.R
import com.android.skip.service.AccessibilityInspectViewModel
import com.android.skip.service.InspectService
import com.android.skip.ui.components.ResourceIcon
import com.android.skip.ui.components.ScaffoldPage
import com.android.skip.ui.components.notification.NotificationDialog
import com.android.skip.ui.components.notification.NotificationDialogViewModel
Expand Down Expand Up @@ -61,7 +59,7 @@ class InspectActivity : AppCompatActivity() {
}
},{
DropdownMenuItem(
leadingIcon = { Icon(Icons.Outlined.Info, contentDescription = null) },
leadingIcon = { ResourceIcon(iconResource = R.drawable.help) },
text = { Text(stringResource(id = R.string.inspect_function_intro)) },
onClick = {
val intent = Intent(MyApp.context, WebViewActivity::class.java).apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Info
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.ui.res.stringResource
import androidx.core.app.NotificationManagerCompat
Expand All @@ -21,6 +18,7 @@ import com.android.skip.MyApp
import com.android.skip.R
import com.android.skip.data.SyncWorker
import com.android.skip.data.config.ConfigViewModel
import com.android.skip.ui.components.ResourceIcon
import com.android.skip.ui.components.ScaffoldPage
import com.android.skip.ui.components.notification.NotificationDialog
import com.android.skip.ui.components.notification.NotificationDialogViewModel
Expand Down Expand Up @@ -80,7 +78,7 @@ class SettingsActivity : AppCompatActivity() {
}
}, {
DropdownMenuItem(
leadingIcon = { Icon(Icons.Outlined.Info, contentDescription = null) },
leadingIcon = { ResourceIcon(iconResource = R.drawable.help) },
text = { Text(stringResource(id = R.string.settings_function_intro)) },
onClick = {
val intent = Intent(MyApp.context, WebViewActivity::class.java).apply {
Expand All @@ -107,9 +105,7 @@ class SettingsActivity : AppCompatActivity() {
}

val periodicWorkRequest =
PeriodicWorkRequestBuilder<SyncWorker>(15, TimeUnit.MINUTES)
.setInitialDelay(5, TimeUnit.SECONDS)
.build()
PeriodicWorkRequestBuilder<SyncWorker>(12, TimeUnit.HOURS).build()
val workManager = WorkManager.getInstance(this)

autoUpdateViewModel.autoUpdate.observe(this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fun CustomButton(configViewModel: ConfigViewModel, onClick: () -> Unit) {
fontSize = 20.sp
)
IconButton(onClick = onClick) {
ResourceIcon(iconResource = R.drawable.info)
ResourceIcon(iconResource = R.drawable.help)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fun RecentButton(recentViewModel: RecentViewModel) {
RowContent(
title = R.string.settings_background_task,
subTitle = R.string.settings_background_task_subtitle,
icon = { ResourceIcon(iconResource = R.drawable.info)},
icon = { ResourceIcon(iconResource = R.drawable.hide_image)},
checked =excludeFromRecent.value,
onCheckedChange = {
recentViewModel.changeExcludeFromRecent(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package com.android.skip.ui.settings.recent
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.android.skip.R
import com.android.skip.util.DataStoreUtils
import com.blankj.utilcode.util.StringUtils.getString
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
Expand All @@ -21,5 +23,9 @@ class RecentViewModel @Inject constructor() : ViewModel() {

fun changeExcludeFromRecent(excludeFromRecent: Boolean) {
_excludeFromRecent.postValue(excludeFromRecent)

viewModelScope.launch {
DataStoreUtils.putData(getString(R.string.store_exclude_from_recent), excludeFromRecent)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fun StrictButton(
RowContent(
R.string.settings_strict,
stringResource(id = strictText),
{ ResourceIcon(iconResource = R.drawable.point_scan) },
{ ResourceIcon(iconResource = R.drawable.target) },
enable.value, {
strictViewModel.changeEnable(it)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ class StrictRepository @Inject constructor() {

fun changeEnable(enable: Boolean) {
_enable.postValue(enable)
DataStoreUtils.putSyncData(getString(R.string.store_strict_mode), enable)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package com.android.skip.ui.settings.strict

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.android.skip.R
import com.android.skip.util.DataStoreUtils
import com.blankj.utilcode.util.StringUtils.getString
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
Expand All @@ -10,5 +15,11 @@ class StrictViewModel @Inject constructor(
): ViewModel(){
val enable = strictRepository.enable

fun changeEnable(enable: Boolean) = strictRepository.changeEnable(enable)
fun changeEnable(enable: Boolean) {
strictRepository.changeEnable(enable)

viewModelScope.launch {
DataStoreUtils.putData(getString(R.string.store_strict_mode), enable)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ class TipRepository @Inject constructor() {

fun changeEnable(enable: Boolean) {
_enable.postValue(enable)
DataStoreUtils.putSyncData(getString(R.string.store_skip_tip), enable)
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
package com.android.skip.ui.settings.tip

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.android.skip.R
import com.android.skip.util.DataStoreUtils
import com.blankj.utilcode.util.StringUtils.getString
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class TipViewModel @Inject constructor(
private val tipRepository: TipRepository
) : ViewModel() {
val enable = tipRepository.enable
fun changeEnable(enable: Boolean) = tipRepository.changeEnable(enable)
fun changeEnable(enable: Boolean) {
tipRepository.changeEnable(enable)

viewModelScope.launch {
DataStoreUtils.putData(getString(R.string.store_skip_tip), enable)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package com.android.skip.ui.settings.update
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.android.skip.R
import com.android.skip.util.DataStoreUtils
import com.blankj.utilcode.util.StringUtils.getString
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
Expand All @@ -17,5 +19,9 @@ class AutoUpdateViewModel @Inject constructor() : ViewModel() {

fun changeAutoUpdate(autoUpdate: Boolean) {
_autoUpdate.postValue(autoUpdate)

viewModelScope.launch {
DataStoreUtils.putData(getString(R.string.store_auto_update), autoUpdate)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Info
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.ui.res.stringResource
import com.android.skip.MyApp
import com.android.skip.R
import com.android.skip.ui.components.ResourceIcon
import com.android.skip.ui.components.ScaffoldPage
import com.android.skip.ui.settings.theme.SwitchThemeViewModel
import com.android.skip.ui.theme.AppTheme
Expand Down Expand Up @@ -41,7 +39,7 @@ class WhiteListActivity : AppCompatActivity() {
AppListColumn(appListViewModel, whiteListViewModel)
}, {
DropdownMenuItem(
leadingIcon = { Icon(Icons.Outlined.Info, contentDescription = null) },
leadingIcon = { ResourceIcon(iconResource = R.drawable.help) },
text = { Text(stringResource(id = R.string.whitelist_function_intro)) },
onClick = {
val intent = Intent(MyApp.context, WebViewActivity::class.java).apply {
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/help.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M478,720q21,0 35.5,-14.5T528,670q0,-21 -14.5,-35.5T478,620q-21,0 -35.5,14.5T428,670q0,21 14.5,35.5T478,720ZM442,566h74q0,-33 7.5,-52t42.5,-52q26,-26 41,-49.5t15,-56.5q0,-56 -41,-86t-97,-30q-57,0 -92.5,30T342,342l66,26q5,-18 22.5,-39t53.5,-21q32,0 48,17.5t16,38.5q0,20 -12,37.5T506,434q-44,39 -54,59t-10,73ZM480,880q-83,0 -156,-31.5T197,763q-54,-54 -85.5,-127T80,480q0,-83 31.5,-156T197,197q54,-54 127,-85.5T480,80q83,0 156,31.5T763,197q54,54 85.5,127T880,480q0,83 -31.5,156T763,763q-54,54 -127,85.5T480,880ZM480,800q134,0 227,-93t93,-227q0,-134 -93,-227t-227,-93q-134,0 -227,93t-93,227q0,134 93,227t227,93ZM480,480Z"
android:fillColor="#000000"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/hide_image.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="m840,726 l-80,-80v-446L314,200l-80,-80h526q33,0 56.5,23.5T840,200v526ZM792,904l-64,-64L200,840q-33,0 -56.5,-23.5T120,760v-528l-64,-64 56,-56 736,736 -56,56ZM240,680l120,-160 90,120 33,-44 -283,-283v447h447l-80,-80L240,680ZM537,423ZM424,536Z"
android:fillColor="#000000"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/target.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M480,880q-83,0 -156,-31.5T197,763q-54,-54 -85.5,-127T80,480q0,-83 31.5,-156T197,197q54,-54 127,-85.5T480,80q83,0 156,31.5T763,197q54,54 85.5,127T880,480q0,83 -31.5,156T763,763q-54,54 -127,85.5T480,880ZM480,800q134,0 227,-93t93,-227q0,-134 -93,-227t-227,-93q-134,0 -227,93t-93,227q0,134 93,227t227,93ZM480,720q-100,0 -170,-70t-70,-170q0,-100 70,-170t170,-70q100,0 170,70t70,170q0,100 -70,170t-170,70ZM480,640q66,0 113,-47t47,-113q0,-66 -47,-113t-113,-47q-66,0 -113,47t-47,113q0,66 47,113t113,47ZM480,560q-33,0 -56.5,-23.5T400,480q0,-33 23.5,-56.5T480,400q33,0 56.5,23.5T560,480q0,33 -23.5,56.5T480,560Z"
android:fillColor="#000000"/>
</vector>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<string name="store_resident_notification_bar">RESIDENT_NOTIFICATION_BAR</string>
<string name="store_exclude_from_recent">EXCLUDE_FROM_RECENT</string>
<string name="store_auto_update">AUTO_UPDATE</string>
<string name="store_current_theme">CURRENT_THEME</string>

<string name="notification_accessibility_service_running">无障碍服务运行中</string>
</resources>
1 change: 1 addition & 0 deletions gui/svg/help_24dp_000000_FILL0_wght400_GRAD0_opsz24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions gui/svg/target_24dp_000000_FILL0_wght400_GRAD0_opsz24.svg
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 cabf10b

Please sign in to comment.