List of usage examples for android.view View findViewWithTag
public final <T extends View> T findViewWithTag(Object tag)
From source file:org.adaway.ui.HostsSourcesFragment.java
/** * Handle Checkboxes clicks here, because to enable context menus on longClick we had to disable * focusable and clickable on checkboxes in layout xml. *///from w w w . j a v a 2 s. c o m @Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); mCurrentRowId = id; // Checkbox tags are defined by cursor position in HostsCursorAdapter, so we can get // checkboxes by position of cursor CheckBox cBox = (CheckBox) v.findViewWithTag("checkbox_" + position); if (cBox != null) { if (cBox.isChecked()) { cBox.setChecked(false); // change status based on row id from cursor ProviderHelper.updateHostsSourceEnabled(mActivity, mCurrentRowId, false); } else { cBox.setChecked(true); ProviderHelper.updateHostsSourceEnabled(mActivity, mCurrentRowId, true); } } else { Log.e(Constants.TAG, "Checkbox could not be found!"); } }
From source file:com.gome.haoyuangong.views.MyViewPageIndicator.java
@Override public void setCurrentItem(int item) { if (mViewPager == null) { throw new IllegalStateException("ViewPager has not been bound."); }/*from www.j av a 2 s . c o m*/ mSelectedTabIndex = item; mViewPager.setCurrentItem(item); final int tabCount = mTabLayout.getChildCount(); for (int i = 0; i < tabCount; i++) { final View child = mTabLayout.getChildAt(i); final boolean isSelected = (i == item); child.setSelected(isSelected); if (isSelected) { animateToTab(item); } FrameLayout f = (FrameLayout) child.findViewWithTag("framelayout"); if (i == item) { //f.setBackgroundResource(R.drawable.icon_tab_focus); } else { f.setBackgroundResource(0); } } }
From source file:org.adaway.ui.RedirectionListFragment.java
/** * Handle Checkboxes clicks here, because to enable context menus on longClick we had to disable * focusable and clickable on checkboxes in layout xml. *//*from w w w . java2s .c o m*/ @Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); mCurrentRowId = id; // Checkbox tags are defined by cursor position in HostsCursorAdapter, so we can get // checkboxes by position of cursor CheckBox cBox = (CheckBox) v.findViewWithTag("checkbox_" + position); if (cBox != null) { if (cBox.isChecked()) { cBox.setChecked(false); // change status based on row id from cursor ProviderHelper.updateRedirectionListItemEnabled(mActivity, mCurrentRowId, false); } else { cBox.setChecked(true); ProviderHelper.updateRedirectionListItemEnabled(mActivity, mCurrentRowId, true); } } else { Log.e(Constants.TAG, "Checkbox could not be found!"); } }
From source file:org.adawaycn.ui.RedirectionListFragment.java
/** * Handle Checkboxes clicks here, because to enable context menus on longClick we had to disable * focusable and clickable on checkboxes in layout xml. *//*from ww w. ja v a 2s . c o m*/ @Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); mCurrentRowId = id; // Checkbox tags are defined by cursor position in HostsCursorAdapter, so we can get // checkboxes by position of cursor CheckBox cBox = (CheckBox) v.findViewWithTag("checkbox_" + position); if (cBox != null) { if (cBox.isChecked()) { cBox.setChecked(false); // change status based on row id from cursor org.adawaycn.provider.ProviderHelper.updateRedirectionListItemEnabled(mActivity, mCurrentRowId, false); } else { cBox.setChecked(true); org.adawaycn.provider.ProviderHelper.updateRedirectionListItemEnabled(mActivity, mCurrentRowId, true); } } else { org.adawaycn.util.Log.e(org.adawaycn.util.Constants.TAG, "Checkbox could not be found!"); } }
From source file:rubenjg.tiroconarco.ui.fragment.EndFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_end, container, false); // Se busca el espacio para colocar los scores en el fragmento scores = new TextView[IDS.length]; for (int i = 0; i < scores.length; ++i) { scores[i] = (TextView) v.findViewById(IDS[i]); }//www .j a v a2 s .c o m // Se crea un OnClickListener para todos los botones del fragmento MyOnClickListener l = new MyOnClickListener(this, scores); for (String s : Score.POSSIBLE_SCORES) { Button b = (Button) v.findViewWithTag(s); b.setOnClickListener(l); } // Ttulo del fragmento getDialog().setTitle("Tirada " + (rowNumber + 1)); return v; }
From source file:de.schildbach.wallet.ui.WalletActivity.java
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); application = getWalletApplication(); config = application.getConfiguration(); wallet = application.getWallet();//from w w w .java 2s . c om setContentView(R.layout.wallet_content); final View exchangeRatesFragment = findViewById(R.id.wallet_main_twopanes_exchange_rates); if (exchangeRatesFragment != null) exchangeRatesFragment.setVisibility(Constants.ENABLE_EXCHANGE_RATES ? View.VISIBLE : View.GONE); if (savedInstanceState == null) { final View contentView = findViewById(android.R.id.content); final View slideInLeftView = contentView.findViewWithTag("slide_in_left"); if (slideInLeftView != null) slideInLeftView.startAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_left)); final View slideInRightView = contentView.findViewWithTag("slide_in_right"); if (slideInRightView != null) slideInRightView.startAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_right)); final View slideInTopView = contentView.findViewWithTag("slide_in_top"); if (slideInTopView != null) slideInTopView.startAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_top)); final View slideInBottomView = contentView.findViewWithTag("slide_in_bottom"); if (slideInBottomView != null) slideInBottomView.startAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_bottom)); checkAlerts(); } config.touchLastUsed(); handleIntent(getIntent()); MaybeMaintenanceFragment.add(getFragmentManager()); }
From source file:com.tavant.droid.womensecurity.fragments.ContactsListFragment.java
@Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { CheckBox checkbox = (CheckBox) v.findViewWithTag(position); if (checkbox.isChecked()) checkbox.setChecked(false);// www . j a v a 2 s .c o m else checkbox.setChecked(true); // Gets the Cursor object currently bound to the ListView final Cursor cursor = mAdapter.getCursor(); // Moves to the Cursor row corresponding to the ListView item that was // clicked cursor.moveToPosition(position); // Creates a contact lookup Uri from contact ID and lookup_key final Uri uri = Contacts.getLookupUri(cursor.getLong(ContactsQuery.ID), cursor.getString(ContactsQuery.LOOKUP_KEY)); // Notifies the parent activity that the user selected a contact. In a // two-pane layout, the // parent activity loads a ContactDetailFragment that displays the // details for the selected // contact. In a single-pane layout, the parent activity starts a new // activity that // displays contact details in its own Fragment. mOnContactSelectedListener.onContactSelected(uri); // If two-pane layout sets the selected item to checked so it remains // highlighted. In a // single-pane layout a new activity is started so this is not needed. }
From source file:com.posagent.fragments.RegisterFragment.java
@Override public void onClick(View v) { if (v.getId() == R.id.mi_select_city) { Intent intent = new Intent(getActivity(), CitySelectActivity.class); if (cityName != null) { intent.putExtra(com.example.zf_android.trade.Constants.CityIntent.CITY_NAME, cityName); }/* w w w . j a v a 2 s . co m*/ startActivityForResult(intent, Constants.CommonInputerConstant.REQUEST_CITY_CODE); return; } if (v.getId() == R.id.btn_submit) { this.doSubmit(); return; } if (v.getTag().equals("tag_man_photo")) { photoManager.prompt(); return; } String tag = getString(R.string.tag_destination_get); if (v.getTag().equals(tag)) { Intent intent = new Intent(getActivity(), CommonInputer.class); tag = getString(R.string.tag_destination_name); TextView tv = (TextView) v.findViewWithTag(tag); intent.putExtra(Constants.CommonInputerConstant.TITLE_KEY, tv.getText()); tag = getString(R.string.tag_destination); tvContent = tv = (TextView) v.findViewWithTag(tag); intent.putExtra(Constants.CommonInputerConstant.PLACEHOLDER_KEY, tv.getText()); startActivityForResult(intent, Constants.CommonInputerConstant.REQUEST_CODE); } }
From source file:su.comp.bk.ui.BkEmuActivity.java
protected void updateFloppyDriveView(final View fddView, final FloppyDriveIdentifier fddIdentifier) { FloppyController fddController = computer.getFloppyController(); boolean isFddMounted = fddController.isFloppyDriveMounted(fddIdentifier); ImageView fddImageView = (ImageView) fddView.findViewWithTag("fdd_image"); fddImageView.setImageResource(isFddMounted ? R.drawable.floppy_drive_loaded : R.drawable.floppy_drive); TextView fddFileTextView = (TextView) fddView.findViewWithTag("fdd_file"); if (isFddMounted) { fddFileTextView.setTextColor(getResources().getColor(R.color.fdd_loaded)); String fddImageFileName = Uri.parse(fddController.getFloppyDriveImageUri(fddIdentifier)) .getLastPathSegment();//from www . jav a 2 s. com if (fddImageFileName.length() > MAX_FILE_NAME_DISPLAY_LENGTH) { // Trim file name to display int nameDotIndex = fddImageFileName.lastIndexOf('.'); if (nameDotIndex < 0) { nameDotIndex = fddImageFileName.length(); } int nameSuffixIndex = nameDotIndex - FILE_NAME_DISPLAY_SUFFIX_LENGTH; int namePrefixIndex = MAX_FILE_NAME_DISPLAY_LENGTH - (fddImageFileName.length() - nameSuffixIndex); fddImageFileName = fddImageFileName.substring(0, namePrefixIndex).concat("...") .concat(fddImageFileName.substring(nameSuffixIndex)); } fddFileTextView.setText(fddImageFileName); } else { fddFileTextView.setTextColor(getResources().getColor(R.color.fdd_empty)); fddFileTextView.setText(R.string.fdd_empty); } }
From source file:com.huyn.demogroup.relativetop.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }//from w w w .ja v a 2 s.co m } } else if (v instanceof LinearLayout) { TextView tab = (TextView) v.findViewWithTag("TEXT"); tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }