Example usage for android.graphics Typeface NORMAL

List of usage examples for android.graphics Typeface NORMAL

Introduction

In this page you can find the example usage for android.graphics Typeface NORMAL.

Prototype

int NORMAL

To view the source code for android.graphics Typeface NORMAL.

Click Source Link

Usage

From source file:com.taobao.weex.dom.WXStyle.java

public static int getFontStyle(Map<String, Object> style) {
    int typeface = android.graphics.Typeface.NORMAL;
    if (style == null) {
        return typeface;
    }//from w w w  .j a  va 2  s . c  o m
    Object temp = style.get(Constants.Name.FONT_STYLE);
    if (temp == null) {
        return typeface;
    }
    String fontWeight = temp.toString();
    if (fontWeight.equals(Constants.Value.ITALIC)) {
        typeface = android.graphics.Typeface.ITALIC;
    }
    return typeface;
}

From source file:com.androidinspain.deskclock.Utils.java

/**
 * @param amPmRatio      a value between 0 and 1 that is the ratio of the relative size of the
 *                       am/pm string to the time string
 * @param includeSeconds whether or not to include seconds in the time string
 * @return format string for 12 hours mode time, not including seconds
 *///from   w  w w  .j a  v  a 2s  .c  o m
public static CharSequence get12ModeFormat(float amPmRatio, boolean includeSeconds) {
    String pattern = DateFormat.getBestDateTimePattern(Locale.getDefault(), includeSeconds ? "hmsa" : "hma");
    if (amPmRatio <= 0) {
        pattern = pattern.replaceAll("a", "").trim();
    }

    // Replace spaces with "Hair Space"
    pattern = pattern.replaceAll(" ", "\u200A");
    // Build a spannable so that the am/pm will be formatted
    int amPmPos = pattern.indexOf('a');
    if (amPmPos == -1) {
        return pattern;
    }

    final Spannable sp = new SpannableString(pattern);
    sp.setSpan(new RelativeSizeSpan(amPmRatio), amPmPos, amPmPos + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    sp.setSpan(new StyleSpan(Typeface.NORMAL), amPmPos, amPmPos + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    sp.setSpan(new TypefaceSpan("sans-serif"), amPmPos, amPmPos + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

    return sp;
}

From source file:com.fjoglar.etsitnoticias.view.activities.NewsListActivity.java

private void setUpSearchView(MenuItem searchMenuItem, final MenuItem filterMenuItem) {
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) searchMenuItem.getActionView();
    searchView.setMaxWidth(Integer.MAX_VALUE);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    TextView searchText = (TextView) searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);
    searchText.setTypeface(Typeface.create("sans-serif-condensed", Typeface.NORMAL));

    // Hide filter option when SearchView is expanded, restore it when collapsed.
    MenuItemCompat.setOnActionExpandListener(searchMenuItem, new MenuItemCompat.OnActionExpandListener() {
        @Override/*from  ww w.j  a va  2  s. c o m*/
        public boolean onMenuItemActionExpand(MenuItem item) {
            filterMenuItem.setVisible(false);
            return true;
        }

        @Override
        public boolean onMenuItemActionCollapse(MenuItem item) {
            filterMenuItem.setVisible(true);
            return true;
        }
    });
}

From source file:com.andexert.calendarlistview.library.SimpleMonthView.java

protected void drawMonthNums(Canvas canvas) {
    int y = (mRowHeight + MINI_DAY_NUMBER_TEXT_SIZE) / 2 - DAY_SEPARATOR_WIDTH + MONTH_HEADER_SIZE;
    int paddingDay = (mWidth - 2 * mPadding) / (2 * mNumDays);
    int dayOffset = findDayOffset();
    int day = 1;/*from  www . jav a  2  s. c om*/
    String toDayRes = getResources().getString(R.string.today);
    while (day <= mNumCells) {
        boolean isShowTrain = true;
        int x = paddingDay * (1 + dayOffset * 2) + mPadding;
        if ((mMonth == mSelectedBeginMonth && mSelectedBeginDay == day && mSelectedBeginYear == mYear)
                || (mMonth == mSelectedLastMonth && mSelectedLastDay == day && mSelectedLastYear == mYear)) {
            if (mDrawRect) {
                RectF rectF = new RectF(x - DAY_SELECTED_CIRCLE_SIZE,
                        (y - MINI_DAY_NUMBER_TEXT_SIZE / 3) - DAY_SELECTED_CIRCLE_SIZE,
                        x + DAY_SELECTED_CIRCLE_SIZE,
                        (y - MINI_DAY_NUMBER_TEXT_SIZE / 3) + DAY_SELECTED_CIRCLE_SIZE);
                canvas.drawRoundRect(rectF, 10.0f, 10.0f, mSelectedCirclePaint);
            } else {
                canvas.drawCircle(x, y - MINI_DAY_NUMBER_TEXT_SIZE / 3, DAY_SELECTED_CIRCLE_SIZE,
                        mSelectedCirclePaint);
            }
            isShowTrain = false;
        }
        if (mHasToday && (mToday == day)) {
            mMonthNumPaint.setColor(mCurrentDayTextColor);
        } else {
            mMonthNumPaint.setColor(mDayNumColor);
            mMonthNumPaint.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
        }

        if ((mMonth == mSelectedBeginMonth && mSelectedBeginDay == day && mSelectedBeginYear == mYear)
                || (mMonth == mSelectedLastMonth && mSelectedLastDay == day && mSelectedLastYear == mYear))
            mMonthNumPaint.setColor(mMonthTitleBGColor);

        if ((mSelectedBeginDay != -1 && mSelectedLastDay != -1 && mSelectedBeginYear == mSelectedLastYear
                && mSelectedBeginMonth == mSelectedLastMonth && mSelectedBeginDay == mSelectedLastDay
                && day == mSelectedBeginDay && mMonth == mSelectedBeginMonth && mYear == mSelectedBeginYear)) {
            mMonthNumPaint.setColor(mSelectedDaysColor);
        }
        //?
        if ((mSelectedBeginDay != -1 && mSelectedLastDay != -1 && mSelectedBeginYear == mSelectedLastYear
                && mSelectedBeginYear == mYear)
                && (((mMonth == mSelectedBeginMonth && mSelectedLastMonth == mSelectedBeginMonth)
                        && ((mSelectedBeginDay < mSelectedLastDay && day > mSelectedBeginDay
                                && day < mSelectedLastDay)
                                || (mSelectedBeginDay > mSelectedLastDay && day < mSelectedBeginDay
                                        && day > mSelectedLastDay)))
                        || ((mSelectedBeginMonth < mSelectedLastMonth && mMonth == mSelectedBeginMonth
                                && day > mSelectedBeginDay)
                                || (mSelectedBeginMonth < mSelectedLastMonth && mMonth == mSelectedLastMonth
                                        && day < mSelectedLastDay))
                        || ((mSelectedBeginMonth > mSelectedLastMonth && mMonth == mSelectedBeginMonth
                                && day < mSelectedBeginDay)
                                || (mSelectedBeginMonth > mSelectedLastMonth && mMonth == mSelectedLastMonth
                                        && day > mSelectedLastDay)))) {
            mMonthNumPaint.setColor(mSelectedDaysColor);
        }

        if ((mSelectedBeginDay != -1 && mSelectedLastDay != -1 && mSelectedBeginYear != mSelectedLastYear
                && ((mSelectedBeginYear == mYear && mMonth == mSelectedBeginMonth)
                        || (mSelectedLastYear == mYear && mMonth == mSelectedLastMonth))
                && (((mSelectedBeginMonth < mSelectedLastMonth && mMonth == mSelectedBeginMonth
                        && day < mSelectedBeginDay)
                        || (mSelectedBeginMonth < mSelectedLastMonth && mMonth == mSelectedLastMonth
                                && day > mSelectedLastDay))
                        || ((mSelectedBeginMonth > mSelectedLastMonth && mMonth == mSelectedBeginMonth
                                && day > mSelectedBeginDay)
                                || (mSelectedBeginMonth > mSelectedLastMonth && mMonth == mSelectedLastMonth
                                        && day < mSelectedLastDay))))) {
            mMonthNumPaint.setColor(mSelectedDaysColor);
        }

        if ((mSelectedBeginDay != -1 && mSelectedLastDay != -1 && mSelectedBeginYear == mSelectedLastYear
                && mYear == mSelectedBeginYear)
                && ((mMonth > mSelectedBeginMonth && mMonth < mSelectedLastMonth
                        && mSelectedBeginMonth < mSelectedLastMonth)
                        || (mMonth < mSelectedBeginMonth && mMonth > mSelectedLastMonth
                                && mSelectedBeginMonth > mSelectedLastMonth))) {
            mMonthNumPaint.setColor(mSelectedDaysColor);
        }

        if ((mSelectedBeginDay != -1 && mSelectedLastDay != -1 && mSelectedBeginYear != mSelectedLastYear)
                && ((mSelectedBeginYear < mSelectedLastYear
                        && ((mMonth > mSelectedBeginMonth && mYear == mSelectedBeginYear)
                                || (mMonth < mSelectedLastMonth && mYear == mSelectedLastYear)))
                        || (mSelectedBeginYear > mSelectedLastYear
                                && ((mMonth < mSelectedBeginMonth && mYear == mSelectedBeginYear)
                                        || (mMonth > mSelectedLastMonth && mYear == mSelectedLastYear))))) {
            mMonthNumPaint.setColor(mSelectedDaysColor);
        }

        if ((!isPrevDayEnabled && prevDay(day, today)) || nextDay(day)) {
            mMonthNumPaint.setColor(mPreviousDayColor);
        }
        if (mHasToday && (mToday == day)) {
            canvas.drawText(toDayRes, x, y, mMonthNumPaint);
        } else {
            canvas.drawText(String.format("%d", day), x, y, mMonthNumPaint);
        }
        dayOffset++;
        if (dayOffset == mNumDays) {
            dayOffset = 0;
            y += mRowHeight;
        }
        day++;
    }
}

From source file:org.telegram.ui.MainTabActivity.java

@Override
public View createView(Context context, LayoutInflater inflater) {
    searching = false;/*from  w  w w .  j a  v a 2  s.c  o m*/
    searchWas = false;

    ActionBarMenu menu = actionBar.createMenu();
    if (searchString == null) {
        passcodeItem = menu.addItem(passcode_menu_item, R.drawable.lock_close);
        updatePasscodeButton();
    }
    ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true)
            .setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
                @Override
                public void onSearchExpand() {
                    searching = true;
                    //                if (messagesListView != null) {
                    //                    if (searchString != null) {
                    //                        messagesListView.setEmptyView(progressView);
                    //                        searchEmptyView.setVisibility(View.INVISIBLE);
                    //                    } else {
                    //                        messagesListView.setEmptyView(searchEmptyView);
                    //                        progressView.setVisibility(View.INVISIBLE);
                    //                    }
                    //                    emptyView.setVisibility(View.INVISIBLE);
                    //                    if (!onlySelect) {
                    //                        floatingButton.setVisibility(View.GONE);
                    //                    }
                    //                }
                    searchFragment = currentFragment;
                    ((SeparateMessagesActivity) searchFragment).onSearchExpand();
                    updatePasscodeButton();
                }

                @Override
                public boolean onSearchCollapse() {
                    if (searchString != null) {
                        finishFragment();
                        return false;
                    }
                    searching = false;
                    searchWas = false;
                    //                if (messagesListView != null) {
                    //                    if (MessagesController.getInstance().loadingDialogs && MessagesController.getInstance().dialogs.isEmpty()) {
                    //                        searchEmptyView.setVisibility(View.INVISIBLE);
                    //                        emptyView.setVisibility(View.INVISIBLE);
                    //                        progressView.setVisibility(View.VISIBLE);
                    //                        messagesListView.setEmptyView(progressView);
                    //                    } else {
                    //                        messagesListView.setEmptyView(emptyView);
                    //                        searchEmptyView.setVisibility(View.INVISIBLE);
                    //                        progressView.setVisibility(View.INVISIBLE);
                    //                    }
                    //                    if (!onlySelect) {
                    //                        floatingButton.setVisibility(View.VISIBLE);
                    //                        floatingHidden = true;
                    //                        ViewProxy.setTranslationY(floatingButton, AndroidUtilities.dp(100));
                    //                        hideFloatingButton(false);
                    //                    }
                    //                    if (messagesListView.getAdapter() != dialogsAdapter) {
                    //                        messagesListView.setAdapter(dialogsAdapter);
                    //                        dialogsAdapter.notifyDataSetChanged();
                    //                    }
                    //                }
                    //                if (dialogsSearchAdapter != null) {
                    //                    dialogsSearchAdapter.searchDialogs(null, false);
                    //                }
                    ((SeparateMessagesActivity) searchFragment).onSearchCollapse();
                    searchFragment = null;
                    updatePasscodeButton();
                    return true;
                }

                @Override
                public void onTextChanged(EditText editText) {
                    //                String text = editText.getText().toString();
                    //                if (text.length() != 0) {
                    //                    searchWas = true;
                    //                    if (dialogsSearchAdapter != null) {
                    //                        messagesListView.setAdapter(dialogsSearchAdapter);
                    //                        dialogsSearchAdapter.notifyDataSetChanged();
                    //                    }
                    //                    if (searchEmptyView != null && messagesListView.getEmptyView() == emptyView) {
                    //                        messagesListView.setEmptyView(searchEmptyView);
                    //                        emptyView.setVisibility(View.INVISIBLE);
                    //                        progressView.setVisibility(View.INVISIBLE);
                    //                    }
                    //                }
                    //                if (dialogsSearchAdapter != null) {
                    //                    dialogsSearchAdapter.searchDialogs(text, serverOnly);
                    //                }
                    if (searchFragment == null) {
                        ((SeparateMessagesActivity) currentFragment).onTextChanged(editText);
                    } else {
                        ((SeparateMessagesActivity) searchFragment).onTextChanged(editText);
                    }
                }
            });

    headerItem = menu.addItem(2, R.drawable.ic_ab_other);
    headerItem.addSubItem(new_secret_chat, LocaleController.getString("NewSecretChat", R.string.NewSecretChat),
            0);
    headerItem.addSubItem(new_broadcast,
            LocaleController.getString("NewBroadcastList", R.string.NewBroadcastList), 0);
    headerItem.addSubItem(join_group, LocaleController.getString("AddGroup", R.string.AddGroup), 0);
    headerItem.addSubItem(invite, LocaleController.getString("InviteFriends", R.string.InviteFriends), 0);

    item.getSearchField().setHint(LocaleController.getString("Search", R.string.Search));
    if (searchString != null) {
        actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    } else {
        actionBar.setBackButtonDrawable(new MenuDrawable());
    }
    actionBar.setTitle(LocaleController.getString("AppName", R.string.AppName));
    actionBar.setAllowOverlayTitle(true);

    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                if (parentLayout != null) {
                    parentLayout.getDrawerLayoutContainer().openDrawer(false);
                }
            } else if (id == passcode_menu_item) {
                UserConfig.appLocked = !UserConfig.appLocked;
                UserConfig.saveConfig(false);
                updatePasscodeButton();
            } else if (id == new_secret_chat) {
                Bundle args = new Bundle();
                args.putBoolean("onlyUsers", true);
                args.putBoolean("destroyAfterSelect", true);
                args.putBoolean("createSecretChat", true);
                presentFragment(new ContactsActivity(args));
            } else if (id == new_broadcast) {
                if (!MessagesController.isFeatureEnabled("broadcast_create", MainTabActivity.this)) {
                    return;
                }
                Bundle args = new Bundle();
                args.putBoolean("broadcast", true);
                presentFragment(new GroupCreateActivity(args));
            } else if (id == join_group) {
                GroupQRScanActivity fragment = new GroupQRScanActivity();
                presentFragment(fragment);
            } else if (id == invite) {
                try {
                    Intent intent = new Intent(Intent.ACTION_SEND);
                    intent.setType("text/plain");
                    intent.putExtra(Intent.EXTRA_TEXT, ContactsController.getInstance().getInviteText());
                    startActivityForResult(Intent.createChooser(intent,
                            LocaleController.getString("InviteFriends", R.string.InviteFriends)), 500);
                } catch (Exception e) {
                    FileLog.e("tmessages", e);
                }
            }
        }
    });

    views.clear();
    views.add(chatMessagesFragment.createView(context, inflater));
    views.add(userMessagesFragment.createView(context, inflater));

    fragmentView = inflater.inflate(R.layout.messages_pager, null, false);
    pager = (ViewPager) fragmentView.findViewById(R.id.pager);
    pager.setAdapter(new MessagePagesAdapter());

    // actionbar tab
    actionBar.setExtraHeight(AndroidUtilities.dp(40), false);
    pagerTab = new PagerSlidingTabStrip(context);
    actionBar.addView(pagerTab);
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) pagerTab.getLayoutParams();
    layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
    layoutParams.height = AndroidUtilities.dp(40);
    layoutParams.gravity = Gravity.BOTTOM;
    pagerTab.setLayoutParams(layoutParams);
    pagerTab.setViewPager(pager);
    pagerTab.setShouldExpand(true);
    pagerTab.setIndicatorColor(0xffffffff);
    pagerTab.setIndicatorHeight(AndroidUtilities.dp(2.0f));
    pagerTab.setUnderlineHeight(AndroidUtilities.dp(2.0f));
    pagerTab.setUnderlineColor(0x00000000);
    pagerTab.setTabBackground(0);
    pagerTab.setTextSize(AndroidUtilities.dp(14));
    pagerTab.setTextColor(0xFFffffff);
    pagerTab.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"), Typeface.NORMAL);

    pagerTab.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int i, float v, int i2) {

        }

        @Override
        public void onPageSelected(int i) {
            currentTab = i;
            switch (i) {
            case 0:
                currentFragment = chatMessagesFragment;
                break;
            case 1:
                currentFragment = userMessagesFragment;
                break;
            }
            currentFragment.onResume();
        }

        @Override
        public void onPageScrollStateChanged(int i) {

        }
    });

    if (searchString == null) {
        //            dialogsAdapter = new DialogsAdapter(context, serverOnly, dialogShowType);
        //            if (AndroidUtilities.isTablet() && openedDialogId != 0) {
        //                dialogsAdapter.setOpenedDialogId(openedDialogId);
        //            }
    }

    if (searchString != null) {
        actionBar.openSearchField(searchString);
    }

    return fragmentView;
}

From source file:com.mobicage.rogerthat.plugins.friends.ServiceSearchActivity.java

private TextView setCatorySelected(LinearLayout label, final boolean selected) {
    final View labelIndicatorView = label.findViewById(R.id.indicator);
    final TextView labelTextView = (TextView) label.findViewById(R.id.category);
    if (selected) {
        labelIndicatorView.setVisibility(View.VISIBLE);
        labelTextView.setTypeface(Typeface.create(labelTextView.getTypeface(), Typeface.BOLD));
        labelTextView.setTextColor(getResources().getColor(R.color.mc_blue2));
    } else {/*from  w  w  w.  j  ava  2  s  .  c  o  m*/
        labelIndicatorView.setVisibility(View.INVISIBLE);
        labelTextView.setTypeface(Typeface.create(labelTextView.getTypeface(), Typeface.NORMAL));
        labelTextView.setTextColor(getResources().getColor(android.R.color.secondary_text_light));
    }
    return labelTextView;
}

From source file:com.android.messaging.ui.conversationlist.ConversationListItemView.java

/**
 * Fills in the data associated with this view.
 *
 * @param cursor The cursor from a ConversationList that this view is in, pointing to its
 * entry.//from w  ww . j  a  va 2  s  .  com
 */
public void bind(final Cursor cursor, final HostInterface hostInterface) {
    // Update our UI model
    mHostInterface = hostInterface;
    mData.bind(cursor);

    resetAnimatingState();

    mSwipeableContainer.setOnClickListener(this);
    mSwipeableContainer.setOnLongClickListener(this);

    final Resources resources = getContext().getResources();

    int color;
    final int maxLines;
    final Typeface typeface;
    final int typefaceStyle = mData.getShowDraft() ? Typeface.ITALIC : Typeface.NORMAL;
    final String snippetText = getSnippetText();

    if (mData.getIsRead() || mData.getShowDraft()) {
        maxLines = TextUtils.isEmpty(snippetText) ? 0 : NO_UNREAD_SNIPPET_LINE_COUNT;
        color = mListItemReadColor;
        typeface = mListItemReadTypeface;
    } else {
        maxLines = TextUtils.isEmpty(snippetText) ? 0 : UNREAD_SNIPPET_LINE_COUNT;
        color = mListItemUnreadColor;
        typeface = mListItemUnreadTypeface;
    }

    mSnippetTextView.setMaxLines(maxLines);
    mSnippetTextView.setTextColor(color);
    mSnippetTextView.setTypeface(typeface, typefaceStyle);
    mSubjectTextView.setTextColor(color);
    mSubjectTextView.setTypeface(typeface, typefaceStyle);

    setSnippet();
    setConversationName();
    setSubject();
    setContentDescription(buildContentDescription(resources, mData, mConversationNameView.getPaint()));

    final boolean isDefaultSmsApp = PhoneUtils.getDefault().isDefaultSmsApp();
    // don't show the error state unless we're the default sms app
    if (mData.getIsFailedStatus() && isDefaultSmsApp) {
        mTimestampTextView.setTextColor(resources.getColor(R.color.conversation_list_error));
        mTimestampTextView.setTypeface(mListItemReadTypeface, typefaceStyle);
        int failureMessageId = R.string.message_status_download_failed;
        if (mData.getIsMessageTypeOutgoing()) {
            failureMessageId = MmsUtils.mapRawStatusToErrorResourceId(mData.getMessageStatus(),
                    mData.getMessageRawTelephonyStatus());
        }
        mTimestampTextView.setText(resources.getString(failureMessageId));
    } else if (mData.getShowDraft() || mData.getMessageStatus() == MessageData.BUGLE_STATUS_OUTGOING_DRAFT
    // also check for unknown status which we get because sometimes the conversation
    // row is left with a latest_message_id of a no longer existing message and
    // therefore the join values come back as null (or in this case zero).
            || mData.getMessageStatus() == MessageData.BUGLE_STATUS_UNKNOWN) {
        mTimestampTextView.setTextColor(mListItemReadColor);
        mTimestampTextView.setTypeface(mListItemReadTypeface, typefaceStyle);
        mTimestampTextView.setText(resources.getString(R.string.conversation_list_item_view_draft_message));
    } else {
        mTimestampTextView.setTextColor(mListItemReadColor);
        mTimestampTextView.setTypeface(mListItemReadTypeface, typefaceStyle);
        final String formattedTimestamp = mData.getFormattedTimestamp();
        if (mData.getIsSendRequested()) {
            mTimestampTextView.setText(R.string.message_status_sending);
        } else {
            mTimestampTextView.setText(formattedTimestamp);
        }
    }

    final boolean isSelected = mHostInterface.isConversationSelected(mData.getConversationId());
    setSelected(isSelected);
    Uri iconUri = null;
    int contactIconVisibility = GONE;
    int checkmarkVisiblity = GONE;
    int failStatusVisiblity = GONE;
    if (isSelected) {
        checkmarkVisiblity = VISIBLE;
    } else {
        contactIconVisibility = VISIBLE;
        // Only show the fail icon if it is not a group conversation.
        // And also require that we be the default sms app.
        if (mData.getIsFailedStatus() && !mData.getIsGroup() && isDefaultSmsApp) {
            failStatusVisiblity = VISIBLE;
        }
    }
    if (mData.getIcon() != null) {
        iconUri = Uri.parse(mData.getIcon());
    }
    mContactIconView.setImageResourceUri(iconUri, mData.getParticipantContactId(),
            mData.getParticipantLookupKey(), mData.getOtherParticipantNormalizedDestination());
    mContactIconView.setVisibility(contactIconVisibility);
    mContactIconView.setOnLongClickListener(this);
    mContactIconView.setClickable(!mHostInterface.isSelectionMode());
    mContactIconView.setLongClickable(!mHostInterface.isSelectionMode());

    mContactCheckmarkView.setVisibility(checkmarkVisiblity);
    mFailedStatusIconView.setVisibility(failStatusVisiblity);

    final Uri previewUri = mData.getShowDraft() ? mData.getDraftPreviewUri() : mData.getPreviewUri();
    final String previewContentType = mData.getShowDraft() ? mData.getDraftPreviewContentType()
            : mData.getPreviewContentType();
    OnClickListener previewClickListener = null;
    Uri previewImageUri = null;
    int previewImageVisibility = GONE;
    int audioPreviewVisiblity = GONE;
    if (previewUri != null && !TextUtils.isEmpty(previewContentType)) {
        if (ContentType.isAudioType(previewContentType)) {
            boolean incoming = !(mData.getShowDraft() || mData.getIsMessageTypeOutgoing());
            mAudioAttachmentView.bind(previewUri, incoming, false);
            audioPreviewVisiblity = VISIBLE;
        } else if (ContentType.isVideoType(previewContentType)) {
            previewImageUri = UriUtil.getUriForResourceId(getContext(), R.drawable.ic_preview_play);
            previewClickListener = fullScreenPreviewClickListener;
            previewImageVisibility = VISIBLE;
        } else if (ContentType.isImageType(previewContentType)) {
            previewImageUri = previewUri;
            previewClickListener = fullScreenPreviewClickListener;
            previewImageVisibility = VISIBLE;
        }
    }

    final int imageSize = resources.getDimensionPixelSize(R.dimen.conversation_list_image_preview_size);
    mImagePreviewView.setImageResourceId(new UriImageRequestDescriptor(previewImageUri, imageSize, imageSize,
            true /* allowCompression */, false /* isStatic */, false /*cropToCircle*/,
            ImageUtils.DEFAULT_CIRCLE_BACKGROUND_COLOR /* circleBackgroundColor */,
            ImageUtils.DEFAULT_CIRCLE_STROKE_COLOR /* circleStrokeColor */));
    mImagePreviewView.setOnLongClickListener(this);
    mImagePreviewView.setVisibility(previewImageVisibility);
    mImagePreviewView.setOnClickListener(previewClickListener);
    mAudioAttachmentView.setOnLongClickListener(this);
    mAudioAttachmentView.setVisibility(audioPreviewVisiblity);

    final int notificationBellVisiblity = mData.getNotificationEnabled() ? GONE : VISIBLE;
    mNotificationBellView.setVisibility(notificationBellVisiblity);
}

From source file:com.github.omadahealth.slidepager.lib.views.SlideChartView.java

/**
 * Sets the selected {@link ProgressView}
 *
 * @param selected The index of the selected view in {@link #mProgressList}
 *//*  w  w w.  j  a v a2  s  .co  m*/
private void toggleSelectedViews(int selected) {
    mSelectedView = selected;
    for (int i = 0; i < mProgressList.size(); i++) {
        ProgressView day = mProgressList.get(i);
        TypefaceTextView currentBottomText = mProgressBottomTextList.get(i);

        if (day.getIntTag() == mSelectedView) {
            day.isSelected(true);
            currentBottomText.setTypeface(currentBottomText.getTypeface(), Typeface.BOLD);
            continue;
        }

        day.isSelected(false);
        currentBottomText.setTypeface(
                TypefaceTextView.getFont(getContext(), TypefaceType
                        .getTypeface(TypefaceType.getDefaultTypeface(getContext())).getAssetFileName()),
                Typeface.NORMAL);
    }
}

From source file:uk.co.ashtonbrsc.intentexplode.Explode.java

private void checkAndShowMatchingActivites() {

    activitiesLayout.removeAllViews();/*w ww  .ja  va2  s  .  c  om*/
    PackageManager pm = getPackageManager();
    List<ResolveInfo> resolveInfo = pm.queryIntentActivities(editableIntent, 0);

    // Remove Intent Intercept from matching activities
    int numberOfMatchingActivities = resolveInfo.size() - 1;

    if (numberOfMatchingActivities < 1) {
        resendIntentButton.setEnabled(false);
        activitiesHeader.setText(getResources().getString(R.string.no_activities_match_intent));
    } else {
        resendIntentButton.setEnabled(true);
        activitiesHeader.setText(getResources().getQuantityString(R.plurals.activities_match_intent,
                numberOfMatchingActivities, numberOfMatchingActivities));
        for (int i = 0; i <= numberOfMatchingActivities; i++) {
            ResolveInfo info = resolveInfo.get(i);
            ActivityInfo activityinfo = info.activityInfo;
            if (!activityinfo.packageName.equals(getPackageName())) {
                addTextToLayout(
                        activityinfo.loadLabel(pm) + getResources().getString(R.string.open_bracket)
                                + activityinfo.packageName + getResources().getString(R.string.dash)
                                + activityinfo.name + getResources().getString(R.string.close_bracket),
                        Typeface.NORMAL, activitiesLayout);
            }
        }
    }
}

From source file:talex.zsw.baselibrary.widget.NavigationTabBar.java

public void setTypeface(final String typeface) {
    Typeface tempTypeface;/*  w  ww  . j  a  va 2  s .c  o  m*/
    //      try
    //      {
    //         tempTypeface = Typeface.createFromAsset(getContext().getAssets(), typeface);
    //      } catch (Exception e)
    //      {
    tempTypeface = Typeface.create(Typeface.DEFAULT, Typeface.NORMAL);
    //         e.printStackTrace();
    //      }

    setTypeface(tempTypeface);
}