Example usage for android.graphics Typeface DEFAULT_BOLD

List of usage examples for android.graphics Typeface DEFAULT_BOLD

Introduction

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

Prototype

Typeface DEFAULT_BOLD

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

Click Source Link

Document

The default BOLD typeface object.

Usage

From source file:biz.wiz.android.wallet.ui.PeerListFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    adapter = new ArrayAdapter<Peer>(activity, 0) {
        private final LayoutInflater inflater = LayoutInflater.from(activity);

        @Override/*  w w  w.  jav a  2s.  c o  m*/
        public View getView(final int position, View row, final ViewGroup parent) {
            if (row == null)
                row = inflater.inflate(R.layout.peer_list_row, null);

            final Peer peer = getItem(position);
            final VersionMessage versionMessage = peer.getPeerVersionMessage();
            final boolean isDownloading = peer.getDownloadData();

            final TextView rowIp = (TextView) row.findViewById(R.id.peer_list_row_ip);
            final InetAddress address = peer.getAddress().getAddr();
            final String hostname = hostnames.get(address);
            rowIp.setText(hostname != null ? hostname : address.getHostAddress());

            final TextView rowHeight = (TextView) row.findViewById(R.id.peer_list_row_height);
            final long bestHeight = peer.getBestHeight();
            rowHeight.setText(bestHeight > 0 ? bestHeight + " blocks" : null);
            rowHeight.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);

            final TextView rowVersion = (TextView) row.findViewById(R.id.peer_list_row_version);
            rowVersion.setText(versionMessage.subVer);
            rowVersion.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);

            final TextView rowProtocol = (TextView) row.findViewById(R.id.peer_list_row_protocol);
            rowProtocol.setText("protocol: " + versionMessage.clientVersion);
            rowProtocol.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);

            final TextView rowPing = (TextView) row.findViewById(R.id.peer_list_row_ping);
            final long pingTime = peer.getPingTime();
            rowPing.setText(
                    pingTime < Long.MAX_VALUE ? getString(R.string.peer_list_row_ping_time, pingTime) : null);
            rowPing.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);

            return row;
        }

        @Override
        public boolean isEnabled(final int position) {
            return false;
        }
    };
    setListAdapter(adapter);
}

From source file:cc.mintcoin.wallet.ui.PeerListFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    adapter = new ArrayAdapter<Peer>(activity, 0) {
        @Override/*from w  ww  .  j ava2  s .  co  m*/
        public View getView(final int position, View row, final ViewGroup parent) {
            if (row == null)
                row = getLayoutInflater(null).inflate(R.layout.peer_list_row, null);

            final Peer peer = getItem(position);
            final VersionMessage versionMessage = peer.getPeerVersionMessage();
            final boolean isDownloading = peer.getDownloadData();

            final TextView rowIp = (TextView) row.findViewById(R.id.peer_list_row_ip);
            final InetAddress address = peer.getAddress().getAddr();
            final String hostname = hostnames.get(address);
            rowIp.setText(hostname != null ? hostname : address.getHostAddress());

            final TextView rowHeight = (TextView) row.findViewById(R.id.peer_list_row_height);
            final long bestHeight = peer.getBestHeight();
            rowHeight.setText(bestHeight > 0 ? bestHeight + " blocks" : null);
            rowHeight.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);

            final TextView rowVersion = (TextView) row.findViewById(R.id.peer_list_row_version);
            rowVersion.setText(versionMessage.subVer);
            rowVersion.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);

            final TextView rowProtocol = (TextView) row.findViewById(R.id.peer_list_row_protocol);
            rowProtocol.setText("protocol: " + versionMessage.clientVersion);
            rowProtocol.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);

            final TextView rowPing = (TextView) row.findViewById(R.id.peer_list_row_ping);
            final long pingTime = peer.getPingTime();
            rowPing.setText(
                    pingTime < Long.MAX_VALUE ? getString(R.string.peer_list_row_ping_time, pingTime) : null);
            rowPing.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);

            return row;
        }

        @Override
        public boolean isEnabled(final int position) {
            return false;
        }
    };
    setListAdapter(adapter);
}

From source file:org.borderstone.tagtags.TTStartActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.setTheme(R.style.AppTheme);
    this.setContentView(R.layout.activity_start);

    Toolbar toolbar = (Toolbar) this.findViewById(R.id.toolbar);
    //toolbar.inflateMenu(R.menu.menu_start);
    toolbar.setTitle("TagTags");

    toolbar.setVisibility(View.VISIBLE);

    TTStartActivity.me = getApplicationContext();

    protocol.setAction("android.intent.action.PROTOCOL");
    settings.setAction("android.intent.action.SETTINGS");

    Constants.init(new File(this.getFilesDir(), "bsettings.txt"), this.getApplicationContext());
    Constants.fileListener = this;

    /*Load variables that are stored in a text file
      keeping version info and info about third party
      resources here, for easy editing*/
    try {/*from  w  ww  .j  a  va 2  s.  c  om*/
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(this.getResources().openRawResource(R.raw.appinfo)));

        String line = reader.readLine();

        String[] t;
        while (line != null) {
            t = line.split(":");
            if (line.startsWith("#thirdparty:"))
                thirdparty += t[1] + "\n";
            else if (line.startsWith("#recentchanges:"))
                recentchanges += "-- " + t[1] + "\n";

            line = reader.readLine();
        }

        //just to remove the final new line.
        if (!thirdparty.equals(""))
            thirdparty = thirdparty.substring(0, thirdparty.length() - 1);
        if (!recentchanges.equals(""))
            recentchanges = recentchanges.substring(0, recentchanges.length() - 1);
    } catch (Exception ignored) {
    }

    //Most of the code below is purely for aesthetics!

    txtPhilosophy = new BTitleLabel(this);
    txtPhilosophy.setTypeface(Typeface.DEFAULT_BOLD);
    txtPhilosophy.setLayoutParams(Constants.defaultParams);
    txtPhilosophy.setOnClickListener(this);
    txtPhilosophy.setTextColor(Color.BLACK);

    txtVersion = new BStandardLabel(this);
    txtVersion.setText("Recent changes:\n" + recentchanges);
    txtVersion.setLayoutParams(Constants.defaultParams);
    txtVersion.setTextColor(Color.BLACK);

    try {
        PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        toolbar.setSubtitle("v. " + pInfo.versionName);
    } catch (PackageManager.NameNotFoundException ignored) {
    }

    toolbar.setNavigationIcon(R.drawable.drawer);

    ImageView slu = new ImageView(this);
    ImageView sites = new ImageView(this);

    slu.setImageResource(R.drawable.slulogo);
    sites.setImageResource(R.drawable.sites);

    LinearLayout llLogos = new LinearLayout(this);
    llLogos.setOrientation(LinearLayout.HORIZONTAL);
    llLogos.setGravity(Gravity.END | Gravity.CENTER_VERTICAL);

    llLogos.addView(slu);
    llLogos.addView(sites);

    setPhiloText();

    LinearLayout back = (LinearLayout) this.findViewById(R.id.back);
    back.setOrientation(LinearLayout.VERTICAL);

    txtPhilosophy.setLayoutParams(Constants.defaultParams);
    txtPhilosophy.setBackgroundResource(R.drawable.border);

    txtVersion.setLayoutParams(Constants.defaultParams);
    txtVersion.setBackgroundResource(R.drawable.border_recurring);

    back.addView(txtPhilosophy);
    back.addView(txtVersion);
    back.addView(llLogos);

    lblSettings = new BButton(this);
    lblDownload = new BButton(this);

    lblDownload.setIcon(R.drawable.download);
    lblSettings.setIcon(R.drawable.settings);

    lblSettings.setText("Settings");
    lblDownload.setText("Download from server");

    lblSettings.setOnClickListener(this);
    lblDownload.setOnClickListener(this);

    if (!checkPermissions()) {
        final Intent intro = new Intent();
        intro.setAction("android.intent.action.INTRO");

        this.startActivity(intro);
    }

    BTitleLabel lblProperties = new BTitleLabel(this);
    BTitleLabel lblLocal = new BTitleLabel(this);
    fileNavView = new BFileNavView(this, this);

    lblProperties.setTextSize(Constants.fontSize + 2);
    lblLocal.setTextSize(Constants.fontSize + 2);

    lblProperties.setText("PROPERTIES");
    lblProperties.setTextColor(Color.WHITE);
    lblProperties.setGravity(Gravity.CENTER);
    lblLocal.setText("LOCAL FILES");
    lblLocal.setTextColor(Color.WHITE);
    lblLocal.setGravity(Gravity.CENTER);

    final DrawerLayout drawerLayout = (DrawerLayout) this.findViewById(R.id.startDrawerLayout);
    final LinearLayout drawer = (LinearLayout) this.findViewById(R.id.drawer);
    drawer.setClickable(false);
    drawer.bringToFront();

    drawer.addView(lblProperties);
    drawer.addView(lblDownload);
    drawer.addView(lblSettings);
    drawer.addView(lblLocal);
    drawer.addView(fileNavView);

    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!drawerLayout.isDrawerOpen(Gravity.LEFT))
                drawerLayout.openDrawer(Gravity.LEFT);
            else
                drawerLayout.closeDrawer(Gravity.LEFT);
        }
    });
}

From source file:com.cannabiscoin.wallet.ui.PeerListFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    adapter = new ArrayAdapter<Peer>(activity, 0) {
        @Override//from  www.jav a  2s  .c o  m
        public View getView(final int position, View row, final ViewGroup parent) {
            if (row == null)
                row = getLayoutInflater(null).inflate(R.layout.peer_list_row, null);

            final Peer peer = getItem(position);
            final VersionMessage versionMessage = peer.getPeerVersionMessage();
            final boolean isDownloading = peer.getDownloadData();

            final TextView rowIp = (TextView) row.findViewById(R.id.peer_list_row_ip);
            final InetAddress address = peer.getAddress().getAddr();
            final String hostname = hostnames.get(address);
            rowIp.setText(/*address.toString()*/hostname != null ? hostname : address.getHostAddress());

            final TextView rowHeight = (TextView) row.findViewById(R.id.peer_list_row_height);
            final long bestHeight = peer.getBestHeight();
            rowHeight.setText(bestHeight > 0 ? bestHeight + " blocks" : null);
            rowHeight.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);

            final TextView rowVersion = (TextView) row.findViewById(R.id.peer_list_row_version);
            rowVersion.setText(versionMessage.subVer);
            rowVersion.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);

            final TextView rowProtocol = (TextView) row.findViewById(R.id.peer_list_row_protocol);
            rowProtocol.setText("protocol: " + versionMessage.clientVersion);
            rowProtocol.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);

            final TextView rowPing = (TextView) row.findViewById(R.id.peer_list_row_ping);
            final long pingTime = peer.getPingTime();
            rowPing.setText(
                    pingTime < Long.MAX_VALUE ? getString(R.string.peer_list_row_ping_time, pingTime) : null);
            rowPing.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);

            return row;
        }

        @Override
        public boolean isEnabled(final int position) {
            return false;
        }
    };
    setListAdapter(adapter);
}

From source file:com.android.design.material.widgets.SlidingTabLayout.java

/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}./*w  w  w .j  a v a2  s.c o  m*/
 */
protected TextView createDefaultTabView(Context context) {
    final TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTabTextViewSize);
    textView.setTypeface(Typeface.DEFAULT_BOLD);
    textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    final TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
    textView.setBackgroundResource(outValue.resourceId);
    textView.setAllCaps(true);
    final int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

From source file:dev.drsoran.moloko.fragments.TagCloudFragment.java

private void showTagCloudEntries(final List<TagCloudEntry> cloudEntries) {
    final Activity activity = getSherlockActivity();

    // Sort all cloud entries by their name
    Collections.sort(cloudEntries);

    final int size = cloudEntries.size();
    final List<Button> buttons = new ArrayList<Button>(size);

    for (int i = 0; i < size; ++i) {
        final TagCloudEntry cloudEntry = cloudEntries.get(i);

        final Button cloudEntryButton = new Button(activity);
        cloudEntryButton.setId(i);/*  w ww. ja v  a2  s  .c  om*/
        cloudEntryButton.setText(cloudEntry.name);
        cloudEntryButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * getMagnifyFactor(cloudEntry.count));

        cloudEntry.present(cloudEntryButton);
        cloudEntry.setTagCloudFragmentListener(listener);

        if (cloudEntry.count > 1) {
            cloudEntryButton.setTypeface(Typeface.DEFAULT_BOLD);
        }

        buttons.add(cloudEntryButton);
    }

    final ViewGroup tagContainer = (ViewGroup) activity.findViewById(R.id.tagcloud_container);

    addButtons(buttons, tagContainer);
}

From source file:com.example.fugro.SlidingTabLayout.java

/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}./*from   w w  w  . j  a v  a 2 s.  co  m*/
 */
protected TextView createDefaultTabView(Context context) {
    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
    textView.setTypeface(Typeface.DEFAULT_BOLD);
    textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
    textView.setBackgroundResource(outValue.resourceId);
    // textView.setAllCaps(true);

    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);

    return textView;
}

From source file:com.metinkale.prayerapp.vakit.PrefsView.java

@Override
public void draw(Canvas canvas) {
    super.draw(canvas);
    canvas.scale(0.8f, 0.8f, canvas.getWidth() / 2, canvas.getHeight() / 2);
    Object o = getValue();/*from w w w .  ja v a  2s.  c o m*/
    boolean active = ((o instanceof Boolean) && o.equals(true)) || ((o instanceof Integer) && !o.equals(0))
            || ((o instanceof String) && !((String) o).startsWith("silent"));
    if (mPref == Pref.Vibration2) {
        active = !o.equals(-1);
    }
    mPaint.setColor(active ? 0xff03A9F4 : 0xffe0e0e0);
    int w = getHeight();
    canvas.drawCircle(w / 2, w / 2, w / 2, mPaint);

    int p = w / 7;
    mDrawable.setBounds(p, p, w - p, w - p);
    mDrawable.setColorFilter(active ? sCFActive : sCFInactive);
    mDrawable.draw(canvas);

    if ((mPref == Pref.Time) || (mPref == Pref.SabahTime) || (mPref == Pref.Silenter)) {
        int s = (Integer) getValue();

        if (s != 0) {
            mPaint.setColor(getResources().getColor(R.color.colorPrimaryDark));
            canvas.drawCircle(getWidth() * 0.78f, getHeight() * 0.78f, getWidth() / 4, mPaint);
            mPaint.setColor(Color.WHITE);
            mPaint.setTextAlign(Align.CENTER);
            mPaint.setTextSize(w / 5);
            mPaint.setTypeface(Typeface.DEFAULT_BOLD);
            canvas.drawText(s + "", w * 0.78f, w * 0.87f, mPaint);
        }
    } else if (mPref == Pref.Vibration2)

    {
        int s = (Integer) getValue();
        String txt = "";
        if (s == 0) {
            txt = "8";
        } else if (s == 1) {
            txt = "1";
        }
        mPaint.setColor(Color.BLACK);
        mPaint.setTextAlign(Align.CENTER);
        mPaint.setTextSize(w / 2);
        mPaint.setTypeface(Typeface.DEFAULT_BOLD);
        if (s == 0) {
            canvas.rotate(90, canvas.getWidth() / 2, canvas.getHeight() / 2);
            canvas.drawText(txt, w / 2, (w * 2) / 3, mPaint);
            canvas.rotate(-90, canvas.getWidth() / 2, canvas.getHeight() / 2);
        } else {
            canvas.drawText(txt, w / 2, w * 2 / 3, mPaint);
        }
    }
}

From source file:com.google.android.apps.santatracker.doodles.pursuit.PursuitFragment.java

@Override
protected void firstPassLoadOnUiThread() {
    wrapper.setOnTouchListener(new View.OnTouchListener() {
        @Override//from  w  w  w. j a v a  2 s .  c o m
        public boolean onTouch(View v, MotionEvent event) {
            return onTouchEvent(event);
        }
    });

    countdownView = new TextView(context);
    countdownView.setGravity(Gravity.CENTER);
    countdownView.setTextColor(context.getResources().getColor(R.color.ui_text_yellow));
    countdownView.setTypeface(Typeface.DEFAULT_BOLD);
    countdownView.setText("0");
    countdownView.setVisibility(View.INVISIBLE);
    Locale locale = context.getResources().getConfiguration().locale;
    countdownView.setText(NumberFormat.getInstance(locale).format(3));
    Point screenDimens = AndroidUtils.getScreenSize();
    UIUtil.fitToBounds(countdownView, screenDimens.x / 10, screenDimens.y / 10);

    final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.MATCH_PARENT);
    gameView = new PursuitView(context);
    wrapper.addView(gameView, 0, lp);

    wrapper.addView(countdownView, 1, lp);
    scoreView = getScoreView();
    wrapper.addView(scoreView, 2, lp);
    pauseView = getPauseView();
    pauseView.hidePauseButton();
    wrapper.addView(pauseView, 3, lp);
}

From source file:id.bizdir.ui.widget.SlidingTabLayout.java

/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}./*from   www .  j  a v a  2  s . c  om*/
 */
protected TextView createDefaultTabView(Context context) {
    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
    textView.setTypeface(Typeface.DEFAULT_BOLD);
    textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

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

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        textView.setAllCaps(true);
    } else {
        textView.setTransformationMethod(true ? AllCapsTransformationMethodCompat.getInstance() : null);
    }

    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);

    return textView;
}