make sure that update dialog show

This commit is contained in:
CsHeng
2017-11-07 11:59:22 +08:00
parent bcd32dde85
commit 5a04749ef2

View File

@ -1,7 +1,9 @@
package com.gh.gamecenter;
import android.app.Dialog;
import android.app.NotificationManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
@ -17,6 +19,10 @@ import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
import com.gh.base.AppUncaughtHandler;
import com.gh.base.BaseActivity;
@ -710,7 +716,7 @@ public class MainActivity extends BaseActivity {
return;
}
Gson gson = new Gson();
final Gson gson = new Gson();
Type type = new TypeToken<HashMap<String, Set<String>>>() {
}.getType();
@ -731,13 +737,50 @@ public class MainActivity extends BaseActivity {
// 有新的补丁,没有显示过
if (!tinkerIdSet.contains(newTinkerId)) {
DialogUtils.showWarningDialog(this, "补丁更新成功"
, "光环助手已成功更新到V" + PackageUtils.getPatchVersionName()
, null, "知道了", null, null);
tinkerIdSet.add(newTinkerId);
final Dialog dialog = new Dialog(this, R.style.GhAlertDialog);
View contentView = LayoutInflater.from(this).inflate(R.layout.dialog_alert, null);
TextView contentTv = contentView.findViewById(R.id.dialog_content);
TextView titleTv = contentView.findViewById(R.id.dialog_title);
TextView negativeTv = contentView.findViewById(R.id.dialog_negative);
TextView positiveTv = contentView.findViewById(R.id.dialog_positive);
titleTv.setText("补丁更新成功");
contentTv.setText("光环助手已成功更新到V" + PackageUtils.getPatchVersionName());
positiveTv.setText("知道了");
negativeTv.setText(null);
negativeTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
positiveTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
sp.edit().putString(Config.PATCHES, gson.toJson(tinkerIdMap)).apply();
}
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(contentView);
dialog.show();
}
sp.edit().putString(Config.PATCHES, gson.toJson(tinkerIdMap)).apply();
}
private void showUploadlog(){
}