Skip to content

Commit 54077a6

Browse files
committed
Add warning for wrong path & Add Cantonese translation
Signed-off-by: Fung Gwo <fython@163.com>
1 parent 40e35b4 commit 54077a6

6 files changed

Lines changed: 76 additions & 1 deletion

File tree

app/src/main/java/app/gwo/safenhancer/lite/SettingsActivity.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
155155
if (rootStorageUri.isPresent()) {
156156
mQIsolatedSupport.setSummaryOn(getString(
157157
R.string.isolated_storage_support_for_q_summary_checked,
158-
rootStorageUri.get().toString()
158+
rootStorageUri.map(Uri::toString).requireValue()
159159
));
160160
}
161161

@@ -199,6 +199,13 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
199199
R.string.isolated_storage_support_for_q_summary_checked,
200200
uri.toString()
201201
));
202+
if (!"primary:".equals(uri.getLastPathSegment())) {
203+
new AlertDialog.Builder(getActivity())
204+
.setTitle(R.string.handled_apps_what_apps_can_use_it_wrong_path_dialog_title)
205+
.setMessage(R.string.handled_apps_what_apps_can_use_it_wrong_path_dialog_message)
206+
.setPositiveButton(android.R.string.ok, null)
207+
.show();
208+
}
202209
}
203210
}
204211
}

app/src/main/java/app/gwo/safenhancer/lite/compat/Optional.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ public T get() {
7979
return value;
8080
}
8181

82+
@NonNull
83+
public T requireValue() {
84+
return requireNonNull(get());
85+
}
86+
8287
@NonNull
8388
public T orElse(@NonNull T defaultValue) {
8489
if (value != null) {
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<resources>
2+
3+
<string name="app_name">SAF 強化器 Lite</string>
4+
5+
<string name="copy_dialog_message">處理緊檔案…</string>
6+
7+
<string name="camera_chooser_dialog_title">揀個相機程式</string>
8+
<string name="remember_this_choice">記住呢個選擇</string>
9+
10+
<string name="preferred_camera">相機偏好</string>
11+
<string name="preferred_camera_clear">清除默認值</string>
12+
13+
<string name="toast_cleared">已清除。</string>
14+
15+
<string name="handled_apps">畀檔案介面處理嘅應用程式</string>
16+
<string name="handled_apps_choose_apps">揀應用程式</string>
17+
<string name="handled_apps_choose_apps_summary">WeChat 同另外 %d 個應用程式</string>
18+
<string name="handled_apps_what_apps_can_use_it">乜嘢程式可以用佢?</string>
19+
<string name="handled_apps_what_apps_can_use_it_summary"><![CDATA[
20+
識得調用系統選擇器來影相嘅程式可以交畀 SAF 強化器處理。
21+
如果佢地只識用自己嘅用戶介面,即使清單入面揀左呢個程式都冇效果。
22+
]]></string>
23+
24+
<string name="action_done">搞掂</string>
25+
<string name="packages_selector_search_hint">搵標題/包名…</string>
26+
27+
<string name="isolated_storage_support_title">隔離存儲支援</string>
28+
<string name="isolated_storage_support_for_sr">啟用「儲存重新導向」支援</string>
29+
<string name="isolated_storage_support_for_sr_summary"><![CDATA[
30+
如果交畀 SAF 強化器處理選圖嘅應用程式存儲被儲存重新導向所控制而妳又冇得正常揀圖,妳就要啟用呢個特性。
31+
]]></string>
32+
<string name="isolated_storage_support_for_q">啟用原生隔離存儲支援</string>
33+
<string name="isolated_storage_support_for_q_summary_disabled"><![CDATA[
34+
呢個特性只喺 Android Q 或更新嘅版本上啟用。
35+
]]></string>
36+
<string name="isolated_storage_support_for_q_summary_enabled"><![CDATA[
37+
如果你嘅設備喺度運行緊 Android Q 或更新嘅版本,妳可能需要啟用呢個特性黎修正一啲程式無法正常接收圖象嘅問題。
38+
]]></string>
39+
<string name="isolated_storage_support_for_q_summary_checked"><![CDATA[
40+
妳已經啟用左呢個特性。而家嘅根文檔地址:%s
41+
]]></string>
42+
<string name="isolated_storage_support_for_q_dialog_title">啟用支援</string>
43+
<string name="isolated_storage_support_for_q_dialog_message"><![CDATA[
44+
而家我地將打開檔案介面來揀定存儲根,請務必揀啱真正嘅存儲根路徑!
45+
]]></string>
46+
<string name="handled_apps_what_apps_can_use_it_wrong_path_dialog_title">警告</string>
47+
<string name="handled_apps_what_apps_can_use_it_wrong_path_dialog_message">妳揀嘅位置好似唔啱!如果妳確認呢個係啱嘅根存儲路徑,妳可以無視呢條消息。</string>
48+
49+
<string name="action_camera">相機</string>
50+
<string name="action_documents">檔案</string>
51+
52+
<string name="about_title">關於</string>
53+
<string name="version_format">%1$s (%2$d)</string>
54+
<string name="github_title">GitHub 倉庫</string>
55+
<string name="github_url" translatable="false">https://github.com/fython-tools/DocUIProxy-Android</string>
56+
57+
</resources>

app/src/main/res/values-zh-rCN/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
<string name="isolated_storage_support_for_q_dialog_message"><![CDATA[
4444
现在我们将打开文档界面来选择存储根,请务必选择真正的存储根目录!
4545
]]></string>
46+
<string name="handled_apps_what_apps_can_use_it_wrong_path_dialog_title">警告</string>
47+
<string name="handled_apps_what_apps_can_use_it_wrong_path_dialog_message">你选择的路径似乎不正确!如果你确认这是个正确的根存储路径,你可以无视这条消息。</string>
4648

4749
<string name="action_camera">相机</string>
4850
<string name="action_documents">文档</string>

app/src/main/res/values-zh-rTW/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ h
4343
<string name="isolated_storage_support_for_q_dialog_message"><![CDATA[
4444
現在我們將打開檔案介面來選定存儲根,請務必選擇真正的存儲根路徑!
4545
]]></string>
46+
<string name="handled_apps_what_apps_can_use_it_wrong_path_dialog_title">警告</string>
47+
<string name="handled_apps_what_apps_can_use_it_wrong_path_dialog_message">妳選擇的路徑似乎不正確!如果妳確認這是個正確的根存儲路徑,妳可以無視這條消息。</string>
4648

4749
<string name="action_camera">相機</string>
4850
<string name="action_documents">檔案</string>

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ You have enabled this feature. Current root documents tree uri: %s
4545
<string name="isolated_storage_support_for_q_dialog_message"><![CDATA[
4646
Now we will open Documents UI to pick root storage. Please be sure to choose the real root storage!
4747
]]></string>
48+
<string name="handled_apps_what_apps_can_use_it_wrong_path_dialog_title">Warning</string>
49+
<string name="handled_apps_what_apps_can_use_it_wrong_path_dialog_message">The path you picked seems not to be correct. If you confirm it\'s a correct path to root storage, you can ignore it.</string>
4850

4951
<string name="action_camera">Camera</string>
5052
<string name="action_documents">Documents</string>

0 commit comments

Comments
 (0)