l="">
+ loadingView.setVisibility(View.GONE);
+ backBtn.setVisibility(View.VISIBLE);
}
+
}
@@ -9,6 +9,7 @@ import org.json.JSONObject; |
||
| 9 | 9 |
|
| 10 | 10 |
import java.util.HashMap; |
| 11 | 11 |
|
| 12 |
+import ai.pai.lensman.BuildConfig; |
|
| 12 | 13 |
import ai.pai.lensman.base.BaseInteractor; |
| 13 | 14 |
import ai.pai.lensman.utils.BoxUrlContainer; |
| 14 | 15 |
import ai.pai.lensman.utils.HttpPostTask; |
@@ -29,12 +30,15 @@ public class BoxUpgradeInteractor implements BaseInteractor {
|
||
| 29 | 30 |
cancelJob(); |
| 30 | 31 |
HashMap<String, String> params = new HashMap<>(); |
| 31 | 32 |
params.put("bpversion_str", bpversion_str);
|
| 32 |
- LogHelper.d("czy", "开始box升级任务");
|
|
| 33 |
+ LogHelper.d("czy", "开始box设置升级任务");
|
|
| 33 | 34 |
upgradeTask = new HttpPostTask(params) {
|
| 34 | 35 |
|
| 35 | 36 |
@Override |
| 36 | 37 |
protected boolean parseResponse(String response) {
|
| 37 |
- LogHelper.d("czy", "box升级任务 box应答=" + response);
|
|
| 38 |
+ LogHelper.d("czy", "box设置升级任务 box应答=" + response);
|
|
| 39 |
+ if(BuildConfig.isTestMode){
|
|
| 40 |
+ return true; |
|
| 41 |
+ } |
|
| 38 | 42 |
try {
|
| 39 | 43 |
JSONObject json = new JSONObject(response); |
| 40 | 44 |
int status = json.getInt("status");
|
@@ -42,7 +46,7 @@ public class BoxUpgradeInteractor implements BaseInteractor {
|
||
| 42 | 46 |
return true; |
| 43 | 47 |
} |
| 44 | 48 |
} catch (Exception e) {
|
| 45 |
- LogHelper.d("czy", "box升级任务 box应答异常 " + e);
|
|
| 49 |
+ LogHelper.d("czy", "box设置升级任务 box应答异常 " + e);
|
|
| 46 | 50 |
} |
| 47 | 51 |
return false; |
| 48 | 52 |
} |
@@ -51,14 +55,14 @@ public class BoxUpgradeInteractor implements BaseInteractor {
|
||
| 51 | 55 |
protected void onPostFail() {
|
| 52 | 56 |
super.onPostFail(); |
| 53 | 57 |
listener.onBoxUpgrade(false); |
| 54 |
- LogHelper.d("czy", "box升级任务失败");
|
|
| 58 |
+ LogHelper.d("czy", "box设置升级任务失败");
|
|
| 55 | 59 |
} |
| 56 | 60 |
|
| 57 | 61 |
@Override |
| 58 | 62 |
protected void onPostSuccess() {
|
| 59 | 63 |
super.onPostSuccess(); |
| 60 | 64 |
listener.onBoxUpgrade(true); |
| 61 |
- LogHelper.d("czy", "box升级任务成功");
|
|
| 65 |
+ LogHelper.d("czy", "box设置升级任务成功");
|
|
| 62 | 66 |
} |
| 63 | 67 |
}; |
| 64 | 68 |
upgradeTask.executeOnExecutor(ThreadExecutor.getInstance().getExecutor(), BoxUrlContainer.SET_VERSION); |
@@ -37,11 +37,11 @@ public class CheckBoxUpgradeInfoInteractor implements BaseInteractor {
|
||
| 37 | 37 |
upgradeTask = new HttpPostTask(params) {
|
| 38 | 38 |
|
| 39 | 39 |
String bpversion_str =""; |
| 40 |
- |
|
| 40 |
+ int latestVersionCode=0; |
|
| 41 | 41 |
@Override |
| 42 | 42 |
protected boolean parseResponse(String response) {
|
| 43 | 43 |
LogHelper.d(TAG, "box升级任务 服务器应答=" + response); |
| 44 |
- int latestVersionCode=0; |
|
| 44 |
+ |
|
| 45 | 45 |
try {
|
| 46 | 46 |
JSONObject json = new JSONObject(response); |
| 47 | 47 |
int status = json.getInt("status");
|
@@ -66,14 +66,14 @@ public class CheckBoxUpgradeInfoInteractor implements BaseInteractor {
|
||
| 66 | 66 |
@Override |
| 67 | 67 |
protected void onPostFail() {
|
| 68 | 68 |
super.onPostFail(); |
| 69 |
- listener.onUpgradeInfoFetched(false, null); |
|
| 69 |
+ listener.onUpgradeInfoFetched(false, bpversion_str,latestVersionCode); |
|
| 70 | 70 |
LogHelper.d(TAG, "box升级任务 获取更新失败或者无需更新"); |
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 | 73 |
@Override |
| 74 | 74 |
protected void onPostSuccess() {
|
| 75 | 75 |
super.onPostSuccess(); |
| 76 |
- listener.onUpgradeInfoFetched(true, bpversion_str); |
|
| 76 |
+ listener.onUpgradeInfoFetched(true, bpversion_str,latestVersionCode); |
|
| 77 | 77 |
LogHelper.d(TAG, "box升级任务 需要更新"); |
| 78 | 78 |
} |
| 79 | 79 |
}; |
@@ -92,7 +92,7 @@ public class CheckBoxUpgradeInfoInteractor implements BaseInteractor {
|
||
| 92 | 92 |
} |
| 93 | 93 |
|
| 94 | 94 |
public interface FetchUpgradeInfoListener {
|
| 95 |
- void onUpgradeInfoFetched(boolean result, String bpversion_str); |
|
| 95 |
+ void onUpgradeInfoFetched(boolean result, String bpversion_str,int versionCode); |
|
| 96 | 96 |
} |
| 97 | 97 |
|
| 98 | 98 |
} |
@@ -2,6 +2,7 @@ |
||
| 2 | 2 |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | 3 |
android:layout_width="match_parent" |
| 4 | 4 |
android:layout_height="match_parent" |
| 5 |
+ xmlns:app="http://schemas.android.com/apk/res-auto" |
|
| 5 | 6 |
android:background="@color/half_transparent"> |
| 6 | 7 |
|
| 7 | 8 |
<RelativeLayout |
@@ -14,7 +15,7 @@ |
||
| 14 | 15 |
android:layout_width="wrap_content" |
| 15 | 16 |
android:layout_height="wrap_content" |
| 16 | 17 |
android:text="@string/box_upgrade_found" |
| 17 |
- android:layout_centerInParent="true" |
|
| 18 |
+ android:layout_centerHorizontal="true" |
|
| 18 | 19 |
android:textSize="18sp" |
| 19 | 20 |
android:textColor="@color/white" |
| 20 | 21 |
android:id="@+id/tv_box_upgrade_info"/> |
@@ -46,4 +47,46 @@ |
||
| 46 | 47 |
android:layout_below="@+id/btn_update_now" |
| 47 | 48 |
/> |
| 48 | 49 |
</RelativeLayout> |
| 50 |
+ |
|
| 51 |
+ <RelativeLayout |
|
| 52 |
+ android:id="@+id/layout_box_updating" |
|
| 53 |
+ android:layout_width="match_parent" |
|
| 54 |
+ android:layout_height="wrap_content" |
|
| 55 |
+ android:layout_centerInParent="true" |
|
| 56 |
+ android:visibility="gone"> |
|
| 57 |
+ |
|
| 58 |
+ <com.android.views.loadingdrawable.LoadingView |
|
| 59 |
+ android:id="@+id/loading_gear_view" |
|
| 60 |
+ android:layout_width="180dp" |
|
| 61 |
+ android:layout_height="180dp" |
|
| 62 |
+ android:layout_centerHorizontal="true" |
|
| 63 |
+ app:loading_renderer="GearLoadingRenderer"/> |
|
| 64 |
+ |
|
| 65 |
+ <TextView |
|
| 66 |
+ android:id="@+id/tv_updating_status" |
|
| 67 |
+ android:layout_width="wrap_content" |
|
| 68 |
+ android:layout_height="wrap_content" |
|
| 69 |
+ android:textSize="16sp" |
|
| 70 |
+ android:text="@string/box_is_upgrading" |
|
| 71 |
+ android:layout_below="@id/loading_gear_view" |
|
| 72 |
+ android:layout_marginTop="10dp" |
|
| 73 |
+ android:layout_centerHorizontal="true" |
|
| 74 |
+ android:textColor="@color/white"/> |
|
| 75 |
+ |
|
| 76 |
+ <Button |
|
| 77 |
+ android:id="@+id/btn_return_work" |
|
| 78 |
+ android:layout_width="match_parent" |
|
| 79 |
+ android:layout_height="40dp" |
|
| 80 |
+ android:layout_margin="12dp" |
|
| 81 |
+ android:text="@string/back_to_work" |
|
| 82 |
+ android:gravity="center" |
|
| 83 |
+ android:textSize="18sp" |
|
| 84 |
+ android:textColor="@color/white" |
|
| 85 |
+ android:background="@drawable/print_rounded_rect_bg" |
|
| 86 |
+ android:layout_below="@+id/tv_updating_status" |
|
| 87 |
+ android:visibility="gone" |
|
| 88 |
+ /> |
|
| 89 |
+ |
|
| 90 |
+ </RelativeLayout> |
|
| 91 |
+ |
|
| 49 | 92 |
</RelativeLayout> |
@@ -186,4 +186,13 @@ |
||
| 186 | 186 |
<string name="upgrade_now">立即更新</string> |
| 187 | 187 |
|
| 188 | 188 |
<string name="upgrade_later">下次再说</string> |
| 189 |
+ |
|
| 190 |
+ <string name="box_is_upgrading">box软件更新中,约需要一分钟,请勿关闭电源...</string> |
|
| 191 |
+ |
|
| 192 |
+ <string name="box_updating_fail">box软件更新失败,请检查box与手机是否处在同一网络</string> |
|
| 193 |
+ |
|
| 194 |
+ <string name="box_update_success">box软件更新成功,欢迎使用</string> |
|
| 195 |
+ |
|
| 196 |
+ <string name="back_to_work">返回</string> |
|
| 197 |
+ |
|
| 189 | 198 |
</resources> |