Example usage for android.graphics Typeface BOLD

List of usage examples for android.graphics Typeface BOLD

Introduction

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

Prototype

int BOLD

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

Click Source Link

Usage

From source file:ro.adriancoman.app.TermsActivity.java

private void setUpUi() {

    LinearLayout at_ll_main = (LinearLayout) findViewById(R.id.at_ll_main);

    LinearLayout.LayoutParams lp_title = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    lp_title.setMargins(20, 5, 20, 5);/*from   w  w w  .  j  a v  a 2s .c om*/
    LinearLayout.LayoutParams lp_content = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    lp_content.setMargins(30, 5, 30, 10);

    String[] license_title = getResources().getStringArray(R.array.licenses_title);
    String[] license_content = getResources().getStringArray(R.array.license_content);

    Toast.makeText(context, license_title.length + "", Toast.LENGTH_LONG).show();

    for (int i = 0; i < license_title.length; i++) {
        TextView tv_title = new TextView(this);
        TextView tv_content = new TextView(this);

        tv_title.setText(license_title[i]);
        tv_title.setTextSize(16);
        tv_title.setTypeface(null, Typeface.BOLD);
        at_ll_main.addView(tv_title, lp_title);
        tv_content.setText(license_content[i]);
        tv_content.setTextSize(14);
        at_ll_main.addView(tv_content, lp_content);
    }
}

From source file:asu.edu.msse.gpeddabu.moviedescriptions.MovieListAdapter.java

@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
    String headerTitle = (String) getGroup(groupPosition);
    if (convertView == null) {
        android.util.Log.d(this.getClass().getSimpleName(), "in getGroupView null so creating new view");
        LayoutInflater inflater = (LayoutInflater) this.parent
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.movie_group, null);
    }/*from w  w w .  j  a  v a2 s  . c o m*/

    TextView genreName = (TextView) convertView.findViewById(R.id.genreName);
    //android.util.Log.d(this.getClass().getSimpleName(),"in getGroupView text is: "+lblListHeader.getText());
    genreName.setTypeface(null, Typeface.BOLD);
    genreName.setText(headerTitle);
    return convertView;
}

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);/*from   ww w.  j  a  va 2 s  .  c  om*/

    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:com.stepstone.stepper.internal.widget.StepTab.java

public StepTab(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    LayoutInflater.from(getContext()).inflate(R.layout.ms_step_tab, this, true);

    mSelectedColor = ContextCompat.getColor(context, R.color.ms_selectedColor);
    mUnselectedColor = ContextCompat.getColor(context, R.color.ms_unselectedColor);
    mErrorColor = ContextCompat.getColor(context, R.color.ms_errorColor);

    mStepNumber = (TextView) findViewById(R.id.ms_stepNumber);
    mStepDoneIndicator = (ImageView) findViewById(R.id.ms_stepDoneIndicator);
    mStepIconBackground = (ImageView) findViewById(R.id.ms_stepIconBackground);
    mStepDivider = findViewById(R.id.ms_stepDivider);
    mStepTitle = ((TextView) findViewById(R.id.ms_stepTitle));

    mTitleColor = mStepTitle.getCurrentTextColor();

    Typeface typeface = mStepTitle.getTypeface();
    mNormalTypeface = Typeface.create(typeface, Typeface.NORMAL);
    mBoldTypeface = Typeface.create(typeface, Typeface.BOLD);
    Drawable avd = createCircleToWarningDrawable();
    mStepIconBackground.setImageDrawable(avd);
}

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

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

    Title = (TextView) rootView.findViewById(R.id.EventTitle);
    Component = (TextView) rootView.findViewById(R.id.Componant);
    EventClass = (TextView) rootView.findViewById(R.id.EventClass);
    Summary = (TextView) rootView.findViewById(R.id.Summary);
    FirstTime = (TextView) rootView.findViewById(R.id.FirstTime);
    LastTime = (TextView) rootView.findViewById(R.id.LastTime);
    ackIcon = (ImageView) rootView.findViewById(R.id.ackIcon);
    img = (ImageView) rootView.findViewById(R.id.summaryImage);
    EventCount = (TextView) rootView.findViewById(R.id.EventCount);
    agent = (TextView) rootView.findViewById(R.id.Agent);
    logList = (LinearLayout) rootView.findViewById(R.id.LogList);
    progressbar = (ProgressBar) rootView.findViewById(R.id.progressBar);

    Typeface Titles = Typeface.create("sans-serif-light", Typeface.NORMAL);
    Typeface Subtitles = Typeface.create("sans-serif", Typeface.BOLD);

    Title.setTypeface(Titles);/*from   w w w  .  java  2 s . com*/

    try {
        if (getActivity().getIntent().hasExtra("EventCount")) {
            EventCount.setText(
                    "Count: " + Integer.toString(getActivity().getIntent().getIntExtra("EventCount", 0)));
        } else if (getArguments().getInt("EventCount", 0) != 0) {
            EventCount.setText("Count: " + Integer.toString(getArguments().getInt("EventCount", 0)));
        } else {
            EventCount.setText("Count: 0");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    try {
        if (getActivity().getIntent().hasExtra("EventTitle")) {
            Title.setText(getActivity().getIntent().getStringExtra("EventTitle"));
        } else if (!getArguments().getString("EventTitle").equals("")) {
            Title.setText(getArguments().getString("EventTitle"));
        } else {
            Title.setText(getActivity().getString(R.string.eventDetailsTitlePlaceholder));
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    ackIcon.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            progressbar.setVisibility(View.VISIBLE);

            ((Thread) new Thread() {
                public void run() {
                    if (settings.getBoolean(ZenossAPI.PREFERENCE_IS_ZAAS, false)) {
                        API = new ZenossAPIZaas();
                    } else {
                        API = new ZenossAPICore();
                    }

                    ZenossCredentials credentials = null;

                    try {
                        credentials = new ZenossCredentials(getActivity());
                    } catch (Exception e) {
                        BugSenseHandler.sendExceptionMessage("ViewZenossEventFragmentUpdate", "credentials", e);
                        credentials = null;
                    }

                    try {
                        API.Login(credentials);
                        JSONObject ackJSON = API.AcknowledgeEvent(getArguments().getString("EventID"));

                        if (ackJSON.getJSONObject("result").getBoolean("success")) {
                            getActivity().runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    progressbar.setVisibility(View.INVISIBLE);
                                    ackIcon.setImageResource(R.drawable.ic_acknowledged);
                                    mCallbacks.onItemAcknowledged(getArguments().getInt("position"));
                                }
                            });

                            RhybuddDataSource datasource = null;
                            try {
                                datasource = new RhybuddDataSource(getActivity());
                                datasource.open();
                                datasource.ackEvent(getArguments().getString("EventID"));
                            } catch (Exception e) {
                                e.printStackTrace();
                                BugSenseHandler.sendExceptionMessage("ViewZenossEventFragmentUpdate",
                                        "DBUpdate", e);
                            } finally {
                                if (null != datasource)
                                    datasource.close();
                            }
                        } else {
                            Toast.makeText(getActivity(), "Unable to acknowledge alert", Toast.LENGTH_SHORT)
                                    .show();
                        }
                    } catch (Exception e) {
                        getActivity().runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                Toast.makeText(getActivity(), "Unable to acknowledge alert", Toast.LENGTH_SHORT)
                                        .show();
                            }
                        });

                        BugSenseHandler.sendExceptionMessage("ViewZenossEventFragment", "outer try", e);
                    }
                }
            }).start();
        }
    });
    return rootView;
}

From source file:org.odk.collect.android.widgets.QuestionWidget.java

private MediaLayout createQuestionMediaLayout(FormEntryPrompt prompt) {
    String promptText = prompt.getLongText();
    // Add the text view. Textview always exists, regardless of whether there's text.
    TextView questionText = new TextView(getContext());
    questionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, questionFontsize);
    questionText.setTypeface(null, Typeface.BOLD);
    questionText.setTextColor(ContextCompat.getColor(getContext(), R.color.primaryTextColor));
    questionText.setPadding(0, 0, 0, 7);
    questionText.setText(promptText == null ? "" : TextUtils.textToHtml(promptText));
    questionText.setMovementMethod(LinkMovementMethod.getInstance());

    // Wrap to the size of the parent view
    questionText.setHorizontallyScrolling(false);

    if (promptText == null || promptText.length() == 0) {
        questionText.setVisibility(GONE);
    }//from   w w w  .j  a va2s  .c om

    String imageURI = prompt.getImageText();
    String audioURI = prompt.getAudioText();
    String videoURI = prompt.getSpecialFormQuestionText("video");

    // shown when image is clicked
    String bigImageURI = prompt.getSpecialFormQuestionText("big-image");

    // Create the layout for audio, image, text
    MediaLayout questionMediaLayout = new MediaLayout(getContext(), player);
    questionMediaLayout.setId(ViewIds.generateViewId()); // assign random id
    questionMediaLayout.setAVT(prompt.getIndex(), "", questionText, audioURI, imageURI, videoURI, bigImageURI);
    questionMediaLayout.setAudioListener(this);

    String playColorString = prompt.getFormElement().getAdditionalAttribute(null, "playColor");
    if (playColorString != null) {
        try {
            playColor = Color.parseColor(playColorString);
        } catch (IllegalArgumentException e) {
            Timber.e(e, "Argument %s is incorrect", playColorString);
        }
    }
    questionMediaLayout.setPlayTextColor(playColor);

    String playBackgroundColorString = prompt.getFormElement().getAdditionalAttribute(null,
            "playBackgroundColor");
    if (playBackgroundColorString != null) {
        try {
            playBackgroundColor = Color.parseColor(playBackgroundColorString);
        } catch (IllegalArgumentException e) {
            Timber.e(e, "Argument %s is incorrect", playBackgroundColorString);
        }
    }
    questionMediaLayout.setPlayTextBackgroundColor(playBackgroundColor);

    return questionMediaLayout;
}

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

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);//from  w  w w  . j a  va2 s. c o m
    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:com.wellsandwhistles.android.redditsp.reddit.prepared.RedditPreparedMessage.java

@Override
public View getBody(final AppCompatActivity activity, final Integer textColor, final Float textSize,
        final boolean showLinkButtons) {

    final LinearLayout subjectLayout = new LinearLayout(activity);
    subjectLayout.setOrientation(LinearLayout.VERTICAL);

    final TextView subjectText = new TextView(activity);
    subjectText.setText(StringEscapeUtils.unescapeHtml4(src.subject != null ? src.subject : "(no subject)"));
    subjectText.setTextColor(textColor);
    subjectText.setTextSize(textSize);//w  ww .ja va  2s .c  o m
    subjectText.setTypeface(null, Typeface.BOLD);

    subjectLayout.addView(subjectText);
    subjectLayout.addView(body.buildView(activity, textColor, textSize, showLinkButtons));

    return subjectLayout;
}

From source file:com.dgsd.android.ShiftTracker.Adapter.WeekAdapter.java

@Override
protected void bindHeaderView(View view, Context context, Cursor cursor) {
    HeaderViewHolder holder = (HeaderViewHolder) view.getTag();

    final int jd = cursor.getInt(cursor.getColumnIndex(DbField.JULIAN_DAY.name));
    String title = mJdToTitleArray.get(jd, null);
    if (TextUtils.isEmpty(title)) {

        mTime.setJulianDay(jd);//  ww  w. java  2  s.c o  m
        title = DateUtils.formatDateTime(getContext(), mTime.toMillis(true), DateUtils.FORMAT_SHOW_DATE
                | DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_ABBREV_MONTH | DateUtils.FORMAT_NO_YEAR);

        mJdToTitleArray.put(jd, title);
    }

    //Highlight the current day with a bold title
    if (jd == mCurrentJulianDay)
        holder.title.setTypeface(null, Typeface.BOLD);
    else
        holder.title.setTypeface(null, Typeface.NORMAL);

    holder.title.setText(title);
}

From source file:com.amaze.filemanager.adapters.TabSpinnerAdapter.java

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

    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View row = inflater.inflate(R.layout.spinner_dropdown_layout, parent, false);

    ma = ((Main) fragmentTransaction.findFragmentById(R.id.content_frame));
    final TextView textView = (TextView) row.findViewById(R.id.spinnerText);
    LinearLayout linearLayout = (LinearLayout) row.findViewById(R.id.textParent);
    final SharedPreferences sharedPreferences1 = PreferenceManager.getDefaultSharedPreferences(context);
    String skin = sharedPreferences1.getString("skin_color", "#5677fc");
    final int spinner_current = sharedPreferences1.getInt("spinner_selected", 0);
    ImageButton imageButton = (ImageButton) row.findViewById(R.id.spinnerButton);
    if (items.get(position).equals("/"))
        textView.setText(R.string.rootdirectory);
    else/*from w  w  w. j  a  v  a 2  s.  c o  m*/
        textView.setText(new File(items.get(position)).getName());
    imageButton.setBackgroundColor(Color.parseColor(skin));

    if (position == spinner_current) {

        textView.setTextColor(Color.parseColor(skin));
        textView.setTypeface(null, Typeface.BOLD);

    }

    linearLayout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {

            hideSpinnerDropDown(spinner);

            if (position == spinner_current) {
            } else {

                TabHandler tabHandler1 = new TabHandler(context, null, null, 1);
                Tab tab = tabHandler1.findTab(position);
                String name = tab.getPath();
                //Toast.makeText(getActivity(), name, Toast.LENGTH_SHORT).show();
                sharedPreferences1.edit().putString("current", name).apply();
                sharedPreferences1.edit().putInt("spinner_selected", position).apply();

                Main ma = ((Main) fragmentTransaction.findFragmentById(R.id.content_frame));
                ma.loadlist(new File(tab.getPath()), false);

                Animation animationLeft = AnimationUtils.loadAnimation(getContext(), R.anim.tab_selection_left);
                Animation animationRight = AnimationUtils.loadAnimation(getContext(),
                        R.anim.tab_selection_right);

                if (position < spinner_current) {
                    ma.listView.setAnimation(animationLeft);
                    ma.gridView.setAnimation(animationLeft);
                } else {
                    ma.listView.setAnimation(animationRight);
                    ma.gridView.setAnimation(animationRight);
                }

            }
        }
    });

    imageButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            TabHandler tabHandler = new TabHandler(context, null, null, 1);
            Tab tab = tabHandler.findTab(position);
            if (position > spinner_current) {

                //Toast.makeText(getContext(), "Closed", Toast.LENGTH_SHORT).show();
                items.remove(position);

                int old_tab = tab.getTab();
                int a;
                for (a = old_tab; a < tabHandler.getTabsCount() - 1; a++) {

                    int new_tab = a + 1;
                    Tab tab1 = tabHandler.findTab(new_tab);
                    String next_label = tab1.getLabel();
                    String next_path = tab1.getPath();
                    tabHandler.updateTab(new Tab(a, next_label, next_path));
                }
                tabHandler.deleteTab(tabHandler.getTabsCount() - 1);
                hideSpinnerDropDown(spinner);

            } else if (position < spinner_current) {

                // Toast.makeText(getContext(), "Closed", Toast.LENGTH_SHORT).show();
                items.remove(position);
                int old_tab = tab.getTab();
                int a;
                for (a = old_tab; a < tabHandler.getTabsCount() - 1; a++) {

                    int new_tab = a + 1;
                    Tab tab1 = tabHandler.findTab(new_tab);
                    String next_label = tab1.getLabel();
                    String next_path = tab1.getPath();
                    tabHandler.updateTab(new Tab(a, next_label, next_path));
                }
                tabHandler.deleteTab(tabHandler.getTabsCount() - 1);
                int older_spinner_selected = sharedPreferences1.getInt("spinner_selected", 0);
                older_spinner_selected--;
                sharedPreferences1.edit().putInt("spinner_selected", older_spinner_selected).apply();
                hideSpinnerDropDown(spinner);

            } else if (position == spinner_current) {

                if (tabHandler.getTabsCount() == 1) {
                    // Toast.makeText(getContext(), "exits the app", Toast.LENGTH_SHORT).show();
                    ma.home();

                } else if (tabHandler.getTabsCount() - 1 > position) {
                    items.remove(position);
                    int old_tab = tab.getTab();
                    int a;
                    for (a = old_tab; a < tabHandler.getTabsCount() - 1; a++) {

                        int new_tab = a + 1;
                        Tab tab1 = tabHandler.findTab(new_tab);
                        String next_label = tab1.getLabel();
                        String next_path = tab1.getPath();
                        tabHandler.updateTab(new Tab(a, next_label, next_path));
                    }
                    tabHandler.deleteTab(tabHandler.getTabsCount() - 1);
                    Tab tab1 = tabHandler.findTab(spinner_current);
                    ma.loadlist(new File(tab1.getPath()), false);

                } else if (tabHandler.getTabsCount() - 1 == position) {
                    items.remove(position);
                    tabHandler.deleteTab(tabHandler.getTabsCount() - 1);

                    int older_spinner_selected = sharedPreferences1.getInt("spinner_selected", 0);
                    older_spinner_selected--;
                    sharedPreferences1.edit().putInt("spinner_selected", older_spinner_selected).apply();
                    Tab tab1 = tabHandler.findTab(older_spinner_selected);
                    Main ma = ((Main) fragmentTransaction.findFragmentById(R.id.content_frame));
                    ma.loadlist(new File(tab1.getPath()), false);
                }
            }
        }
    });
    return row;
}