启动屏幕部分逻辑修改
This commit is contained in:
@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user