Example usage for android.graphics Typeface create

List of usage examples for android.graphics Typeface create

Introduction

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

Prototype

public static Typeface create(Typeface family, @Style int style) 

Source Link

Document

Create a typeface object that best matches the specified existing typeface and the specified Style.

Usage

From source file:Main.java

/**
 * Bold font.
 * 
 * @return the typeface
 */
public static Typeface boldFont() {
    return Typeface.create("sans-serif-condensed", 0);
}

From source file:Main.java

/**
 * Light font.
 * 
 * @return the typeface
 */
public static Typeface lightFont() {
    return Typeface.create("sans-serif-light", 0);
}

From source file:Main.java

/**
 * Initializes all necessary values. Must be called once before 
 * any other method to avoid NullPointerException.
 *///from   w  w w . java 2  s.c o m
public static void init() {

    // initialize all booleans to true
    draw_help = true;
    draw_aim = true;
    draw_shields = true;
    draw_battery = true;
    draw_controls = true;
    draw_stats = true;
    draw_btns = true;

    // Initialize all Paints and set as much information as possible without
    // access to resources
    titlePaint = new Paint();
    titlePaint.setTextAlign(Align.LEFT);

    textPaint = new Paint();
    textPaint.setTextAlign(Align.LEFT);
    textPaint.setTypeface(Typeface.create(Typeface.MONOSPACE, Typeface.NORMAL));
    textPaint.setAntiAlias(true);

    fieldPaint = new Paint();

    highlightPaint = new Paint();
    highlightPaint.setStyle(Paint.Style.FILL);
    highlightPaint.setAntiAlias(true);

    arrowPaint = new Paint();
    arrowPaint.setStyle(Paint.Style.FILL_AND_STROKE);
    arrowPaint.setStrokeWidth(3);
    arrowPaint.setAntiAlias(true);

    controlPaint = new Paint();
    controlPaint.setStyle(Paint.Style.STROKE);
    controlPaint.setStrokeWidth(5);

    bitmapPaint = new Paint();
    bitmapPaint = new Paint();
    bitmapPaint.setStrokeWidth(10);
    bitmapPaint.setFilterBitmap(true);
    bitmapPaint.setAntiAlias(true);
}

From source file:net.networksaremadeofstring.rhybudd.EventsListWelcomeFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.events_list_welcome_fragment, null);
    ((TextView) view.findViewById(R.id.WelcomeTitle))
            .setTypeface(Typeface.create("sans-serif-light", Typeface.NORMAL));
    ((TextView) view.findViewById(R.id.EventsListWelcomeIntro))
            .setTypeface(Typeface.create("sans-serif", Typeface.NORMAL));
    return view;//from w  ww.  j a  v a 2  s  .  c o m
}

From source file:com.fjoglar.etsitnoticias.utils.UiUtils.java

/**
 * Configure the TextViews that will show the attachments of the new.
 *
 * @param textView      TextView to be configured.
 * @param title         Text shown in TextView
 * @param downloadLink  Link attached to TextView.
 * @param fileType      Type of file of the attachment.
 * @param context       The context of activity.
 *//*from  w w  w.j  av a2s.c  o  m*/
public static void configureTextView(TextView textView, String title, final String downloadLink,
        Attachment.FILE_TYPE fileType, final Context context) {

    final int TEXT_VIEW_MIN_HEIGHT = 40;
    final int TEXT_VIEW_MARGIN_TOP = 4;

    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    params.setMargins(0, convertDpToPx(TEXT_VIEW_MARGIN_TOP, context), 0, 0);
    textView.setLayoutParams(params);

    textView.setText(title);
    textView.setTypeface(Typeface.create("sans-serif-condensed", Typeface.NORMAL));
    textView.setMinHeight(convertDpToPx(TEXT_VIEW_MIN_HEIGHT, context));
    textView.setGravity(Gravity.CENTER_VERTICAL);

    switch (fileType) {
    case FILE:
        textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_file, 0, 0, 0);
        break;
    case IMAGE:
        textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_photo, 0, 0, 0);
        break;
    case FOLDER:
        textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_folder, 0, 0, 0);
        break;
    default:
        textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_link, 0, 0, 0);
        break;
    }

    textView.setCompoundDrawablePadding(convertDpToPx(4, context));

    TypedValue typedValue = new TypedValue();
    context.getTheme().resolveAttribute(android.R.attr.selectableItemBackground, typedValue, true);
    textView.setBackgroundResource(typedValue.resourceId);

    textView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Navigator.getInstance().openUrl(context, downloadLink);
        }
    });
}

From source file:app.hacked.ChallengeWelcomeFragment.java

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

    ((TextView) view.findViewById(R.id.Title)).setTypeface(Typeface.create("sans-serif-thin", Typeface.NORMAL));
    ((TextView) view.findViewById(R.id.publicChoiceTitle))
            .setTypeface(Typeface.create("sans-serif-thin", Typeface.NORMAL));
    ((TextView) view.findViewById(R.id.judgeTitle))
            .setTypeface(Typeface.create("sans-serif-thin", Typeface.NORMAL));
    return view;//from www .  j av  a 2s  .co m
}

From source file:io.github.hidroh.materialistic.widget.PeekabooTouchHelperCallback.java

PeekabooTouchHelperCallback(Context context) {
    super(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT);
    mDefaultTextColor = ContextCompat.getColor(context,
            AppUtils.getThemedResId(context, android.R.attr.textColorPrimary));
    mPaint.setTextSize(context.getResources().getDimensionPixelSize(R.dimen.text_size_small));
    mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
    mPadding = context.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin);
}

From source file:app.hacked.ScheduleWelcomeFragment.java

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

    ((TextView) view.findViewById(R.id.Title)).setTypeface(Typeface.create("sans-serif-thin", Typeface.NORMAL));

    ((TextView) view.findViewById(R.id.Welcome)).setText(Html.fromHtml(getString(R.string.ScheduleWelcome)));
    ((TextView) view.findViewById(R.id.Welcome)).setTypeface(Typeface.create("sans-serif", Typeface.NORMAL));

    Log.e("html", getString(R.string.ScheduleWelcome));

    return view;/*from www  .j av a 2s  .c  om*/
}

From source file:app.hacked.ProjectWelcomeFragment.java

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

    ((TextView) view.findViewById(R.id.Title)).setTypeface(Typeface.create("sans-serif-thin", Typeface.NORMAL));

    ((ImageButton) view.findViewById(R.id.addProjectButton)).setOnClickListener(new View.OnClickListener() {
        @Override//from  w w w.j a  v  a2s  . c o m
        public void onClick(View view) {
            startActivity(new Intent(Intent.ACTION_VIEW,
                    Uri.parse("https://www.hackerleague.org/hackathons/hacked/hacks")));
            /*if (getActivity().findViewById(R.id.ProjectDetails) != null)
            {
            AddProjectFragment fragment = new AddProjectFragment();
            getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.ProjectDetails, fragment).commit();
            }
            else
            {
            Intent addProjectIntent = new Intent(getActivity(), AddProjectActivity.class);
            startActivity(addProjectIntent);
            }*/
        }
    });

    return view;
}

From source file:app.philm.in.util.TypefaceManager.java

public Typeface getRobotoLight() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        return Typeface.create(ROBOTO_LIGHT_NATIVE_FONT_FAMILY, Typeface.NORMAL);
    }//w w  w .j a  v  a2s .c om
    return getTypeface(ROBOTO_LIGHT_FILENAME);
}