Skip to content

Commit

Permalink
Merge pull request maoruibin#47 from maoruibin/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
maoruibin committed Apr 5, 2017
2 parents 5a2bb5c 0252cc8 commit 47139c7
Show file tree
Hide file tree
Showing 61 changed files with 494 additions and 2,130 deletions.
20 changes: 5 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 5,7 @@ apply plugin:'im.fir.plugin.gradle'

fir{
apiToken '15e5206706b555384608e449d6def6d3'
changeLog '重要: 大幅优化单词本的使用体验,提供单词导入导出等功能(2017-02-11)\n'
'优化: 为 6.0 设备增加悬浮窗权限申请,解决 MIUI 等部分设备需要手动开启权限的问题\n'
'新增: 单词数据备份、恢复(2017-02-05)\n'
'新增: 咕咚翻译可以背收藏的生词了,好词就应该死里记(10-01)\n'
'新增: 支持手势滑动删除悬浮窗(10-03)\n'
'变更: 调换设置与单词本的位置(10-17)\n'
'优化: 部分 UI 颜色等小细节调整(2017-02-11)\n'
'优化: 循环翻译顺序,锁屏停止循环(10-12)\n'
'优化: 添加点击按钮的动画(10-04)\n'
'优化: 循环显示背单词列表(10-04)\n'
'修复: Android N 发音奔溃问题(10-04)\n'
'修复: 某些情况下,重复显示翻译结果的问题(2017-02-11)\n'
'修复: 增加悬浮窗点击事件(10-06)\n'
'优化: 首页 menu 中可以查看版本信息了(10-07)'
changeLog '添加单词本发音功能\n增加谷歌翻译的支持'
}

bughd{
Expand Down Expand Up @@ -64,6 51,10 @@ android {
buildConfigField "String", "YOUDAO_DOC_TYPE", '"json"'
buildConfigField "String", "YOUDAO_VERSION", '"1.2"'

//google config
buildConfigField "String", "GOOGLE_LANGUAGE_ENGLISH", '"en"'
buildConfigField "String", "GOOGLE_LANGUAGE_CHINEASE", '"zh-CN"'

//common value
buildConfigField "String", "RESULT_JSON", '"json"'
buildConfigField "String", "LANGUAGE_AUTO", '"auto"'
Expand Down Expand Up @@ -199,7 190,6 @@ dependencies {
compile ("me.drakeet.library:crashwoodpecker:${libs.crashwoodpecker}"){
exclude module: 'recyclerview-v7'
}
compile project(":headsupcompat")

compile 'net.grandcentrix.tray:tray:0.11.0'

Expand Down
9 changes: 2 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 40,8 @@
<!--android:theme="@android:style/Theme.Dialog"-->
<activity
android:name=".ui.activitys.ProcessTextActivity"
android:label="咕咚翻译"
android:label="@string/app_name"

android:theme="@style/myTransparent">
<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" />
Expand Down Expand Up @@ -77,12 78,6 @@

<activity android:name=".ui.activitys.SettingActivity" />

<receiver android:name=".listener.AlarmReceiver">
<intent-filter>
<action android:name="name.gudong.translate.alarm"/>
</intent-filter>
</receiver>

<!--<receiver android:name=".service.KeepAlarmLiveReceiver">-->
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.USER_PRESENT"/>-->
Expand Down
28 changes: 12 additions & 16 deletions app/src/main/assets/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 48,21 @@
咕咚翻译 - 一个实现手机端『划词翻译』功能的 App,可能是目前 Android 市场上翻译效率最高的应用。
</p>

<h3>Version 1.5.0</h3>
<h3>Version 1.6.0</h3>

<ol>
<li><b>重要:</b> 大幅优化单词本的使用体验,提供单词导入导出等功能(2017-02-11)</li>
<li><b>优化:</b> 为 6.0 设备增加悬浮窗权限申请,解决 MIUI 等部分设备需要手动开启权限的问题</li>
<li><b>新增:</b> 为 Android 6.0 设备适配自定义的文本选择操作,长按文本点击咕咚翻译后可直接查词。<a href="http://www.jianshu.com/p/40e84359d683" title="关于自定义文本操作栏">关于自定义文本操作栏</a>
<li><b>新增:</b> 单词数据备份、恢复(2017-02-05)</li>
<li><b>新增:</b> 咕咚翻译可以背收藏的生词了,好词就应该死里记(10-01)</li>
<li><b>新增:</b> 支持手势滑动删除悬浮窗(10-03)</li>
<li><b>变更:</b> 调换设置与单词本的位置(10-17)</li>
<li><b>优化:</b> 部分 UI 颜色等小细节调整(2017-02-11)</li>
<li><b>优化:</b> 循环翻译顺序,锁屏停止循环(10-12)</li>
<li><b>优化:</b> 添加点击按钮的动画(10-04)</li>
<li><b>优化:</b> 循环显示背单词列表(10-04)</li>
<li><b>修复:</b> Android N 发音奔溃问题(10-04)</li>
<li><b>修复:</b> 某些情况下,重复显示翻译结果的问题(2017-02-11)</li>
<li><b>修复:</b> 增加悬浮窗点击事件(10-06)</li>
<li><b>优化:</b> 首页 menu 中可以查看版本信息了(10-07)</li>
<li><b>修复:</b> 诸多奔溃异常问题(04-02)</li>
<li><b>优化:</b> 翻译失败增加当前翻译引擎提示(04-02)</li>
</ol>

<h3>Version 1.5.5</h3>

<ol>
<li><b>修复:</b> 循环背单词次序停留在末尾的bug(03-16)</li>
<li><b>优化:</b> 翻译结果的文字大小以及颜色(加深)(03-13)</li>
<li><b>修复:</b> 导出单词失败的问题(03-03)</li>
</ol>

<p>
查看<a href="https://github.com/maoruibin/TranslateApp/blob/master/doc/Changelog.md" title="历史日志">历史日志</a>
</p>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/name/gudong/translate/GDApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 64,7 @@ public void onCreate() {

private void initCrashWoodpecker() {
CrashWoodpecker.instance()
.withKeys("widget", "me.drakeet")
.withKeys("widget", "name.gudong")
.setPatchMode(PatchMode.SHOW_LOG_PAGE)
.setPatchDialogUrlToOpen("http://gudong.name")
.setPassToOriginalDefaultHandler(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 27,7 @@
import dagger.Component;
import name.gudong.translate.GDApplication;
import name.gudong.translate.mvp.model.ApiBaidu;
import name.gudong.translate.mvp.model.ApiGoogle;
import name.gudong.translate.mvp.model.ApiJinShan;
import name.gudong.translate.mvp.model.ApiYouDao;
import name.gudong.translate.mvp.model.SingleRequestService;
Expand All @@ -37,6 38,8 @@
/**
* Created by GuDong on 12/27/15 16:41.
* Contact with [email protected].
*
* Updated by Levine on 2/21/17 add google api
*/
@Singleton
@Component(modules = {AppModule.class,ApiServiceModel.class})
Expand All @@ -54,6 57,8 @@ public interface AppComponent {

ApiBaidu getApiBaidu();

ApiGoogle getApiGoogle();

SingleRequestService getDwnloadService();

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 29,7 @@
import dagger.Provides;
import name.gudong.translate.BuildConfig;
import name.gudong.translate.mvp.model.ApiBaidu;
import name.gudong.translate.mvp.model.ApiGoogle;
import name.gudong.translate.mvp.model.ApiJinShan;
import name.gudong.translate.mvp.model.ApiYouDao;
import name.gudong.translate.mvp.model.SingleRequestService;
Expand All @@ -43,6 44,8 @@
/**
* Created by GuDong on 12/27/15 16:17.
* Contact with [email protected].
*
* Updated by Levine on 2/21/17 add google api
*/
@Module
public class ApiServiceModel {
Expand Down Expand Up @@ -76,6 79,10 @@ ApiJinShan provideApiJinShan() {
return createService(ETranslateFrom.JIN_SHAN);
}

@Provides
@Singleton
ApiGoogle provideApiGoogle(){return createService(ETranslateFrom.GOOGLE);}

private <S> S createService(ETranslateFrom type) {
Retrofit.Builder builder = new Retrofit.Builder()
.baseUrl(HttpUrl.parse(type.getUrl()))
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -60,8 60,6 @@ public final class ListenClipboardService extends Service implements ITipFloatVi

BroadcastReceiver mScreenStatusReceive;



@Override
public void onCreate() {
setUpInject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 49,15 @@
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Func1;

public class TipViewController{
import static name.gudong.translate.mvp.presenters.MainPresenter.KEY_REQUEST_CODE_FOR_NOTI;

public class TipViewController {
private WindowManager mWindowManager;
private Context mContext;
/**
* cache mul tip view
*/
private Map<Result,TipView>mMapTipView = new WeakHashMap<>();
private Map<Result, TipView> mMapTipView = new WeakHashMap<>();

private Observable mHideTipTask;

Expand All @@ -67,7 69,7 @@ public TipViewController(Context application) {
mRecitePreference = new ReciteModulePreference(mContext);
}

public void showErrorInfo(String error,TipView.ITipViewListener mListener){
public void showErrorInfo(String error, TipView.ITipViewListener mListener) {
TipView tipView = new TipView(mContext);
tipView.setListener(mListener);
mWindowManager.addView(tipView, getPopViewParams());
Expand All @@ -78,7 80,7 @@ public void showErrorInfo(String error,TipView.ITipViewListener mListener){

private void closeTipViewCountdown(final TipView tipView, TipView.ITipViewListener mListener) {
int duration = mRecitePreference.getDurationTimeWay().getDurationTime();
Logger.t("recite").d(duration "秒消失");
Logger.t("recite").d(duration "秒消失");
mHideTipTask = Observable.timer(duration, TimeUnit.SECONDS, AndroidSchedulers.mainThread())
.map(new Func1<Long, Object>() {
@Override
Expand All @@ -96,18 98,18 @@ public void onCloseAnimEnd(Animator animation) {
mHideTipTask.subscribe();
}

private void removeTipViewInner(TipView tipView){
if(tipView.getParent() != null){
private void removeTipViewInner(TipView tipView) {
if (tipView.getParent() != null) {
mWindowManager.removeView(tipView);
}
}

public void show(Result result,boolean isShowFavoriteButton,boolean isShowDoneMark,TipView.ITipViewListener mListener) {
public void show(Result result, boolean isShowFavoriteButton, boolean isShowDoneMark, TipView.ITipViewListener mListener) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
boolean isSettingUseSystemNotification = sharedPreferences.getBoolean("preference_show_float_view_use_system",false);
if(Utils.isSDKHigh5() && isSettingUseSystemNotification){
boolean isSettingUseSystemNotification = sharedPreferences.getBoolean("preference_show_float_view_use_system", false);
if (Utils.isSDKHigh5() && isSettingUseSystemNotification) {
StringBuilder sb = new StringBuilder();
for(String string:result.getExplains()){
for (String string : result.getExplains()) {
sb.append(string).append("\n");
}

Expand All @@ -124,49 126,48 @@ public void show(Result result,boolean isShowFavoriteButton,boolean isShowDoneMa
NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();

// Moves events into the big view
for (String string:result.getExplains()) {
for (String string : result.getExplains()) {
inboxStyle.addLine(string);
}

mBuilder.setStyle(inboxStyle);

Intent resultIntent = new Intent(mContext, MainActivity.class);
resultIntent.putExtra("data",result);
resultIntent.putExtra("data", result);

PendingIntent resultPendingIntent = PendingIntent.getActivity(
mContext,
0,
resultIntent,
PendingIntent.FLAG_UPDATE_CURRENT
);

mContext,
KEY_REQUEST_CODE_FOR_NOTI,
resultIntent,
PendingIntent.FLAG_UPDATE_CURRENT
);

mBuilder.addAction(R.drawable.ic_favorite_border_grey_24dp,"收藏",resultPendingIntent);
mBuilder.addAction(R.drawable.ic_favorite_border_grey_24dp, "收藏", resultPendingIntent);
NotificationManager mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
Notification note = mBuilder.build();
mNotificationManager.notify(result.getQuery().hashCode(), note);

}else{
} else {
TipView tipView = new TipView(mContext);
mMapTipView.put(result,tipView);
mMapTipView.put(result, tipView);
tipView.setListener(mListener);
mWindowManager.addView(tipView, getPopViewParams());
tipView.startWithAnim();
tipView.setContent(result, isShowFavoriteButton,isShowDoneMark);
closeTipViewCountdown(tipView,mListener);
tipView.setContent(result, isShowFavoriteButton, isShowDoneMark);
closeTipViewCountdown(tipView, mListener);
}
}

public void setWithFavorite(Result result){
public void setWithFavorite(Result result) {
TipView tipView = mMapTipView.get(result);
if(tipView != null){
if (tipView != null) {
tipView.setFavoriteBackground(R.drawable.ic_favorite_pink_24dp);
}
}

public void setWithNotFavorite(Result result){
public void setWithNotFavorite(Result result) {
TipView tipView = mMapTipView.get(result);
if(tipView != null){
if (tipView != null) {
tipView.setFavoriteBackground(R.drawable.ic_favorite_border_white_24dp);
}
}
Expand Down Expand Up @@ -196,13 197,13 @@ private WindowManager.LayoutParams getPopViewParams() {
}

public void removeTipView(Result result) {
if(result == null)return;
if (result == null) return;
TipView tipView = mMapTipView.get(result);
if(tipView != null){
if (tipView != null) {
Logger.i("移除 tipView ");
removeTipViewInner(tipView);
}
if(mHideTipTask != null){
if (mHideTipTask != null) {
Logger.i("移除 tipView 对应的 倒计时");
mHideTipTask.unsubscribeOn(AndroidSchedulers.mainThread());
}
Expand Down
33 changes: 0 additions & 33 deletions app/src/main/java/name/gudong/translate/manager/AlarmManagers.java

This file was deleted.

Loading

0 comments on commit 47139c7

Please sign in to comment.