Skip to content

Commit

Permalink
Support the English language on UI. (geeeeeeeeek#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhongyi Tong authored Jan 22, 2017
1 parent 2f76570 commit a00ab36
Show file tree
Hide file tree
Showing 8 changed files with 280 additions and 95 deletions.
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -116,26 +116,26 @@ protected void onDestroy() {

public void openAccessibility(View view) {
try {
Toast.makeText(this, "点击「微信红包」" + pluginStatusText.getText(), Toast.LENGTH_SHORT).show();
Toast.makeText(this, getString(R.string.turn_on_toast) + pluginStatusText.getText(), Toast.LENGTH_SHORT).show();
Intent accessibleIntent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
startActivity(accessibleIntent);
} catch (Exception e) {
Toast.makeText(this, "遇到一些问题,请手动打开系统设置>无障碍服务>微信红包(ฅ´ω`ฅ)", Toast.LENGTH_LONG).show();
Toast.makeText(this, getString(R.string.turn_on_error_toast), Toast.LENGTH_LONG).show();
e.printStackTrace();
}

}

public void openGitHub(View view) {
Intent webViewIntent = new Intent(this, WebViewActivity.class);
webViewIntent.putExtra("title", "GitHub 项目主页");
webViewIntent.putExtra("title", getString(R.string.webview_github_title));
webViewIntent.putExtra("url", "https://github.com/geeeeeeeeek/WeChatLuckyMoney");
startActivity(webViewIntent);
}

public void openUber(View view) {
Intent webViewIntent = new Intent(this, WebViewActivity.class);
webViewIntent.putExtra("title", "Uber 优惠乘车");
webViewIntent.putExtra("title", getString(R.string.webview_uber_title));
String[] couponList = new String[]{"https://dc.tt/oTLtXH2BHsD", "https://dc.tt/ozFJHDnfLky"};
int index = (int) (Math.random() * 2);
webViewIntent.putExtra("url", couponList[index]);
Expand All @@ -144,7 +144,7 @@ public void openUber(View view) {

public void openSettings(View view) {
Intent settingsIntent = new Intent(this, SettingsActivity.class);
settingsIntent.putExtra("title", "偏好设置");
settingsIntent.putExtra("title", getString(R.string.preference));
settingsIntent.putExtra("frag_id", "GeneralSettingsFragment");
startActivity(settingsIntent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.contains("apk")) {
Toast.makeText(getApplicationContext(), "正在后台下载", Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), getString(R.string.download_backend), Toast.LENGTH_SHORT).show();
(new DownloadUtil()).enqueue(url, getApplicationContext());
return true;
} else if (!url.contains("http")) {
Toast.makeText(getApplicationContext(), "正在前往下载页面", Toast.LENGTH_LONG).show();
webViewBar.setText("点击\"普通下载\"获取 Uber");
Toast.makeText(getApplicationContext(), getString(R.string.download_redirect), Toast.LENGTH_LONG).show();
webViewBar.setText(getString(R.string.download_hint));
return false;
} else {
view.loadUrl(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class UpdateTask extends AsyncTask<String, String, String> {
public UpdateTask(Context context, boolean needUpdate) {
this.context = context;
this.isUpdateOnRelease = needUpdate;
if (this.isUpdateOnRelease) Toast.makeText(context, "正在检查新版本……", Toast.LENGTH_SHORT).show();
if (this.isUpdateOnRelease) Toast.makeText(context, context.getString(R.string.checking_new_version), Toast.LENGTH_SHORT).show();
}

@Override
Expand Down
224 changes: 159 additions & 65 deletions app/src/main/res/layout/activity_main.xml

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions app/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<resources>
<string name="app_name">WeChat Lucky Money</string>
<string name="app_version">v3.0</string>
<string name="app_description">∠( ᐛ 」∠)_ Instructions ∠( ᐛ 」∠)_\n\n ○ Turn on the Accessibility switch\n ○ Go back to WeChat\n ○ Wait for money comes in\n\n Please submit your feedback on GitHub Issues Page~\n https://github.com/geeeeeeeeek/WeChatLuckyMoney</string>
<string name="preference">Preferences</string>
<string name="update_error">An error occurred. Please manually update from GitHub Release Page. (ฅ´ω`ฅ)</string>
<string name="update_new_seg1">New version found.(</string>
<string name="update_new_seg2">)Preparing download for you. ( /) V (\\ )</string>
<string name="update_new_seg3">)Please go to Settings to finish update. (ฅ´ω`ฅ)</string>
<string name="update_already_latest">You\'re using the latest version! (❁´▽`❁)</string>
<string name="service_off">Turn Off</string>
<string name="service_on">Turn On</string>
<string name="pref_watch_exclude_words_summary">Skip red packets with these phrases (separated by space)</string>
<string name="pref_comment_words_summary">Randomly choose reply from these phrases (separated by space)</string>
<string name="url_github_issues">https://github.com/geeeeeeeeek/WeChatLuckyMoney/issues</string>
<string name="home_banner_ad_unit_id">ca-app-pub-8428619221469478/4736153346</string>
<string name="webview_banner_ad_unit_id">ca-app-pub-8428619221469478/4163694548</string>
<string name="community">Community</string>
<string name="settings">Settings</string>
<string name="uber_ad_title">Your first trip is free up to ¥12</string>
<string name="uber_ad_text">Get Free Ride Now</string>
<string name="github_1"/>
<string name="github_2">this app on GitHub to support us</string>
<string name="star_2">Star</string>
<string name="star_1">★</string>
<string name="turn_on_toast">Click 「WeChat Lucky Money」 To </string>
<string name="turn_on_error_toast">An error occurred. Please manually open System Settings > Accessibility > WeChat Lucky Money. (ฅ´ω`ฅ)</string>
<string name="webview_github_title">Project Homepage on GitHub</string>
<string name="webview_uber_title">Uber Free Trip</string>
<string name="download_backend">Downloading…</string>
<string name="download_redirect">Redirecting to download page…</string>
<string name="download_hint">Download Uber by clicking \"普通下载\"</string>
<string name="watch_options">Watch Level</string>
<string name="watch_notifications">Watch system notifications</string>
<string name="watch_notifications_hint">Enter chat when a red packet is detected from WeChat notifications</string>
<string name="watch_list">Watch chat list</string>
<string name="watch_list_hint">Enter chat when a red packet is detected from chat list</string>
<string name="anti_block_options">Anti-block Options</string>
<string name="auto_open_packets">Open red packets automatically</string>
<string name="open_with_delay">Open red packets with delay</string>
<string name="open_self">Open red packets I gave out</string>
<string name="skip_phrases">Skip red packets by words in the message</string>
<string name="about">About</string>
<string name="check_new_version">Check for updates</string>
<string name="help_and_feedback">Help and feedback</string>
<string name="help_hint">Submit issues on GitHub homepage</string>
<string name="labs">Labs</string>
<string name="snatch_on_lockscreen">Snatch red packets on lock screen</string>
<string name="snatch_on_lockscreen_hint">Will keep the app active in backend for 30 min. Please proceed with caution, since this might greatly increase your battery usage.</string>
<string name="auto_reply">Auto reply</string>
<string name="checking_new_version">Checking for updates…</string>
</resources>
39 changes: 36 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<resources>
<string name="app_name">微信红包</string>
<string name="app_version">测试版 v3.0</string>
<string name="app_version">v3.0</string>
<string name="app_description">∠( ᐛ 」∠)_使用指南∠( ᐛ 」∠)_\n\n ○ 狠戳插件开关\n ○ 回到微信聊天\n ○ 坐等红包进账\n\n 遇到问题, 欢迎通过 GitHub Issue 反馈~\n https://github.com/geeeeeeeeek/WeChatLuckyMoney</string>
<string name="service_status">当前辅助服务状态:</string>
<string name="service_name">设置抢红包辅助服务</string>
<string name="preference">偏好设置</string>
<string name="update_error">遇到一些问题,请前往GitHub手动更新喵(ฅ´ω`ฅ)</string>
<string name="update_new_seg1">发现新版本(</string>
Expand All @@ -17,4 +15,39 @@
<string name="url_github_issues">https://github.com/geeeeeeeeek/WeChatLuckyMoney/issues</string>
<string name="home_banner_ad_unit_id">ca-app-pub-8428619221469478/4736153346</string>
<string name="webview_banner_ad_unit_id">ca-app-pub-8428619221469478/4163694548</string>
<string name="turn_on_plugin">开启插件</string>
<string name="community">社区</string>
<string name="settings">设置</string>
<string name="uber_ad_title">首次乘车可获得 ¥12 优惠</string>
<string name="uber_ad_text">立即获得免费乘车机会</string>
<string name="github_1">在 GitHub 上</string>
<string name="github_2">本项目,支持应用开源</string>
<string name="star_2">Star</string>
<string name="star_1">★</string>
<string name="turn_on_toast">点击「微信红包」</string>
<string name="turn_on_error_toast">遇到一些问题,请手动打开系统设置>无障碍服务>微信红包(ฅ´ω`ฅ)</string>
<string name="webview_github_title">GitHub 项目主页</string>
<string name="webview_uber_title">Uber 优惠乘车</string>
<string name="download_backend">正在后台下载</string>
<string name="download_redirect">正在前往下载页面</string>
<string name="download_hint">点击\"普通下载\"获取 Uber</string>
<string name="watch_options">监视选项</string>
<string name="watch_notifications">监视系统通知</string>
<string name="watch_notifications_hint">读取新消息通知中的红包提示并进入聊天页</string>
<string name="watch_list">监视聊天列表</string>
<string name="watch_list_hint">读取聊天列表中的红包提示并进入聊天页</string>
<string name="anti_block_options">防封号选项</string>
<string name="auto_open_packets">自动拆开红包</string>
<string name="open_with_delay">延时拆开红包</string>
<string name="open_self">拆开自己发的红包</string>
<string name="skip_phrases">屏蔽红包文字</string>
<string name="about">关于应用</string>
<string name="check_new_version">检查新版本</string>
<string name="help_and_feedback">帮助与反馈</string>
<string name="help_hint">前往GitHub项目主页提交issue</string>
<string name="labs">实验功能</string>
<string name="snatch_on_lockscreen">息屏抢红包</string>
<string name="snatch_on_lockscreen_hint">保持30分钟后台活跃,可能会极大增加电量消耗,请谨慎使用</string>
<string name="auto_reply">拆开红包后自动回复</string>
<string name="checking_new_version">正在检查新版本……</string>
</resources>
36 changes: 18 additions & 18 deletions app/src/main/res/xml/general_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,71 +4,71 @@
tools:context=".SettingsActivity"
android:icon="@null">
<PreferenceCategory
android:title="监视选项"
android:title="@string/watch_options"
android:layout="@layout/preference_category">
<CheckBoxPreference
android:key="pref_watch_notification"
android:title="监视系统通知"
android:summary="读取新消息通知中的红包提示并进入聊天页"
android:title="@string/watch_notifications"
android:summary="@string/watch_notifications_hint"
android:defaultValue="true"
android:layout="@layout/preference_checkbox"/>
<CheckBoxPreference
android:key="pref_watch_list"
android:title="监视聊天列表"
android:summary="读取聊天列表中的红包提示并进入聊天页"
android:title="@string/watch_list"
android:summary="@string/watch_list_hint"
android:layout="@layout/preference_checkbox"
android:defaultValue="false"/>
</PreferenceCategory>
<PreferenceCategory
android:title="防封号选项"
android:title="@string/anti_block_options"
android:layout="@layout/preference_category">
<CheckBoxPreference
android:key="pref_watch_chat"
android:title="自动拆开红包"
android:title="@string/auto_open_packets"
android:layout="@layout/preference_checkbox"
android:defaultValue="true"/>
<xyz.monkeytong.hongbao.activities.SeekBarPreference
android:key="pref_open_delay"
android:title="延时拆开红包"
android:title="@string/open_with_delay"
pref_kind="pref_open_delay"
android:layout="@layout/preference_checkbox"/>
<CheckBoxPreference
android:key="pref_watch_self"
android:title="拆开自己发的红包"
android:title="@string/open_self"
android:layout="@layout/preference_checkbox"
android:defaultValue="true"/>
<EditTextPreference
android:key="pref_watch_exclude_words"
android:title="屏蔽红包文字"
android:title="@string/skip_phrases"
android:summary="@string/pref_watch_exclude_words_summary"
android:layout="@layout/preference_checkbox"/>
</PreferenceCategory>
<PreferenceCategory
android:title="关于应用"
android:title="@string/about"
android:layout="@layout/preference_category">
<Preference
android:key="pref_etc_check_update"
android:title="检查新版本"
android:title="@string/check_new_version"
android:summary="http://dwz.cn/WeChatLuckyMoney"
android:layout="@layout/preference_checkbox"/>
<Preference
android:key="pref_etc_issue"
android:title="帮助与反馈"
android:summary="前往GitHub项目主页提交issue"
android:title="@string/help_and_feedback"
android:summary="@string/help_hint"
android:layout="@layout/preference_checkbox"/>
</PreferenceCategory>
<PreferenceCategory
android:title="实验功能"
android:title="@string/labs"
android:layout="@layout/preference_category">
<CheckBoxPreference
android:key="pref_watch_on_lock"
android:title="息屏抢红包"
android:summary="保持30分钟后台活跃,可能会极大增加电量消耗,请谨慎使用"
android:title="@string/snatch_on_lockscreen"
android:summary="@string/snatch_on_lockscreen_hint"
android:layout="@layout/preference_checkbox"
android:defaultValue="false"/>
<PreferenceScreen
android:key="pref_auto_comment"
android:title="拆开红包后自动回复"
android:title="@string/auto_reply"
android:layout="@layout/preference_checkbox">
<intent android:action="android.intent.action.VIEW"
android:targetPackage="xyz.monkeytong.hongbao"
Expand Down

0 comments on commit a00ab36

Please sign in to comment.