|
@@ -1,5 +1,7 @@
|
|
|
package com.ysnows.update;
|
|
|
|
|
|
+import android.view.KeyEvent;
|
|
|
+import android.view.View;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
|
|
|
@@ -26,10 +28,14 @@ public class StormUpgradeActivity extends UpgradeActivity {
|
|
|
private TextView tvLeft;
|
|
|
private LinearLayout buttonRight;
|
|
|
private TextView tvRight;
|
|
|
+ private int updateType = 0;//升级策略 1建议 2强制 3手工
|
|
|
+
|
|
|
|
|
|
|
|
|
@Override
|
|
|
protected void initData() {
|
|
|
+ setFinishOnTouchOutside(false);
|
|
|
+
|
|
|
/*获取下载任务,初始化界面信息*/
|
|
|
updateBtn(Beta.getStrategyTask());
|
|
|
tvVersion.setText(Beta.getUpgradeInfo().title + getString(R.string.version_online));
|
|
@@ -45,6 +51,10 @@ public class StormUpgradeActivity extends UpgradeActivity {
|
|
|
// String time = times(String.valueOf(Beta.getUpgradeInfo().publishTime));
|
|
|
tvUpdatetime.setText(getString(R.string.update_time) + time);
|
|
|
tvUpdatecontent.setText(Beta.getUpgradeInfo().newFeature);
|
|
|
+ if (Beta.getUpgradeInfo().upgradeType == 2) {//强制
|
|
|
+ updateType = 2;
|
|
|
+ buttonLeft.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|
|
@@ -140,4 +150,15 @@ public class StormUpgradeActivity extends UpgradeActivity {
|
|
|
});
|
|
|
|
|
|
}
|
|
|
+ @Override
|
|
|
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
+ if (keyCode == KeyEvent.KEYCODE_BACK) {
|
|
|
+ if (updateType == 2) {//强制升级
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return super.onKeyDown(keyCode, event);
|
|
|
+ }
|
|
|
+
|
|
|
}
|