Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
maoruibin committed Mar 4, 2016
2 parents c1c3953 + 6335a27 commit f70be70
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 20 deletions.
6 changes: 0 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ android {
}

productFlavors {
beta{
manifestPlaceholders = [UMENG_CHANNEL_VALUE:"beta"]
}
xiaomi {
manifestPlaceholders = [UMENG_CHANNEL_VALUE:"xiaomi"]
}
Expand All @@ -93,9 +90,6 @@ android {
fir {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "fir"]
}
umeng {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "umeng"]
}
play {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "play"]
}
Expand Down
12 changes: 7 additions & 5 deletions app/src/main/assets/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@
</head>
<body>

<h3>Version 0.6</h3>
<h3>Version 0.6.3</h3>
<p>
咕咚翻译 - 一个实现手机端『划词翻译』功能的 App,可能是目前 Android 市场上翻译效率最高的 App
咕咚翻译 - 一个实现手机端『划词翻译』功能的 App,可能是目前 Android 市场上翻译效率最高的应用
</p>
<ol>
<li><b>新增:</b> 划词翻译开关,你可以关闭划词翻译功能了。(03-04)</li>
<li><b>优化:</b> 单词本被移动到了 Toolbar 上面展示。(03-05)</li>
<li><b>修复:</b> 翻译时不显示 "翻译中" 的提示问题,Thanks @leizhiyuan。(03-04)</li>
<li><b>优化:</b> 大幅提高定时设置的稳定性,可以在首页灵活设置显示开关,以及显示间隔时间等。(03-01)</li>
<li><b>新增:</b> 使用 MVP、Dagger2等重构了大部分代码,大幅提升应用性能(02-28)</li>

</ol>
<p>获取 App 最近动态,可通过以下方式关注<br><br>
<p>获取咕咚翻译的最近动态,可通过以下方式关注<br><br>
微博&nbsp;&nbsp;<a href='http://weibo.com/u/1874136301'>@大侠咕咚</a><br>
Github&nbsp;&nbsp;<a href='https://github.com/maoruibin'>@GuDong</a><br>
Google+社区&nbsp;&nbsp;<a href='https://plus.google.com/communities/111919086388322816251'>咕咚翻译</a><br>
</p>
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
}
12 changes: 12 additions & 0 deletions app/src/main/java/name/gudong/translate/util/SpUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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 ------------------- //
Expand Down
25 changes: 17 additions & 8 deletions app/src/main/res/menu/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@

<menu
xmlns:android="http://schemas.android.com/apk/res/android"
>
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" >
<item
android:id="@+id/menu_book"
android:showAsAction="ifRoom"
app:showAsAction="ifRoom"
android:title="@string/favorite_list"/>

<item
android:id="@+id/menu_translate"
android:showAsAction="ifRoom"
app:showAsAction="never"
android:title="@string/translate_from">
<menu>
<group
Expand All @@ -47,15 +48,23 @@
</group>
</menu>
</item>

<item
android:id="@+id/menu_open_jit_or_nor"
app:showAsAction="never"
android:title="@string/open_jit_or_nor"
android:checked="true"
android:checkable="true"/>

<item
android:id="@+id/menu_use_recite_or_not"
android:showAsAction="ifRoom"
app:showAsAction="never"
android:title="@string/use_recite_or_nor"
android:checked="false"
android:checkable="true"/>
<item
android:id="@+id/menu_interval_tip_time"
android:showAsAction="ifRoom"
app:showAsAction="never"
android:visible="false"
android:title="@string/tip_time_interval">
<menu>
Expand All @@ -82,7 +91,7 @@
</item>
<item
android:id="@+id/menu_duration_tip_time"
android:showAsAction="ifRoom"
app:showAsAction="never"
android:visible="false"
android:title="@string/tip_time_duration">
<menu>
Expand All @@ -106,10 +115,10 @@

<item
android:id="@+id/menu_score"
android:showAsAction="always"
app:showAsAction="never"
android:title="@string/menu_score"/>
<item
android:id="@+id/menu_about"
android:showAsAction="always"
app:showAsAction="never"
android:title="@string/menu_about"/>
</menu>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<string name="translate_from">翻译引擎</string>
<string name="use_recite_or_nor">开启定时单词提醒</string>
<string name="open_jit_or_nor">开启划词翻译</string>
<string name="tip_time_interval">提示间隔时间</string>
<string name="tip_time_duration">提示显示时间</string>

Expand Down

0 comments on commit f70be70

Please sign in to comment.