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:ru.tinkoff.acquiring.sdk.views.KeyView.java

private void applyAttrs(AttributeSet attrs) {
    if (attrs == null) {
        return;//ww w .j a v a  2s . c  o m
    }

    final TypedArray a = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.KeyView, 0, 0);

    try {
        keyCode = a.getInt(R.styleable.KeyView_keyCode, -1);

        final float textSize = a.getDimension(R.styleable.KeyView_keyTextSize, -1.F);
        if (textSize != -1.F) {
            contentPaint.setTextSize(dpToPx(textSize));
        }

        final String fontFamily = a.getString(R.styleable.KeyView_keyTextFontFamily);
        if (fontFamily != null) {
            contentPaint.setTypeface(Typeface.create(fontFamily, Typeface.NORMAL));
        }

        contentText = a.getString(R.styleable.KeyView_keyText);
        if (contentText != null) {
            textWidth = contentPaint.measureText(contentText);
        }

        final int imageDrawableId = a.getResourceId(R.styleable.KeyView_keyImage, -1);
        if (imageDrawableId != -1) {
            contentImage = BitmapFactory.decodeResource(getResources(), imageDrawableId);
        }

        final int textColor = a.getColor(R.styleable.KeyView_keyTextColor, contentPaint.getColor());
        contentPaint.setColor(textColor);

        final int circleColor = a.getColor(R.styleable.KeyView_keyCircleColor, circlePaint.getColor());
        circlePaint.setColor(circleColor);
    } finally {
        a.recycle();
    }
}

From source file:com.jwork.dhammapada.ContentFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    log.d(this, "onCreateView()");
    View view = inflater.inflate(R.layout.verse_content, container, false);

    tvContentPali = (TextView) view.findViewById(R.id.verseContentPali);
    tvContentPali.setTypeface(tfPali, Typeface.NORMAL);
    tvContentEng = (TextView) view.findViewById(R.id.verseContentEng);
    tvContentId = (TextView) view.findViewById(R.id.verseContentId);

    return view;/*w ww.ja  v  a 2  s. co m*/
}

From source file:ufms.br.com.ufmsapp.adapter.EventosAdapter.java

@Override
public void onBindViewHolder(EventosViewHolder eventosViewHolder, int i) {
    evento = eventosList.get(i);/*from   w w w  .  j a v a  2  s  . c om*/

    EventoRead eventoRead = MyApplication.getWritableDatabase().eventoReadById(evento.getIdEventoServidor());

    if (eventoRead != null) {
        if (eventoRead.getEventoReadStatus() == 0) {
            eventosViewHolder.cardLayout
                    .setBackgroundColor(ContextCompat.getColor(context, R.color.whiteTextColor));
            eventosViewHolder.eventoTitle.setTypeface(null, Typeface.BOLD);
            eventosViewHolder.eventoSubtitle.setTypeface(null, Typeface.BOLD);
        } else if (eventoRead.getEventoReadStatus() == 1) {
            eventosViewHolder.eventoTitle.setTypeface(null, Typeface.NORMAL);
            eventosViewHolder.eventoSubtitle.setTypeface(null, Typeface.NORMAL);
            eventosViewHolder.cardLayout
                    .setBackground(ContextCompat.getDrawable(context, R.drawable.custom_bg));
        }

    }

    eventosViewHolder.eventoTitle.setText(evento.getTitulo());

    Disciplina disciplina = MyApplication.getWritableDatabase().disciplinaById(evento.getDisciplina());

    eventosViewHolder.eventoSubtitle.setText(disciplina.getTitulo());
    eventosViewHolder.eventoDescription.setText(evento.getDescricao());
    eventosViewHolder.eventoTimeStamp.setText(df.format(evento.getDataEventoCriado()));

    String firstLetter = String.valueOf(evento.getTitulo().charAt(0));

    ColorGenerator generator = ColorGenerator.MATERIAL;

    int color = generator.getRandomColor();

    TextDrawable drawable = TextDrawable.builder().buildRound(firstLetter, color);

    eventosViewHolder.eventoIcon.setImageDrawable(drawable);

    /*  Picasso.with(itemView.getContext())
        .load(UrlEndpoints.URL_ENDPOINT + evento.getBigIcon())
        .resize(110, 80)
        .centerCrop()
        .into(eventosViewHolder.eventoIcon);*/

    setAnimation(eventosViewHolder.cardLayout, i);

}

From source file:de.vanita5.twittnuker.adapter.DraftsAdapter.java

@Override
public void bindView(final View view, final Context context, final Cursor cursor) {
    final DraftViewHolder holder = (DraftViewHolder) view.getTag();
    final long[] accountIds = ArrayUtils.parseLongArray(cursor.getString(mIndices.account_ids), ',');
    final String text = cursor.getString(mIndices.text);
    final ParcelableMediaUpdate[] medias = ParcelableMediaUpdate
            .fromJSONString(cursor.getString(mIndices.medias));
    final long timestamp = cursor.getLong(mIndices.timestamp);
    final int actionType = cursor.getInt(mIndices.action_type);
    final String actionName = getActionName(context, actionType);
    if (actionType == Drafts.ACTION_UPDATE_STATUS) {
        final String mediaUri = medias != null && medias.length > 0 ? medias[0].uri : null;
        holder.image_preview_container.setVisibility(TextUtils.isEmpty(mediaUri) ? View.GONE : View.VISIBLE);
        if (mediaUri != null && !mediaUri.equals(mImageLoadingHandler.getLoadingUri(holder.image_preview))) {
            mImageLoader.displayPreviewImage(holder.image_preview, mediaUri, mImageLoadingHandler);
        } else {/*from w ww.  j a va2 s  . c  om*/
            mImageLoader.cancelDisplayTask(holder.image_preview);
        }
    } else {
        mImageLoader.cancelDisplayTask(holder.image_preview);

        holder.image_preview_container.setVisibility(View.GONE);
    }
    holder.content.drawEnd(getAccountColors(context, accountIds));
    holder.setTextSize(mTextSize);
    final boolean emptyContent = TextUtils.isEmpty(text);
    if (emptyContent) {
        holder.text.setText(R.string.empty_content);
    } else {
        holder.text.setText(text);
    }
    holder.text.setTypeface(holder.text.getTypeface(), emptyContent ? Typeface.ITALIC : Typeface.NORMAL);

    if (timestamp > 0) {
        final String timeString = Utils.formatSameDayTime(context, timestamp);
        holder.time.setText(context.getString(R.string.action_name_saved_at_time, actionName, timeString));
    } else {
        holder.time.setText(actionName);
    }
}

From source file:org.cm.podd.report.activity.SettingActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    sharedPrefUtil = new SharedPrefUtil(getApplicationContext());

    final Context context = this;

    setContentView(R.layout.activity_setting);

    Typeface face = StyleUtil.getDefaultTypeface(getAssets(), Typeface.NORMAL);

    final TextView userText = (TextView) findViewById(R.id.username);
    userText.setText(sharedPrefUtil.getUserName());
    userText.setTypeface(face);/*from   w w  w. ja  v a 2  s .  c om*/

    final TextView nameText = (TextView) findViewById(R.id.name);
    nameText.setText(sharedPrefUtil.getFullName());
    nameText.setTypeface(face);

    final TextView versionCodeText = (TextView) findViewById(R.id.version_code);
    versionCodeText.setText(String.valueOf(BuildConfig.VERSION_CODE));
    versionCodeText.setTypeface(face);

    final TextView versionNameText = (TextView) findViewById(R.id.version_name);
    versionNameText.setText(BuildConfig.VERSION_NAME);
    versionNameText.setTypeface(face);

    ((TextView) findViewById(R.id.username_label)).setTypeface(face);
    ((TextView) findViewById(R.id.password_label)).setTypeface(face);
    ((TextView) findViewById(R.id.app_version_code_label)).setTypeface(face);
    ((TextView) findViewById(R.id.app_version_name_label)).setTypeface(face);

    profileImageView = (ImageView) findViewById(R.id.profileImage);
    String profileImageFilePath = sharedPrefUtil.getProfileImageFilePath();
    Bitmap profileBitmap;
    if (profileImageFilePath == null) {
        // Use default profile image if not setup
        profileBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.avatar);
        profileImageView.setImageBitmap(profileBitmap);
    } else {
        if (profileImageFilePath.matches("^https?://.*")) {
            Picasso.with(this).load(profileImageFilePath).fit().centerCrop().placeholder(R.drawable.avatar)
                    .into(profileImageView);
        } else {
            profileBitmap = BitmapFactory.decodeFile(Uri.parse(profileImageFilePath).getPath());
            // use default image, if user deleted an image somehow
            if (profileBitmap == null) {
                profileBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.avatar);
            }
            profileImageView.setImageBitmap(profileBitmap);
        }
    }
    profileImageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            DialogFragment fragment = new MediaChoiceDialog();
            fragment.show(getSupportFragmentManager(), "MediaChoiceDialog");
        }
    });

    findViewById(R.id.reset_password).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(context, ResetPasswordActivity.class);
            context.startActivity(intent);
        }
    });

    FontUtil.overrideFonts(this, profileImageView.getRootView());

    Tracker tracker = ((PoddApplication) getApplication()).getTracker(PoddApplication.TrackerName.APP_TRACKER);
    tracker.setScreenName("Setting");
    tracker.send(new HitBuilders.AppViewBuilder().build());

    myToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(myToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}

From source file:org.cm.podd.report.fragment.NotificationListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    ListView listView = (ListView) view.findViewById(android.R.id.list);

    ViewGroup parent = (ViewGroup) listView.getParent();
    TextView emptyText = (TextView) getActivity().getLayoutInflater().inflate(R.layout.empty_text, null);

    emptyText.setTypeface(StyleUtil.getDefaultTypeface(getActivity().getAssets(), Typeface.NORMAL));
    emptyText.setText(R.string.no_news_update_text);
    listView.setEmptyView(emptyText);//from   w ww.  j  av a2 s.  c  o m

    emptyText.setVisibility(View.GONE);
    parent.addView(emptyText);

    return view;
}

From source file:org.mariotaku.twidere.adapter.DraftsAdapter.java

@Override
public void bindView(final View view, final Context context, final Cursor cursor) {
    final DraftViewHolder holder = (DraftViewHolder) view.getTag();
    final long[] accountIds = TwidereArrayUtils.parseLongArray(cursor.getString(mIndices.account_ids), ',');
    final String text = cursor.getString(mIndices.text);
    final ParcelableMediaUpdate[] mediaUpdates = ParcelableMediaUpdate
            .fromJSONString(cursor.getString(mIndices.media));
    final long timestamp = cursor.getLong(mIndices.timestamp);
    final int actionType = cursor.getInt(mIndices.action_type);
    final String actionName = getActionName(context, actionType);
    holder.media_preview_container.setStyle(mMediaPreviewStyle);
    if (actionType == Drafts.ACTION_UPDATE_STATUS) {
        final ParcelableMedia[] media = ParcelableMedia.fromMediaUpdates(mediaUpdates);
        holder.media_preview_container.setVisibility(View.VISIBLE);
        holder.media_preview_container.displayMedia(media, mImageLoader, -1L, null, mMediaLoadingHandler);
    } else {// w  w w  . j av  a2 s.  c o  m
        holder.media_preview_container.setVisibility(View.GONE);
    }
    holder.content.drawEnd(getAccountColors(context, accountIds));
    holder.setTextSize(mTextSize);
    final boolean emptyContent = TextUtils.isEmpty(text);
    if (emptyContent) {
        holder.text.setText(R.string.empty_content);
    } else {
        holder.text.setText(text);
    }
    holder.text.setTypeface(holder.text.getTypeface(), emptyContent ? Typeface.ITALIC : Typeface.NORMAL);

    if (timestamp > 0) {
        final String timeString = Utils.formatSameDayTime(context, timestamp);
        holder.time.setText(context.getString(R.string.action_name_saved_at_time, actionName, timeString));
    } else {
        holder.time.setText(actionName);
    }
}

From source file:org.getlantern.firetweet.adapter.DraftsAdapter.java

@Override
public void bindView(final View view, final Context context, final Cursor cursor) {
    final DraftViewHolder holder = (DraftViewHolder) view.getTag();
    final long[] accountIds = FiretweetArrayUtils.parseLongArray(cursor.getString(mIndices.account_ids), ',');
    final String text = cursor.getString(mIndices.text);
    final ParcelableMediaUpdate[] mediaUpdates = ParcelableMediaUpdate
            .fromJSONString(cursor.getString(mIndices.media));
    final long timestamp = cursor.getLong(mIndices.timestamp);
    final int actionType = cursor.getInt(mIndices.action_type);
    final String actionName = getActionName(context, actionType);
    holder.media_preview_container.setStyle(mMediaPreviewStyle);
    if (actionType == Drafts.ACTION_UPDATE_STATUS) {
        final ParcelableMedia[] media = ParcelableMedia.fromMediaUpdates(mediaUpdates);
        holder.media_preview_container.setVisibility(View.VISIBLE);
        holder.media_preview_container.displayMedia(media, mImageLoader, -1L, null, mImageLoadingHandler);
    } else {//from  w w w .  j av  a 2  s. co m
        holder.media_preview_container.setVisibility(View.GONE);
    }
    holder.content.drawEnd(getAccountColors(context, accountIds));
    holder.setTextSize(mTextSize);
    final boolean emptyContent = TextUtils.isEmpty(text);
    if (emptyContent) {
        holder.text.setText(R.string.empty_content);
    } else {
        holder.text.setText(text);
    }
    holder.text.setTypeface(holder.text.getTypeface(), emptyContent ? Typeface.ITALIC : Typeface.NORMAL);

    if (timestamp > 0) {
        final String timeString = Utils.formatSameDayTime(context, timestamp);
        holder.time.setText(context.getString(R.string.action_name_saved_at_time, actionName, timeString));
    } else {
        holder.time.setText(actionName);
    }
}

From source file:com.amazonaws.mobile.auth.userpools.SignUpView.java

/**
 * Constructs the SignUp View.// www.ja  va 2  s .  c om
 * @param context The activity context.
 * @param attrs The Attribute Set for the view from which the resources can be accessed.
 * @param defStyleAttr The resource identifier for the default style attribute.
 */
public SignUpView(final Context context, final AttributeSet attrs, final int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setOrientation(VERTICAL);

    final int backgroundColor;
    if (isInEditMode()) {
        backgroundColor = Color.DKGRAY;
    } else {
        final TypedArray styledAttributes = context.obtainStyledAttributes(attrs, R.styleable.SignUpView);
        backgroundColor = styledAttributes.getInt(R.styleable.SignUpView_signUpViewBackgroundColor,
                Color.DKGRAY);
        styledAttributes.recycle();
    }

    this.fontFamily = CognitoUserPoolsSignInProvider.getFontFamily();
    this.typeFace = Typeface.create(this.fontFamily, Typeface.NORMAL);
    this.fullScreenBackgroundColor = CognitoUserPoolsSignInProvider.isBackgroundColorFullScreen();
    this.backgroundColor = CognitoUserPoolsSignInProvider.getBackgroundColor();

    if (this.fullScreenBackgroundColor) {
        this.backgroundDrawable = new BackgroundDrawable(this.backgroundColor);
    } else {
        this.splitBackgroundDrawable = new SplitBackgroundDrawable(0, this.backgroundColor);
    }
}

From source file:edu.mecc.race2ged.helpers.Utils.java

/**
 * Sets the font of a view.//  w  w  w .ja  v a 2s.c  om
 * @param view The view that will use defined Typeface
 * @param robotoTypeFace The font typeface to use.
 */
private static void setFont(View view, Typeface robotoTypeFace) {
    setFont(view, robotoTypeFace, Typeface.NORMAL);
}