- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {}
public void showEmptyOrErrorView(String text, int img) { if (emptyView == null) { emptyView = findViewById(R.id.vs_empty); } emptyView.setVisibility(View.VISIBLE); findViewById(R.id.iv_empty).setBackgroundResource(img); ((TextView) findViewById(R.id.tv_empty)).setText(text); findViewById(R.id.ll_empty).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onPageClick(); } }); }
protected void showEmptyView() { showEmptyView(getString(R.string.no_data)); }
protected void showErrorView() { showErrorView(getString(R.string.error_data)); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); if (isActionBar()) { setContentView(R.layout.activity_base); ((ViewGroup) findViewById(R.id.fl_content)).addView(getLayoutInflater().inflate(getLayoutId(), null)); } else { setContentView(getLayoutId()); } //初始化ButterKnife unbinder = ButterKnife.bind(this); //沉浸式状态栏 initImmersionBar(R.color.blue); //加入Activity管理器 BaseApplication.getApplication().getActivityManage().addActivity(this); if (regEvent()) { EventBusUtils.register(this); } loadingDialog = new LoadingDialog(mContext); }
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); Logger.e("permissions:" + Arrays.toString(permissions) + " grantResults:" + Arrays.toString(grantResults)); //如果有未授权权限则跳转设置页面 if (!requestPermissionsResult(grantResults)) { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.parse("package:" + getPackageName())); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); handler.sendEmptyMessageDelayed(0, loadingTime); }
@Override public void onAttachedToWindow() { super.onAttachedToWindow(); initView(); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); //创建present presenter = createPresenter(); if (presenter != null) { presenter.attachView(this); } }