Merge remote-tracking branch 'origin/temp' into dev
This commit is contained in:
@ -5,19 +5,17 @@ import android.support.annotation.NonNull;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.RunningUtils;
|
||||
import com.gh.common.util.ShareUtils;
|
||||
import com.gh.common.util.StringUtils;
|
||||
import com.gh.gamecenter.DataUtils;
|
||||
import com.gh.gamecenter.LoginActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.eventbus.EBShowDialog;
|
||||
import com.lightgame.download.FileUtils;
|
||||
import com.lightgame.utils.AppManager;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@ -35,7 +33,7 @@ import pub.devrel.easypermissions.EasyPermissions;
|
||||
import static com.gh.common.util.EntranceUtils.KEY_DATA;
|
||||
import static com.gh.common.util.EntranceUtils.KEY_ENTRANCE;
|
||||
|
||||
public abstract class BaseActivity extends BaseAppCompatToolBarActivity implements EasyPermissions.PermissionCallbacks{
|
||||
public abstract class BaseActivity extends BaseToolBarActivity implements EasyPermissions.PermissionCallbacks {
|
||||
|
||||
protected String mEntrance;
|
||||
private boolean mIsPause;
|
||||
@ -43,39 +41,24 @@ public abstract class BaseActivity extends BaseAppCompatToolBarActivity implemen
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
init(mContentView);
|
||||
AppManager.getInstance().addActivity(this);
|
||||
EventBus.getDefault().register(this);
|
||||
ButterKnife.bind(this);
|
||||
mEntrance = getIntent().getStringExtra(KEY_ENTRANCE);
|
||||
if (getIntent().getBundleExtra(KEY_DATA) != null) {
|
||||
mEntrance = getIntent().getBundleExtra(KEY_DATA).getString(KEY_ENTRANCE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
EventBus.getDefault().unregister(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onNavigationIconClicked() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void init(View contentView) {
|
||||
setContentView(contentView);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
View back = findViewById(R.id.actionbar_rl_back);
|
||||
if (back != null)
|
||||
back.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void initTitle(String title) {
|
||||
TextView actionbar_tv_title = (TextView) findViewById(R.id.actionbar_tv_title);
|
||||
actionbar_tv_title.setText(title);
|
||||
// setNavigationTitle(title);
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void toast(String msg) {
|
||||
@ -83,16 +66,17 @@ public abstract class BaseActivity extends BaseAppCompatToolBarActivity implemen
|
||||
}
|
||||
|
||||
public void toast(int msg) {
|
||||
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
|
||||
toast(getString(msg));
|
||||
}
|
||||
|
||||
//如果是游戏分享,newsTitle默认为空
|
||||
public void showShare(String url, String gameName, String icon, String newsTitle, ArrayList<String> tag, boolean isToolsBox) {
|
||||
public void showShare(String url, String gameName, String icon, String newsTitle, ArrayList<String> tagList, boolean isToolsBox) {
|
||||
|
||||
//判断是否是官方版
|
||||
boolean isPlugin = false;
|
||||
if (tag != null) {
|
||||
for (String s : tag) {
|
||||
// tagList.contains("官方版")???
|
||||
if (tagList != null) {
|
||||
for (String s : tagList) {
|
||||
if (!"官方版".equals(s)) {
|
||||
isPlugin = true;
|
||||
}
|
||||
@ -108,10 +92,9 @@ public abstract class BaseActivity extends BaseAppCompatToolBarActivity implemen
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(final EBShowDialog showDialog) {
|
||||
//TODO 改为缓存到UI可见时才调用,参考beier-assist
|
||||
//TODO 改为缓存到UI可见时才调用,参考beier-assist Lifecycle组件
|
||||
if (!mIsPause && this.getClass().getName().equals(RunningUtils.getTopActivity(this))) {
|
||||
if ("hijack".equals(showDialog.getType())) {
|
||||
DialogUtils.showQqSessionDialog(this, "2586716223");// 建议用户联系客服
|
||||
@ -120,7 +103,7 @@ public abstract class BaseActivity extends BaseAppCompatToolBarActivity implemen
|
||||
@Override
|
||||
public void onConfirm() {
|
||||
if (FileUtils.isEmptyFile(showDialog.getPath())) {
|
||||
Utils.toast(BaseActivity.this, getString(R.string.install_failure_hint));
|
||||
toast(getString(R.string.install_failure_hint));
|
||||
} else {
|
||||
startActivity(PackageUtils.getUninstallIntent(BaseActivity.this, showDialog.getPath()));
|
||||
}
|
||||
@ -150,26 +133,16 @@ public abstract class BaseActivity extends BaseAppCompatToolBarActivity implemen
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
AppManager.getInstance().finishActivity(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
// DataUtils.onPause(this);
|
||||
mIsPause = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
// DataUtils.onResume(this);
|
||||
mIsPause = false;
|
||||
// DownloadManager.getInstance(this).initGameMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user