添加简单的页面快速跳转功能

This commit is contained in:
juntao
2020-08-11 10:38:14 +08:00
parent 1b946c325c
commit e80b198aa5
4 changed files with 107 additions and 3 deletions

View File

@ -27,6 +27,7 @@ import com.gh.base.fragment.BaseFragment;
import com.gh.common.constant.Constants;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.MtaHelper;
import com.gh.common.util.PackageInstaller;
import com.gh.common.util.RunningUtils;
@ -169,14 +170,15 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Easy
LinearLayout ll = new LinearLayout(this);
TextView tv = new TextView(this);
String envText = "正式环境";
tv.setBackground(ContextCompat.getDrawable(this, R.color.theme));
if (BuildConfig.FLAVOR.equals("internal")) {
envText = "测试环境";
tv.setBackground(ContextCompat.getDrawable(this, R.color.red));
}
tv.setText(envText);
tv.setGravity(Gravity.CENTER);
tv.setTextColor(Color.WHITE);
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
tv.setBackground(ContextCompat.getDrawable(this, R.color.red));
tv.measure(0, 0);
tv.setAlpha(0.15F);
int height = tv.getMeasuredHeight();
@ -187,6 +189,13 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Easy
ll.addView(tv);
ll.setPadding(0, (width - height) / 2, 0, (width - height) / 2);
if (BuildConfig.DEBUG) {
ll.setOnLongClickListener(v -> {
EntranceUtils.saveShortcut(this.getClass().getName(), getIntent().getExtras());
return true;
});
}
screenRootView.addView(view);
screenRootView.addView(ll);