List of usage examples for android.widget ViewSwitcher showNext
@android.view.RemotableViewMethod public void showNext()
From source file:de.azapps.mirakel.helper.TaskDialogHelpers.java
@SuppressLint("NewApi") public static void handleSubtask(final Context ctx, final Task task, final OnTaskChangedListner taskChanged, final boolean asSubtask) { final List<Pair<Long, String>> names = Task.getTaskNames(); final CharSequence[] values = new String[names.size()]; for (int i = 0; i < names.size(); i++) { values[i] = names.get(i).second; }/*from w w w . ja va2 s.c o m*/ final View v = ((Activity) ctx).getLayoutInflater().inflate(R.layout.select_subtask, null, false); final ListView lv = (ListView) v.findViewById(R.id.subtask_listview); final List<Task> tasks = Task.cursorToTaskList( ctx.getContentResolver().query(MirakelInternalContentProvider.TASK_URI, Task.allColumns, ModelBase.ID + "=" + task.getId() + " AND " + Task.BASIC_FILTER_DISPLAY_TASKS, null, null)); subtaskAdapter = new SubtaskAdapter(ctx, 0, tasks, task, asSubtask); lv.post(new Runnable() { @Override public void run() { lv.setAdapter(subtaskAdapter); } }); searchString = ""; done = false; content = false; reminder = false; optionEnabled = false; newTask = true; listId = SpecialList.firstSpecialSafe().getId(); final EditText search = (EditText) v.findViewById(R.id.subtask_searchbox); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { Drawable left = ctx.getResources().getDrawable(android.R.drawable.ic_menu_search); Drawable right = null; left.setBounds(0, 0, 42, 42); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && ctx.getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { right = ctx.getResources().getDrawable(android.R.drawable.ic_menu_search); right.setBounds(0, 0, 42, 42); left = null; } search.setCompoundDrawables(left, null, right, null); } search.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(final Editable s) { // Nothing } @Override public void beforeTextChanged(final CharSequence s, final int start, final int count, final int after) { // Nothing } @Override public void onTextChanged(final CharSequence s, final int start, final int before, final int count) { searchString = s.toString(); updateListView(subtaskAdapter, task, lv, ctx); } }); final Button options = (Button) v.findViewById(R.id.subtasks_options); final LinearLayout wrapper = (LinearLayout) v.findViewById(R.id.subtask_option_wrapper); wrapper.setVisibility(View.GONE); options.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { if (optionEnabled) { wrapper.setVisibility(View.GONE); } else { wrapper.setVisibility(View.VISIBLE); final InputMethodManager imm = (InputMethodManager) ctx .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(search.getWindowToken(), 0); } optionEnabled = !optionEnabled; } }); final ViewSwitcher switcher = (ViewSwitcher) v.findViewById(R.id.subtask_switcher); final Button subtaskNewtask = (Button) v.findViewById(R.id.subtask_newtask); final Button subtaskSelectOld = (Button) v.findViewById(R.id.subtask_select_old); final boolean darkTheme = MirakelCommonPreferences.isDark(); if (asSubtask) { v.findViewById(R.id.subtask_header).setVisibility(View.GONE); switcher.showNext(); newTask = false; } else { subtaskNewtask.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { if (newTask) { return; } switcher.showPrevious(); subtaskNewtask .setTextColor(ctx.getResources().getColor(darkTheme ? R.color.White : R.color.Black)); subtaskSelectOld.setTextColor(ctx.getResources().getColor(R.color.Grey)); newTask = true; } }); subtaskSelectOld.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { if (!newTask) { return; } switcher.showNext(); subtaskNewtask.setTextColor(ctx.getResources().getColor(R.color.Grey)); subtaskSelectOld .setTextColor(ctx.getResources().getColor(darkTheme ? R.color.White : R.color.Black)); if (subtaskAdapter != null) { subtaskAdapter.notifyDataSetChanged(); } newTask = false; lv.invalidateViews(); updateListView(subtaskAdapter, task, lv, ctx); } }); } final CheckBox doneBox = (CheckBox) v.findViewById(R.id.subtask_done); doneBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) { done = isChecked; updateListView(subtaskAdapter, task, lv, ctx); } }); final CheckBox reminderBox = (CheckBox) v.findViewById(R.id.subtask_reminder); reminderBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) { reminder = isChecked; updateListView(subtaskAdapter, task, lv, ctx); } }); final Button list = (Button) v.findViewById(R.id.subtask_list); list.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { final List<ListMirakel> lists = ListMirakel.all(true); final CharSequence[] names = new String[lists.size()]; for (int i = 0; i < names.length; i++) { names[i] = lists.get(i).getName(); } new AlertDialog.Builder(ctx).setSingleChoiceItems(names, -1, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { listId = lists.get(which).getId(); updateListView(subtaskAdapter, task, lv, ctx); list.setText(lists.get(which).getName()); dialog.dismiss(); } }).show(); } }); final CheckBox contentBox = (CheckBox) v.findViewById(R.id.subtask_content); contentBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) { content = isChecked; updateListView(subtaskAdapter, task, lv, ctx); } }); final EditText newTaskEdit = (EditText) v.findViewById(R.id.subtask_add_task_edit); final AlertDialog dialog = new AlertDialog.Builder(ctx).setTitle(ctx.getString(R.string.add_subtask)) .setView(v).setPositiveButton(R.string.add, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { if (newTask && newTaskEdit.getText().length() > 0) { newSubtask(newTaskEdit.getText().toString(), task, ctx); } else if (!newTask) { final List<Task> checked = subtaskAdapter.getSelected(); for (final Task t : checked) { if (!asSubtask) { if (!t.hasSubtasksLoop(task)) { task.addSubtask(t); } else { ErrorReporter.report(ErrorType.TASKS_CANNOT_FORM_LOOP); } } else { if (!task.hasSubtasksLoop(t)) { t.addSubtask(task); } else { ErrorReporter.report(ErrorType.TASKS_CANNOT_FORM_LOOP); } } } } if (taskChanged != null) { taskChanged.onTaskChanged(task); } ((Activity) ctx).getWindow() .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); dialog.dismiss(); } }).setNegativeButton(android.R.string.cancel, dialogDoNothing).show(); newTaskEdit.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(final TextView v, final int actionId, final KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEND) { newSubtask(v.getText().toString(), task, ctx); v.setText(null); if (taskChanged != null) { taskChanged.onTaskChanged(task); } dialog.dismiss(); } return false; } }); }
From source file:com.quaap.audiometer.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.menu_options) { ViewSwitcher ctrls = (ViewSwitcher) findViewById(R.id.ctrls); ctrls.showNext(); } else if (id == R.id.menu_about) { Intent intent = new Intent(this, AboutActivity.class); startActivity(intent);//from w w w . j a va2s .co m } else if (id == R.id.menu_help) { Intent intent = new Intent(this, HelpActivity.class); startActivity(intent); } return super.onOptionsItemSelected(item); }
From source file:com.quaap.audiometer.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pref = getApplicationContext().getSharedPreferences("main", MODE_PRIVATE); mMeterView = (MeterView) findViewById(R.id.meterLayout); mMicLevelReader = new MicLevelReader(this, LevelMethod.dBFS); ImageButton show_ctrls = (ImageButton) findViewById(R.id.show_ctrls); show_ctrls.setOnClickListener(new View.OnClickListener() { @Override/* ww w. j a v a 2s.c o m*/ public void onClick(View view) { ViewSwitcher ctrls = (ViewSwitcher) findViewById(R.id.ctrls); ctrls.showNext(); } }); ImageButton hide_ctrls = (ImageButton) findViewById(R.id.hide_ctrls); hide_ctrls.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ViewSwitcher ctrls = (ViewSwitcher) findViewById(R.id.ctrls); ctrls.showPrevious(); } }); final SeekBar scaleCtrl = (SeekBar) findViewById(R.id.scaleCtrl); scaleCtrl.setProgress(pref.getInt("scaleCtrl", scaleCtrl.getProgress())); setScale(); scaleCtrl.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int i, boolean b) { setScale(); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); final ToggleButton onoff = (ToggleButton) findViewById(R.id.toggleButton); onoff.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (onoff.isChecked()) { if (!startit()) { onoff.setChecked(false); } } else { stopit(); } } }); LevelMethod levM = LevelMethod.valueOf(pref.getString("levelMethod", LevelMethod.dBFS.toString())); final Spinner levelType = (Spinner) findViewById(R.id.levelType); ArrayAdapter<LevelMethod> levelTypeAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, LevelMethod.values()); levelType.setAdapter(levelTypeAdapter); levelType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { LevelMethod lmeth = (LevelMethod) adapterView.getSelectedItem(); levelMethodChanged(lmeth); } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); levelType.setSelection(levelTypeAdapter.getPosition(levM)); levelMethodChanged((LevelMethod) levelType.getSelectedItem()); checkMicrophoneAccess(); }
From source file:com.friedran.appengine.dashboard.gui.DashboardLoadFragment.java
private void updateChartImage(View chartView, Bitmap image, boolean animate) { ImageView chartImageView = (ImageView) chartView.findViewById(R.id.load_chart_image); if (image != null) { chartImageView.setImageBitmap(image); } else {//from w w w .j a va 2 s. c o m chartImageView.setImageResource(android.R.color.transparent); Toast.makeText(mActivity, "Failed downloading charts, please make sure you have Internet connectivity and try refreshing", 2000).show(); } ViewSwitcher viewSwitcher = (ViewSwitcher) chartView.findViewById(R.id.load_chart_switcher); if (viewSwitcher.getDisplayedChild() != 1) { if (animate) { viewSwitcher.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.fadein)); } else viewSwitcher.setAnimation(null); viewSwitcher.showNext(); } // Mark the refresh UI as complete once anyone of the charts has been loaded. mPullToRefreshAttacher.setRefreshComplete(); }
From source file:de.measite.contactmerger.MergeActivity.java
public void updateList() { progressContainer = findViewById(R.id.progress_bar_container); progressBar = (ProgressBar) findViewById(R.id.analyze_progress); progressContainer.setVisibility(View.GONE); loadText = (TextView) findViewById(R.id.load_text); TextView stopScan = (TextView) findViewById(R.id.stop_scan); Typeface font = Typeface.createFromAsset(getAssets(), "fontawesome-webfont.ttf"); stopScan.setTypeface(font);/* w w w . jav a 2s . c o m*/ stopScan.setClickable(true); stopScan.setOnClickListener(this); startScan = (Button) findViewById(R.id.start_scan); startScan.setOnClickListener(this); ViewSwitcher switcher = (ViewSwitcher) findViewById(R.id.switcher); ViewSwitcher switcher_list = (ViewSwitcher) findViewById(R.id.switcher_list); Context context = getApplicationContext(); File path = context.getDatabasePath("contactsgraph"); File modelFile = new File(path, "model.kryo.gz"); if (path.exists() && modelFile.exists()) { this.adapter.update(); while (switcher.getCurrentView().getId() != R.id.switcher_list) { switcher.showNext(); } if (adapter.getCount() == 0) { while (switcher_list.getCurrentView().getId() != R.id.all_done) { switcher_list.showNext(); } } else { while (switcher_list.getCurrentView().getId() != R.id.contact_merge_list) { switcher_list.showPrevious(); } } switcher_list.postInvalidate(); } else { if (switcher.getCurrentView().getId() == R.id.contact_merge_list) { switcher.showPrevious(); } Intent intent = new Intent(getApplicationContext(), AnalyzerService.class); intent.putExtra("forceRunning", true); startService(intent); } switcher.postInvalidate(); }
From source file:io.github.trulyfree.easyaspi.MainActivity.java
@Override public boolean setup() { downloadHandler = new DownloadHandler(this); fileHandler = new FileHandler(this); moduleHandler = new ModuleHandler(this); executorService = Executors.newCachedThreadPool(); setContentView(R.layout.activity_main); BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation); navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override//from ww w . ja va 2 s .c o m public boolean onNavigationItemSelected(@NonNull MenuItem item) { ViewSwitcher viewGroup = (ViewSwitcher) findViewById(R.id.content); int id = item.getItemId(); if ((id == R.id.navigation_home || id == R.id.navigation_modules) && id != currentID) { currentID = item.getItemId(); viewGroup.showNext(); return true; } return false; } }); ViewSwitcher viewSwitcher = (ViewSwitcher) findViewById(R.id.content); Animation in = AnimationUtils.loadAnimation(this, android.R.anim.slide_in_left); Animation out = AnimationUtils.loadAnimation(this, android.R.anim.slide_out_right); viewSwitcher.setInAnimation(in); viewSwitcher.setOutAnimation(out); resetConfigReturned(); Button getNewModule = (Button) findViewById(R.id.new_module_config_confirm); getNewModule.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { EditText editText = (EditText) findViewById(R.id.new_module_config_configurl); final String url = editText.getText().toString(); Toast.makeText(MainActivity.this, "Requested config from: " + url, Toast.LENGTH_SHORT).show(); executorService.submit(new Callable<Boolean>() { @Override public Boolean call() { ModuleConfig config; try { config = moduleHandler.getModuleConfig(url); } catch (MalformedURLException e) { e.printStackTrace(); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, "Invalid URL. :(", Toast.LENGTH_LONG).show(); } }); return false; } catch (IOException e) { e.printStackTrace(); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, "Failed to get module config. :(", Toast.LENGTH_LONG).show(); } }); return false; } catch (JsonParseException e) { e.printStackTrace(); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, "Config loaded was invalid. :(", Toast.LENGTH_LONG).show(); } }); return false; } final ModuleConfig finalConfig = config; final ImageView configResponseBlock = (ImageView) findViewById(R.id.block_module_returned); final int colorFrom = ContextCompat.getColor(MainActivity.this, R.color.colorFillingTint); final int colorTo = ContextCompat.getColor(MainActivity.this, R.color.colorClear); final ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); colorAnimation.setDuration(ANIMATION_DURATION); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { configResponseBlock.setBackgroundColor((Integer) animator.getAnimatedValue()); } }); colorAnimation.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) { } @Override public void onAnimationEnd(Animator animator) { LinearLayout layout = (LinearLayout) findViewById(R.id.module_returned_config); EditText moduleName = (EditText) findViewById(R.id.module_returned_configname); EditText moduleVersion = (EditText) findViewById( R.id.module_returned_configversion); EditText moduleConfigUrl = (EditText) findViewById(R.id.module_returned_configurl); EditText moduleJarUrl = (EditText) findViewById(R.id.module_returned_jarurl); LinearLayout moduleDependencies = (LinearLayout) findViewById( R.id.module_returned_dependencies); moduleDependencies.removeAllViewsInLayout(); try { configResponseBlock.setVisibility(View.GONE); moduleName.setText(finalConfig.getName()); moduleVersion.setText(finalConfig.getVersion()); moduleConfigUrl.setText(finalConfig.getConfUrl()); moduleJarUrl.setText(finalConfig.getJarUrl()); Config[] dependencies = finalConfig.getDependencies(); for (Config dependency : dependencies) { LinearLayout dependencyLayout = new LinearLayout(MainActivity.this); dependencyLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); dependencyLayout.setOrientation(LinearLayout.HORIZONTAL); EditText name = new EditText(MainActivity.this); EditText jarUrl = new EditText(MainActivity.this); EditText[] loopThrough = { name, jarUrl }; LayoutParams params = new LayoutParams(0, LayoutParams.WRAP_CONTENT, 1.0f); for (EditText item : loopThrough) { item.setLayoutParams(params); item.setClickable(false); item.setInputType(InputType.TYPE_NULL); item.setCursorVisible(false); item.setFocusable(false); item.setFocusableInTouchMode(false); } name.setText(dependency.getName()); jarUrl.setText(dependency.getJarUrl()); dependencyLayout.addView(name); dependencyLayout.addView(jarUrl); moduleDependencies.addView(dependencyLayout); } layout.setClickable(true); Button validate = (Button) findViewById(R.id.module_returned_validate); Button cancel = (Button) findViewById(R.id.module_returned_cancel); validate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(MainActivity.this, "Requesting jars...", Toast.LENGTH_SHORT).show(); executorService.submit(new Callable<Boolean>() { @Override public Boolean call() { try { boolean success = true, refreshAllModification = true; Button refreshAll = null, getNewModule = (Button) findViewById( R.id.new_module_config_confirm); try { refreshAll = (Button) findViewById(R.id.refresh_all); refreshAll.setClickable(false); } catch (Throwable e) { refreshAllModification = false; } getNewModule.setClickable(false); final TextView stager = (TextView) findViewById( R.id.new_module_config_downloadstage); final ProgressBar progressBar = (ProgressBar) findViewById( R.id.new_module_config_downloadprogress); try { runOnUiThread(new Runnable() { @Override public void run() { resetConfigReturned(); } }); moduleHandler.getNewModule( makeModuleCallback(stager, progressBar), finalConfig, null, true); } catch (IOException e) { e.printStackTrace(); runOnUiThread(new Runnable() { @Override public void run() { stager.setText(""); progressBar.setProgress(0); } }); success = false; } getNewModule.setClickable(true); if (refreshAllModification) { refreshAll.setClickable(true); } return success; } catch (Throwable throwable) { throwable.printStackTrace(); return false; } } }); } }); cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(MainActivity.this, "Cancelling request...", Toast.LENGTH_SHORT).show(); resetConfigReturned(); } }); } catch (Exception e) { e.printStackTrace(); Toast.makeText(MainActivity.this, "Module config invalid. :(", Toast.LENGTH_LONG).show(); layout.setClickable(false); final int colorFrom = ContextCompat.getColor(MainActivity.this, R.color.colorClear); final int colorTo = ContextCompat.getColor(MainActivity.this, R.color.colorFillingTint); ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); colorAnimation.setDuration(ANIMATION_DURATION); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { configResponseBlock .setBackgroundColor((Integer) animator.getAnimatedValue()); } }); } } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }); runOnUiThread(new Runnable() { @Override public void run() { colorAnimation.start(); } }); return true; } }); } }); moduleHandler.setup(); refreshFilling(); return true; }
From source file:de.tum.frm2.nicos_android.gui.MainActivity.java
@Override protected void onResume() { super.onResume(); _visible = true;/*from w w w . ja va2 s. com*/ // Initialize design for buttons. SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean useJK = prefs.getBoolean(getResources().getString(R.string.key_jk_design_switch), false); ViewSwitcher switcher = (ViewSwitcher) findViewById(R.id.viewSwitch); if (useJK) { if (switcher.getCurrentView() == findViewById(R.id.layoutSmallButtons)) { switcher.showNext(); setPanelHeight(false); } } else { if (switcher.getCurrentView() == findViewById(R.id.layoutBigButtons)) { switcher.showNext(); setPanelHeight(true); } } }
From source file:com.pressurelabs.flowopensource.TheHubActivity.java
/** * Hides the Options Menu and uses a ViewSwitcher to quick turn the exisiting TextView with the * Flow's name into an EditText for the user to rename. * * @param cardPosition position of cardview in adapter * @param cardViewClicked the cardview view object clicked *//*w ww . ja v a 2s . c o m*/ private void renameFlow(final int cardPosition, final View cardViewClicked) { menuState = AppConstants.MENU_ITEMS_HIDE; invalidateOptionsMenu(); final ViewSwitcher switcher = (ViewSwitcher) cardViewClicked.findViewById(R.id.hub_rename_switcher); final EditText rename = (EditText) switcher.findViewById(R.id.hub_item_flow_rename); AppUtils.setNameInputFilters(rename); rename.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (rename.hasFocus()) { showEditPopupWindow(rename, cardViewClicked, switcher, cardPosition); } } }); switcher.showNext(); rename.requestFocus(); /* Forces keyboard */ }
From source file:org.thoughtcrime.securesms.conversation.ConversationFragment.java
private void initializeLoadMoreView(ViewSwitcher loadMoreView) { loadMoreView.setOnClickListener(v -> { Bundle args = new Bundle(); args.putInt(KEY_LIMIT, 0);/*from ww w. j a v a2 s .c om*/ getLoaderManager().restartLoader(0, args, ConversationFragment.this); loadMoreView.showNext(); loadMoreView.setOnClickListener(null); }); }
From source file:mn.today.TheHubActivity.java
/** * Hides the Options Menu and uses a ViewSwitcher to quick turn the exisiting TextView with the * Flow's name into an EditText for the user to rename. * * @param cardPosition position of cardview in adapter * @param cardViewClicked the cardview view object clicked *//* w w w.j a v a 2 s. c o m*/ private void renameFlow(final int cardPosition, final View cardViewClicked) { menuState = AppConstants.MENU_ITEMS_HIDE; invalidateOptionsMenu(); final ViewSwitcher switcher = (ViewSwitcher) cardViewClicked.findViewById(R.id.hub_rename_switcher); final EditText rename = (EditText) switcher.findViewById(R.id.hub_item_flow_rename); AppUtils.setNameInputFilters(rename); rename.setOnFocusChangeListener(new View.OnFocusChangeListener() { @RequiresApi(api = Build.VERSION_CODES.KITKAT) @Override public void onFocusChange(View v, boolean hasFocus) { if (rename.hasFocus()) { showEditPopupWindow(rename, cardViewClicked, switcher, cardPosition); } } }); switcher.showNext(); rename.requestFocus(); /* Forces keyboard */ }