List of usage examples for android.widget ViewSwitcher findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
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 */// ww w . j a va 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() { @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: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 .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() { @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 */ }