Example usage for android.graphics Typeface MONOSPACE

List of usage examples for android.graphics Typeface MONOSPACE

Introduction

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

Prototype

Typeface MONOSPACE

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

Click Source Link

Document

The NORMAL style of the default monospace typeface.

Usage

From source file:Main.java

/**
 * Initializes all necessary values. Must be called once before 
 * any other method to avoid NullPointerException.
 *//*  w  w  w  .jav a 2 s.  com*/
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:com.example.song.myapplication.logger.LogFragment.java

public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);

    mLogView = new com.example.song.myapplication.logger.LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);/*from   w  w  w .jav  a 2s .  com*/
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);

    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);

    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);

    mScrollView.addView(mLogView);
    return mScrollView;
}

From source file:in.jatindhankhar.krishi.SeedAdapter.java

@Override
public void onBindViewHolder(final SeedAdapter.ViewHolder holder, final int position) {
    //holder.companyName.setText(dataSet.get(position).companyDetails.getName());
    //holder.productName.setText(dataSet.get(position).cropDetails.getCropNames());

    String compnyName = dataSet.get(position).companyDetails.getName();
    String seedtype = dataSet.get(position).cropDetails.getCropNames();
    ColorGenerator generator = ColorGenerator.MATERIAL;
    int color = generator.getColor(compnyName.substring(0, 1));
    TextDrawable drawable1 = TextDrawable.builder().beginConfig().useFont(Typeface.MONOSPACE).bold()
            .fontSize(60).width(120).height(120).endConfig()
            .buildRoundRect(seedtype.substring(0, 1), color, 160); // radius in px
    holder.mDistrict.setText(dataSet.get(position).addressDetails.getDistrict());
    holder.mDistrict.setBackgroundColor(color);
    holder.mCompanyNameIcon.setImageDrawable(drawable1);
    holder.mCompanyName.setText(compnyName);
    holder.mBlock.setText(dataSet.get(position).addressDetails.getBlock().toString());
    holder.mSeedType.setText(dataSet.get(position).cropDetails.getCropNames());
    holder.mPersoName.setText(dataSet.get(position).contactDetails.getName());
    String phoneNumber = dataSet.get(position).contactDetails.getNumber();

    if (phoneNumber.isEmpty()) {
        holder.mPhoneNumber.setText("No number");
        holder.mPhoneIcon.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.phone_hangup));
    } else {//from  ww  w  . j  a v a 2s.com
        holder.mPhoneIcon.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_phone_default));
        holder.mPhoneNumber.setText("+91" + phoneNumber);
        //holder.mNumber.setAutoLinkMask(Linkify.PHONE_NUMBERS);
    }
    holder.mAuthorityType.setText(dataSet.get(position).licenseDetails.getMembership());
    if (holder.mView == null)
        Log.d("Yolopad", "We got null situation");
    holder.mView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mListener.seeditemInteraction(dataSet.get(position));
        }
    });
    //   holder.nameImage.setImageDrawable(drawable);
}

From source file:com.maxleap.demo.clouddata.log.LogFragment.java

public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);

    mLogView = new LogNodeView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);//from w  w  w  .  j a  v a  2s.com
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);

    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);

    mLogView.setGravity(Gravity.BOTTOM);

    mScrollView.setBackgroundColor(0XFF000000);
    mLogView.setTextColor(0XFF5394EC);

    mScrollView.addView(mLogView);
    return mScrollView;
}

From source file:com.wlz.awarenesstest.LogFragment.java

public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);

    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);// www. j av  a2s.  c  om
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);

    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);

    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_DeviceDefault_Medium);

    mScrollView.addView(mLogView);
    return mScrollView;
}

From source file:com.digiwiz.geofence.log.LogFragment.java

public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);

    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);//ww  w  . j a  v  a2s  .  co m
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);

    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);

    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Small);

    mScrollView.addView(mLogView);
    return mScrollView;
}

From source file:com.example.android.common.logger.LogFragment.java

public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);

    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);//from w  w w  .  j  a  v  a2 s. c o m
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);

    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);

    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);

    mScrollView.addView(mLogView);
    return mScrollView;
}

From source file:com.jolly.sdk.logger.LogFragment.java

public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);

    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);//from w  w w . j a  v a 2  s  .  c  o  m
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);

    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);

    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);
    mLogView.setTextSize(11);
    mScrollView.addView(mLogView);
    return mScrollView;
}

From source file:edu.vandy.mooc.aad_3_assg_2.framework.common.logger.LogFragment.java

private View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);

    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);/*w ww. jav  a  2 s  .co m*/
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);

    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);

    mLogView.setGravity(Gravity.BOTTOM);
    //noinspection deprecation
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);

    mScrollView.addView(mLogView);
    return mScrollView;
}

From source file:practices.my.countstep.logger.LogFragment.java

public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);

    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;

    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);//www  . j av a 2  s  . c  om
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);

    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 1;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);

    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);
    mLogView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, (float) 13.5);
    mScrollView.addView(mLogView);
    return mScrollView;
}