|
@@ -26,6 +26,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alipay.sdk.app.PayTask;
|
|
import com.alipay.sdk.app.PayTask;
|
|
|
import com.arialyy.aria.core.Aria;
|
|
import com.arialyy.aria.core.Aria;
|
|
|
import com.arialyy.aria.core.download.DownloadTarget;
|
|
import com.arialyy.aria.core.download.DownloadTarget;
|
|
|
|
|
+import com.arialyy.aria.core.download.DownloadTask;
|
|
|
import com.arialyy.aria.core.inf.IEntity;
|
|
import com.arialyy.aria.core.inf.IEntity;
|
|
|
import com.kfzs.duanduan.datashare.provider.download.DownLoadInfo;
|
|
import com.kfzs.duanduan.datashare.provider.download.DownLoadInfo;
|
|
|
import com.kfzs.duanduan.event.BigEvent;
|
|
import com.kfzs.duanduan.event.BigEvent;
|
|
@@ -88,6 +89,7 @@ import rx.functions.Action1;
|
|
|
import rx.schedulers.Schedulers;
|
|
import rx.schedulers.Schedulers;
|
|
|
|
|
|
|
|
import static com.sheep.gamegroup.util.UMConfigUtils.Event.XIAOMI_GAME_RECEIVE;
|
|
import static com.sheep.gamegroup.util.UMConfigUtils.Event.XIAOMI_GAME_RECEIVE;
|
|
|
|
|
+import static com.sheep.gamegroup.view.adapter.TryMakeMoneyAdp.PUBLIC_TAG_PREFIX_TEXTVIEW_LIST;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 一些公用的class
|
|
* 一些公用的class
|
|
@@ -1538,8 +1540,10 @@ public class CommonUtil {
|
|
|
public void onNext(BaseMessage baseMessage) {
|
|
public void onNext(BaseMessage baseMessage) {
|
|
|
G.showToast(baseMessage.getMsg());
|
|
G.showToast(baseMessage.getMsg());
|
|
|
ViewUtil.newInstance().hideProgress(activity);
|
|
ViewUtil.newInstance().hideProgress(activity);
|
|
|
- String text = String.format(activity.getResources().getString(R.string.get_xiaomi_game_success_dialog),"小米账号","等带服务器开发");
|
|
|
|
|
final JSONObject jsonObject1 = JSONObject.parseObject(JSONObject.toJSONString(baseMessage.getData()));
|
|
final JSONObject jsonObject1 = JSONObject.parseObject(JSONObject.toJSONString(baseMessage.getData()));
|
|
|
|
|
+ String text = String.format(activity.getResources().getString(R.string.get_xiaomi_game_success_dialog),
|
|
|
|
|
+ jsonObject1!= null?jsonObject1.getString("account"):"*****",
|
|
|
|
|
+ jsonObject1!= null?jsonObject1.getString("password"):"*****");
|
|
|
|
|
|
|
|
ViewUtil.showMsgDialog(activity,
|
|
ViewUtil.showMsgDialog(activity,
|
|
|
text,
|
|
text,
|
|
@@ -1556,8 +1560,8 @@ public class CommonUtil {
|
|
|
intent.setData(uri);
|
|
intent.setData(uri);
|
|
|
activity.sendBroadcast(intent); // 发送广播通知相册
|
|
activity.sendBroadcast(intent); // 发送广播通知相册
|
|
|
} else {
|
|
} else {
|
|
|
- if(jsonObject1 != null)
|
|
|
|
|
- ViewUtil.sysSaveImage((View) v.getParent().getParent(), jsonObject1.getString("account")+"", jsonObject1.getString("password")+"");
|
|
|
|
|
|
|
+ if (jsonObject1 != null)
|
|
|
|
|
+ ViewUtil.sysSaveImage((View) v.getParent().getParent(), "小绵羊-小米", "小绵羊-小米账号");
|
|
|
}
|
|
}
|
|
|
G.showToast("已保存");
|
|
G.showToast("已保存");
|
|
|
EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.REFRESH_XIAOMI_GAME_LIST));
|
|
EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.REFRESH_XIAOMI_GAME_LIST));
|
|
@@ -1569,6 +1573,12 @@ public class CommonUtil {
|
|
|
|
|
|
|
|
EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.REFRESH_XIAOMI_GAME_LIST));
|
|
EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.REFRESH_XIAOMI_GAME_LIST));
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ new View.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(View v) {
|
|
|
|
|
+ EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.REFRESH_XIAOMI_GAME_LIST));
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1576,4 +1586,44 @@ public class CommonUtil {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 下载回调 状态修改
|
|
|
|
|
+ */
|
|
|
|
|
+ public void setEventResultViewStatus(BigEvent event, View view){
|
|
|
|
|
+ if(event.getData() instanceof DownloadTask){
|
|
|
|
|
+ DownloadTask task = (DownloadTask) event.getData();
|
|
|
|
|
+ String url = task.getKey();
|
|
|
|
|
+ TextView tvProgress = view.findViewWithTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + url);
|
|
|
|
|
+ switch (event.getEventTypes()){
|
|
|
|
|
+ case GENERATION_ACCOUNT_REFRESH_ADAPTER:
|
|
|
|
|
+ try {
|
|
|
|
|
+ int p = task.getPercent(); //任务进度百分比
|
|
|
|
|
+ String speed = task.getConvertSpeed(); //转换单位后的下载速度,单位转换需要在配置文件中打开
|
|
|
|
|
+ System.out.println("Aria "+task.getKey()+",p " + p + ", speed = " + speed);
|
|
|
|
|
+ if (tvProgress == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ tvProgress.setText(String.format(Locale.CHINA, "%d%%",Math.abs(p)));
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case DOWNLOAD_STOP:
|
|
|
|
|
+ tvProgress.setText("继续下载");
|
|
|
|
|
+ break;
|
|
|
|
|
+ case DOWNLOAD_COMPLETE:
|
|
|
|
|
+ tvProgress.setText("安装游戏");
|
|
|
|
|
+ break;
|
|
|
|
|
+ case DOWNLOAD_CANCEL:
|
|
|
|
|
+ tvProgress.setText("下载取消");
|
|
|
|
|
+ break;
|
|
|
|
|
+ case DOWNLOAD_FAIL:
|
|
|
|
|
+ tvProgress.setText("下载失败");
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|