List of usage examples for android.graphics Typeface MONOSPACE
Typeface MONOSPACE
To view the source code for android.graphics Typeface MONOSPACE.
Click Source Link
From source file:com.demo.maat.hello_rxjava.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.setTextSize(10);/*ww w . jav a 2s . c o m*/ mLogView.setClickable(true); 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:org.connectbot.util.TerminalTextViewOverlay.java
public TerminalTextViewOverlay(Context context, TerminalView terminalView) { super(context); this.terminalView = terminalView; clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE); setTextColor(Color.TRANSPARENT); setTypeface(Typeface.MONOSPACE); setTextIsSelectable(true);/*from w ww . ja v a 2 s . c om*/ setCustomSelectionActionModeCallback(new TextSelectionActionModeCallback()); }
From source file:logging.view.LogSupportFragment.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);//w w w . ja v a2 s . 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_Holo_Medium); mScrollView.addView(mLogView); return mScrollView; }
From source file:com.example.apptankcontroller.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.setBackgroundColor(Color.WHITE); 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 av 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); mScrollView.addView(mLogView); return mScrollView; }
From source file:com.common.library.logger.LogFragment.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) 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 www . j a v a2s.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); Log.setLogNode(mLogView); return mScrollView; }
From source file:com.simplytapp.demo.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 ww w . j ava 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); mScrollView.addView(mLogView); return mScrollView; }
From source file:com.farmerbb.notepad.adapter.NoteListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { // Get the data item for this position NoteListItem item = getItem(position); String note = item.getNote(); // Check if an existing view is being reused, otherwise inflate the view if (convertView == null) convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_layout, parent, false); // Lookup view for data population TextView noteTitle = convertView.findViewById(R.id.noteTitle); // Populate the data into the template view using the data object noteTitle.setText(note);/*from ww w. ja v a 2 s. c o m*/ // Apply theme SharedPreferences pref = getContext().getSharedPreferences(getContext().getPackageName() + "_preferences", Context.MODE_PRIVATE); String theme = pref.getString("theme", "light-sans"); if (theme.contains("light")) noteTitle.setTextColor(ContextCompat.getColor(getContext(), R.color.text_color_primary)); if (theme.contains("dark")) noteTitle.setTextColor(ContextCompat.getColor(getContext(), R.color.text_color_primary_dark)); if (theme.contains("sans")) noteTitle.setTypeface(Typeface.SANS_SERIF); if (theme.contains("serif")) noteTitle.setTypeface(Typeface.SERIF); if (theme.contains("monospace")) noteTitle.setTypeface(Typeface.MONOSPACE); switch (pref.getString("font_size", "normal")) { case "smallest": noteTitle.setTextSize(12); break; case "small": noteTitle.setTextSize(14); break; case "normal": noteTitle.setTextSize(16); break; case "large": noteTitle.setTextSize(18); break; case "largest": noteTitle.setTextSize(20); break; } // Return the completed view to render on screen return convertView; }
From source file:com.anjalimacwan.adapter.NoteListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { // Get the data item for this position NoteListItem item = getItem(position); String note = item.getNote(); // Check if an existing view is being reused, otherwise inflate the view if (convertView == null) convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_layout, parent, false); // Lookup view for data population TextView noteTitle = (TextView) convertView.findViewById(R.id.noteTitle); // Populate the data into the template view using the data object noteTitle.setText(note);/* w w w .java 2 s .co m*/ // Apply theme SharedPreferences pref = getContext().getSharedPreferences(getContext().getPackageName() + "_preferences", Context.MODE_PRIVATE); String theme = pref.getString("theme", "light-sans"); if (theme.contains("light")) noteTitle.setTextColor(ContextCompat.getColor(getContext(), R.color.text_color_primary)); if (theme.contains("dark")) noteTitle.setTextColor(ContextCompat.getColor(getContext(), R.color.text_color_primary_dark)); if (theme.contains("sans")) noteTitle.setTypeface(Typeface.SANS_SERIF); if (theme.contains("serif")) noteTitle.setTypeface(Typeface.SERIF); if (theme.contains("monospace")) noteTitle.setTypeface(Typeface.MONOSPACE); switch (pref.getString("font_size", "normal")) { case "smallest": noteTitle.setTextSize(12); break; case "small": noteTitle.setTextSize(14); break; case "normal": noteTitle.setTextSize(16); break; case "large": noteTitle.setTextSize(18); break; case "largest": noteTitle.setTextSize(20); break; } // Return the completed view to render on screen return convertView; }
From source file:org.mdc.chess.SeekBarPreference.java
@Override protected View onCreateView(ViewGroup parent) { TextView name = new TextView(getContext()); name.setText(getTitle());/* w w w . jav a2 s . co m*/ //name.setTextAppearance(getContext(), android.R.style.TextAppearance_Large); TextViewCompat.setTextAppearance(name, android.R.style.TextAppearance_Large); name.setGravity(Gravity.START); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.START; lp.weight = 1.0f; name.setLayoutParams(lp); currValBox = new TextView(getContext()); currValBox.setTextSize(12); currValBox.setTypeface(Typeface.MONOSPACE, Typeface.ITALIC); currValBox.setPadding(2, 5, 0, 0); currValBox.setText(valToString()); lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER; currValBox.setLayoutParams(lp); LinearLayout row1 = new LinearLayout(getContext()); row1.setOrientation(LinearLayout.HORIZONTAL); row1.addView(name); row1.addView(currValBox); final SeekBar bar = new SeekBar(getContext()); bar.setMax(maxValue); bar.setProgress(currVal); bar.setOnSeekBarChangeListener(this); lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.END; bar.setLayoutParams(lp); CharSequence summaryCharSeq = getSummary(); boolean haveSummary = (summaryCharSeq != null) && (summaryCharSeq.length() > 0); TextView summary = null; if (haveSummary) { summary = new TextView(getContext()); summary.setText(getSummary()); // summary.setTextAppearance(getContext(), android.R.style.TextAppearance_Large); summary.setGravity(Gravity.START); lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.START; lp.weight = 1.0f; summary.setLayoutParams(lp); } LinearLayout layout = new LinearLayout(getContext()); layout.setPadding(25, 5, 25, 5); layout.setOrientation(LinearLayout.VERTICAL); layout.addView(row1); layout.addView(bar); if (summary != null) { layout.addView(summary); } layout.setId(android.R.id.widget_frame); currValBox.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { View content = View.inflate(SeekBarPreference.this.getContext(), R.layout.select_percentage, null); final AlertDialog.Builder builder = new AlertDialog.Builder(SeekBarPreference.this.getContext()); builder.setView(content); String title = ""; String key = getKey(); if (key.equals("strength")) { title = getContext().getString(R.string.edit_strength); } else if (key.equals("bookRandom")) { title = getContext().getString(R.string.edit_randomization); } builder.setTitle(title); final EditText valueView = (EditText) content.findViewById(R.id.selpercentage_number); valueView.setText(currValBox.getText().toString().replaceAll("%", "").replaceAll(",", ".")); final Runnable selectValue = new Runnable() { public void run() { try { String txt = valueView.getText().toString(); int value = (int) (Double.parseDouble(txt) * 10 + 0.5); if (value < 0) value = 0; if (value > maxValue) value = maxValue; onProgressChanged(bar, value, false); } catch (NumberFormatException ignored) { } } }; valueView.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { selectValue.run(); return true; } return false; } }); builder.setPositiveButton("Ok", new Dialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { selectValue.run(); } }); builder.setNegativeButton("Cancel", null); builder.create().show(); } }); return layout; }
From source file:com.farmerbb.notepad.adapter.NoteListDateAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { // Get the data item for this position NoteListItem item = getItem(position); String note = item.getNote(); String date = item.getDate(); // Check if an existing view is being reused, otherwise inflate the view if (convertView == null) convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_layout_date, parent, false); // Lookup view for data population TextView noteTitle = convertView.findViewById(R.id.noteTitle); TextView noteDate = convertView.findViewById(R.id.noteDate); // Populate the data into the template view using the data object noteTitle.setText(note);/*from www .j av a2 s . c o m*/ noteDate.setText(date); // Apply theme SharedPreferences pref = getContext().getSharedPreferences(getContext().getPackageName() + "_preferences", Context.MODE_PRIVATE); String theme = pref.getString("theme", "light-sans"); if (theme.contains("light")) { noteTitle.setTextColor(ContextCompat.getColor(getContext(), R.color.text_color_primary)); noteDate.setTextColor(ContextCompat.getColor(getContext(), R.color.text_color_secondary)); } if (theme.contains("dark")) { noteTitle.setTextColor(ContextCompat.getColor(getContext(), R.color.text_color_primary_dark)); noteDate.setTextColor(ContextCompat.getColor(getContext(), R.color.text_color_secondary_dark)); } if (theme.contains("sans")) { noteTitle.setTypeface(Typeface.SANS_SERIF); noteDate.setTypeface(Typeface.SANS_SERIF); } if (theme.contains("serif")) { noteTitle.setTypeface(Typeface.SERIF); noteDate.setTypeface(Typeface.SERIF); } if (theme.contains("monospace")) { noteTitle.setTypeface(Typeface.MONOSPACE); noteDate.setTypeface(Typeface.MONOSPACE); } switch (pref.getString("font_size", "normal")) { case "smallest": noteTitle.setTextSize(12); noteDate.setTextSize(8); break; case "small": noteTitle.setTextSize(14); noteDate.setTextSize(10); break; case "normal": noteTitle.setTextSize(16); noteDate.setTextSize(12); break; case "large": noteTitle.setTextSize(18); noteDate.setTextSize(14); break; case "largest": noteTitle.setTextSize(20); noteDate.setTextSize(16); break; } // Return the completed view to render on screen return convertView; }