Skip to content

Commit

Permalink
Merge pull request #276 from GuoXiCheng/dev-c
Browse files Browse the repository at this point in the history
update
  • Loading branch information
GuoXiCheng authored Oct 19, 2024
2 parents dc0dd17 + 9a7618d commit c2ee730
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### 修改

- 解决加载的配置文件包含 Unicode 编码时未转换为中文的问题
- 解决点击右上角「功能介绍」后菜单未自动关闭的问题

## v3.0.0 - 2024.09.27

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/android/skip/ui/about/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ 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.components.expandMenuItems
import com.android.skip.ui.settings.theme.SwitchThemeViewModel
import com.android.skip.ui.theme.AppTheme
import com.android.skip.ui.webview.WebViewActivity
Expand Down Expand Up @@ -70,6 +71,7 @@ class AboutActivity : AppCompatActivity() {
putExtra("url", R.string.about_function_intro_url)
}
startActivity(intent)
expandMenuItems = false
})
})
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/android/skip/ui/alive/AliveActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ 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.components.expandMenuItems
import com.android.skip.ui.components.notification.NotificationDialog
import com.android.skip.ui.components.notification.NotificationDialogViewModel
import com.android.skip.ui.settings.theme.SwitchThemeViewModel
Expand Down Expand Up @@ -94,6 +95,7 @@ class AliveActivity : AppCompatActivity() {
putExtra("url", R.string.alive_function_intro_url)
}
startActivity(intent)
expandMenuItems = false
})
})
}
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/android/skip/ui/components/ScaffoldPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand All @@ -28,14 +27,15 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.android.skip.R

var expandMenuItems by mutableStateOf(false)

@Composable
fun ScaffoldPage(
barTitle: Int,
onBackClick: () -> Unit,
content: @Composable (PaddingValues) -> Unit,
menuItems: (@Composable (ColumnScope.() -> Unit))? = null
) {
var expanded by remember { mutableStateOf(false) }
Scaffold(topBar = {
Row(
modifier = Modifier
Expand All @@ -61,11 +61,11 @@ fun ScaffoldPage(

menuItems?.let {
Row {
IconButton(onClick = { expanded = true }) {
IconButton(onClick = { expandMenuItems = true }) {
Icon(Icons.Default.MoreVert, contentDescription = null)
DropdownMenu(expanded = expanded,
DropdownMenu(expanded = expandMenuItems,
modifier = Modifier.background(MaterialTheme.colorScheme.background),
onDismissRequest = { expanded = false }) {
onDismissRequest = { expandMenuItems = false }) {
menuItems()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ 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.expandMenuItems
import com.android.skip.ui.components.notification.NotificationDialog
import com.android.skip.ui.components.notification.NotificationDialogViewModel
import com.android.skip.ui.inspect.record.InspectRecordButton
Expand Down Expand Up @@ -66,6 +67,7 @@ class InspectActivity : AppCompatActivity() {
putExtra("url", R.string.inspect_function_intro_url)
}
startActivity(intent)
expandMenuItems = false
})
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ 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.expandMenuItems
import com.android.skip.ui.components.notification.NotificationDialog
import com.android.skip.ui.components.notification.NotificationDialogViewModel
import com.android.skip.ui.settings.custom.CustomButton
Expand Down Expand Up @@ -85,6 +86,7 @@ class SettingsActivity : AppCompatActivity() {
putExtra("url", R.string.settings_function_intro_url)
}
startActivity(intent)
expandMenuItems = false
})
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ 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.components.expandMenuItems
import com.android.skip.ui.settings.theme.SwitchThemeViewModel
import com.android.skip.ui.theme.AppTheme
import com.android.skip.ui.webview.WebViewActivity
Expand Down Expand Up @@ -46,6 +47,7 @@ class WhiteListActivity : AppCompatActivity() {
putExtra("url", R.string.whitelist_function_intro_url)
}
startActivity(intent)
expandMenuItems = false
})
ShowSystemButton(showSystemViewModel)
})
Expand Down

0 comments on commit c2ee730

Please sign in to comment.