List of usage examples for android.view View setContentDescription
@RemotableViewMethod public void setContentDescription(CharSequence contentDescription)
From source file:com.facebook.litho.MountState.java
private static void unsetContentDescription(View view) { view.setContentDescription(null); }
From source file:com.facebook.litho.MountState.java
private static void setContentDescription(View view, CharSequence contentDescription) { if (TextUtils.isEmpty(contentDescription)) { return;//from www.ja va 2 s.c o m } view.setContentDescription(contentDescription); }
From source file:jp.co.crowdworks.unwantedly.view.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final View.OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null; if (mTabViewLayoutId != 0) { // If there is a custom tab view layout id set, try and inflate it tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false); }//w ww . j av a 2 s.co m if (tabView == null) { tabView = createDefaultTabView(getContext()); } if (mDistributeEvenly) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); lp.width = 0; lp.weight = 1; } populateTabItemView(adapter, tabView, i); tabView.setOnClickListener(tabClickListener); String desc = mContentDescriptions.get(i, null); if (desc != null) { tabView.setContentDescription(desc); } mTabStrip.addView(tabView); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } } }
From source file:com.cerema.cloud2.ui.activity.FileActivity.java
/** * Updates title bar and home buttons (state and icon). * * Assumes that navigation drawer is NOT visible. */// www . j ava 2s . com protected void updateActionBarTitleAndHomeButton(OCFile chosenFile) { String title = getString(R.string.default_display_name_for_root_folder); // default boolean inRoot; /// choose the appropiate title if (chosenFile == null) { chosenFile = mFile; // if no file is passed, current file decides } inRoot = (chosenFile == null || (chosenFile.isFolder() && chosenFile.getParentId() == FileDataStorageManager.ROOT_PARENT_ID)); if (!inRoot) { title = chosenFile.getFileName(); } /// set the chosen title ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(title); /// also as content description View actionBarTitleView = getWindow().getDecorView() .findViewById(getResources().getIdentifier("action_bar_title", "id", "android")); if (actionBarTitleView != null) { // it's null in Android 2.x actionBarTitleView.setContentDescription(title); } /// set home button properties mDrawerToggle.setDrawerIndicatorEnabled(inRoot); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); }
From source file:com.example.graemecastle.testapplication.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null; TextView tabTitleView = null;//from ww w. ja v a 2 s . c om tabView = createModifiedTabView(i, adapter.getCount()); tabTitleView = createModifiedTabTextView(i, adapter.getCount()); if (tabView == null) { tabView = createDefaultTabView(getContext()); } if (tabTitleView == null && TextView.class.isInstance(tabView)) { tabTitleView = (TextView) tabView; } if (mDistributeEvenly) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); lp.width = 0; lp.weight = 1; } tabTitleView.setText(adapter.getPageTitle(i)); tabView.setOnClickListener(tabClickListener); String desc = mContentDescriptions.get(i, null); if (desc != null) { tabView.setContentDescription(desc); } mTabStrip.addView(tabView); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } } }
From source file:com.bruno.distribuciones.android.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final View.OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null; TextView tabTitleView = null;/* www.j av a 2 s .c o m*/ if (mTabViewLayoutId != 0) { tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false); tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); } if (tabView == null) { tabView = createDefaultTabView(getContext()); } if (tabTitleView == null && TextView.class.isInstance(tabView)) { tabTitleView = (TextView) tabView; } if (mDistributeEvenly) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); lp.width = 0; lp.weight = 1; } tabTitleView.setText(adapter.getPageTitle(i)); tabView.setOnClickListener(tabClickListener); String desc = mContentDescriptions.get(i, null); if (desc != null) { tabView.setContentDescription(desc); } mTabStrip.addView(tabView); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } tabTitleView.setTextColor(getResources().getColorStateList(R.color.selector)); tabTitleView.setTextSize(14); } }
From source file:com.advaitaworld.widgets.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final View.OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null; TextView tabTitleView = null;/* w ww . ja v a 2 s . c o m*/ if (mTabViewLayoutId != 0) { // If there is a custom tab view layout id set, try and inflate it tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false); } if (tabView == null) { tabView = createDefaultTabView(getContext()); } tabTitleView = getTabTitleView(tabView); if (mDistributeEvenly) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); lp.width = 0; lp.weight = 1; } tabTitleView.setText(adapter.getPageTitle(i)); tabView.setOnClickListener(tabClickListener); String desc = mContentDescriptions.get(i, null); if (desc != null) { tabView.setContentDescription(desc); } mTabStrip.addView(tabView); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } if (mSelectedTabColor != 0 && mDefaultTabColor != 0) { tabTitleView.setTextColor(i == mViewPager.getCurrentItem() ? mSelectedTabColor : mDefaultTabColor); } } }
From source file:com.matescorp.parkinggo.view.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null; TextView tabTitleView = null;/* ww w.j a v a2s . c o m*/ if (mTabViewLayoutId != 0) { tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false); tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); } if (tabView == null) { tabView = createDefaultTabView(getContext()); } if (tabTitleView == null && TextView.class.isInstance(tabView)) { tabTitleView = (TextView) tabView; } if (mDistributeEvenly) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); lp.width = 0; lp.weight = 1; } tabTitleView.setText(adapter.getPageTitle(i)); tabTitleView.setTextColor(Color.WHITE); tabView.setOnClickListener(tabClickListener); String desc = mContentDescriptions.get(i, null); if (desc != null) { tabView.setContentDescription(desc); } mTabStrip.addView(tabView); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } } }
From source file:org.totschnig.myexpenses.fragment.StaleImagesList.java
@Override @SuppressLint("InlinedApi") public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.images_list, container, false); final GridView lv = (GridView) v.findViewById(R.id.grid); // Create an array to specify the fields we want to display in the list String[] from = new String[] { DatabaseConstants.KEY_PICTURE_URI }; // and an array of the fields we want to bind those fields to int[] to = new int[] { R.id.image }; // Now create a simple cursor adapter and set it to display mAdapter = new SimpleCursorAdapter(getActivity(), R.layout.image_view, null, from, to, 0) { @Override//from w w w. j a v a2 s . c o m public View getView(int position, View convertView, ViewGroup parent) { return super.getView(position, convertView, parent); } @Override public void setViewImage(ImageView v, String value) { if (v.getTag() != null && v.getTag().equals(value)) { //already dealing with value; nothing to do return; } Picasso.with(getActivity()).load(value).placeholder(R.drawable.empty_photo).fit().into(v); v.setTag(value); v.setContentDescription(value); } }; lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { mImagesCursor.moveToPosition(position); startActivity(Transaction.getViewIntent(Uri.parse( mImagesCursor.getString(mImagesCursor.getColumnIndex(DatabaseConstants.KEY_PICTURE_URI))))); } }); getLoaderManager().initLoader(0, null, this); lv.setAdapter(mAdapter); registerForContextualActionBar(lv); return v; }
From source file:com.almeida.matheus.androidslidingtabmaterialdesigner.Components.SlidingTabLayout.java
private void populateTabStrip() { final TabsAdapter adapter = (TabsAdapter) mViewPager.getAdapter(); final OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null; ImageView textTab = null; if (mTabViewLayoutId != 0) { // If there is a custom tab view layout id set, try and inflate it tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false); textTab = (ImageView) tabView.findViewById(mTabViewTextViewId); }//from ww w . ja v a2s .c o m if (tabView == null) { tabView = createDefaultTabView(getContext()); } if (textTab == null && ImageView.class.isInstance(tabView)) { textTab = (ImageView) tabView; } if (mDistributeEvenly) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); lp.width = 0; lp.weight = 1; } tabView.setOnClickListener(tabClickListener); String desc = mContentDescriptions.get(i, null); if (desc != null) { tabView.setContentDescription(desc); } mTabStrip.addView(tabView); textTab.setImageResource(adapter.getPageIconResId(i)); textTab.setImageTintList(getResources().getColorStateList(R.color.item_selector)); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } } }