Example usage for android.graphics Typeface ITALIC

List of usage examples for android.graphics Typeface ITALIC

Introduction

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

Prototype

int ITALIC

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

Click Source Link

Usage

From source file:com.jauker.badgeview.example.ViewsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = inflater.inflate(R.layout.fragment_views, null);

    View backgroundDefaultView = layout.findViewById(R.id.backgroundDefault);
    backgroundDefaultBadge = new BadgeView(getActivity());
    backgroundDefaultBadge.setBadgeCount(42);
    backgroundDefaultBadge.setTargetView(backgroundDefaultView);

    View backgroundDrawableView = layout.findViewById(R.id.backgroundDrawable);
    backgroundDrawableBadge = new BadgeView(getActivity());
    backgroundDrawableBadge.setBadgeCount(88);
    backgroundDrawableBadge.setBackgroundResource(R.drawable.badge_blue);
    backgroundDrawableBadge.setTargetView(backgroundDrawableView);

    View backgroundShapeView = layout.findViewById(R.id.backgroundShape);
    backgroundShapeBadge = new BadgeView(getActivity());
    backgroundShapeBadge.setBadgeCount(47);
    backgroundShapeBadge.setBackground(12, Color.parseColor("#9b2eef"));
    backgroundShapeBadge.setTargetView(backgroundShapeView);

    View counterView = layout.findViewById(R.id.counter);
    counterView.setOnClickListener(this);
    counterBadge = new BadgeView(getActivity());
    counterBadge.setBadgeCount(-2);/*from w  w  w .ja  v a 2 s.  c o m*/
    counterBadge.setTargetView(counterView);

    View gravityView = layout.findViewById(R.id.gravity);
    gravityView.setOnClickListener(this);
    gravityBadge = new BadgeView(getActivity());
    gravityBadge.setBadgeGravity(Gravity.LEFT | Gravity.BOTTOM);
    gravityBadge.setBadgeCount(4);
    gravityBadge.setTargetView(gravityView);

    View textStyleView = layout.findViewById(R.id.textStyle);
    textStyleView.setOnClickListener(this);
    textStyleBadge = new BadgeView(getActivity());
    textStyleBadge.setBadgeCount(18);
    textStyleBadge.setTargetView(textStyleView);
    textStyleBadge.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.ITALIC));
    textStyleBadge.setShadowLayer(2, -1, -1, Color.GREEN);

    View visibilityView = layout.findViewById(R.id.visibility);
    visibilityView.setOnClickListener(this);
    visibilityBadgeView = new BadgeView(getActivity());
    visibilityBadgeView.setBadgeCount(1);
    visibilityBadgeView.setTargetView(visibilityView);

    return layout;
}

From source file:com.ayoview.sample.textview.badge.ViewsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = inflater.inflate(R.layout.badge_fragment_views, null);

    View backgroundDefaultView = layout.findViewById(R.id.backgroundDefault);
    backgroundDefaultBadge = new BadgeView(getActivity());
    backgroundDefaultBadge.setBadgeCount(42);
    backgroundDefaultBadge.setTargetView(backgroundDefaultView);

    View backgroundDrawableView = layout.findViewById(R.id.backgroundDrawable);
    backgroundDrawableBadge = new BadgeView(getActivity());
    backgroundDrawableBadge.setBadgeCount(88);
    backgroundDrawableBadge.setBackgroundResource(R.drawable.badge_blue);
    backgroundDrawableBadge.setTargetView(backgroundDrawableView);

    View backgroundShapeView = layout.findViewById(R.id.backgroundShape);
    backgroundShapeBadge = new BadgeView(getActivity());
    backgroundShapeBadge.setBadgeCount(47);
    backgroundShapeBadge.setBackground(12, Color.parseColor("#9b2eef"));
    backgroundShapeBadge.setTargetView(backgroundShapeView);

    View counterView = layout.findViewById(R.id.counter);
    counterView.setOnClickListener(this);
    counterBadge = new BadgeView(getActivity());
    counterBadge.setBadgeCount(-2);/*from   w  w  w. j a  va2s . c  o m*/
    counterBadge.setTargetView(counterView);

    View gravityView = layout.findViewById(R.id.gravity);
    gravityView.setOnClickListener(this);
    gravityBadge = new BadgeView(getActivity());
    gravityBadge.setBadgeGravity(Gravity.LEFT | Gravity.BOTTOM);
    gravityBadge.setBadgeCount(4);
    gravityBadge.setTargetView(gravityView);

    View textStyleView = layout.findViewById(R.id.textStyle);
    textStyleView.setOnClickListener(this);
    textStyleBadge = new BadgeView(getActivity());
    textStyleBadge.setBadgeCount(18);
    textStyleBadge.setTargetView(textStyleView);
    textStyleBadge.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.ITALIC));
    textStyleBadge.setShadowLayer(2, -1, -1, Color.GREEN);

    View visibilityView = layout.findViewById(R.id.visibility);
    visibilityView.setOnClickListener(this);
    visibilityBadgeView = new BadgeView(getActivity());
    visibilityBadgeView.setBadgeCount(1);
    visibilityBadgeView.setTargetView(visibilityView);

    return layout;
}

From source file:com.skydoves.elasticviewsexample.ElasticVIews.ElasticButton.java

private void setTypeArray(TypedArray typedArray) {
    GradientDrawable bgShape = (GradientDrawable) view.getBackground();

    round = typedArray.getInt(R.styleable.ElasticButton_button_round, round);
    bgShape.setCornerRadius(round);/* ww w . j a v  a 2 s.  c om*/

    color = typedArray.getInt(R.styleable.ElasticButton_button_backgroundColor, color);
    bgShape.setColor(color);

    scale = typedArray.getFloat(R.styleable.ElasticButton_button_scale, scale);

    duration = typedArray.getInt(R.styleable.ElasticButton_button_duration, duration);

    labelText = typedArray.getString(R.styleable.ElasticButton_button_labelText);
    view.setText(labelText);

    labelColor = typedArray.getInt(R.styleable.ElasticButton_button_labelColor, labelColor);
    view.setTextColor(labelColor);

    labelSize = typedArray.getInt(R.styleable.ElasticButton_button_labelSize, labelSize);
    view.setTextSize(labelSize);

    labelStyle = typedArray.getInt(R.styleable.ElasticButton_button_labelStyle, labelStyle);

    if (labelStyle == 0)
        view.setTypeface(null, Typeface.NORMAL);
    else if (labelStyle == 1)
        view.setTypeface(null, Typeface.BOLD);
    else if (labelStyle == 2)
        view.setTypeface(null, Typeface.ITALIC);
}

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 {//  w w  w . j a v  a2s.  c  o  m
            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:com.skydoves.elasticviewsexample.ElasticVIews.ElasticCheckButton.java

private void setTypeArray(TypedArray typedArray) {
    GradientDrawable bgShape = (GradientDrawable) view.getBackground();

    round = typedArray.getInt(R.styleable.ElasticCheckButton_checkbutton_round, round);
    bgShape.setCornerRadius(round);/*  w  ww.  j av a2 s .c  o m*/

    color = typedArray.getInt(R.styleable.ElasticCheckButton_checkbutton_backgroundColor, color);
    bgShape.setColor(color);

    scale = typedArray.getFloat(R.styleable.ElasticCheckButton_checkbutton_scale, scale);

    duration = typedArray.getInt(R.styleable.ElasticCheckButton_checkbutton_duration, duration);

    labelText = typedArray.getString(R.styleable.ElasticCheckButton_checkbutton_labelText);
    view.setText(labelText);

    labelColor = typedArray.getInt(R.styleable.ElasticCheckButton_checkbutton_labelColor, labelColor);
    view.setTextColor(labelColor);

    labelSize = typedArray.getInt(R.styleable.ElasticCheckButton_checkbutton_labelSize, labelSize);
    view.setTextSize(labelSize);

    labelStyle = typedArray.getInt(R.styleable.ElasticCheckButton_checkbutton_labelStyle, labelStyle);

    if (labelStyle == 0)
        view.setTypeface(null, Typeface.NORMAL);
    else if (labelStyle == 1)
        view.setTypeface(null, Typeface.BOLD);
    else if (labelStyle == 2)
        view.setTypeface(null, Typeface.ITALIC);

    alpha = typedArray.getFloat(R.styleable.ElasticCheckButton_checkbutton_alpha, alpha);

    checked = typedArray.getBoolean(R.styleable.ElasticCheckButton_checkbutton_ischecked, checked);
    if (checked)
        view.setAlpha(alpha);
}

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 {//from  w  w w .j a v  a  2s  .  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: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.jav a2 s .c om
        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.npr.android.news.NewsListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = inflater.inflate(R.layout.news_item, parent, false);
    }//  w w w . j  a v  a  2 s  . c  o  m

    Story story = getItem(position);

    ImageView image = (ImageView) convertView.findViewById(R.id.NewsItemImage);
    TextView teaser = (TextView) convertView.findViewById(R.id.NewsItemTeaserText);
    TextView name = (TextView) convertView.findViewById(R.id.NewsItemNameText);

    if (story != null) {
        image.setImageDrawable(getContext().getResources()
                .getDrawable(isPlayable(story) ? R.drawable.icon_listen_main : R.drawable.bullet));
        image.setVisibility(View.VISIBLE);
        name.setTypeface(headlineTypeface, Typeface.NORMAL);
        name.setText(story.toString());
        String teaserText = story.getMiniTeaser();
        if (teaserText == null) {
            teaserText = story.getTeaser();
        }
        if (teaserText != null && teaserText.length() > 0) {
            // Disable for now.
            //        teaser.setText(story.getTeaser());
            //        teaser.setVisibility(View.VISIBLE);
        } else {
            teaser.setVisibility(View.INVISIBLE);
        }
        teaser.setVisibility(View.GONE);
    } else {
        // null marker means it's the end of the list.
        image.setVisibility(View.INVISIBLE);
        teaser.setVisibility(View.INVISIBLE);
        name.setTypeface(Typeface.SANS_SERIF, Typeface.ITALIC);
        name.setText(R.string.msg_load_more);
    }
    return convertView;
}

From source file:widgets.Graphical_Trigger.java

public Graphical_Trigger(tracerengine Trac, Activity context, String address, String name, int id, int dev_id,
        String stat_key, String url, String usage, String parameters, String model_id, int widgetSize,
        int session_type, int place_id, String place_type, SharedPreferences params) throws JSONException {
    super(context, Trac, id, name, "", usage, widgetSize, session_type, place_id, place_type, mytag, container);
    this.address = address;
    this.Tracer = Trac;
    this.url = url;
    this.id = id;
    this.context = context;
    this.usage = usage;
    this.myself = this;
    this.session_type = session_type;
    this.dev_id = dev_id;
    this.place_id = place_id;
    this.place_type = place_type;
    mytag = "Graphical_Trigger(" + dev_id + ")";
    this.params = params;
    login = params.getString("http_auth_username", null);
    password = params.getString("http_auth_password", null);

    //get parameters
    JSONObject jparam = new JSONObject(parameters.replaceAll(""", "\""));

    if (jparam != null) {
        try {// w  w w. j a v a2s .  com
            command = jparam.getString("command");
            usable = true;
        } catch (Exception e) {
            usable = false;
            e.printStackTrace();
        }
    }

    String[] model = model_id.split("\\.");
    type = model[0];

    //first seekbar on/off
    trigger = new Graphical_Trigger_Button(context);
    trigger.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT));
    trigger.setOnClickListener(this);

    //unusable
    unusable = new TextView(context);
    unusable.setText(R.string.unusable);
    unusable.setTypeface(Typeface.defaultFromStyle(Typeface.ITALIC));
    unusable.setTextColor(Color.BLACK);
    unusable.setTextSize(14);
    unusable.setPadding(0, 0, 15, 0);

    if (usable == true) {
        LL_featurePan.addView(trigger);
    } else {
        LL_featurePan.addView(unusable);
    }

}

From source file:com.dmbstream.android.adapter.ConcertListAdapter.java

@Override
public View getView(final int position, View convertView, final ViewGroup parent) {

    if (convertView == null) {
        convertView = inflater.inflate(R.layout.partial_concert_list_item, parent, false);
    }/*ww w  .  ja v a 2  s  .c  o  m*/

    Concert concert = getItem(position);

    TextView date = (TextView) convertView.findViewById(R.id.ConcertItemDate);
    TextView artist = (TextView) convertView.findViewById(R.id.ConcertItemArtist);
    TextView name = (TextView) convertView.findViewById(R.id.ConcertItemName);

    if (concert != null) {

        Date d = new Date(concert.date.getTimeInMillis());
        DateFormat shortDateFormat = new SimpleDateFormat("yyyy-MM-dd");

        date.setText(shortDateFormat.format(d));
        artist.setText(concert.artistAbbreviation);
        name.setText(concert.name);

        // Need to (re)set this because the views are reused. If we don't
        // then
        // while scrolling, some items will replace the old
        // "Load more concerts"
        // view and will be in italics
        name.setTypeface(name.getTypeface(), Typeface.BOLD);
        date.setVisibility(View.VISIBLE);
        artist.setVisibility(View.VISIBLE);
    } else {
        // null marker means it's the end of the list.
        name.setTypeface(name.getTypeface(), Typeface.ITALIC);
        name.setText(R.string.msg_load_more_concerts);
        date.setVisibility(View.GONE);
        artist.setVisibility(View.GONE);
    }

    return convertView;
}