Skip to content

Commit

Permalink
更好的国际化语言支持
Browse files Browse the repository at this point in the history
重写设置界面
修正错别字"撤销"->"撤消"
  • Loading branch information
imlk0 committed Jan 3, 2019
1 parent 3bcc8e3 commit 463e8af
Show file tree
Hide file tree
Showing 15 changed files with 407 additions and 132 deletions.
17 changes: 13 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "top.imlk.undo"
minSdkVersion 14
targetSdkVersion 27
versionCode 29
versionName "1.0.3"
versionCode 30
versionName "1.0.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -16,10 +16,19 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.github.didikee:AndroidDonate:0.1.0'
provided files('lib/api-82.jar')
implementation 'com.github.didikee:AndroidDonate:0.1.0'
compileOnly files('lib/api-82.jar')
implementation 'com.github.daniel-stoneuk:material-about-library:2.3.0'
// https://mvnrepository.com/artifact/com.mikepenz/iconics-core
compile group: 'com.mikepenz', name: 'iconics-core', version: '3.0.4'

implementation 'com.mikepenz:community-material-typeface:2.7.94.1@aar'
}
18 changes: 9 additions & 9 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:supportsRtl="true">


<!--<activity android:name=".activity.SettingActivity">-->
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.MAIN" />-->
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.MAIN" />-->

<!--<category android:name="android.intent.category.LAUNCHER" />-->
<!--</intent-filter>-->
<!--<category android:name="android.intent.category.LAUNCHER" />-->
<!--</intent-filter>-->
<!--</activity>-->


Expand All @@ -27,7 +26,8 @@
<!-- 这个activity可以被Xposed Installer启动 -->
<activity
android:name=".activity.SettingActivity"
android:label="@string/app_name">
android:label="@string/app_name"
android:theme="@style/AppTheme.AboutActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="de.robv.android.xposed.category.MODULE_SETTINGS" />
Expand All @@ -52,7 +52,7 @@
android:value="true" />
<meta-data
android:name="xposeddescription"
android:value="Undo - 为你的输入框增加撤销/重做\ndeveloper: imlk\ncoolapk: https://www.coolapk.com/apk/top.imlk.undo" />
android:value="@string/xposed_desc" />
<meta-data
android:name="xposedminversion"
android:value="36" />
Expand All @@ -61,7 +61,7 @@

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<!--<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />-->


</manifest>
313 changes: 209 additions & 104 deletions app/src/main/java/top/imlk/undo/activity/SettingActivity.java

Large diffs are not rendered by default.

32 changes: 30 additions & 2 deletions app/src/main/java/top/imlk/undo/holder/IResources.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package top.imlk.undo.holder;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.AssetManager;
import android.content.res.Resources;

import java.lang.reflect.Method;

import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;

/**
* Created by imlk on 2018/3/18.
*/
Expand All @@ -14,16 +20,38 @@ public class IResources {
public static Resources resources;
public static String MODULE_PATH;

public static void initResources(Context context) {
static boolean registed = false;

public static synchronized void initResources(Context context) {
try {
MODULE_PATH = context.getPackageManager().getApplicationInfo("top.imlk.undo", 0).sourceDir;

if (MODULE_PATH == null) {// firsttime
MODULE_PATH = context.getPackageManager().getApplicationInfo("top.imlk.undo", 0).sourceDir;
}

AssetManager assetManager = AssetManager.class.newInstance();
Method addAssetPath = AssetManager.class.getMethod("addAssetPath", String.class);
addAssetPath.invoke(assetManager, MODULE_PATH);
resources = new Resources(assetManager, context.getResources().getDisplayMetrics(), context.getResources().getConfiguration());

if (!registed) {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.LOCALE_CHANGED");
context.registerReceiver(new LanguageChangeListener(), intentFilter);
registed = true;
}

} catch (Exception e) {
XposedBridge.log("Undo:" + "initResources error");
XposedBridge.log(e.toString());
}
}

static class LanguageChangeListener extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
initResources(context);
}
}
}
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 0 additions & 6 deletions app/src/main/res/values-en-rIN/strings.xml

This file was deleted.

27 changes: 27 additions & 0 deletions app/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,31 @@
<string name="app_name">Undo</string>
<string name="undo">Undo</string>
<string name="redo">Redo</string>
<string name="about_title_undo">Undo</string>
<string name="about_title_desc">Add the undo (Ctrl-Z) option to your input box</string>
<string name="version">Version</string>
<string name="license">Open source license</string>
<string name="subtext_license">GPL v3.0 ©2019 imlk</string>
<string name="settings">Setting</string>
<string name="hide_or_show_ico">Hide/show desktop icon</string>
<string name="ico_show">Icon is displayed</string>
<string name="ico_hide">Icon is hidden</string>
<string name="donate">Donation</string>
<string name="alipay">Alipay</string>
<string name="wechat">WeChat</string>
<string name="paypal">Paypal</string>
<string name="developers">Developer</string>
<string name="developer">Developer</string>
<string name="ico_designer">Icon design</string>
<string name="links">Related Links</string>
<string name="coolapk">Coolapk</string>
<string name="qq_group">QQ group</string>
<string name="error_wake_up_qq">Pulling up QQ failed</string>
<string name="github">Github</string>
<string name="donate_wechat_thx">Please select the payment code from the album, thank you</string>
<string name="donate_alipay_thx">Thank you very much</string>
<string name="donate_paypal_thx">Thank you very much</string>
<string name="need_permission">Need to read and write files to release a payment code image</string>
<string name="xposed_desc">Undo - Add undo/redo to your input box\ndeveloper: imlk\ncoolapk: https://www.coolapk.com/apk/top.imlk.undo</string>

</resources>
26 changes: 26 additions & 0 deletions app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,30 @@
<string name="app_name">Undo</string>
<string name="undo">元に戻す</string>
<string name="redo">やり直し</string>
<string name="about_title_undo">元に戻す</string>
<string name="about_title_desc">入力ボックスに元に戻す(Ctrl-Z)オプションを追加します。</string>
<string name="version">バージョン</string>
<string name="license">オープンソースライセンス</string>
<string name="subtext_license">GPL v3.0©2019 imlk</string>
<string name="settings">設定</string>
<string name="hide_or_show_ico">デスクトップアイコンを隠す/表示する</string>
<string name="ico_show">アイコンが表示されます</string>
<string name="ico_hide">アイコンは隠れています</string>
<string name="donate">寄付</string>
<string name="alipay">アリペイ</string>
<string name="wechat">WeChat</string>
<string name="paypal">ペイパル</string>
<string name="developers">開発者</string>
<string name="developer">開発者</string>
<string name="ico_designer">アイコンデザイン</string>
<string name="links">関連リンク</string>
<string name="coolapk">クーラップ</string>
<string name="qq_group">QQグループ</string>
<string name="error_wake_up_qq">QQの引き上げに失敗しました</string>
<string name="github">Github</string>
<string name="donate_wechat_thx">アルバムから支払いコードを選択してください、ありがとう</string>
<string name="donate_alipay_thx">どうもありがとう</string>
<string name="donate_paypal_thx">どうもありがとう</string>
<string name="need_permission">支払いコードの画像を公開するためにファイルを読み書きする必要がある</string>
<string name="xposed_desc">Undo - 入力ボックスに元に戻す/やり直しを追加\ndeveloper: imlk\ncoolapk: https://www.coolapk.com/apk/top.imlk.undo</string>
</resources>
32 changes: 30 additions & 2 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Undo</string>
<string name="undo">撤銷</string>
<string name="redo">恢復</string>
<string name="undo">撤消</string>
<string name="redo">重做</string>

<string name="about_title_undo">撤消</string>
<string name="about_title_desc">給你的輸入框加上撤消(Ctrl-Z)選項</string>
<string name="version">版本</string>
<string name="license">開源許可</string>
<string name="subtext_license">GPL v3.0 ©2019 imlk</string>
<string name="settings">設置</string>
<string name="hide_or_show_ico">隱藏/顯示桌面圖標</string>
<string name="ico_show">圖標已顯示</string>
<string name="ico_hide">圖標已隱藏</string>
<string name="donate">捐贈</string>
<string name="alipay">支付寶</string>
<string name="wechat">微信</string>
<string name="paypal">Paypal</string>
<string name="developers">開發人員</string>
<string name="developer">開發者</string>
<string name="ico_designer">圖標設計</string>
<string name="links">相關鏈接</string>
<string name="coolapk">Coolapk</string>
<string name="qq_group">QQ群</string>
<string name="error_wake_up_qq">拉起QQ失敗</string>
<string name="github">Github</string>
<string name="donate_wechat_thx">請從相冊選擇收款碼,謝謝</string>
<string name="donate_alipay_thx">非常感謝</string>
<string name="donate_paypal_thx">非常感謝</string>
<string name="need_permission">需要讀寫文件的權限來釋放一張付款碼圖片</string>
<string name="xposed_desc">Undo - 為你的輸入框增加撤銷/重做\ndeveloper: imlk\ncoolapk: https://www.coolapk.com/apk/top.imlk.undo</string>

</resources>
31 changes: 29 additions & 2 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Undo</string>
<string name="undo">撤销</string>
<string name="redo">恢复</string>
<string name="undo">撤消</string>
<string name="redo">重做</string>
<string name="about_title_undo">撤消</string>
<string name="about_title_desc">给你的输入框加上撤消(Ctrl-Z)选项</string>
<string name="version">版本</string>
<string name="license">开源许可</string>
<string name="subtext_license">GPL v3.0 ©2019 imlk</string>
<string name="settings">设置</string>
<string name="hide_or_show_ico">隐藏/显示桌面图标</string>
<string name="ico_show">图标已显示</string>
<string name="ico_hide">图标已隐藏</string>
<string name="donate">捐赠</string>
<string name="alipay">支付宝</string>
<string name="wechat">微信</string>
<string name="paypal">Paypal</string>
<string name="developers">开发人员</string>
<string name="developer">开发者</string>
<string name="ico_designer">图标设计</string>
<string name="links">相关链接</string>
<string name="coolapk">Coolapk</string>
<string name="qq_group">QQ群</string>
<string name="error_wake_up_qq">拉起QQ失败emmmm</string>
<string name="github">Github</string>
<string name="donate_wechat_thx">请从相册选择收款码,蟹蟹,你的鼓励是我的最大动力</string>
<string name="donate_alipay_thx">蟹蟹,你的鼓励是我的最大动力</string>
<string name="donate_paypal_thx">蟹蟹你的支持</string>
<string name="need_permission">需要读写文件的权限来释放一张付款码图片</string>
<string name="xposed_desc">Undo - 为你的输入框增加撤销/重做\ndeveloper: imlk\ncoolapk: https://www.coolapk.com/apk/top.imlk.undo</string>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
<color name="color_title_bg">#e5e5e5</color>
<color name="color_text_value">#424242</color>
<color name="color_text_value_pressed">#dcdcdc</color>
<color name="ico">#868686</color>

</resources>
31 changes: 29 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
<resources>
<string name="app_name">Undo</string>
<string name="undo">撤销</string>
<string name="redo">恢复</string>
<string name="undo">Undo</string>
<string name="redo">Redo</string>
<string name="about_title_undo">Undo</string>
<string name="about_title_desc">Add the undo (Ctrl-Z) option to your input box</string>
<string name="version">Version</string>
<string name="license">Open source license</string>
<string name="subtext_license">GPL v3.0 ©2019 imlk</string>
<string name="settings">Setting</string>
<string name="hide_or_show_ico">Hide/show desktop icon</string>
<string name="ico_show">Icon is displayed</string>
<string name="ico_hide">Icon is hidden</string>
<string name="donate">Donation</string>
<string name="alipay">Alipay</string>
<string name="wechat">WeChat</string>
<string name="paypal">Paypal</string>
<string name="developers">Developer</string>
<string name="developer">Developer</string>
<string name="ico_designer">Icon design</string>
<string name="links">Related Links</string>
<string name="coolapk">Coolapk</string>
<string name="qq_group">QQ group</string>
<string name="error_wake_up_qq">Pulling up QQ failed</string>
<string name="github">Github</string>
<string name="donate_wechat_thx">Please select the payment code from the album, thank you</string>
<string name="donate_alipay_thx">Thank you very much</string>
<string name="donate_paypal_thx">Thank you very much</string>
<string name="need_permission">Need to read and write files to release a payment code image</string>
<string name="xposed_desc">Undo - Add undo/redo to your input box\ndeveloper: imlk\ncoolapk: https://www.coolapk.com/apk/top.imlk.undo</string>

</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.DeviceDefault.Light.NoActionBar">
<style name="AppTheme.AboutActivity" parent="Theme.Mal.Light">
<!-- Customize your theme here. -->


Expand Down
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
buildscript {

repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
google()
jcenter()
}
Expand All @@ -17,6 +18,8 @@ buildscript {

allprojects {
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
google()
jcenter()
maven { url 'https://jitpack.io' }
Expand Down
Binary file added image/ic_launcher.psd
Binary file not shown.

0 comments on commit 463e8af

Please sign in to comment.