处理一部分activity的toolbar,已经处理完毕的标记为Deprecated,为了保持MTA数据上报兼容性,暂时未删除对应的Activity

This commit is contained in:
CsHeng
2017-12-14 17:56:54 +08:00
parent e0b70b26f3
commit bf7b0b0a82
67 changed files with 2251 additions and 2495 deletions

View File

@ -2,114 +2,23 @@ package com.gh.gamecenter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.gh.base.BaseActivity;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.StringUtils;
import com.gh.gamecenter.manager.UpdateManager;
import com.tencent.bugly.beta.tinker.TinkerManager;
import java.lang.ref.WeakReference;
import butterknife.BindView;
import butterknife.OnClick;
import butterknife.OnLongClick;
import com.halo.assistant.fragment.AboutFragment;
import com.halo.assistant.ui.IntentFactory;
/**
* Created by khy on 2017/2/28.
*/
public class AboutActivity extends BaseActivity {
@BindView(R.id.about_version_tv)
TextView mAboutVersion;
@BindView(R.id.setting_rl_update)
RelativeLayout mAboutUpdateRl;
@BindView(R.id.about_version_pb)
ProgressBar mAboutPb;
@BindView(R.id.about_tv_version)
TextView mVersionName;
private Handler handler = new MyHandler(this);
@Deprecated
public class AboutActivity extends CommonActivity {
@NonNull
public static Intent getIntent(Context context) {
Intent intent = new Intent(context, AboutActivity.class);
return intent;
// Intent intent = new Intent(context, AboutActivity.class);
return new IntentFactory.Builder(context)
.setActivity(AboutActivity.class)
.setFragment(AboutFragment.class).build();
}
@Override
protected int getLayoutId() {
return R.layout.activity_about;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNavigationTitle(getString(R.string.title_about));
// ((TextView) findViewById(R.id.about_tv_version)).setText("V" + PackageUtils.getVersionName(this));
mVersionName.setText("V" + PackageUtils.getPatchVersionName()); // TODO 版本号暂时与gradle versionName不一致
}
@Override
protected void onDestroy() {
super.onDestroy();
handler.removeCallbacksAndMessages(null);
}
@OnClick({R.id.about_shengming, R.id.setting_rl_update})
public void OnClick(View view) {
if (view.getId() == R.id.setting_rl_update) {
UpdateManager.getInstance(AboutActivity.this).checkUpdate(false, handler); // 检出更新
} else if (view.getId() == R.id.about_shengming) {
Intent intent = WebActivity.getWebIntent(this);
startActivity(intent);
}
}
@OnLongClick(R.id.about_tv_version)
public boolean OnLongClick(View view) {
if (view.getId() == R.id.about_tv_version) {
String tinkerId = TinkerManager.getNewTinkerId();
if (!TextUtils.isEmpty(tinkerId)) {
mVersionName.setText("V" + PackageUtils.getPatchVersionName() + "." + tinkerId);
} else {
Toast.makeText(getApplicationContext(), R.string.toast_upload_latest, Toast.LENGTH_SHORT).show();
}
}
return false;
}
private 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);
final AboutActivity activity = mWeakReference.get();
if (activity != null) {
if (msg.what == 0) {
final String version = (String) msg.obj;
activity.mAboutVersion.setText(StringUtils.buildString("发现新版本 V", version));
} else if (msg.what == 1) {
activity.mAboutVersion.setText(R.string.toast_upload_latest);
}
}
}
}
}