Example usage for android.graphics Typeface DEFAULT

List of usage examples for android.graphics Typeface DEFAULT

Introduction

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

Prototype

Typeface DEFAULT

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

Click Source Link

Document

The default NORMAL typeface object

Usage

From source file:com.module.candychat.net.wouclass.CaseInsensitiveAssetFontLoader.java

@Override
public Typeface getTypeFace(String typefaceName) {
    String lowerTypefaceName = typefaceName.toLowerCase();
    Typeface typeface = sTypefaceCache.get(lowerTypefaceName);

    if (typeface == null) {
        String fontFile = mTypefacenameMapping.get(lowerTypefaceName);

        try {/*from   w  ww . j  av a 2  s .co  m*/
            typeface = Typeface.createFromAsset(mAssetManager, fontFile);
            sTypefaceCache.put(lowerTypefaceName, typeface);
            sTypefaceCache555.put(typeface, typefaceName);
        } catch (java.lang.RuntimeException e) {
            return android.graphics.Typeface.DEFAULT;
        }

    }
    return typeface;
}

From source file:com.miz.mizuu.fragments.AccountsFragment.java

@Override
public void onViewCreated(View v, Bundle savedInstanceState) {
    super.onViewCreated(v, savedInstanceState);

    traktUser = (EditText) v.findViewById(R.id.traktUsername);
    traktUser.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

    traktPass = (EditText) v.findViewById(R.id.traktPassword);
    traktPass.setTypeface(Typeface.DEFAULT);
    traktPass.setTransformationMethod(new PasswordTransformationMethod());

    traktLogIn = (Button) v.findViewById(R.id.traktLogIn);
    traktLogIn.setOnClickListener(new OnClickListener() {
        @Override//  w ww  .j av  a  2 s  . co m
        public void onClick(View v) {
            new TraktLogin().execute();
        }
    });
    traktRemoveAccount = (Button) v.findViewById(R.id.traktRemoveAccount);
    traktRemoveAccount.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            traktRemove();
        }
    });
    traktSyncNow = (Button) v.findViewById(R.id.traktSyncNow);
    traktSyncNow.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            getActivity().startService(new Intent(getActivity(), TraktMoviesSyncService.class));
            getActivity().startService(new Intent(getActivity(), TraktTvShowsSyncService.class));
        }
    });

    syncTrakt = (CheckBox) v.findViewById(R.id.syncTrakt);
    syncTrakt.setChecked(settings.getBoolean(SYNC_WITH_TRAKT, true));
    syncTrakt.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Editor editor = settings.edit();
            editor.putBoolean(SYNC_WITH_TRAKT, isChecked);
            editor.apply();
        }
    });

    traktUser.setText(settings.getString(TRAKT_USERNAME, ""));
    if (TextUtils.isEmpty(settings.getString(TRAKT_PASSWORD, ""))) {
        traktPass.setText("");
        traktUser.setEnabled(true);
        traktPass.setEnabled(true);
        traktLogIn.setVisibility(View.VISIBLE);
        traktSyncNow.setVisibility(View.GONE);
        traktRemoveAccount.setVisibility(View.GONE);
        syncTrakt.setVisibility(View.GONE);
        syncTrakt.setChecked(false);
    } else {
        traktPass.setText("password");
        traktUser.setEnabled(false);
        traktPass.setEnabled(false);
        traktLogIn.setVisibility(View.GONE);
        traktSyncNow.setVisibility(View.VISIBLE);
        traktRemoveAccount.setVisibility(View.VISIBLE);
        syncTrakt.setVisibility(View.VISIBLE);
        ;
    }
}

From source file:biz.wiz.android.wallet.util.ViewPagerTabs.java

@Override
protected void onDraw(final Canvas canvas) {
    super.onDraw(canvas);

    final int viewWidth = getWidth();
    final int viewHalfWidth = viewWidth / 2;
    final int viewBottom = getHeight();

    final float density = getResources().getDisplayMetrics().density;
    final float spacing = 32 * density;

    path.reset();//from w w  w .j a  va2 s.c om
    path.moveTo(viewHalfWidth, viewBottom - 5 * density);
    path.lineTo(viewHalfWidth + 5 * density, viewBottom);
    path.lineTo(viewHalfWidth - 5 * density, viewBottom);
    path.close();

    paint.setColor(Color.WHITE);
    canvas.drawPath(path, paint);

    paint.setTypeface(Typeface.DEFAULT_BOLD);
    final float y = getPaddingTop() + -paint.getFontMetrics().top;

    for (int i = 0; i < labels.size(); i++) {
        final String label = labels.get(i);

        paint.setTypeface(i == pagePosition ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
        paint.setColor(i == pagePosition ? Color.BLACK : Color.DKGRAY);

        final float x = viewHalfWidth + (maxWidth + spacing) * (i - pageOffset);
        final float labelWidth = paint.measureText(label);
        final float labelHalfWidth = labelWidth / 2;

        final float labelLeft = x - labelHalfWidth;
        final float labelVisibleLeft = labelLeft >= 0 ? 1f : 1f - (-labelLeft / labelWidth);

        final float labelRight = x + labelHalfWidth;
        final float labelVisibleRight = labelRight < viewWidth ? 1f
                : 1f - ((labelRight - viewWidth) / labelWidth);

        final float labelVisible = Math.min(labelVisibleLeft, labelVisibleRight);

        paint.setAlpha((int) (labelVisible * 255));

        canvas.drawText(label, labelLeft, y, paint);
    }
}

From source file:com.kncwallet.wallet.util.ViewPagerTabs.java

@Override
protected void onDraw(final Canvas canvas) {
    super.onDraw(canvas);

    final int viewWidth = getWidth();
    final int viewHalfWidth = viewWidth / 2;
    final int viewBottom = getHeight();

    final float density = getResources().getDisplayMetrics().density;
    final float spacing = 32 * density;

    path.reset();/*from  w  w  w  . j  av a 2 s  . co  m*/
    path.moveTo(viewHalfWidth, viewBottom - 5 * density);
    path.lineTo(viewHalfWidth + 5 * density, viewBottom);
    path.lineTo(viewHalfWidth - 5 * density, viewBottom);
    path.close();

    paint.setColor(Color.TRANSPARENT);
    canvas.drawPath(path, paint);

    paint.setTypeface(Typeface.DEFAULT_BOLD);
    final float y = getPaddingTop() + -paint.getFontMetrics().top;

    for (int i = 0; i < labels.size(); i++) {
        final String label = labels.get(i);

        paint.setTypeface(i == pagePosition ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
        paint.setColor(i == pagePosition ? Color.WHITE : Color.WHITE);

        final float x = viewHalfWidth + (maxWidth + spacing) * (i - pageOffset);
        final float labelWidth = paint.measureText(label);
        final float labelHalfWidth = labelWidth / 2;

        final float labelLeft = x - labelHalfWidth;
        final float labelVisibleLeft = labelLeft >= 0 ? 1f : 1f - (-labelLeft / labelWidth);

        final float labelRight = x + labelHalfWidth;
        final float labelVisibleRight = labelRight < viewWidth ? 1f
                : 1f - ((labelRight - viewWidth) / labelWidth);

        final float labelVisible = Math.min(labelVisibleLeft, labelVisibleRight);

        paint.setAlpha((int) (labelVisible * 255));

        canvas.drawText(label, labelLeft, y, paint);
    }
}

From source file:com.android.mail.browse.SendersView.java

public static Typeface getTypeface(boolean isUnread) {
    return isUnread ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT;
}

From source file:com.allmycode.flags.MyActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);/*from  w ww.j  a v a 2s.c om*/
    targetActivity = (AutoCompleteTextView) findViewById(R.id.editText1);
    ArrayAdapter<String> targetsAdapter = new ArrayAdapter<String>(this, R.layout.list_item, TARGETS_LIST);
    targetActivity.setAdapter(targetsAdapter);
    flags = (AutoCompleteTextView) findViewById(R.id.editText2);
    ArrayAdapter<String> flagsAdapter = new ArrayAdapter<String>(this, R.layout.list_item, FLAGS_LIST_CONCISE);
    flags.setAdapter(flagsAdapter);
    cheatSheet = (EditText) findViewById(R.id.editText3);
    for (String item : FLAGS_LIST) {
        cheatSheet.append(item);
        cheatSheet.append("\n");
    }
    Intent whoCalled = getIntent();
    helloView = ((TextView) findViewById(R.id.textView3));
    helloView.setTextColor(android.graphics.Color.WHITE);
    helloView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
    helloView.setText("Flags: 0x" + Integer.toHexString(whoCalled.getFlags()));
    if (whoCalled.getExtras() != null) {
        boolean areErrors = whoCalled.getExtras().getBoolean("existErrors", false);
        if (areErrors) {
            helloView.append(" There were errors!");
            helloView.setTextColor(android.graphics.Color.RED);
            helloView.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
        }
    }

    ActivityManager am = (ActivityManager) getSystemService(Service.ACTIVITY_SERVICE);
    List<ActivityManager.RunningAppProcessInfo> processes;
    processes = am.getRunningAppProcesses();
    for (ActivityManager.RunningAppProcessInfo info : processes) {
        Log.i("Process:", info.processName);
    }
}

From source file:org.tomahawk.tomahawk_android.dialogs.RegisterConfigDialog.java

/**
 * Called when this {@link android.support.v4.app.DialogFragment} is being created
 *///from   w ww  .  j av  a  2s  .  c  o  m
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    String username = "";
    String password = "";
    if (getArguments() != null) {
        if (getArguments().containsKey(TomahawkFragment.PREFERENCEID)) {
            String authenticatorId = getArguments().getString(TomahawkFragment.PREFERENCEID);
            mAuthenticatorUtils = AuthenticatorManager.getInstance().getAuthenticatorUtils(authenticatorId);
        }
        if (getArguments().containsKey(TomahawkFragment.USERNAME_STRING)) {
            username = getArguments().getString(TomahawkFragment.USERNAME_STRING);
        }
        if (getArguments().containsKey(TomahawkFragment.PASSWORD_STRING)) {
            password = getArguments().getString(TomahawkFragment.PASSWORD_STRING);
        }
    }

    TextView headerTextView = (TextView) addScrollingViewToFrame(R.layout.config_textview);
    headerTextView.setText(mAuthenticatorUtils.getDescription());
    mUsernameEditText = (ConfigEdittext) addScrollingViewToFrame(R.layout.config_edittext);
    mUsernameEditText.setHint(mAuthenticatorUtils.getUserIdEditTextHintResId());
    mUsernameEditText.setText(username);
    mPasswordEditText = (ConfigEdittext) addScrollingViewToFrame(R.layout.config_edittext);
    mPasswordEditText.setHint(R.string.login_password);
    mPasswordEditText.setTypeface(Typeface.DEFAULT);
    mPasswordEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
    mPasswordEditText.setTransformationMethod(new PasswordTransformationMethod());
    mPasswordEditText.setText(password);
    mPasswordConfirmationEditText = (ConfigEdittext) addScrollingViewToFrame(R.layout.config_edittext);
    mPasswordConfirmationEditText.setHint(R.string.login_password_confirmation);
    mPasswordConfirmationEditText.setTypeface(Typeface.DEFAULT);
    mPasswordConfirmationEditText.setTransformationMethod(new PasswordTransformationMethod());
    mMailEditText = (ConfigEdittext) addScrollingViewToFrame(R.layout.config_edittext);
    mMailEditText.setHint(R.string.account_email_label);
    mMailEditText.setOnEditorActionListener(mOnKeyboardEnterListener);

    showSoftKeyboard(mUsernameEditText);

    setDialogTitle(mAuthenticatorUtils.getPrettyName() + ": " + getString(R.string.register));
    setStatus(new HatchetStubResolver(HatchetAuthenticatorUtils.HATCHET_PRETTY_NAME, null));
    setPositiveButtonText(R.string.register);
    setNegativeButtonText(R.string.cancel);
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setView(getDialogView());
    return builder.create();
}

From source file:com.facebook.notifications.internal.content.TextContent.java

@Override
public void applyTo(@NonNull View view) {
    if (view instanceof TextView) {
        TextView textView = (TextView) view;

        textView.setText(getText());//w  w  w  .  j av  a  2s  .c  o m
        textView.setTextColor(getTextColor());

        Typeface typeface = FontUtilities.parseFont(getTypeface());
        typeface = typeface != null ? typeface : Typeface.DEFAULT;

        textView.setTypeface(typeface);
        textView.setTextSize(getTypefaceSize());

        switch (getTextAlignment()) {
        case Left:
            textView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
            break;

        case Center:
            textView.setGravity(Gravity.CENTER);
            break;

        case Right:
            textView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            break;
        }
    }
}

From source file:com.stepstone.stepper.internal.StepTab.java

/**
 * Updates tab's UI//from ww w .  ja  v  a  2  s .  c o m
 *
 * @param done    true if the step is done and the step's number should be replaced with a <i>done</i> icon, false otherwise
 * @param showErrorOnBack true if an error should be shown if verification failed, false otherwise
 * @param current true if the step is the current step, false otherwise
 */
public void updateState(final boolean done, final boolean showErrorOnBack, final boolean current) {
    //if this tab has errors and the user decide not to clear when going backwards, simply ignore the update
    if (this.hasError && showErrorOnBack) {
        return;
    }

    mStepDoneIndicator.setVisibility(done ? View.VISIBLE : View.GONE);
    mStepNumber.setVisibility(!done ? View.VISIBLE : View.GONE);
    mStepErrorIndicator.setVisibility(GONE);
    colorViewBackground(done ? mStepDoneIndicator : mStepNumber, done || current);

    this.hasError = false;

    mStepTitle.setTextColor(ContextCompat.getColor(getContext(), R.color.ms_black));
    mStepTitle.setTypeface(current ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
    mStepTitle.setAlpha(done || current ? OPAQUE_ALPHA : INACTIVE_STEP_TITLE_ALPHA);
}