List of usage examples for android.graphics Typeface NORMAL
int NORMAL
To view the source code for android.graphics Typeface NORMAL.
Click Source Link
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);//from w w w . j a v a 2s.co 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.money.manager.ex.reports.IncomeVsExpensesAdapter.java
@Override public void bindView(View view, Context context, Cursor cursor) { TextView txtYear = (TextView) view.findViewById(R.id.textViewYear); TextView txtMonth = (TextView) view.findViewById(R.id.textViewMonth); TextView txtIncome = (TextView) view.findViewById(R.id.textViewIncome); TextView txtExpenses = (TextView) view.findViewById(R.id.textViewExpenses); TextView txtDifference = (TextView) view.findViewById(R.id.textViewDifference); // take data//from w w w .java 2 s . c o m int year, month; year = cursor.getInt(cursor.getColumnIndex(IncomeVsExpenseReportEntity.YEAR)); month = cursor.getInt(cursor.getColumnIndex(IncomeVsExpenseReportEntity.Month)); Calendar calendar = Calendar.getInstance(); calendar.set(year, month - 1, 1); double income = 0, expenses = 0; expenses = cursor.getDouble(cursor.getColumnIndex(IncomeVsExpenseReportEntity.Expenses)); income = cursor.getDouble(cursor.getColumnIndex(IncomeVsExpenseReportEntity.Income)); // attach data txtYear.setText(Integer.toString(year)); String formatMonth = context.getResources() .getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT ? "MMM" : "MMMM"; if (month != IncomeVsExpensesActivity.SUBTOTAL_MONTH) { txtMonth.setText(new SimpleDateFormat(formatMonth).format(calendar.getTime())); } else { txtMonth.setText(null); } CurrencyService currencyService = new CurrencyService(mContext); txtIncome.setText(currencyService.getCurrencyFormatted(currencyService.getBaseCurrencyId(), MoneyFactory.fromDouble(income))); txtExpenses.setText(currencyService.getCurrencyFormatted(currencyService.getBaseCurrencyId(), MoneyFactory.fromDouble(Math.abs(expenses)))); txtDifference.setText(currencyService.getCurrencyFormatted(currencyService.getBaseCurrencyId(), MoneyFactory.fromDouble(income - Math.abs(expenses)))); UIHelper uiHelper = new UIHelper(context); if (income - Math.abs(expenses) < 0) { txtDifference.setTextColor( context.getResources().getColor(uiHelper.resolveAttribute(R.attr.holo_red_color_theme))); } else { txtDifference.setTextColor( context.getResources().getColor(uiHelper.resolveAttribute(R.attr.holo_green_color_theme))); } //view.setBackgroundColor(core.resolveColorAttribute(cursor.getPosition() % 2 == 1 ? R.attr.row_dark_theme : R.attr.row_light_theme)); // check if subtotal int typefaceStyle = month == IncomeVsExpensesActivity.SUBTOTAL_MONTH ? Typeface.BOLD : Typeface.NORMAL; txtDifference.setTypeface(null, typefaceStyle); txtExpenses.setTypeface(null, typefaceStyle); txtIncome.setTypeface(null, typefaceStyle); txtMonth.setTypeface(null, typefaceStyle); txtYear.setTypeface(null, typefaceStyle); }
From source file:edu.sfsu.cs.orange.ocr.language.TranslateAsyncTask.java
@Override protected synchronized void onPostExecute(Boolean result) { super.onPostExecute(result); if (result) { //Log.i(TAG, "SUCCESS"); if (targetLanguageTextView != null) { targetLanguageTextView.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL), Typeface.NORMAL); }/*from w w w . j ava 2 s. c o m*/ textView.setText(translatedText); textView.setVisibility(View.VISIBLE); textView.setTextColor(activity.getResources().getColor(R.color.translation_text)); // Crudely scale betweeen 22 and 32 -- bigger font for shorter text int scaledSize = Math.max(22, 32 - translatedText.length() / 4); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, scaledSize); } else { Log.e(TAG, "FAILURE"); targetLanguageTextView.setTypeface(Typeface.defaultFromStyle(Typeface.ITALIC), Typeface.ITALIC); targetLanguageTextView.setText("Unavailable"); } // Turn off the indeterminate progress indicator if (progressView != null) { progressView.setVisibility(View.GONE); } }
From source file:pl.ipebk.tabi.presentation.ui.search.SearchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); ButterKnife.bind(this); getActivityComponent().inject(this); setSupportActionBar(toolbar);/*w ww .j ava2 s . c om*/ presenter.attachView(this); doodleHeaderFont = fontManager.get("bebas-book", Typeface.NORMAL); doodleDescriptionFont = fontManager.get("montserrat", Typeface.NORMAL); RxViewPager.pageSelections(searchPager).subscribe(page -> { if (page == SEARCH_PLACES_FRAGMENT_POSITION) { searchEditText.setHint(getString(R.string.main_search_bar_hint_places)); } else if (page == SEARCH_PLATES_FRAGMENT_POSITION) { searchEditText.setHint(getString(R.string.main_search_bar_hint_plates)); } }, ex -> Timber.e(ex, "Page cannot be changed")); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setupTransition(); } searchedText.setVisibility(View.GONE); preparePlaceFragments(); prepareDoodleImages(); }
From source file:org.videolan.vlc2.gui.SidebarAdapter.java
@Override public View getView(int position, View v, ViewGroup parent) { SidebarEntry sidebarEntry = entries.get(position); /* If view not created */ if (v == null) { v = mInflater.inflate(R.layout.sidebar_item, parent, false); }/*from w w w. jav a 2 s .c om*/ TextView textView = (TextView) v; textView.setText(sidebarEntry.name); Drawable img = VLCApplication.getAppResources() .getDrawable(Util.getResourceFromAttribute(mContext, sidebarEntry.attributeID)); if (img != null) { int dp_32 = Util.convertDpToPx(32); img.setBounds(0, 0, dp_32, dp_32); textView.setCompoundDrawables(img, null, null, null); } // Set in bold the current item. if (mCurrentFragmentId.equals(sidebarEntry.id)) textView.setTypeface(null, Typeface.BOLD); else textView.setTypeface(null, Typeface.NORMAL); return v; }
From source file:org.akvo.caddisfly.sensor.colorimetry.strip.camera.InstructionFragment.java
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View rootView = inflater.inflate(R.layout.fragment_instruction, container, false); final Button buttonStart = (Button) rootView.findViewById(R.id.button_start); buttonStart.setEnabled(false);/* w w w .jav a 2 s .c o m*/ buttonStart.setAlpha(BUTTON_START_ALPHA); LinearLayout linearLayout = (LinearLayout) rootView.findViewById(R.id.layout_information); TextView textTitle = (TextView) rootView.findViewById(R.id.textToolbarTitle); if (textTitle != null) { textTitle.setText(R.string.instructions); } if (getArguments() != null) { String uuid = getArguments().getString(Constant.UUID); int phase = getArguments().getInt(Constant.PHASE); StripTest stripTest = new StripTest(); JSONArray instructions = stripTest.getBrand(uuid).getInstructions(); if (phase == 1) { showInstruction(linearLayout, getString(R.string.success_quality_checks), BOLD); } if (instructions != null) { try { for (int i = 0; i < instructions.length(); i++) { JSONObject object = instructions.getJSONObject(i); Object item = instructions.getJSONObject(i).get("text"); if ((object.has("phase") ? object.getInt("phase") : 1) == phase) { JSONArray jsonArray; if (item instanceof JSONArray) { jsonArray = (JSONArray) item; } else { String text = (String) item; jsonArray = new JSONArray(); jsonArray.put(text); } for (int j = 0; j < jsonArray.length(); j++) { showInstruction(linearLayout, jsonArray.getString(j), Typeface.NORMAL); } } } } catch (JSONException e) { Timber.e(e); } } } buttonStart.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mListener.nextFragment(); } }); (new Handler()).postDelayed(new Runnable() { public void run() { buttonStart.setEnabled(true); AlphaAnimation animation = new AlphaAnimation(BUTTON_START_ALPHA, 1f); buttonStart.setAlpha(1f); animation.setDuration(ANIMATION_DURATION_MILLIS); buttonStart.startAnimation(animation); } }, BUTTON_ENABLE_DELAY); return rootView; }
From source file:io.github.marktony.espresso.mvp.companydetails.CompanyDetailFragment.java
@Override public void setCompanyName(String name) { String companyName = getString(R.string.company_name) + "\n" + name; Spannable spannable = new SpannableStringBuilder(companyName); spannable.setSpan(new StyleSpan(Typeface.BOLD), 0, companyName.length() - name.length() - 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); spannable.setSpan(new StyleSpan(Typeface.NORMAL), companyName.length() - name.length(), companyName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textViewCompanyName.setText(spannable); }
From source file:com.tr4android.support.extension.typeface.TypefaceCompat.java
/** * Creates a typeface object that best matches the specified typeface and the specified style. * Use this call if you want to pick a new style from the same family of an typeface object. * If family is null, this selects from the default font's family. * * @param ctx A context./*from w ww . j a va2s. com*/ * @param familyName May be null. The name of the font family. * @param style The style (normal, bold, italic) of the typeface, e.g. NORMAL, BOLD, ITALIC, BOLD_ITALIC. * @return The best matching typeface. * @since 0.1.1 * @deprecated */ @Deprecated public static Typeface create(Context ctx, String familyName, int style) { if (!mInitialized) initialize(); if (isSupported(familyName) || familyName == null) { boolean styleAfterwards = false; String fileName = FONT_FAMILY_FILE_PREFIX.get(familyName == null ? "sans-serif" : familyName); if (fileName.endsWith("-")) { // All styles are supported. fileName += STYLE_SUFFIX[style]; } else { switch (style) { case Typeface.NORMAL: break; case Typeface.BOLD: case Typeface.BOLD_ITALIC: // These styles are not supported by default. Therefore force style after retrieving normal font. styleAfterwards = true; break; case Typeface.ITALIC: fileName += STYLE_SUFFIX[style]; break; } } fileName += TTF_SUFFIX; // Retrieve Typeface from cache. Typeface tf = TYPEFACE_CACHE.get(fileName); if (tf == null) { // Create Typeface and cache it for later. String fontPath = "fonts/" + fileName; tf = Typeface.createFromAsset(ctx.getAssets(), fontPath); if (tf != null) { TYPEFACE_CACHE.put(fileName, tf); } } if (tf != null) { return styleAfterwards ? Typeface.create(tf, style) : tf; } } // Let the default implementation of Typeface try. return Typeface.create(familyName, style); }
From source file:app.hacked.ProjectDetailsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.project_detail_fragment, container, false); ((TextView) rootView.findViewById(R.id.Title)).setText(Name); ((TextView) rootView.findViewById(R.id.Title)) .setTypeface(Typeface.create("sans-serif-light", Typeface.NORMAL)); /*((TextView) rootView.findViewById(R.id.TeamMembers)).setText(TeamMembers); ((TextView) rootView.findViewById(R.id.TeamMembers)).setTypeface(Typeface.create("sans-serif-condensed", Typeface.NORMAL));*/ ((TextView) rootView.findViewById(R.id.Tech)).setText(Technologies); ((TextView) rootView.findViewById(R.id.Tech)) .setTypeface(Typeface.create("sans-serif-condensed", Typeface.NORMAL)); ((TextView) rootView.findViewById(R.id.Description)).setText(Html.fromHtml(Description)); ((TextView) rootView.findViewById(R.id.Description)) .setTypeface(Typeface.create("sans-serif", Typeface.NORMAL)); ((Button) rootView.findViewById(R.id.VoteUp)).setOnClickListener(new View.OnClickListener() { @Override//from ww w .j av a 2 s. c o m public void onClick(View view) { doVote(true); } }); ((Button) rootView.findViewById(R.id.VoteDown)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { doVote(false); } }); ((Button) rootView.findViewById(R.id.EditProject)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.hackerleague.org/hackathons/hacked/hacks"))); } }); return rootView; }
From source file:com.liberorignanese.android.stepindicatorview.Step.java
public void setUpView(View stepView, Step previous, Step next, int orientation, boolean useSecondaryStepColor) { ImageView iconView = (ImageView) stepView.findViewById(R.id.icon_step_layout); ImageView lineStartView = (ImageView) stepView.findViewById(R.id.linestart_step_layout); ImageView lineEndView = (ImageView) stepView.findViewById(R.id.lineend_step_layout); TextView textView = (TextView) stepView.findViewById(R.id.text_step_layout); int line_completed = orientation == LinearLayout.HORIZONTAL ? (useSecondaryStepColor ? R.drawable.line_completed_horizontal_secondary : R.drawable.line_completed_horizontal) : (useSecondaryStepColor ? R.drawable.line_completed_vertical_secondary : R.drawable.line_completed_vertical); int line_uncompleted = orientation == LinearLayout.HORIZONTAL ? (useSecondaryStepColor ? R.drawable.line_uncompleted_horizontal_secondary : R.drawable.line_uncompleted_horizontal) : (useSecondaryStepColor ? R.drawable.line_uncompleted_vertical_secondary : R.drawable.line_uncompleted_vertical); int icon_completed = useSecondaryStepColor ? R.drawable.icon_check_secondary : R.drawable.icon_check; int icon_uncompleted = useSecondaryStepColor ? R.drawable.icon_circle_secondary : R.drawable.icon_circle; int icon_completed_current = useSecondaryStepColor ? R.drawable.icon_check_secondary_current : R.drawable.icon_check_current; int step_backgroundcolor = Color.TRANSPARENT; int step_textcolor = useSecondaryStepColor ? R.color.stepviewindicator_maincolor_secondary : R.color.stepviewindicator_maincolor; int step_iscurrent_backgroundcolor = useSecondaryStepColor ? R.color.stepviewindicator_maincolor_secondary : R.color.stepviewindicator_maincolor; int step_iscurrent_textcolor = useSecondaryStepColor ? R.color.stepviewindicator_checkcolor_secondary : R.color.stepviewindicator_checkcolor; /*//from ww w.j a v a 2 s. c om if(useSecondaryStepColor){ } */ if (previous == null) { lineStartView.setVisibility(View.INVISIBLE); } else { lineStartView.setVisibility(View.VISIBLE); if (previous.isCompleted()) { lineStartView.setImageResource(line_completed); lineStartView.setImageAlpha(255); } else { lineStartView.setImageResource(line_uncompleted); lineStartView.setImageAlpha(alpha); } } if (next == null) { lineEndView.setVisibility(View.INVISIBLE); } else { lineEndView.setVisibility(View.VISIBLE); if (isCompleted()) { lineEndView.setImageResource(line_completed); lineEndView.setImageAlpha(255); } else { lineEndView.setImageResource(line_uncompleted); lineEndView.setImageAlpha(alpha); } } textView.setText(getText()); if (isCompleted()) { iconView.setImageResource(current ? icon_completed_current : icon_completed); iconView.setImageAlpha(255); } else { iconView.setImageResource(icon_uncompleted); if (isCurrent()) { iconView.setImageAlpha(255); } else { iconView.setImageAlpha(alpha); } } if (isCurrent()) { textView.setTypeface(null, Typeface.BOLD); textView.setTextColor(ContextCompat.getColor(stepView.getContext(), step_iscurrent_textcolor)); textView.setBackgroundColor( ContextCompat.getColor(stepView.getContext(), step_iscurrent_backgroundcolor)); } else { textView.setTypeface(null, Typeface.NORMAL); textView.setTextColor(ContextCompat.getColor(stepView.getContext(), step_textcolor)); textView.setBackgroundColor(step_backgroundcolor); } /* if(useSecondaryStepColor){ textView.setTextColor(ContextCompat.getColor(stepView.getContext(), R.color.stepviewindicator_maincolor_secondary)); }else{ textView.setTextColor(ContextCompat.getColor(stepView.getContext(), R.color.stepviewindicator_maincolor)); } */ stepView.setOnClickListener(onClickListener); }