Skip to content

Commit

Permalink
Huawei AppGallery tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
levinli303 committed Jul 12, 2024
1 parent 31c6817 commit d3ae2f9
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/src/main/java/space/celestia/mobilecelestia/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class MainActivity : AppCompatActivity(R.layout.activity_main),

private var bottomSheetCommitIds = arrayListOf<Int>()
private var initialURLCheckPerformed = false
private var isAskingForExit = false

override fun onCreate(savedInstanceState: Bundle?) {
val factory = EntryPointAccessors.fromApplication(this, AppStatusInterface::class.java)
Expand Down Expand Up @@ -478,10 +479,19 @@ class MainActivity : AppCompatActivity(R.layout.activity_main),
frag.popLast()
} else if (self.canPopBottomSheetFragment()) {
self.popBottomSheetFragment()
} else {
} else if (frag != null || drawerLayout.isDrawerOpen(GravityCompat.END)) {
self.lifecycleScope.launch {
self.hideOverlay(true)
}
} else if (!self.isAskingForExit) {
self.isAskingForExit = true
self.showAlert(self.getString(R.string.exit_celestia_alert_title), self.getString(R.string.exit_celestia_alert_message), handler = {
self.isAskingForExit = false
self.finishAndRemoveTask()
exitProcess(0)
}, cancelHandler = {
self.isAskingForExit = false
})
}
}
})
Expand Down
32 changes: 32 additions & 0 deletions huawei.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
diff --git a/android/values-zh-rCN/strings.xml b/android/values-zh-rCN/strings.xml
index 6c03140..8c1269f 100644
--- a/android/values-zh-rCN/strings.xml
+++ b/android/values-zh-rCN/strings.xml
@@ -10,11 +10,13 @@
-->

<resources>
- <string name="app_name">Celestia</string>
+ <string name="app_name">天际遨游</string>
<string name="celestia_language">zh_CN</string>
<string name="privacy_policy_alert_decline_button_title">暂不同意</string>
<string name="privacy_policy_alert_show_policy_button_title">查看协议</string>
<string name="privacy_policy_alert_title">隐私政策与服务协议</string>
<string name="privacy_policy_alert_detail">请您务必仔细阅读,充分理解服务协议和隐私政策各条款。如果您同意,请点击下方的\"同意\"按钮。</string>
<string name="privacy_policy_alert_accept_button_title">同意</string>
-</resources>
\ No newline at end of file
+ <string name="exit_celestia_alert_title">退出天际遨游</string>
+ <string name="exit_celestia_alert_message">确认需要退出?</string>
+</resources>
diff --git a/android/values/strings.xml b/android/values/strings.xml
index eb222a9..742e351 100644
--- a/android/values/strings.xml
+++ b/android/values/strings.xml
@@ -17,4 +17,6 @@
<string name="privacy_policy_alert_show_policy_button_title">View Policy</string>
<string name="privacy_policy_alert_accept_button_title">Agree</string>
<string name="privacy_policy_alert_decline_button_title">Not Now</string>
+ <string name="exit_celestia_alert_title">Exit Celestia</string>
+ <string name="exit_celestia_alert_message">Are you sure you want to exit?</string>
</resources>
5 changes: 5 additions & 0 deletions jobs/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ jobs:
git checkout $(contentCommitHash)
displayName: 'Checkout Content'
- script: |
cd CelestiaLocalization
git apply ../AndroidCelestia/huawei.patch --ignore-whitespace --whitespace=nowarn
displayName: 'Apply Localization Patch'
- script: |
sh $(System.DefaultWorkingDirectory)/AndroidCelestia/app/run_gperf.sh $(System.DefaultWorkingDirectory)/Celestia
displayName: 'Running gperf'
Expand Down

0 comments on commit d3ae2f9

Please sign in to comment.