Skip to content

Commit

Permalink
fix: Add missing BackHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
YuKongA committed Feb 7, 2025
1 parent 6fd045f commit a8c73e4
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 36 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/Android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [ main ]
paths-ignore:
- "README.md"
pull_request:
pull_request:

jobs:
build:
Expand All @@ -27,20 +27,20 @@ jobs:
echo ${{ secrets.SIGNING_KEY }} | base64 --decode > key.jks
fi
- name: set up JDK 17
- name: set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
cache: 'gradle'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.ref != 'refs/heads/dev' && github.ref != 'refs/heads/new' }}

- name: Build with Gradle
run: |
./gradlew assemble
run: ./gradlew assemble

- name: Upload Release APK
uses: actions/upload-artifact@v4
Expand All @@ -66,7 +66,7 @@ jobs:
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
COMMIT_MESSAGE: |+
Github CI
New Github CI Build
```
${{ github.event.head_commit.message }}
```
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/Android_Dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Android CI Dev

on:
push:
branches: [Dev, new]
branches: [ Dev, new ]
paths-ignore:
- "README.md"
pull_request:
Expand All @@ -28,22 +28,20 @@ jobs:
echo ${{ secrets.SIGNING_KEY }} | base64 --decode > key.jks
fi
- name: set up JDK 17
- name: set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
cache: 'gradle'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.ref != 'refs/heads/dev' && github.ref != 'refs/heads/new' }}

- name: Build with Gradle
run: |
echo 'org.gradle.parallel=true' >> gradle.properties
echo 'org.gradle.jvmargs=-Xmx4g' >> gradle.properties
./gradlew assemble
run: ./gradlew assemble

- name: Upload Release APK
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -71,7 +69,7 @@ jobs:
MAPPING: ./app/build/outputs/mapping/release/mapping.txt
COMMIT_URL: ${{ github.event.head_commit.url }}
COMMIT_MESSAGE: |+
Github CI Build
New Github Dev Build
```
${{ github.event.head_commit.message }}
```
Expand Down
11 changes: 3 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
Expand All @@ -17,22 +16,18 @@
android:theme="@style/Theme.StatusbarLyric">
<activity
android:name=".MainActivity"
android:enableOnBackInvokedCallback="false"
android:exported="true"
android:windowSoftInputMode="adjustResize"
tools:ignore="UnusedAttribute">
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="de.robv.android.xposed.category.MODULE_SETTINGS" />
</intent-filter>
</activity>
<activity-alias
android:name=".AliasActivity"
android:enableOnBackInvokedCallback="false"
android:exported="true"
android:targetActivity=".MainActivity"
android:windowSoftInputMode="adjustResize"
tools:ignore="UnusedAttribute">
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/statusbar/lyric/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ fun PortraitLayout(navController: NavHostController, currentStartDestination: Mu
) {
composable("HomePage") { HomePage(navController) }
composable("EmptyPage") { EmptyPage() }
composable("MenuPage") { MenuPage(navController, currentStartDestination) }
composable("ChoosePage") { ChoosePage(navController) }
composable("TestPage") { TestPage(navController, currentStartDestination) }
composable("MenuPage") { MenuPage(navController, currentStartDestination) }
composable("LyricPage") { LyricPage(navController, currentStartDestination) }
composable("IconPage") { IconPage(navController, currentStartDestination) }
composable("ExtendPage") { ExtendPage(navController, currentStartDestination) }
Expand Down Expand Up @@ -195,9 +195,9 @@ fun LandscapeLayout(navController: NavHostController, currentStartDestination: M
) {
composable("HomePage") { HomePage(navController) }
composable("EmptyPage") { EmptyPage() }
composable("MenuPage") { MenuPage(navController, currentStartDestination) }
composable("ChoosePage") { ChoosePage(navController) }
composable("TestPage") { TestPage(navController, currentStartDestination) }
composable("MenuPage") { MenuPage(navController, currentStartDestination) }
composable("LyricPage") { LyricPage(navController, currentStartDestination) }
composable("IconPage") { IconPage(navController, currentStartDestination) }
composable("ExtendPage") { ExtendPage(navController, currentStartDestination) }
Expand Down
1 change: 0 additions & 1 deletion app/src/main/kotlin/statusbar/lyric/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class MainActivity : ComponentActivity() {
lateinit var createDocumentLauncher: ActivityResultLauncher<Intent>
lateinit var openDocumentLauncher: ActivityResultLauncher<Intent>


companion object {
@SuppressLint("StaticFieldLeak")
lateinit var context: Context
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/statusbar/lyric/tools/Tools.kt
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ object Tools {
}
}
}
return false;
return false
}

inline fun <T> T?.isNotNull(callback: (T) -> Unit): Boolean {
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/kotlin/statusbar/lyric/ui/page/ChoosePage.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package statusbar.lyric.ui.page

import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand Down Expand Up @@ -100,6 +101,10 @@ fun ChoosePage(navController: NavController) {
},
popupHost = { null }
) {
BackHandler(true) {
navController.popBackStack("TestPage", inclusive = false)
}

LazyColumn(
modifier = Modifier
.hazeSource(state = hazeState)
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/kotlin/statusbar/lyric/ui/page/ExtendPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,6 @@ fun ExtendPage(navController: NavController, currentStartDestination: MutableSta
SuperDropdown(
title = stringResource(R.string.view_location),
items = viewLocationOptions,
titleColor = BasicComponentDefaults.titleColor(
color = MiuixTheme.colorScheme.primary
),
selectedIndex = viewLocationSelectedOption.intValue,
onSelectedIndexChange = { newOption ->
viewLocationSelectedOption.intValue = newOption
Expand Down
16 changes: 12 additions & 4 deletions app/src/main/res/drawable/ic_menu.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:autoMirrored="true" android:height="24dp" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="#000000" android:fillType="evenOdd" android:pathData="M12.244,4.156L18.904,7.886C19.062,7.974 19.16,8.141 19.16,8.322V15.678C19.16,15.859 19.062,16.026 18.904,16.114L12.244,19.844C12.092,19.929 11.907,19.929 11.756,19.844L5.095,16.114C4.938,16.026 4.84,15.859 4.84,15.678V8.322C4.84,8.141 4.938,7.974 5.095,7.886L11.756,4.156C11.907,4.071 12.092,4.071 12.244,4.156ZM11.023,2.847C11.63,2.507 12.37,2.507 12.977,2.847L19.638,6.577C20.269,6.931 20.66,7.598 20.66,8.322V15.678C20.66,16.402 20.269,17.069 19.638,17.423L12.977,21.153C12.37,21.493 11.63,21.493 11.023,21.153L4.362,17.423C3.731,17.069 3.34,16.402 3.34,15.678V8.322C3.34,7.598 3.731,6.931 4.362,6.577L11.023,2.847ZM14.5,12C14.5,13.381 13.381,14.5 12,14.5C10.619,14.5 9.5,13.381 9.5,12C9.5,10.619 10.619,9.5 12,9.5C13.381,9.5 14.5,10.619 14.5,12ZM16,12C16,14.209 14.209,16 12,16C9.791,16 8,14.209 8,12C8,9.791 9.791,8 12,8C14.209,8 16,9.791 16,12Z"/>

<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:width="24dp"
android:height="24dp"
android:autoMirrored="true"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#000000"
android:fillType="evenOdd"
android:pathData="M12.244,4.156L18.904,7.886C19.062,7.974 19.16,8.141 19.16,8.322V15.678C19.16,15.859 19.062,16.026 18.904,16.114L12.244,19.844C12.092,19.929 11.907,19.929 11.756,19.844L5.095,16.114C4.938,16.026 4.84,15.859 4.84,15.678V8.322C4.84,8.141 4.938,7.974 5.095,7.886L11.756,4.156C11.907,4.071 12.092,4.071 12.244,4.156ZM11.023,2.847C11.63,2.507 12.37,2.507 12.977,2.847L19.638,6.577C20.269,6.931 20.66,7.598 20.66,8.322V15.678C20.66,16.402 20.269,17.069 19.638,17.423L12.977,21.153C12.37,21.493 11.63,21.493 11.023,21.153L4.362,17.423C3.731,17.069 3.34,16.402 3.34,15.678V8.322C3.34,7.598 3.731,6.931 4.362,6.577L11.023,2.847ZM14.5,12C14.5,13.381 13.381,14.5 12,14.5C10.619,14.5 9.5,13.381 9.5,12C9.5,10.619 10.619,9.5 12,9.5C13.381,9.5 14.5,10.619 14.5,12ZM16,12C16,14.209 14.209,16 12,16C9.791,16 8,14.209 8,12C8,9.791 9.791,8 12,8C14.209,8 16,9.791 16,12Z"
tools:ignore="VectorPath" />
</vector>
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
android-gradle-plugin = "8.8.0"
androidx-core-kit = "1.15.0"
androidx-activity-compose = "1.10.0"
androidx-compose-foundation = "1.7.6"
androidx-navigation-compose = "2.8.5"
androidx-compose-foundation = "1.7.7"
androidx-navigation-compose = "2.8.6"
ezXHelper = "2.2.0"
haze = "1.3.0"
kotlin = "2.1.10"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down

0 comments on commit a8c73e4

Please sign in to comment.