List of usage examples for android.content.res Resources getDimensionPixelSize
public int getDimensionPixelSize(@DimenRes int id) throws NotFoundException
From source file:com.chauffeurprive.kronos.date.MonthView.java
public MonthView(Context context, AttributeSet attr, DatePickerController controller) { super(context, attr); mController = controller;//from ww w.ja va 2 s .c om Resources res = context.getResources(); mDayLabelCalendar = Calendar.getInstance(); mCalendar = Calendar.getInstance(); mDayOfWeekTypeface = res.getString(R.string.mdtp_day_of_week_label_typeface); mMonthTitleTypeface = res.getString(R.string.mdtp_sans_serif); mDayTextColor = ContextCompat.getColor(context, mController.getTextColor()); mMonthDayTextColor = ContextCompat.getColor(context, mController.getTextColor()); mDisabledDayTextColor = ContextCompat.getColor(context, mController.getDisabledTextColor()); mHighlightedDayTextColor = ContextCompat.getColor(context, mController.getTextColor()); mSelectedDayTextColor = ContextCompat.getColor(context, mController.getSelectedTextColor()); mTodayNumberColor = ContextCompat.getColor(context, mController.getTodayTextColor()); mMonthTitleColor = ContextCompat.getColor(context, mController.getTextColor()); mStringBuilder = new StringBuilder(50); mFormatter = new Formatter(mStringBuilder, Locale.getDefault()); MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_day_number_size); MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_month_label_size); MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_month_day_label_text_size); MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.mdtp_month_list_item_header_height); DAY_SELECTED_CIRCLE_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_day_number_select_circle_radius); mRowHeight = (res.getDimensionPixelOffset(R.dimen.mdtp_date_picker_view_animator_height) - getMonthHeaderSize()) / MAX_NUM_ROWS; // Set up accessibility components. mTouchHelper = getMonthViewTouchHelper(); ViewCompat.setAccessibilityDelegate(this, mTouchHelper); ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); mLockAccessibilityDelegate = true; // Sets up any standard paints that will be used initView(); }
From source file:com.android.launcher2.AsyncTaskCallback.java
public AppsCustomizePagedView(Context context, AttributeSet attrs) { super(context, attrs); mLayoutInflater = LayoutInflater.from(context); mPackageManager = context.getPackageManager(); mApps = new ArrayList<ApplicationInfo>(); mWidgets = new ArrayList<Object>(); mIconCache = ((LauncherApplication) context.getApplicationContext()).getIconCache(); mCanvas = new Canvas(); mRunningTasks = new ArrayList<AppsCustomizeAsyncTask>(); // Save the default widget preview background Resources resources = context.getResources(); mAppIconSize = resources.getDimensionPixelSize(R.dimen.app_icon_size); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AppsCustomizePagedView, 0, 0); mMaxAppCellCountX = a.getInt(R.styleable.AppsCustomizePagedView_maxAppCellCountX, -1); mMaxAppCellCountY = a.getInt(R.styleable.AppsCustomizePagedView_maxAppCellCountY, -1); mWidgetWidthGap = a.getDimensionPixelSize(R.styleable.AppsCustomizePagedView_widgetCellWidthGap, 0); mWidgetHeightGap = a.getDimensionPixelSize(R.styleable.AppsCustomizePagedView_widgetCellHeightGap, 0); mWidgetCountX = a.getInt(R.styleable.AppsCustomizePagedView_widgetCountX, 2); mWidgetCountY = a.getInt(R.styleable.AppsCustomizePagedView_widgetCountY, 2); mClingFocusedX = a.getInt(R.styleable.AppsCustomizePagedView_clingFocusedX, 0); mClingFocusedY = a.getInt(R.styleable.AppsCustomizePagedView_clingFocusedY, 0); a.recycle();/*from w w w . j ava2 s.com*/ mWidgetSpacingLayout = new PagedViewCellLayout(getContext()); // The padding on the non-matched dimension for the default widget preview icons // (top + bottom) mFadeInAdjacentScreens = false; // Unless otherwise specified this view is important for accessibility. if (ViewCompat.getImportantForAccessibility(this) == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { ViewCompat.setImportantForAccessibility(this, View.IMPORTANT_FOR_ACCESSIBILITY_YES); } }
From source file:io.github.vomitcuddle.SearchViewAllowEmpty.SearchView.java
private void adjustDropDownSizeAndPosition() { if (mDropDownAnchor.getWidth() > 1) { Resources res = getContext().getResources(); int anchorPadding = mSearchPlate.getPaddingLeft(); Rect dropDownPadding = new Rect(); int iconOffset = mIconifiedByDefault ? res.getDimensionPixelSize(R.dimen.abc_dropdownitem_icon_width) + res.getDimensionPixelSize(R.dimen.abc_dropdownitem_text_padding_left) : 0;//from www. j a va 2s . com mQueryTextView.getDropDownBackground().getPadding(dropDownPadding); int offset = anchorPadding - (dropDownPadding.left + iconOffset); mQueryTextView.setDropDownHorizontalOffset(offset); final int width = mDropDownAnchor.getWidth() + dropDownPadding.left + dropDownPadding.right + iconOffset - anchorPadding; mQueryTextView.setDropDownWidth(width); } }
From source file:cm.aptoide.com.actionbarsherlock.widget.SearchView.java
private void adjustDropDownSizeAndPosition() { if (mDropDownAnchor.getWidth() > 1) { Resources res = getContext().getResources(); int anchorPadding = mSearchPlate.getPaddingLeft(); Rect dropDownPadding = new Rect(); int iconOffset = mIconifiedByDefault ? res.getDimensionPixelSize(R.dimen.abs__dropdownitem_icon_width) + res.getDimensionPixelSize(R.dimen.abs__dropdownitem_text_padding_left) : 0;//from ww w .ja va2s. co m mQueryTextView.getDropDownBackground().getPadding(dropDownPadding); mQueryTextView.setDropDownHorizontalOffset(-(dropDownPadding.left + iconOffset) + anchorPadding); mQueryTextView.setDropDownWidth(mDropDownAnchor.getWidth() + dropDownPadding.left + dropDownPadding.right + iconOffset - (anchorPadding)); } }
From source file:com.legendmohe.slidingdrawabletablayout.SlidingDrawableTabLayout.java
public SlidingDrawableTabLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); // Disable the Scroll Bar setHorizontalScrollBarEnabled(false); // Add the TabStrip mTabStrip = new SlidingTabStrip(context, attrs, defStyleAttr); super.addView(mTabStrip, 0, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TabLayout, defStyleAttr, R.style.Widget_Design_TabLayout); mTabStrip.setSelectedIndicatorHeight(a.getDimensionPixelSize(R.styleable.TabLayout_tabIndicatorHeight, 0)); mTabStrip.setSelectedIndicatorColor(a.getColor(R.styleable.TabLayout_tabIndicatorColor, 0)); mTabPaddingStart = mTabPaddingTop = mTabPaddingEnd = mTabPaddingBottom = a .getDimensionPixelSize(R.styleable.TabLayout_tabPadding, 0); mTabPaddingStart = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingStart, mTabPaddingStart); mTabPaddingTop = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingTop, mTabPaddingTop); mTabPaddingEnd = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingEnd, mTabPaddingEnd); mTabPaddingBottom = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingBottom, mTabPaddingBottom); mTabTextAppearance = a.getResourceId(R.styleable.TabLayout_tabTextAppearance, R.style.TextAppearance_Design_Tab); // Text colors/sizes come from the text appearance first final TypedArray ta = context.obtainStyledAttributes(mTabTextAppearance, R.styleable.TextAppearance); try {//from ww w. j a v a 2 s . co m mTabTextSize = ta.getDimensionPixelSize(R.styleable.TextAppearance_android_textSize, 0); mTabTextColors = ta.getColorStateList(R.styleable.TextAppearance_android_textColor); } finally { ta.recycle(); } if (a.hasValue(R.styleable.TabLayout_tabTextColor)) { // If we have an explicit text color set, use it instead mTabTextColors = a.getColorStateList(R.styleable.TabLayout_tabTextColor); } if (a.hasValue(R.styleable.TabLayout_tabSelectedTextColor)) { // We have an explicit selected text color set, so we need to make merge it with the // current colors. This is exposed so that developers can use theme attributes to set // this (theme attrs in ColorStateLists are Lollipop+) final int selected = a.getColor(R.styleable.TabLayout_tabSelectedTextColor, 0); mTabTextColors = createColorStateList(mTabTextColors.getDefaultColor(), selected); } mRequestedTabMinWidth = a.getDimensionPixelSize(R.styleable.TabLayout_tabMinWidth, INVALID_WIDTH); mRequestedTabMaxWidth = a.getDimensionPixelSize(R.styleable.TabLayout_tabMaxWidth, INVALID_WIDTH); mTabBackgroundResId = a.getResourceId(R.styleable.TabLayout_tabBackground, 0); mContentInsetStart = a.getDimensionPixelSize(R.styleable.TabLayout_tabContentStart, 0); mMode = a.getInt(R.styleable.TabLayout_tabMode, MODE_FIXED); mTabGravity = a.getInt(R.styleable.TabLayout_tabGravity, GRAVITY_FILL); a.recycle(); // TODO add attr for these final Resources res = getResources(); mTabTextMultiLineSize = res.getDimensionPixelSize(R.dimen.design_tab_text_size_2line); mScrollableTabMinWidth = res.getDimensionPixelSize(R.dimen.design_tab_scrollable_min_width); // Now apply the tab mode and gravity applyModeAndGravity(); }
From source file:android.support.v7.widget.SearchView.java
private void adjustDropDownSizeAndPosition() { if (mDropDownAnchor.getWidth() > 1) { Resources res = getContext().getResources(); int anchorPadding = mSearchPlate.getPaddingLeft(); Rect dropDownPadding = new Rect(); final boolean isLayoutRtl = ViewUtils.isLayoutRtl(this); int iconOffset = mIconifiedByDefault ? res.getDimensionPixelSize(R.dimen.abc_dropdownitem_icon_width) + res.getDimensionPixelSize(R.dimen.abc_dropdownitem_text_padding_left) : 0;//from w ww .j ava2 s .c o m mSearchSrcTextView.getDropDownBackground().getPadding(dropDownPadding); int offset; if (isLayoutRtl) { offset = -dropDownPadding.left; } else { offset = anchorPadding - (dropDownPadding.left + iconOffset); } mSearchSrcTextView.setDropDownHorizontalOffset(offset); final int width = mDropDownAnchor.getWidth() + dropDownPadding.left + dropDownPadding.right + iconOffset - anchorPadding; mSearchSrcTextView.setDropDownWidth(width); } }
From source file:com.android.dialer.DialtactsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.e(TAG, " --- onCreate(Bundle savedInstanceState) --- start "); Trace.beginSection(TAG + " onCreate"); View retView = null;//from w w w . ja v a 2s. co m super.onCreateView(inflater, container, savedInstanceState); //?? iControlDeleteBtn = (IControlDeleteBtn) getActivity(); //mFirstLaunch = true; final Resources resources = getResources(); int temp = resources.getDimensionPixelSize(R.dimen.floating_action_button_width); //?actionbar mActionBarHeight = resources.getDimensionPixelSize(R.dimen.action_bar_height_large); Trace.beginSection(TAG + " setContentView"); //setContentView(R.layout.dialtacts_activity); retView = inflater.inflate(R.layout.dialtacts_activity, container, false); Trace.endSection(); Trace.beginSection(TAG + " setup Views"); final ActionBar actionBar = getActivity().getActionBar(); //actionbar? //actionBar.setCustomView(R.layout.dialtacts_actionbar); //actionBar.setDisplayShowCustomEnabled(true); TextView actionbarNameTxt = (TextView) actionBar.getCustomView().findViewById(R.id.actionbar_name); actionbarNameTxt.setOnClickListener(this); ImageView actionbarMenu = (ImageView) actionBar.getCustomView().findViewById(R.id.actionbar_menu); actionbarMenu.setOnClickListener(this); TextView editerToCalldetail = (TextView) actionBar.getCustomView() .findViewById(R.id.actionbar_call_dialtacts_action_editer); editerToCalldetail.setOnClickListener(this); TextView cancelTxt = (TextView) actionBar.getCustomView() .findViewById(R.id.actionbar_call_dialtacts_action_cancel); cancelTxt.setOnClickListener(this); actionbarNameTxt.setText(getString(R.string.all_calls)); mSearchView = (EditText) actionBar.getCustomView().findViewById(R.id.edittext); mSearchView.setVisibility(View.GONE); mDialtactsActionBarController = new DialtactsActionBarController(actionbarMenu, editerToCalldetail, cancelTxt, actionbarNameTxt, this); // actionBar.setBackgroundDrawable(null); SearchEditTextLayout searchEditTextLayout = (SearchEditTextLayout) actionBar.getCustomView() .findViewById(R.id.search_view_container); // searchEditTextLayout.setPreImeKeyListener(mSearchEditTextLayoutListener); // mActionBarController = new DialtactsActionBarController(this, searchEditTextLayout); // mSearchView = (EditText) searchEditTextLayout.findViewById(R.id.search_view); mSearchView.addTextChangedListener(mPhoneSearchQueryTextListener); // mVoiceSearchButton = searchEditTextLayout.findViewById(R.id.voice_search_button); // mSearchView.setOnClickListener(mSearchViewOnClickListener); // searchEditTextLayout.findViewById(R.id.search_box_start_search) // .setOnClickListener(mSearchViewOnClickListener); // searchEditTextLayout.setOnClickListener(mSearchViewOnClickListener); // searchEditTextLayout.setCallback(new SearchEditTextLayout.Callback() { // @Override // public void onBackButtonClicked() { // onBackPressed(); // } // // @Override // public void onSearchViewClicked() { // // Hide FAB, as the keyboard is shown. //// mFloatingActionButtonController.scaleOut(); // } // }); mIsLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; // ImageButton optionsMenuButton = // (ImageButton) searchEditTextLayout.findViewById(R.id.dialtacts_options_menu_button); // optionsMenuButton.setOnClickListener(this); // mOverflowMenu = buildOptionsMenu(searchEditTextLayout); // optionsMenuButton.setOnTouchListener(mOverflowMenu.getDragToOpenListener()); // Add the favorites fragment but only if savedInstanceState is null. Otherwise the // fragment manager is responsible for recreating it. //??? if (savedInstanceState == null) { getChildFragmentManager().beginTransaction() .add(R.id.dialtacts_container, new DialpadFragment(getActivity()), TAG_DIALPAD_FRAGMENT) // .add(R.id.dialtacts_frame, new ListsFragment(), TAG_FAVORITES_FRAGMENT) .commit(); } else { mSearchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY); mInRegularSearch = savedInstanceState.getBoolean(KEY_IN_REGULAR_SEARCH_UI); mInDialpadSearch = savedInstanceState.getBoolean(KEY_IN_DIALPAD_SEARCH_UI); mFirstLaunch = savedInstanceState.getBoolean(KEY_FIRST_LAUNCH); mShowDialpadOnResume = savedInstanceState.getBoolean(KEY_IS_DIALPAD_SHOWN); // mActionBarController.restoreInstanceState(savedInstanceState); } final boolean isLayoutRtl = DialerUtils.isRtl(); //?????? if (mIsLandscape) { //?? mSlideIn = AnimationUtils.loadAnimation(getActivity(), isLayoutRtl ? R.anim.dialpad_slide_in_left : R.anim.dialpad_slide_in_right); mSlideOut = AnimationUtils.loadAnimation(getActivity(), isLayoutRtl ? R.anim.dialpad_slide_out_left : R.anim.dialpad_slide_out_right); } else { mSlideIn = AnimationUtils.loadAnimation(getActivity(), R.anim.dialpad_slide_in_bottom); mSlideOut = AnimationUtils.loadAnimation(getActivity(), R.anim.dialpad_slide_out_bottom); } // mSlideIn.setInterpolator(AnimUtils.EASE_IN); mSlideOut.setInterpolator(AnimUtils.EASE_OUT); mSlideIn.setAnimationListener(mSlideInListener); mSlideOut.setAnimationListener(mSlideOutListener); Trace.endSection(); Trace.beginSection(TAG + " initialize smart dialing"); mDialerDatabaseHelper = DatabaseHelperManager.getDatabaseHelper(getActivity()); SmartDialPrefix.initializeNanpSettings(getActivity()); Trace.endSection(); Trace.endSection(); initFlushHandler(); Log.e(TAG, " onCreate() dialerFragment " + mIsDialpadShown); return retView; }
From source file:android.support.designox.widget.TabLayout.java
public TabLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); ThemeUtils.checkAppCompatTheme(context); // Disable the Scroll Bar setHorizontalScrollBarEnabled(false); // Add the TabStrip mTabStrip = new SlidingTabStrip(context); super.addView(mTabStrip, 0, new HorizontalScrollView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TabLayout, defStyleAttr, R.style.Widget_Design_TabLayout); mTabStrip.setSelectedIndicatorHeight(a.getDimensionPixelSize(R.styleable.TabLayout_tabIndicatorHeight, 0)); mTabStrip.setSelectedIndicatorColor(a.getColor(R.styleable.TabLayout_tabIndicatorColor, 0)); mTabPaddingStart = mTabPaddingTop = mTabPaddingEnd = mTabPaddingBottom = a .getDimensionPixelSize(R.styleable.TabLayout_tabPadding, 0); mTabPaddingStart = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingStart, mTabPaddingStart); mTabPaddingTop = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingTop, mTabPaddingTop); mTabPaddingEnd = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingEnd, mTabPaddingEnd); mTabPaddingBottom = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingBottom, mTabPaddingBottom); mTabTextAppearance = a.getResourceId(R.styleable.TabLayout_tabTextAppearance, R.style.TextAppearance_Design_Tab); // Text colors/sizes come from the text appearance first final TypedArray ta = context.obtainStyledAttributes(mTabTextAppearance, R.styleable.TextAppearance); try {//from ww w .j av a 2s . c om mTabTextSize = ta.getDimensionPixelSize(R.styleable.TextAppearance_android_textSize, 0); mTabTextColors = ta.getColorStateList(R.styleable.TextAppearance_android_textColor); } finally { ta.recycle(); } if (a.hasValue(R.styleable.TabLayout_tabTextColor)) { // If we have an explicit text color set, use it instead mTabTextColors = a.getColorStateList(R.styleable.TabLayout_tabTextColor); } if (a.hasValue(R.styleable.TabLayout_tabSelectedTextColor)) { // We have an explicit selected text color set, so we need to make merge it with the // current colors. This is exposed so that developers can use theme attributes to set // this (theme attrs in ColorStateLists are Lollipop+) final int selected = a.getColor(R.styleable.TabLayout_tabSelectedTextColor, 0); mTabTextColors = createColorStateList(mTabTextColors.getDefaultColor(), selected); } mRequestedTabMinWidth = a.getDimensionPixelSize(R.styleable.TabLayout_tabMinWidth, INVALID_WIDTH); mRequestedTabMaxWidth = a.getDimensionPixelSize(R.styleable.TabLayout_tabMaxWidth, INVALID_WIDTH); mTabBackgroundResId = a.getResourceId(R.styleable.TabLayout_tabBackground, 0); mContentInsetStart = a.getDimensionPixelSize(R.styleable.TabLayout_tabContentStart, 0); mMode = a.getInt(R.styleable.TabLayout_tabMode, MODE_FIXED); mTabGravity = a.getInt(R.styleable.TabLayout_tabGravity, GRAVITY_FILL); a.recycle(); // TODO add attr for these final Resources res = getResources(); mTabTextMultiLineSize = res.getDimensionPixelSize(R.dimen.design_tab_text_size_2line); mScrollableTabMinWidth = res.getDimensionPixelSize(R.dimen.design_tab_scrollable_min_width); // Now apply the tab mode and gravity applyModeAndGravity(); }
From source file:com.beijing.ocean.multmediademo.view.mytab.TabLayout.java
public TabLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); // ThemeUtils.checkAppCompatTheme(context); // Disable the Scroll Bar setHorizontalScrollBarEnabled(false); // Add the TabStrip mTabStrip = new SlidingTabStrip(context); super.addView(mTabStrip, 0, new HorizontalScrollView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); TypedArray a = context.obtainStyledAttributes(attrs, android.support.design.R.styleable.TabLayout, defStyleAttr, android.support.design.R.style.Widget_Design_TabLayout); mTabStrip.setSelectedIndicatorHeight( a.getDimensionPixelSize(android.support.design.R.styleable.TabLayout_tabIndicatorHeight, 0)); mTabStrip.setSelectedIndicatorColor( a.getColor(android.support.design.R.styleable.TabLayout_tabIndicatorColor, 0)); mTabPaddingStart = mTabPaddingTop = mTabPaddingEnd = mTabPaddingBottom = a .getDimensionPixelSize(android.support.design.R.styleable.TabLayout_tabPadding, 0); mTabPaddingStart = a.getDimensionPixelSize(android.support.design.R.styleable.TabLayout_tabPaddingStart, mTabPaddingStart);/*ww w. ja v a 2s . c om*/ mTabPaddingTop = a.getDimensionPixelSize(android.support.design.R.styleable.TabLayout_tabPaddingTop, mTabPaddingTop); mTabPaddingEnd = a.getDimensionPixelSize(android.support.design.R.styleable.TabLayout_tabPaddingEnd, mTabPaddingEnd); mTabPaddingBottom = a.getDimensionPixelSize(android.support.design.R.styleable.TabLayout_tabPaddingBottom, mTabPaddingBottom); mTabTextAppearance = a.getResourceId(android.support.design.R.styleable.TabLayout_tabTextAppearance, android.support.design.R.style.TextAppearance_Design_Tab); // Text colors/sizes come from the text appearance first final TypedArray ta = context.obtainStyledAttributes(mTabTextAppearance, android.support.design.R.styleable.TextAppearance); try { mTabTextSize = ta .getDimensionPixelSize(android.support.design.R.styleable.TextAppearance_android_textSize, 0); mTabTextColors = ta .getColorStateList(android.support.design.R.styleable.TextAppearance_android_textColor); } finally { ta.recycle(); } if (a.hasValue(android.support.design.R.styleable.TabLayout_tabTextColor)) { // If we have an explicit text color set, use it instead mTabTextColors = a.getColorStateList(android.support.design.R.styleable.TabLayout_tabTextColor); } if (a.hasValue(android.support.design.R.styleable.TabLayout_tabSelectedTextColor)) { // We have an explicit selected text color set, so we need to make merge it with the // current colors. This is exposed so that developers can use theme attributes to set // this (theme attrs in ColorStateLists are Lollipop+) final int selected = a.getColor(android.support.design.R.styleable.TabLayout_tabSelectedTextColor, 0); mTabTextColors = createColorStateList(mTabTextColors.getDefaultColor(), selected); } mRequestedTabMinWidth = a.getDimensionPixelSize(android.support.design.R.styleable.TabLayout_tabMinWidth, INVALID_WIDTH); mRequestedTabMaxWidth = a.getDimensionPixelSize(android.support.design.R.styleable.TabLayout_tabMaxWidth, INVALID_WIDTH); mTabBackgroundResId = a.getResourceId(android.support.design.R.styleable.TabLayout_tabBackground, 0); mContentInsetStart = a.getDimensionPixelSize(android.support.design.R.styleable.TabLayout_tabContentStart, 0); mMode = a.getInt(android.support.design.R.styleable.TabLayout_tabMode, MODE_FIXED); mTabGravity = a.getInt(android.support.design.R.styleable.TabLayout_tabGravity, GRAVITY_FILL); a.recycle(); // TODO add attr for these final Resources res = getResources(); mTabTextMultiLineSize = res .getDimensionPixelSize(android.support.design.R.dimen.design_tab_text_size_2line); mScrollableTabMinWidth = res .getDimensionPixelSize(android.support.design.R.dimen.design_tab_scrollable_min_width); // Now apply the tab mode and gravity applyModeAndGravity(); }
From source file:com.tct.mail.browse.MessageHeaderView.java
public MessageHeaderView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); context = context;/* ww w . j a v a 2 s.com*/ mIsSnappy = false; mEmailCopyMenu = new EmailCopyContextMenu(getContext()); mInflater = LayoutInflater.from(context); mMyName = context.getString(R.string.me_object_pronoun); final Resources res = getResources(); mContactPhotoWidth = res.getDimensionPixelSize(R.dimen.contact_image_width); mContactPhotoHeight = res.getDimensionPixelSize(R.dimen.contact_image_height); mTitleContainerMarginEnd = res.getDimensionPixelSize(R.dimen.conversation_view_margin_side); mLinkColorBlue = res.getColor(R.color.conversation_view_text_color_link_blue); // AM: Kexue.Geng 2015-03-04 EMAIL BUGFIX_938279 }