List of usage examples for android.graphics Typeface NORMAL
int NORMAL
To view the source code for android.graphics Typeface NORMAL.
Click Source Link
From source file:mobisocial.bento.ebento.ui.RsvpFragment.java
private void setDeselected(Button b) { b.setTextColor(Color.BLACK); b.setTypeface(null, Typeface.NORMAL); }
From source file:com.landenlabs.all_devtool.TextFragment.java
private void fillLayout() { m_tableLayout.removeAllViews();// w ww .java 2 s .c o m m_textInfoList.clear(); int minSP = 8; int maxSP = 20; int stepSP = 2; int[] colors = new int[] { 0xffe0e0e0, 0xffffe0e0, 0xffe0ffe0, 0xffe0e0ff }; TableLayout.LayoutParams tableLP = new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT); TableRow.LayoutParams rowLP = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.MATCH_PARENT); TextView textView; TableRow tableRow; int textColor = 0xff000000; for (int tfIdx = 0; tfIdx < TextInfo.getCount(); tfIdx++) { Typeface typeface = TextInfo.getTypeface(tfIdx); String typefaceStr = TextInfo.getTypefaceStr(tfIdx); textView = new TextView(m_context); textView.setBackgroundColor(Utils.blend(colors[tfIdx], 0x20000000)); textView.setText(typefaceStr); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); m_tableLayout.addView(textView, tableLP); for (int sizeSP = minSP; sizeSP <= maxSP; sizeSP += stepSP) { tableRow = new TableRow(m_context); tableRow.setBackgroundColor(colors[tfIdx]); tableRow.setTag(Integer.valueOf(m_textInfoList.size())); m_textInfoList.add(new TextInfo(sizeSP, tfIdx)); tableRow.setClickable(true); tableRow.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int idx = (Integer) v.getTag(); showTextDialog(m_textInfoList, idx); } }); textView = new TextView(m_context); textView.setText(String.valueOf(sizeSP) + "sp "); textView.setBackgroundColor(0x20000000); textView.setPadding(8, 0, 8, 0); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); tableRow.addView(textView, rowLP); textView = new TextView(m_context); textView.setText("Normal"); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, sizeSP); textView.setTypeface(typeface, Typeface.NORMAL); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); tableRow.addView(textView, rowLP); textView = new TextView(m_context); textView.setText("Bold"); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, sizeSP); textView.setTypeface(typeface, Typeface.BOLD); textView.setPadding(8, 0, 8, 0); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); tableRow.addView(textView, rowLP); textView = new TextView(m_context); textView.setText("Italic"); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, sizeSP); textView.setTypeface(typeface, Typeface.ITALIC); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); tableRow.addView(textView, rowLP); m_tableLayout.addView(tableRow, tableLP); } } }
From source file:com.bobomee.android.gank.io.widget.CompactTabLayout.java
private void renderNormalText(TextView textView) { // textView.setTextSize(14); textView.setTypeface(null, Typeface.NORMAL); }
From source file:im.vector.adapters.RoomViewHolder.java
/** * Refresh the holder layout/* www.ja v a 2 s.com*/ * * @param room the room * @param isDirectChat true when the room is a direct chat one * @param isInvitation true when the room is an invitation one * @param moreRoomActionListener */ public void populateViews(final Context context, final MXSession session, final Room room, final boolean isDirectChat, final boolean isInvitation, final AbsAdapter.MoreRoomActionListener moreRoomActionListener) { // sanity check if (null == room) { Log.e(LOG_TAG, "## populateViews() : null room"); return; } if (null == session) { Log.e(LOG_TAG, "## populateViews() : null session"); return; } if (null == session.getDataHandler()) { Log.e(LOG_TAG, "## populateViews() : null dataHandler"); return; } IMXStore store = session.getDataHandler().getStore(room.getRoomId()); if (null == store) { Log.e(LOG_TAG, "## populateViews() : null Store"); return; } final RoomSummary roomSummary = store.getSummary(room.getRoomId()); if (null == roomSummary) { Log.e(LOG_TAG, "## populateViews() : null roomSummary"); return; } int unreadMsgCount = roomSummary.getUnreadEventsCount(); int highlightCount; int notificationCount; // Setup colors int mFuchsiaColor = ContextCompat.getColor(context, R.color.vector_fuchsia_color); int mGreenColor = ContextCompat.getColor(context, R.color.vector_green_color); int mSilverColor = ContextCompat.getColor(context, R.color.vector_silver_color); highlightCount = roomSummary.getHighlightCount(); notificationCount = roomSummary.getNotificationCount(); // fix a crash reported by GA if ((null != room.getDataHandler()) && room.getDataHandler().getBingRulesManager().isRoomMentionOnly(room.getRoomId())) { notificationCount = highlightCount; } int bingUnreadColor; if (isInvitation || (0 != highlightCount)) { bingUnreadColor = mFuchsiaColor; } else if (0 != notificationCount) { bingUnreadColor = mGreenColor; } else if (0 != unreadMsgCount) { bingUnreadColor = mSilverColor; } else { bingUnreadColor = Color.TRANSPARENT; } if (isInvitation || (notificationCount > 0)) { vRoomUnreadCount.setText(isInvitation ? "!" : RoomUtils.formatUnreadMessagesCounter(notificationCount)); vRoomUnreadCount.setTypeface(null, Typeface.BOLD); GradientDrawable shape = new GradientDrawable(); shape.setShape(GradientDrawable.RECTANGLE); shape.setCornerRadius(100); shape.setColor(bingUnreadColor); vRoomUnreadCount.setBackground(shape); vRoomUnreadCount.setVisibility(View.VISIBLE); } else { vRoomUnreadCount.setVisibility(View.GONE); } String roomName = VectorUtils.getRoomDisplayName(context, session, room); if (vRoomNameServer != null) { // This view holder is for the home page, we have up to two lines to display the name if (MXSession.isRoomAlias(roomName)) { // Room alias, split to display the server name on second line final String[] roomAliasSplitted = roomName.split(":"); final String firstLine = roomAliasSplitted[0] + ":"; final String secondLine = roomAliasSplitted[1]; vRoomName.setLines(1); vRoomName.setText(firstLine); vRoomNameServer.setText(secondLine); vRoomNameServer.setVisibility(View.VISIBLE); vRoomNameServer.setTypeface(null, (0 != unreadMsgCount) ? Typeface.BOLD : Typeface.NORMAL); } else { // Allow the name to take two lines vRoomName.setLines(2); vRoomNameServer.setVisibility(View.GONE); vRoomName.setText(roomName); } } else { vRoomName.setText(roomName); } vRoomName.setTypeface(null, (0 != unreadMsgCount) ? Typeface.BOLD : Typeface.NORMAL); VectorUtils.loadRoomAvatar(context, session, vRoomAvatar, room); // get last message to be displayed if (vRoomLastMessage != null) { CharSequence lastMsgToDisplay = RoomUtils.getRoomMessageToDisplay(context, session, roomSummary); vRoomLastMessage.setText(lastMsgToDisplay); } if (mDirectChatIndicator != null) { mDirectChatIndicator.setVisibility(isDirectChat ? View.VISIBLE : View.INVISIBLE); } vRoomEncryptedIcon.setVisibility(room.isEncrypted() ? View.VISIBLE : View.INVISIBLE); if (vRoomUnreadIndicator != null) { // set bing view background colour vRoomUnreadIndicator.setBackgroundColor(bingUnreadColor); vRoomUnreadIndicator.setVisibility(roomSummary.isInvited() ? View.INVISIBLE : View.VISIBLE); } if (vRoomTimestamp != null) { vRoomTimestamp.setText(RoomUtils.getRoomTimestamp(context, roomSummary.getLatestReceivedEvent())); } if (vRoomMoreActionClickArea != null && vRoomMoreActionAnchor != null) { vRoomMoreActionClickArea.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (null != moreRoomActionListener) { moreRoomActionListener.onMoreActionClick(vRoomMoreActionAnchor, room); } } }); } }
From source file:com.xiaosu.lib.base.widget.PagerSlidingTabStrip.java
public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);//from w w w . ja v a 2 s . c o m setWillNotDraw(false); mTabsContainer = new LinearLayout(context); mTabsContainer.setOrientation(LinearLayout.HORIZONTAL); addView(mTabsContainer); mRectPaint = new Paint(); mRectPaint.setAntiAlias(true); mRectPaint.setStyle(Style.FILL); DisplayMetrics dm = getResources().getDisplayMetrics(); mScrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mScrollOffset, dm); mIndicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mIndicatorHeight, dm); mUnderlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mUnderlineHeight, dm); mDividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mDividerPadding, dm); mTabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mTabPadding, dm); mDividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mDividerWidth, dm); mTabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, mTabTextSize, dm); mDividerPaint = new Paint(); mDividerPaint.setAntiAlias(true); mDividerPaint.setStrokeWidth(mDividerWidth); // get system attrs for container TypedArray a = context.obtainStyledAttributes(attrs, ANDROID_ATTRS); int textPrimaryColor = a.getColor(TEXT_COLOR_PRIMARY, getResources().getColor(android.R.color.black)); mUnderlineColor = textPrimaryColor; mDividerColor = textPrimaryColor; int padding = a.getDimensionPixelSize(PADDING_INDEX, 0); mPaddingLeft = padding > 0 ? padding : a.getDimensionPixelSize(PADDING_LEFT_INDEX, 0); mPaddingRight = padding > 0 ? padding : a.getDimensionPixelSize(PADDING_RIGHT_INDEX, 0); a.recycle(); String tabTextTypefaceName = "sans-serif"; // Use Roboto Medium as the default typeface from API 21 onwards if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { tabTextTypefaceName = "sans-serif-medium"; mTabTextTypefaceStyle = Typeface.NORMAL; } // get custom attrs for tabs and container a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip); mIndicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsIndicatorColor, 0xFF00CFA5); mIndicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, mIndicatorHeight); mIndicatorPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorPadding, mIndicatorPadding); mUnderlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsUnderlineColor, mUnderlineColor); mUnderlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, mUnderlineHeight); mDividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsDividerColor, mDividerColor); mDividerWidth = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerWidth, mDividerWidth); mDividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding, mDividerPadding); isExpandTabs = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsShouldExpand, isExpandTabs); mScrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, mScrollOffset); isPaddingMiddle = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsPaddingMiddle, isPaddingMiddle); mTabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, mTabPadding); mTabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, mTabBackgroundResId); mTabTextSize = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabTextSize, (int) (getResources().getDisplayMetrics().density * 14)); mTabTextColor = a.hasValue(R.styleable.PagerSlidingTabStrip_pstsTabTextColor) ? a.getColorStateList(R.styleable.PagerSlidingTabStrip_pstsTabTextColor) : createColorStateList(0xFF00CFA5, 0xFF00CFA5, Color.BLACK); mTabTextTypefaceStyle = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTabTextStyle, mTabTextTypefaceStyle); isTabTextAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTabTextAllCaps, isTabTextAllCaps); int tabTextAlpha = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTabTextAlpha, DEF_VALUE_TAB_TEXT_ALPHA); String fontFamily = a.getString(R.styleable.PagerSlidingTabStrip_pstsTabTextFontFamily); a.recycle(); //Tab text color selector if (mTabTextColor == null) { mTabTextColor = createColorStateList(textPrimaryColor, textPrimaryColor, Color.argb(tabTextAlpha, Color.red(textPrimaryColor), Color.green(textPrimaryColor), Color.blue(textPrimaryColor))); } //Tab text typeface and style if (fontFamily != null) { tabTextTypefaceName = fontFamily; } mTabTextTypeface = Typeface.create(tabTextTypefaceName, mTabTextTypefaceStyle); //Bottom padding for the tabs container parent view to show indicator and underline setTabsContainerParentViewPaddings(); //Configure tab's container LayoutParams for either equal divided space or just wrap tabs mTabLayoutParams = isExpandTabs ? new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f) : new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); }
From source file:com.ecomnationmobile.library.Control.PagerSlidingTabStrip.java
public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);//from w ww .j a v a 2 s . c om setWillNotDraw(false); mTabsContainer = new LinearLayout(context); mTabsContainer.setOrientation(LinearLayout.HORIZONTAL); addView(mTabsContainer); mRectPaint = new Paint(); mRectPaint.setAntiAlias(true); mRectPaint.setStyle(Style.FILL); DisplayMetrics dm = getResources().getDisplayMetrics(); mScrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mScrollOffset, dm); mIndicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mIndicatorHeight, dm); mUnderlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mUnderlineHeight, dm); mDividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mDividerPadding, dm); mTabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mTabPadding, dm); mDividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mDividerWidth, dm); mTabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, mTabTextSize, dm); mDividerPaint = new Paint(); mDividerPaint.setAntiAlias(true); mDividerPaint.setStrokeWidth(mDividerWidth); // get system attrs for container TypedArray a = context.obtainStyledAttributes(attrs, ANDROID_ATTRS); int textPrimaryColor = a.getColor(TEXT_COLOR_PRIMARY, getResources().getColor(android.R.color.white)); mUnderlineColor = textPrimaryColor; mDividerColor = textPrimaryColor; mIndicatorColor = textPrimaryColor; int padding = a.getDimensionPixelSize(PADDING_INDEX, 0); mPaddingLeft = padding > 0 ? padding : a.getDimensionPixelSize(PADDING_LEFT_INDEX, 0); mPaddingRight = padding > 0 ? padding : a.getDimensionPixelSize(PADDING_RIGHT_INDEX, 0); a.recycle(); String tabTextTypefaceName = "sans-serif"; // Use Roboto Medium as the default typeface from API 21 onwards if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { tabTextTypefaceName = "sans-serif-medium"; mTabTextTypefaceStyle = Typeface.NORMAL; } // get custom attrs for tabs and container a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip); mIndicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsIndicatorColor, mIndicatorColor); mIndicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, mIndicatorHeight); mUnderlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsUnderlineColor, mUnderlineColor); mUnderlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, mUnderlineHeight); mDividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsDividerColor, mDividerColor); mDividerWidth = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerWidth, mDividerWidth); mDividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding, mDividerPadding); isExpandTabs = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsShouldExpand, isExpandTabs); mScrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, mScrollOffset); isPaddingMiddle = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsPaddingMiddle, isPaddingMiddle); mTabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, mTabPadding); mTabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, mTabBackgroundResId); mTabTextSize = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabTextSize, mTabTextSize); mTabTextColor = a.hasValue(R.styleable.PagerSlidingTabStrip_pstsTabTextColor) ? a.getColorStateList(R.styleable.PagerSlidingTabStrip_pstsTabTextColor) : null; mTabTextTypefaceStyle = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTabTextStyle, mTabTextTypefaceStyle); isTabTextAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTabTextAllCaps, isTabTextAllCaps); int tabTextAlpha = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTabTextAlpha, DEF_VALUE_TAB_TEXT_ALPHA); String fontFamily = a.getString(R.styleable.PagerSlidingTabStrip_pstsTabTextFontFamily); a.recycle(); //Tab text color white_selector if (mTabTextColor == null) { mTabTextColor = createColorStateList(textPrimaryColor, textPrimaryColor, Color.argb(tabTextAlpha, Color.red(textPrimaryColor), Color.green(textPrimaryColor), Color.blue(textPrimaryColor))); } //Tab text typeface and style if (fontFamily != null) { tabTextTypefaceName = fontFamily; } mTabTextTypeface = Typeface.create(tabTextTypefaceName, mTabTextTypefaceStyle); //Bottom padding for the tabs container parent view to show indicator and underline setTabsContainerParentViewPaddings(); //Configure tab's container LayoutParams for either equal divided space or just wrap tabs mTabLayoutParams = isExpandTabs ? new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f) : new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); }
From source file:com.csform.android.uiapptemplate.view.PagerSlidingTabStrip.java
public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);/* w w w . j a v a2s . c o m*/ setWillNotDraw(false); mTabsContainer = new LinearLayout(context); mTabsContainer.setOrientation(LinearLayout.HORIZONTAL); addView(mTabsContainer); mRectPaint = new Paint(); mRectPaint.setAntiAlias(true); mRectPaint.setStyle(Style.FILL); DisplayMetrics dm = getResources().getDisplayMetrics(); mScrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mScrollOffset, dm); mIndicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mIndicatorHeight, dm); mUnderlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mUnderlineHeight, dm); mDividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mDividerPadding, dm); mTabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mTabPadding, dm); mDividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mDividerWidth, dm); mTabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, mTabTextSize, dm); mDividerPaint = new Paint(); mDividerPaint.setAntiAlias(true); mDividerPaint.setStrokeWidth(mDividerWidth); // get system attrs for container TypedArray a = context.obtainStyledAttributes(attrs, ANDROID_ATTRS); int textPrimaryColor = a.getColor(TEXT_COLOR_PRIMARY, getResources().getColor(android.R.color.black)); mUnderlineColor = textPrimaryColor; mDividerColor = textPrimaryColor; mIndicatorColor = textPrimaryColor; int padding = a.getDimensionPixelSize(PADDING_INDEX, 0); mPaddingLeft = padding > 0 ? padding : a.getDimensionPixelSize(PADDING_LEFT_INDEX, 0); mPaddingRight = padding > 0 ? padding : a.getDimensionPixelSize(PADDING_RIGHT_INDEX, 0); a.recycle(); String tabTextTypefaceName = "sans-serif"; // Use Roboto Medium as the default typeface from API 21 onwards if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { tabTextTypefaceName = "sans-serif-medium"; mTabTextTypefaceStyle = Typeface.NORMAL; } // get custom attrs for tabs and container a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip); mIndicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsIndicatorColor, mIndicatorColor); mIndicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, mIndicatorHeight); mUnderlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsUnderlineColor, mUnderlineColor); mUnderlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, mUnderlineHeight); mDividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsDividerColor, mDividerColor); mDividerWidth = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerWidth, mDividerWidth); mDividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding, mDividerPadding); isExpandTabs = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsShouldExpand, isExpandTabs); mScrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, mScrollOffset); isPaddingMiddle = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsPaddingMiddle, isPaddingMiddle); mTabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, mTabPadding); mTabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, mTabBackgroundResId); mTabTextSize = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabTextSize, mTabTextSize); mTabTextColor = a.hasValue(R.styleable.PagerSlidingTabStrip_pstsTabTextColor) ? a.getColorStateList(R.styleable.PagerSlidingTabStrip_pstsTabTextColor) : null; mTabTextTypefaceStyle = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTabTextStyle, mTabTextTypefaceStyle); isTabTextAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTabTextAllCaps, isTabTextAllCaps); int tabTextAlpha = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTabTextAlpha, DEF_VALUE_TAB_TEXT_ALPHA); String fontFamily = a.getString(R.styleable.PagerSlidingTabStrip_pstsTabTextFontFamily); a.recycle(); //Tab text color selector if (mTabTextColor == null) { mTabTextColor = createColorStateList(textPrimaryColor, textPrimaryColor, Color.argb(tabTextAlpha, Color.red(textPrimaryColor), Color.green(textPrimaryColor), Color.blue(textPrimaryColor))); } //Tab text typeface and style if (fontFamily != null) { tabTextTypefaceName = fontFamily; } mTabTextTypeface = Typeface.create(tabTextTypefaceName, mTabTextTypefaceStyle); //Bottom padding for the tabs container parent view to show indicator and underline setTabsContainerParentViewPaddings(); //Configure tab's container LayoutParams for either equal divided space or just wrap tabs mTabLayoutParams = isExpandTabs ? new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f) : new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); }
From source file:com.morlunk.mumbleclient.channel.ChannelListAdapter.java
@Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { final Node node = mNodes.get(position); if (node.isChannel()) { final IChannel channel = node.getChannel(); final ChannelViewHolder cvh = (ChannelViewHolder) viewHolder; cvh.itemView.setOnClickListener(new View.OnClickListener() { @Override/*from w w w.j av a2s . co m*/ public void onClick(View v) { if (mChannelClickListener != null) { mChannelClickListener.onChannelClick(channel); } } }); final boolean expandUsable = channel.getSubchannels().size() > 0 || channel.getSubchannelUserCount() > 0; cvh.mChannelExpandToggle.setImageResource( node.isExpanded() ? R.drawable.ic_action_expanded : R.drawable.ic_action_collapsed); cvh.mChannelExpandToggle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mExpandedChannels.put(channel.getId(), !node.isExpanded()); updateChannels(); // FIXME: very inefficient. notifyDataSetChanged(); } }); // Dim channel expand toggle when no subchannels exist cvh.mChannelExpandToggle.setEnabled(expandUsable); cvh.mChannelExpandToggle.setVisibility(expandUsable ? View.VISIBLE : View.INVISIBLE); cvh.mChannelName.setText(channel.getName()); int nameTypeface = Typeface.NORMAL; if (mService != null && mService.getConnectionState() == JumbleService.ConnectionState.CONNECTED) { if (channel.equals(mService.getSessionChannel())) { nameTypeface |= Typeface.BOLD; // Always italicize our current channel if it has a link. if (channel.getLinks().size() > 0) { nameTypeface |= Typeface.ITALIC; } } // Italicize channels in a link with our current channel. if (channel.getLinks().contains(mService.getSessionChannel())) { nameTypeface |= Typeface.ITALIC; } } cvh.mChannelName.setTypeface(null, nameTypeface); if (mShowChannelUserCount) { cvh.mChannelUserCount.setVisibility(View.VISIBLE); int userCount = channel.getSubchannelUserCount(); cvh.mChannelUserCount.setText(String.format("%d", userCount)); } else { cvh.mChannelUserCount.setVisibility(View.GONE); } // Pad the view depending on channel's nested level. DisplayMetrics metrics = mContext.getResources().getDisplayMetrics(); float margin = node.getDepth() * TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 25, metrics); cvh.mChannelHolder.setPadding((int) margin, cvh.mChannelHolder.getPaddingTop(), cvh.mChannelHolder.getPaddingRight(), cvh.mChannelHolder.getPaddingBottom()); cvh.mJoinButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mService.joinChannel(channel.getId()); } }); cvh.mMoreButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ChannelMenu menu = new ChannelMenu(mContext, channel, mService, mDatabase, mFragmentManager); menu.showPopup(v); } }); cvh.itemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { cvh.mMoreButton.performClick(); return true; } }); } else if (node.isUser()) { final IUser user = node.getUser(); final UserViewHolder uvh = (UserViewHolder) viewHolder; uvh.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mUserClickListener != null) { mUserClickListener.onUserClick(user); } } }); uvh.mUserName.setText(user.getName()); uvh.mUserName.setTypeface(null, user.getSession() == mService.getSession() ? Typeface.BOLD : Typeface.NORMAL); uvh.mUserTalkHighlight.setImageDrawable(getTalkStateDrawable(user)); uvh.mTalkingIndicator.setAlpha( (user.getTalkState() == TalkState.TALKING || user.getTalkState() == TalkState.WHISPERING || user.getTalkState() == TalkState.SHOUTING) ? 1 : 0); // Pad the view depending on channel's nested level. DisplayMetrics metrics = mContext.getResources().getDisplayMetrics(); float margin = (node.getDepth() + 1) * TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 25, metrics); uvh.mUserHolder.setPadding((int) margin, uvh.mUserHolder.getPaddingTop(), uvh.mUserHolder.getPaddingRight(), uvh.mUserHolder.getPaddingBottom()); uvh.mMoreButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { UserMenu menu = new UserMenu(mContext, user, (PlumbleService) mService, mFragmentManager, ChannelListAdapter.this); menu.showPopup(v); } }); uvh.itemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { uvh.mMoreButton.performClick(); return true; } }); } }
From source file:color.kidpaint.com.kidpaintcolor.tools.implementation.TextTool.java
public void updateTypeface() { int style;/*ww w .ja v a2s .c o m*/ if (mItalic) { style = Typeface.ITALIC; } else { style = Typeface.NORMAL; } if (mFont.equals("Sans Serif")) { mTextPaint.setTypeface(Typeface.create(Typeface.SANS_SERIF, style)); } else if (mFont.equals("Serif")) { mTextPaint.setTypeface(Typeface.create(Typeface.SERIF, style)); } else if (mFont.equals("Monospace")) { mTextPaint.setTypeface(Typeface.create(Typeface.MONOSPACE, style)); } if (Build.VERSION.SDK_INT < 21) { mTextPaint.setTextSkewX(0.0f); if (mFont.equals("Monospace")) { mTextPaint.setTypeface(Typeface.create(Typeface.MONOSPACE, Typeface.NORMAL)); if (style == Typeface.ITALIC) { mTextPaint.setTextSkewX(-0.25f); } } } }
From source file:com.tcity.android.ui.info.BuildInfoFragment.java
private void updateBranchView(@NotNull BuildInfoData data) { View row = getView().findViewById(R.id.build_info_branch_row); if (data.branch != null) { row.setVisibility(View.VISIBLE); TextView view = (TextView) row.findViewById(R.id.build_info_branch); view.setText(data.branch);//from ww w . j a va2 s .c om if (data.isBranchDefault) { view.setTypeface(null, Typeface.BOLD); } else { view.setTypeface(null, Typeface.NORMAL); } } else { row.setVisibility(View.GONE); } }