Skip to content

Commit 42023b7

Browse files
committed
Add preferences & Add Chinese translation & Update REAME
Signed-off-by: Fung Gwo <fython@163.com>
1 parent 93402d8 commit 42023b7

7 files changed

Lines changed: 129 additions & 6 deletions

File tree

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
WeChatDocUIProxy
1+
SAF Enhancer Lite
22
----
33

4-
Help WeChat users to pick media from Android Documents UI
4+
Help applications that haven't supported Storage Access Framework (likes WeChat)
5+
to pick media from Android Documents UI
56

67
## What can it do?
78

89
Handle camera actions and response with media files from Android Documents UI
9-
when WeChat requests a photo.
10+
when selected applications requests a photo.
1011

1112
## How to use?
1213

13-
1. Download pre-complied package from [GitHub Releases](https://github.com/fython-tools/WeChatDocUIProxy/releases) or compile by yourself.
14+
1. Download pre-complied package from [GitHub Releases](https://github.com/fython-tools/DocUIProxy-Android/releases) or compile by yourself.
1415
2. Long press "Gallery" (相册/相簿) button in the bottom bar of chat pages.
15-
3. Choose "DocUIProxy for WeChat" (You can also make it as default.
16+
3. Choose "SAF Enhancer Lite" (You can also make it as default.
1617
Because we allow other applications to use a real camera app when they are calling proxy camera.)
1718
4. Here you can see a familiar Documents UI. Just pick photos from local storage or any cloud drive
1819
supported DocumentsProvider (like Google Photos, Google Drive, etc.)

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
<category android:name="android.intent.category.DEFAULT"/>
3030
<category android:name="android.intent.category.LAUNCHER"/>
3131
</intent-filter>
32+
<intent-filter>
33+
<action android:name="android.intent.action.APPLICATION_PREFERENCES"/>
34+
</intent-filter>
3235
</activity>
3336

3437
<activity

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
import android.Manifest;
44
import android.content.Intent;
5+
import android.content.pm.PackageInfo;
56
import android.content.pm.PackageManager;
7+
import android.net.Uri;
68
import android.os.Build;
79
import android.os.Bundle;
810
import android.preference.Preference;
@@ -44,6 +46,8 @@ public static final class SettingsFragment extends PreferenceFragment {
4446

4547
private static final String KEY_PREFERRED_CAMERA_CLEAR = "clear_preferred_camera";
4648
private static final String KEY_HANDLED_APPS_CHOOSE = "handled_apps_choose";
49+
private static final String KEY_ABOUT_VERSION = "version";
50+
private static final String KEY_ABOUT_GITHUB = "github";
4751

4852
private Preference mHandledAppsChoose;
4953

@@ -67,6 +71,24 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
6771
return true;
6872
});
6973
updateHandledAppsSummary();
74+
75+
Preference versionPref = findPreference(KEY_ABOUT_VERSION);
76+
PackageManager pm = getActivity().getPackageManager();
77+
String version = "Unknown";
78+
try {
79+
PackageInfo pi = pm.getPackageInfo(getActivity().getPackageName(), 0);
80+
version = getString(R.string.version_format, pi.versionName, pi.versionCode);
81+
} catch (Exception e) {
82+
e.printStackTrace();
83+
}
84+
versionPref.setSummary(version);
85+
86+
findPreference(KEY_ABOUT_GITHUB).setOnPreferenceClickListener(p -> {
87+
startActivity(
88+
new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.github_url)))
89+
);
90+
return true;
91+
});
7092
}
7193

7294
@Override
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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">微信和其它 %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="action_camera">相机</string>
28+
<string name="action_documents">文档</string>
29+
30+
<string name="about_title">关于</string>
31+
<string name="version_format">%1$s (%2$d)</string>
32+
<string name="github_title">GitHub 仓库</string>
33+
<string name="github_url" translatable="false">https://github.com/fython-tools/DocUIProxy-Android</string>
34+
35+
</resources>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
h
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="action_camera">相機</string>
28+
<string name="action_documents">檔案</string>
29+
30+
<string name="about_title">關於</string>
31+
<string name="version_format">%1$s (%2$d)</string>
32+
<string name="github_title">GitHub 倉庫</string>
33+
<string name="github_url" translatable="false">https://github.com/fython-tools/DocUIProxy-Android</string>
34+
35+
</resources>

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,21 @@
1515
<string name="handled_apps">Apps handled by Document UI</string>
1616
<string name="handled_apps_choose_apps">Choose apps</string>
1717
<string name="handled_apps_choose_apps_summary">Wechat and %d more applications</string>
18+
<string name="handled_apps_what_apps_can_use_it">What apps can use it?</string>
19+
<string name="handled_apps_what_apps_can_use_it_summary"><![CDATA[
20+
Apps that will call system chooser to take photos can be handled by SAFEnhancer.
21+
If they use their own interface only, it will have no effect even if apps are chosen in list.
22+
]]></string>
1823

1924
<string name="action_done">Done</string>
2025
<string name="packages_selector_search_hint">Search title/package name…</string>
2126

2227
<string name="action_camera">Camera</string>
2328
<string name="action_documents">Documents</string>
2429

30+
<string name="about_title">About</string>
31+
<string name="version_format">%1$s (%2$d)</string>
32+
<string name="github_title">GitHub repository</string>
33+
<string name="github_url" translatable="false">https://github.com/fython-tools/DocUIProxy-Android</string>
34+
2535
</resources>

app/src/main/res/xml/settings_screen.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
2+
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
34

45
<PreferenceCategory android:title="@string/handled_apps">
56

67
<Preference android:key="handled_apps_choose"
78
android:title="@string/handled_apps_choose_apps"
89
android:summary="@string/handled_apps_choose_apps_summary"/>
910

11+
<Preference
12+
android:title="@string/handled_apps_what_apps_can_use_it"
13+
android:summary="@string/handled_apps_what_apps_can_use_it_summary"/>
14+
1015
</PreferenceCategory>
1116

1217
<PreferenceCategory android:title="@string/preferred_camera">
@@ -16,4 +21,16 @@
1621

1722
</PreferenceCategory>
1823

24+
<PreferenceCategory android:title="@string/about_title">
25+
26+
<Preference android:key="version"
27+
android:title="@string/app_name"
28+
tools:summary="1.0 (10)"/>
29+
30+
<Preference android:key="github"
31+
android:title="@string/github_title"
32+
android:summary="@string/github_url"/>
33+
34+
</PreferenceCategory>
35+
1936
</PreferenceScreen>

0 commit comments

Comments
 (0)