From 3c08d8e94aa161bb13513100ce2513aeae12bcb2 Mon Sep 17 00:00:00 2001 From: GuDong Date: Sat, 5 Mar 2016 02:43:51 +0800 Subject: [PATCH 1/2] temp --- app/src/main/res/menu/main.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/main.xml index c7033a8..7c981f3 100644 --- a/app/src/main/res/menu/main.xml +++ b/app/src/main/res/menu/main.xml @@ -18,18 +18,18 @@ ~ along with GdTranslate. If not, see . ~ --> - @@ -82,7 +82,7 @@ @@ -106,10 +106,10 @@ \ No newline at end of file From 6335a272f79beb6bd2158d66189cbc82c4ea2659 Mon Sep 17 00:00:00 2001 From: GuDong Date: Sat, 5 Mar 2016 03:50:15 +0800 Subject: [PATCH 2/2] add new switch to control show JIT translate make words book show in titlebar update version to v0.6.3 --- app/build.gradle | 6 ----- app/src/main/assets/changelog.html | 12 +++++---- .../mvp/presenters/ClipboardPresenter.java | 3 ++- .../mvp/presenters/MainPresenter.java | 2 ++ .../gudong/translate/mvp/views/IMainView.java | 7 +++++ .../translate/ui/activitys/MainActivity.java | 15 +++++++++++ .../name/gudong/translate/util/SpUtils.java | 12 +++++++++ app/src/main/res/menu/main.xml | 27 ++++++++++++------- app/src/main/res/values/strings.xml | 1 + 9 files changed, 64 insertions(+), 21 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f5cde9b..9574f0a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -78,9 +78,6 @@ android { } productFlavors { - beta{ - manifestPlaceholders = [UMENG_CHANNEL_VALUE:"beta"] - } xiaomi { manifestPlaceholders = [UMENG_CHANNEL_VALUE:"xiaomi"] } @@ -93,9 +90,6 @@ android { fir { manifestPlaceholders = [UMENG_CHANNEL_VALUE: "fir"] } - umeng { - manifestPlaceholders = [UMENG_CHANNEL_VALUE: "umeng"] - } play { manifestPlaceholders = [UMENG_CHANNEL_VALUE: "play"] } diff --git a/app/src/main/assets/changelog.html b/app/src/main/assets/changelog.html index 57044f8..d6322f9 100644 --- a/app/src/main/assets/changelog.html +++ b/app/src/main/assets/changelog.html @@ -43,17 +43,19 @@ -

Version 0.6

+

Version 0.6.3

- 咕咚翻译 - 一个实现手机端『划词翻译』功能的 App,可能是目前 Android 市场上翻译效率最高的 App。 + 咕咚翻译 - 一个实现手机端『划词翻译』功能的 App,可能是目前 Android 市场上翻译效率最高的应用。

    +
  1. 新增: 划词翻译开关,你可以关闭划词翻译功能了。(03-04)
  2. +
  3. 优化: 单词本被移动到了 Toolbar 上面展示。(03-05)
  4. 修复: 翻译时不显示 "翻译中" 的提示问题,Thanks @leizhiyuan。(03-04)
  5. -
  6. 优化: 大幅提高定时设置的稳定性,可以在首页灵活设置显示开关,以及显示间隔时间等。(03-01)
  7. -
  8. 新增: 使用 MVP、Dagger2等重构了大部分代码,大幅提升应用性能(02-28)
  9. +
-

获取 App 最近动态,可通过以下方式关注

+

获取咕咚翻译的最近动态,可通过以下方式关注

微博  @大侠咕咚
Github  @GuDong
+ Google+社区  咕咚翻译

diff --git a/app/src/main/java/name/gudong/translate/mvp/presenters/ClipboardPresenter.java b/app/src/main/java/name/gudong/translate/mvp/presenters/ClipboardPresenter.java index ac46577..5737fbe 100644 --- a/app/src/main/java/name/gudong/translate/mvp/presenters/ClipboardPresenter.java +++ b/app/src/main/java/name/gudong/translate/mvp/presenters/ClipboardPresenter.java @@ -187,7 +187,8 @@ public void addListener() { private void performClipboardCheck() { CharSequence content = mClipboardWatcher.getText(); if (TextUtils.isEmpty(content)) return; - + //if JIT translate is closed by user ,now when clipboard is change ,but we do nothing, + if(!SpUtils.getOpenJITOrNot(mService))return; //处理缓存 String query = content.toString(); if (listQuery.contains(query)) return; diff --git a/app/src/main/java/name/gudong/translate/mvp/presenters/MainPresenter.java b/app/src/main/java/name/gudong/translate/mvp/presenters/MainPresenter.java index 0e955b1..25c3495 100644 --- a/app/src/main/java/name/gudong/translate/mvp/presenters/MainPresenter.java +++ b/app/src/main/java/name/gudong/translate/mvp/presenters/MainPresenter.java @@ -190,10 +190,12 @@ public void prepareOptionSettings(Menu menu) { EIntervalTipTime intervalTime = SpUtils.getIntervalTimeWay(mActivity); EDurationTipTime durationTime = SpUtils.getDurationTimeWay(mActivity); boolean reciteFlag = SpUtils.getReciteOpenOrNot(mActivity); + boolean openJIT = SpUtils.getOpenJITOrNot(mActivity); mView.initTranslateEngineSetting(menu,from); mView.initIntervalTimeSetting(menu,intervalTime); mView.initDurationTimeSetting(menu,durationTime); mView.initReciteSetting(menu,reciteFlag); + mView.initJITSetting(menu,openJIT); } } diff --git a/app/src/main/java/name/gudong/translate/mvp/views/IMainView.java b/app/src/main/java/name/gudong/translate/mvp/views/IMainView.java index bc5f8b2..2ae46bb 100644 --- a/app/src/main/java/name/gudong/translate/mvp/views/IMainView.java +++ b/app/src/main/java/name/gudong/translate/mvp/views/IMainView.java @@ -60,4 +60,11 @@ public interface IMainView extends IBaseView { * @param isOpen */ void initReciteSetting(Menu menu, boolean isOpen); + + /** + * 初始化是否开启划词翻译 + * @param menu + * @param isOpen + */ + void initJITSetting(Menu menu, boolean isOpen); } diff --git a/app/src/main/java/name/gudong/translate/ui/activitys/MainActivity.java b/app/src/main/java/name/gudong/translate/ui/activitys/MainActivity.java index de2d7dd..b256470 100644 --- a/app/src/main/java/name/gudong/translate/ui/activitys/MainActivity.java +++ b/app/src/main/java/name/gudong/translate/ui/activitys/MainActivity.java @@ -143,6 +143,11 @@ public boolean onOptionsItemSelected(MenuItem item) { selectEngine(item,ETranslateFrom.YOU_DAO); break; + case R.id.menu_open_jit_or_nor: + boolean isOpenJit = item.isChecked(); + SpUtils.setOpenJITOrNot(this,!isOpenJit); + break; + case R.id.menu_use_recite_or_not: if (Once.needToDo(KEY_TIP_OF_RECITE)) { new AlertDialog.Builder(this) @@ -380,5 +385,15 @@ public void initReciteSetting(Menu menu, boolean isOpen) { menu.findItem(R.id.menu_use_recite_or_not).setChecked(isOpen); menu.findItem(R.id.menu_interval_tip_time).setVisible(isOpen); menu.findItem(R.id.menu_duration_tip_time).setVisible(isOpen); + + menu.findItem(R.id.menu_use_recite_or_not).setVisible(false); + menu.findItem(R.id.menu_interval_tip_time).setVisible(false); + menu.findItem(R.id.menu_duration_tip_time).setVisible(false); + SpUtils.setReciteOpenOrNot(this,false); + } + + @Override + public void initJITSetting(Menu menu, boolean isOpen) { + menu.findItem(R.id.menu_open_jit_or_nor).setChecked(isOpen); } } diff --git a/app/src/main/java/name/gudong/translate/util/SpUtils.java b/app/src/main/java/name/gudong/translate/util/SpUtils.java index edda3e3..639d9ee 100644 --- a/app/src/main/java/name/gudong/translate/util/SpUtils.java +++ b/app/src/main/java/name/gudong/translate/util/SpUtils.java @@ -53,6 +53,9 @@ public static String getUrlByLocalSetting(){ private static final String KEY_RECITE_OPEN = "RECITE_OPEN_OR_NOT"; + //is open JIT translate or not + private static final String KEY_OPEN_JIT = "RECITE_OPEN_JIT"; + public static void setTranslateEngine(Context context, String version) { putStringPreference(context, KEY_TRANSLATE_FROM, version); } @@ -103,6 +106,15 @@ public static boolean getReciteOpenOrNot(Context context){ return getBooleanPreference(context,KEY_RECITE_OPEN,false); } + //是否开启划词翻译 + public static void setOpenJITOrNot(Context context,boolean isOpen){ + putBooleanPreference(context,KEY_OPEN_JIT,isOpen); + } + + public static boolean getOpenJITOrNot(Context context){ + return getBooleanPreference(context,KEY_OPEN_JIT,true); + } + ////////////////////////////////////////////////////////////////////////////////////////////////////// // ------------------- SharePreference Util Begin ------------------- // diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/main.xml index 7c981f3..f8cf419 100644 --- a/app/src/main/res/menu/main.xml +++ b/app/src/main/res/menu/main.xml @@ -18,18 +18,19 @@ ~ along with GdTranslate. If not, see . ~ --> + + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" > + + + @@ -82,7 +91,7 @@ @@ -106,10 +115,10 @@ \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6c17f3f..ae31e88 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -9,6 +9,7 @@ 翻译引擎 开启定时单词提醒 + 开启划词翻译 提示间隔时间 提示显示时间