启动屏幕部分逻辑修改

This commit is contained in:
CsHeng
2017-05-02 17:15:37 +08:00
parent 4db2b1cc29
commit b00b791107
9 changed files with 336 additions and 76 deletions

View File

@ -11,6 +11,8 @@ import com.gh.base.BaseActivity;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.manager.UpdateManager;
import java.lang.ref.WeakReference;
/**
* Created by khy on 2017/2/28.
*/
@ -21,20 +23,32 @@ public class AboutActivity extends BaseActivity {
@BindView(R.id.about_version_pb)
ProgressBar mAboutPb;
Handler handler = new Handler() {
private Handler handler = new MyHandler(this);
static class MyHandler extends Handler {
private WeakReference<AboutActivity> mWeakReference;
public MyHandler(AboutActivity activity) {
mWeakReference = new WeakReference<>(activity);
}
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == 0) {
String version = (String) msg.obj;
mAboutVersion.setText("发现新版本 V" + version);
mAboutPb.setVisibility(View.GONE);
} else if (msg.what == 1) {
mAboutVersion.setText("已是最新版本");
mAboutPb.setVisibility(View.GONE);
final AboutActivity activity = mWeakReference.get();
if (activity != null) {
if (msg.what == 0) {
final String version = (String) msg.obj;
activity.mAboutVersion.setText("发现新版本 V" + version);
activity.mAboutPb.setVisibility(View.GONE);
} else if (msg.what == 1) {
activity.mAboutVersion.setText("已是最新版本");
activity.mAboutPb.setVisibility(View.GONE);
}
}
}
};
}
@Override
protected void onCreate(Bundle savedInstanceState) {