@Override public void onReceive(final Context context, Intent intent) { // Gets the intent, check if it matches our secret code if (Intent.ACTION_NEW_OUTGOING_CALL.equals(intent.getAction()) && intent.getExtras() != null) { Intent launcher = new Intent(context, MainActivity_.class); //These flags are added to make the new mainActivity in the home stack. //i.e. back button returns to home not dialer. launcher.addFlags(IntentCompat.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_TASK_ON_HOME); String phoneNumber = intent.getExtras().getString(android.content.Intent.EXTRA_PHONE_NUMBER); if (Pref.OpenPIN().exists()) if (("*#" + Pref.OpenPIN().get()).equals(phoneNumber)) // Launch the main app!! launchActivity(context, launcher); } }
void showTutorial() { if ((adapter.getCount() > 0) && (Pref.showVaultLongPressRenameTutorial().get())) { final View mView = context.getLayoutInflater().inflate(R.layout.vault_item_tutorial, mLinearView, false); TextView mInstructions = (TextView) mView.findViewById(R.id.Tutorial__instruction); if (mInstructions != null) mInstructions.setText(R.string.Tutorial__long_click_to_rename); mLinearView.addView(mView, 0); mView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { mLinearView.removeView(mView); Pref.edit() .showVaultLongPressRenameTutorial() .put(false) .apply(); return true; } }); return; //Show only one tutorial at a time. Don't overload users!! } }