List of usage examples for android.util TypedValue TypedValue
TypedValue
From source file:com.grepsound.fragments.MyProfileFragment.java
public int getActionBarHeight() { if (mActionBarHeight != 0) { return mActionBarHeight; }// w w w . j a v a 2 s.c o m TypedValue mTypedValue = new TypedValue(); getActivity().getTheme().resolveAttribute(android.R.attr.actionBarSize, mTypedValue, true); mActionBarHeight = TypedValue.complexToDimensionPixelSize(mTypedValue.data, getResources().getDisplayMetrics()); return mActionBarHeight; }
From source file:android.support.v7.internal.widget.TintManager.java
public TintManager(Context context) { mColorStateLists = new SparseArray<>(); mContext = context;//from www . ja v a2 s. c o m mTypedValue = new TypedValue(); mResources = new TintResources(context.getResources(), this); }
From source file:android.support.v7ox.widget.ContentFrameLayout.java
public TypedValue getMinWidthMajor() { if (mMinWidthMajor == null) mMinWidthMajor = new TypedValue(); return mMinWidthMajor; }
From source file:com.aashir.gmote.player.widget.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}.// www . j a va2 s.c o m */ protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.getSize(size); textView.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); textView.setAllCaps(true); int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:com.genglun.teach_en.tab.SlidingTabLayout.java
@SuppressLint({ "NewApi", "InlinedApi" }) protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); }/*from ww w.j a v a2 s . c o m*/ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style textView.setAllCaps(true); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:com.aniruddhc.acemusic.player.MusicLibraryEditorActivity.MusicLibraryEditorActivity.java
@SuppressWarnings("unchecked") @Override/*from w ww . ja v a 2 s . c o m*/ public void onCreate(Bundle savedInstanceState) { //Initialize Context and SharedPreferences. mContext = this; mApp = (Common) mContext.getApplicationContext(); //Retrieve the name/icon of the library from the arguments. libraryName = getIntent().getExtras().getString("LIBRARY_NAME"); libraryIconName = getIntent().getExtras().getString("LIBRARY_ICON"); if (getIntent().getExtras().getSerializable("SONG_IDS_HASH_SET") != null) { songDBIdsList = (HashSet<String>) getIntent().getExtras().getSerializable("SONG_IDS_HASH_SET"); } //Set the UI theme. if (mApp.getCurrentTheme() == Common.DARK_THEME) { setTheme(R.style.AppTheme); } else { setTheme(R.style.AppThemeLight); } super.onCreate(savedInstanceState); //Initialize the database helper. dbHelper = new DBAccessHelper(mContext.getApplicationContext()); //Create a set of options to optimize the bitmap memory usage. final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; options.inJustDecodeBounds = false; options.inPurgeable = true; //Display Image Options. int defaultArt = UIElementsHelper.getIcon(mContext, "default_album_art_padded"); displayImageOptions = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.default_album_art) .showImageOnFail(R.drawable.default_album_art).showStubImage(R.drawable.transparent_drawable) .cacheInMemory(false).cacheOnDisc(true).decodingOptions(options) .imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565) .displayer(new FadeInBitmapDisplayer(400)).delayBeforeLoading(100).build(); //Attach tabs to the ActionBar. ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); //Add the artists tab. String artistsLabel = getResources().getString(R.string.artists); Tab tab = actionBar.newTab(); tab.setText(artistsLabel); TabListener<ArtistsPickerFragment> artistsTabListener = new TabListener<ArtistsPickerFragment>(this, artistsLabel, ArtistsPickerFragment.class); tab.setTabListener(artistsTabListener); actionBar.addTab(tab); //Add the albums tab. String albumsLabel = getResources().getString(R.string.albums); tab = actionBar.newTab(); tab.setText(albumsLabel); TabListener<AlbumsPickerFragment> albumsTabListener = new TabListener<AlbumsPickerFragment>(this, albumsLabel, AlbumsPickerFragment.class); tab.setTabListener(albumsTabListener); actionBar.addTab(tab); //Add the songs tab. String songsLabel = getResources().getString(R.string.songs); tab = actionBar.newTab(); tab.setText(songsLabel); TabListener<SongsPickerFragment> songsTabListener = new TabListener<SongsPickerFragment>(this, songsLabel, SongsPickerFragment.class); tab.setTabListener(songsTabListener); actionBar.addTab(tab); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { getWindow().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext)); int topPadding = Common.getStatusBarHeight(mContext); View activityView = (View) findViewById(android.R.id.content); //Calculate ActionBar height TypedValue tv = new TypedValue(); int actionBarHeight = 0; if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) { actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics()); } if (activityView != null) { activityView.setPadding(0, topPadding + actionBarHeight, 0, 0); } } }
From source file:android.support.v7ox.widget.ContentFrameLayout.java
public TypedValue getMinWidthMinor() { if (mMinWidthMinor == null) mMinWidthMinor = new TypedValue(); return mMinWidthMinor; }
From source file:com.example.graemecastle.testapplication.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #createModifiedTabView(int, int)}. */// w ww . jav a2 s . co m protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)); TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); textView.setAllCaps(true); int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:com.cse3310.phms.ui.activities.BaseWizardPagerActivity.java
private void updateBottomBar() { int position = mPager.getCurrentItem(); if (position == mCurrentPageSequence.size()) { mNextButton.setText(R.string.finish); mNextButton.setBackgroundResource(R.drawable.finish_background); mNextButton.setTextAppearance(this, R.style.TextAppearanceFinish); } else {//from ww w .j ava2 s.co m mNextButton.setText(mEditingAfterReview ? R.string.review : R.string.next); mNextButton.setBackgroundResource(R.drawable.selectable_item_background); TypedValue v = new TypedValue(); getTheme().resolveAttribute(android.R.attr.textAppearanceMedium, v, true); mNextButton.setTextAppearance(this, v.resourceId); mNextButton.setEnabled(position != mPagerAdapter.getCutOffPage()); } mPrevButton.setVisibility(position <= 0 ? View.INVISIBLE : View.VISIBLE); }
From source file:android.support.v7ox.widget.ContentFrameLayout.java
public TypedValue getFixedWidthMajor() { if (mFixedWidthMajor == null) mFixedWidthMajor = new TypedValue(); return mFixedWidthMajor; }