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.anjalimacwan.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 = (TextView) convertView.findViewById(R.id.noteTitle); TextView noteDate = (TextView) convertView.findViewById(R.id.noteDate); // Populate the data into the template view using the data object noteTitle.setText(note);/*from w w w. j ava2 s .com*/ 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; }
From source file:com.iskrembilen.quasseldroid.gui.dialogs.TopicEditDialog.java
@Override public @NonNull Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { topic = getArguments().getCharSequence("topic"); name = getArguments().getString("name"); id = getArguments().getInt("id"); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); SharedPreferences preferences = PreferenceManager .getDefaultSharedPreferences(getActivity().getApplicationContext()); View dialog = getActivity().getLayoutInflater().inflate(R.layout.dialog_simple_edit, null); final EditText topicField = (EditText) dialog.findViewById(R.id.dialog_simple_text); this.topicField = topicField; topicField.setHint(R.string.hint_topic_edit); topicField.setText(MessageUtil.parseStyleCodes(getActivity(), topic.toString(), preferences.getBoolean(getResources().getString(R.string.preference_colored_text), true))); if (preferences.getBoolean(getString(R.string.preference_monospace), false)) { topicField.setTypeface(Typeface.MONOSPACE); }/*from www .j a v a 2 s . c o m*/ builder.setView(dialog).setTitle(name); builder.setPositiveButton(getString(R.string.action_close), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.setNeutralButton(getString(R.string.action_save), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { BusProvider.getInstance() .post(new SendMessageEvent(id, "/topic " + topicField.getText().toString())); } }); return builder.create(); }
From source file:com.iskrembilen.quasseldroid.gui.dialogs.TopicViewDialog.java
@Override public @NonNull Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { id = getArguments().getInt("id"); mBuffer = Client.getInstance().getNetworks().getBufferById(id); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); SharedPreferences preferences = PreferenceManager .getDefaultSharedPreferences(getActivity().getApplicationContext()); View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_simple_view, null); TextView topicField = (TextView) view.findViewById(R.id.dialog_simple_text); topicField.setText(MessageUtil.parseStyleCodes(getActivity(), mBuffer.getTopic(), preferences.getBoolean(getResources().getString(R.string.preference_colored_text), true))); if (preferences.getBoolean(getString(R.string.preference_monospace), false)) { topicField.setTypeface(Typeface.MONOSPACE); }/*from w ww . j av a 2 s. c o m*/ String bufferName; if (mBuffer.getInfo().type == BufferInfo.Type.StatusBuffer) bufferName = Client.getInstance().getNetworks().getNetworkById(mBuffer.getInfo().networkId).getName(); else bufferName = mBuffer.getInfo().name; builder.setView(view).setTitle(bufferName) .setPositiveButton(getString(R.string.action_close), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).setNeutralButton(getString(R.string.action_edit), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { TopicEditDialog.newInstance(mBuffer.getTopic(), mBuffer.getInfo().name, id) .show(getFragmentManager(), TAG); } }); mDialog = builder.create(); mDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { if (mBuffer.getInfo().type != BufferInfo.Type.ChannelBuffer) { mDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setEnabled(false); } } }); BusProvider.getInstance().register(this); return mDialog; }
From source file:com.dgmltn.ranger.internal.PinView.java
/** * The view is created empty with a default constructor. Use init to set all the initial * variables for the pin/*from w ww. j av a 2 s.c o m*/ * * @param position The position of this point in its parent's view * @param pinRadiusDP the initial size of the pin * @param pinColor the color of the pin * @param textColor the color of the value text in the pin * @param circleRadius the radius of the selector circle * @param circleColor the color of the selector circle */ public void init(PointF position, float pinRadiusDP, int pinColor, int textColor, float circleRadius, int circleColor, float minFont, float maxFont) { mPin = ContextCompat.getDrawable(getContext(), R.drawable.rotate); mPosition = position; mDensity = getResources().getDisplayMetrics().density; mMinPinFont = minFont / mDensity; mMaxPinFont = maxFont / mDensity; mPinPadding = (int) (15f * mDensity); mCircleRadiusPx = circleRadius; mTextYPadding = (int) (3.5f * mDensity); mPinRadiusPx = (int) ((pinRadiusDP == -1 ? DEFAULT_THUMB_RADIUS_DP : pinRadiusDP) * mDensity); // Creates the paint and sets the Paint values mTextPaint = new TextPaint(); mTextPaint.setTypeface(Typeface.MONOSPACE); mTextPaint.setColor(textColor); mTextPaint.setAntiAlias(true); mTextPaint.setTextSize(15f * mDensity); // Creates the paint and sets the Paint values mCirclePaint = new Paint(); mCirclePaint.setColor(circleColor); mCirclePaint.setAntiAlias(true); // Color filter for the selection pin mPinFilter = new LightingColorFilter(pinColor, pinColor); // Sets the minimum touchable area, but allows it to expand based on image size mTargetRadiusPx = Math.max(MINIMUM_TARGET_RADIUS_DP * mDensity, mPinRadiusPx); }
From source file:com.vmihalachi.turboeditor.fragment.EditorFragment.java
/** * {@inheritDoc}//from w w w. j a v a2 s. co m */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_editor, container, false); mEditor = (Editor) rootView.findViewById(R.id.editor); if (this.sLineNumbers) { int paddingLeft = (int) PixelDipConverter.convertDpToPixel(sFontSize * 1.5f, getActivity()); mEditor.setPadding(paddingLeft, 0, 0, 0); } else { int paddingLeft = (int) PixelDipConverter.convertDpToPixel(5, getActivity()); mEditor.setPadding(paddingLeft, 0, 0, 0); } if (this.mUseMonospace) { mEditor.setTypeface(Typeface.MONOSPACE); } mEditor.setTextSize(sFontSize); return rootView; }
From source file:com.softminds.matrixcalculator.ChangeLogActivity.java
private void SetNewContents(int key) { if (!Changes(key).equals("null")) { CardView.LayoutParams param = new CardView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); CardView card = new CardView(this); if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("DARK_THEME_KEY", false)) card.setCardBackgroundColor(ContextCompat.getColor(this, R.color.DarkcolorPrimary)); card.setCardElevation(5);/* w w w .j a va2s. co m*/ card.setLayoutParams(param); card.setPadding(ConvertTopx(15), ConvertTopx(15), ConvertTopx(15), ConvertTopx(15)); card.setUseCompatPadding(true); TextView changes = new TextView(this); changes.setGravity(Gravity.CENTER); changes.setPadding(ConvertTopx(5), ConvertTopx(5), ConvertTopx(5), ConvertTopx(5)); changes.setText(Changes(key)); changes.setTypeface(Typeface.MONOSPACE); if (firebaseRemoteConfig.getBoolean("mark_red") && key == 0) changes.setTextColor(Color.RED); card.addView(changes); layout.addView(card); } bar.setVisibility(View.GONE); }
From source file:bander.notepad.NoteEditAppCompat.java
@Override protected void onResume() { super.onResume(); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); // Font size/*from w w w .ja v a 2 s .c o m*/ float textSize = Float.valueOf(preferences.getString("textSize", "16")); mBodyText.setTextSize(textSize); // Monospace font SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); boolean typeface = settings.getBoolean("typeface", true); if (typeface) { Typeface font = Typeface.MONOSPACE; mBodyText.setTypeface(font); } else { mBodyText.setTypeface(Typeface.SANS_SERIF); } // Auto-correct boolean input = preferences.getBoolean("inputType", true); if (input) { // AutoCorrect on mBodyText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE); } else { // AutoCorrect off mBodyText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_FLAG_MULTI_LINE); } Cursor cursor = getContentResolver().query(mUri, PROJECTION, null, null, null); Note note = Note.fromCursor(cursor); cursor.close(); if (note != null) { if (mOriginalNote == null) mOriginalNote = note; mBodyText.setTextKeepState(note.getBody()); Boolean rememberPosition = preferences.getBoolean("rememberPosition", true); if (rememberPosition) { mBodyText.setSelection(note.getCursor()); mBodyText.scrollTo(0, note.getScrollY()); } } }
From source file:de.schildbach.wallet.ui.TransactionFragment.java
public void update(final Transaction tx) { final Wallet wallet = ((WalletApplication) activity.getApplication()).getWallet(); final byte[] serializedTx = tx.unsafeBitcoinSerialize(); Address from = null;// w w w . j a va 2 s. com boolean fromMine = false; try { from = tx.getInputs().get(0).getFromAddress(); fromMine = wallet.isPubKeyHashMine(from.getHash160()); } catch (final ScriptException x) { x.printStackTrace(); } Address to = null; boolean toMine = false; try { to = tx.getOutputs().get(0).getScriptPubKey().getToAddress(); toMine = wallet.isPubKeyHashMine(to.getHash160()); } catch (final ScriptException x) { x.printStackTrace(); } final ContentResolver contentResolver = activity.getContentResolver(); final View view = getView(); final Date time = tx.getUpdateTime(); view.findViewById(R.id.transaction_fragment_time_row) .setVisibility(time != null ? View.VISIBLE : View.GONE); if (time != null) { final TextView viewDate = (TextView) view.findViewById(R.id.transaction_fragment_time); viewDate.setText( (DateUtils.isToday(time.getTime()) ? getString(R.string.time_today) : dateFormat.format(time)) + ", " + timeFormat.format(time)); } try { final BigInteger amountSent = tx.getValueSentFromMe(wallet); view.findViewById(R.id.transaction_fragment_amount_sent_row) .setVisibility(amountSent.signum() != 0 ? View.VISIBLE : View.GONE); if (amountSent.signum() != 0) { final TextView viewAmountSent = (TextView) view.findViewById(R.id.transaction_fragment_amount_sent); viewAmountSent.setText(Constants.CURRENCY_MINUS_SIGN + WalletUtils.formatValue(amountSent)); } } catch (final ScriptException x) { x.printStackTrace(); } final BigInteger amountReceived = tx.getValueSentToMe(wallet); view.findViewById(R.id.transaction_fragment_amount_received_row) .setVisibility(amountReceived.signum() != 0 ? View.VISIBLE : View.GONE); if (amountReceived.signum() != 0) { final TextView viewAmountReceived = (TextView) view .findViewById(R.id.transaction_fragment_amount_received); viewAmountReceived.setText(Constants.CURRENCY_PLUS_SIGN + WalletUtils.formatValue(amountReceived)); } final View viewFromButton = view.findViewById(R.id.transaction_fragment_from_button); final TextView viewFromLabel = (TextView) view.findViewById(R.id.transaction_fragment_from_label); if (from != null) { final String label = AddressBookProvider.resolveLabel(contentResolver, from.toString()); final StringBuilder builder = new StringBuilder(); if (fromMine) builder.append(getString(R.string.transaction_fragment_you)).append(", "); if (label != null) { builder.append(label); } else { builder.append(from.toString()); viewFromLabel.setTypeface(Typeface.MONOSPACE); } viewFromLabel.setText(builder.toString()); final String addressStr = from.toString(); viewFromButton.setOnClickListener(new OnClickListener() { public void onClick(final View v) { EditAddressBookEntryFragment.edit(getFragmentManager(), addressStr); } }); } else { viewFromLabel.setText(null); } final View viewToButton = view.findViewById(R.id.transaction_fragment_to_button); final TextView viewToLabel = (TextView) view.findViewById(R.id.transaction_fragment_to_label); if (to != null) { final String label = AddressBookProvider.resolveLabel(contentResolver, to.toString()); final StringBuilder builder = new StringBuilder(); if (toMine) builder.append(getString(R.string.transaction_fragment_you)).append(", "); if (label != null) { builder.append(label); } else { builder.append(to.toString()); viewToLabel.setTypeface(Typeface.MONOSPACE); } viewToLabel.setText(builder.toString()); final String addressStr = to.toString(); viewToButton.setOnClickListener(new OnClickListener() { public void onClick(final View v) { EditAddressBookEntryFragment.edit(getFragmentManager(), addressStr); } }); } else { viewToLabel.setText(null); } final TextView viewStatus = (TextView) view.findViewById(R.id.transaction_fragment_status); final ConfidenceType confidenceType = tx.getConfidence().getConfidenceType(); if (confidenceType == ConfidenceType.DEAD || confidenceType == ConfidenceType.NOT_IN_BEST_CHAIN) viewStatus.setText(R.string.transaction_fragment_status_dead); else if (confidenceType == ConfidenceType.NOT_SEEN_IN_CHAIN) viewStatus.setText(R.string.transaction_fragment_status_pending); else if (confidenceType == ConfidenceType.BUILDING) viewStatus.setText(R.string.transaction_fragment_status_confirmed); else viewStatus.setText(R.string.transaction_fragment_status_unknown); final TextView viewHash = (TextView) view.findViewById(R.id.transaction_fragment_hash); viewHash.setText(tx.getHash().toString()); final TextView viewLength = (TextView) view.findViewById(R.id.transaction_fragment_length); viewLength.setText(Integer.toString(serializedTx.length)); final ImageView viewQr = (ImageView) view.findViewById(R.id.transaction_fragment_qr); try { // encode transaction URI final ByteArrayOutputStream bos = new ByteArrayOutputStream(serializedTx.length); final GZIPOutputStream gos = new GZIPOutputStream(bos); gos.write(serializedTx); gos.close(); final byte[] gzippedSerializedTx = bos.toByteArray(); final boolean useCompressioon = gzippedSerializedTx.length < serializedTx.length; final StringBuilder txStr = new StringBuilder("btctx:"); txStr.append(useCompressioon ? 'Z' : '-'); txStr.append(Base43.encode(useCompressioon ? gzippedSerializedTx : serializedTx)); final Bitmap qrCodeBitmap = WalletUtils.getQRCodeBitmap(txStr.toString().toUpperCase(Locale.US), 512); viewQr.setImageBitmap(qrCodeBitmap); viewQr.setOnClickListener(new OnClickListener() { public void onClick(final View v) { BitmapFragment.show(getFragmentManager(), qrCodeBitmap); } }); } catch (final IOException x) { throw new RuntimeException(x); } }
From source file:piuk.blockchain.android.ui.TransactionFragment.java
public void update(final MyTransaction tx) { final MyRemoteWallet wallet = ((WalletApplication) activity.getApplication()).getRemoteWallet(); final byte[] serializedTx = tx.unsafeBitcoinSerialize(); Address from = null;/*from w w w . j a va 2s . c o m*/ boolean fromMine = false; try { from = tx.getInputs().get(0).getFromAddress(); fromMine = wallet.isMine(from.toString()); } catch (final ScriptException x) { x.printStackTrace(); } Address to = null; boolean toMine = false; try { to = tx.getOutputs().get(0).getScriptPubKey().getToAddress(); toMine = wallet.isMine(to.toString()); } catch (final ScriptException x) { x.printStackTrace(); } final ContentResolver contentResolver = activity.getContentResolver(); final View view = getView(); final Date time = tx.getUpdateTime(); view.findViewById(R.id.transaction_fragment_time_row) .setVisibility(time != null ? View.VISIBLE : View.GONE); if (time != null) { final TextView viewDate = (TextView) view.findViewById(R.id.transaction_fragment_time); viewDate.setText( (DateUtils.isToday(time.getTime()) ? getString(R.string.transaction_fragment_time_today) : dateFormat.format(time)) + ", " + timeFormat.format(time)); } final BigInteger amountSent = tx.getResult(); view.findViewById(R.id.transaction_fragment_amount_sent_row) .setVisibility(amountSent.signum() != 0 ? View.VISIBLE : View.GONE); if (amountSent.signum() != 0) { final TextView viewAmountSent = (TextView) view.findViewById(R.id.transaction_fragment_amount_sent); viewAmountSent.setText(Constants.CURRENCY_MINUS_SIGN + WalletUtils.formatValue(amountSent)); } final BigInteger amountReceived = tx.getResult(); view.findViewById(R.id.transaction_fragment_amount_received_row) .setVisibility(amountReceived.signum() != 0 ? View.VISIBLE : View.GONE); if (amountReceived.signum() != 0) { final TextView viewAmountReceived = (TextView) view .findViewById(R.id.transaction_fragment_amount_received); viewAmountReceived.setText(Constants.CURRENCY_PLUS_SIGN + WalletUtils.formatValue(amountReceived)); } final View viewFromButton = view.findViewById(R.id.transaction_fragment_from_button); final TextView viewFromLabel = (TextView) view.findViewById(R.id.transaction_fragment_from_label); if (from != null) { String label = null; if (tx instanceof MyTransaction && ((MyTransaction) tx).getTag() != null) label = ((MyTransaction) tx).getTag(); else label = AddressBookProvider.resolveLabel(contentResolver, from.toString()); final StringBuilder builder = new StringBuilder(); if (fromMine) builder.append(getString(R.string.transaction_fragment_you)).append(", "); if (label != null) { builder.append(label); } else { builder.append(from.toString()); viewFromLabel.setTypeface(Typeface.MONOSPACE); } viewFromLabel.setText(builder.toString()); final String addressStr = from.toString(); viewFromButton.setOnClickListener(new OnClickListener() { public void onClick(final View v) { EditAddressBookEntryFragment.edit(getFragmentManager(), addressStr); } }); } else { viewFromLabel.setText(null); } final View viewToButton = view.findViewById(R.id.transaction_fragment_to_button); final TextView viewToLabel = (TextView) view.findViewById(R.id.transaction_fragment_to_label); if (to != null) { String label = null; if (tx instanceof MyTransaction && ((MyTransaction) tx).getTag() != null) label = ((MyTransaction) tx).getTag(); else label = AddressBookProvider.resolveLabel(contentResolver, from.toString()); final StringBuilder builder = new StringBuilder(); if (toMine) builder.append(getString(R.string.transaction_fragment_you)).append(", "); if (label != null) { builder.append(label); } else { builder.append(to.toString()); viewToLabel.setTypeface(Typeface.MONOSPACE); } viewToLabel.setText(builder.toString()); final String addressStr = to.toString(); viewToButton.setOnClickListener(new OnClickListener() { public void onClick(final View v) { EditAddressBookEntryFragment.edit(getFragmentManager(), addressStr); } }); } else { viewToLabel.setText(null); } final TextView viewStatus = (TextView) view.findViewById(R.id.transaction_fragment_status); final ConfidenceType confidenceType = tx.getConfidence().getConfidenceType(); if (confidenceType == ConfidenceType.DEAD || confidenceType == ConfidenceType.NOT_IN_BEST_CHAIN) viewStatus.setText(R.string.transaction_fragment_status_dead); else if (confidenceType == ConfidenceType.NOT_SEEN_IN_CHAIN) viewStatus.setText(R.string.transaction_fragment_status_pending); else if (confidenceType == ConfidenceType.BUILDING) viewStatus.setText(R.string.transaction_fragment_status_confirmed); else viewStatus.setText(R.string.transaction_fragment_status_unknown); final TextView viewHash = (TextView) view.findViewById(R.id.transaction_fragment_hash); viewHash.setText(tx.getHash().toString()); final TextView viewLength = (TextView) view.findViewById(R.id.transaction_fragment_length); viewLength.setText(Integer.toString(serializedTx.length)); final ImageView viewQr = (ImageView) view.findViewById(R.id.transaction_fragment_qr); try { // encode transaction URI final ByteArrayOutputStream bos = new ByteArrayOutputStream(serializedTx.length); final GZIPOutputStream gos = new GZIPOutputStream(bos); gos.write(serializedTx); gos.close(); final byte[] gzippedSerializedTx = bos.toByteArray(); final boolean useCompressioon = gzippedSerializedTx.length < serializedTx.length; final StringBuilder txStr = new StringBuilder("btctx:"); txStr.append(useCompressioon ? 'Z' : '-'); txStr.append(Base43.encode(useCompressioon ? gzippedSerializedTx : serializedTx)); final Bitmap qrCodeBitmap = WalletUtils.getQRCodeBitmap(txStr.toString().toUpperCase(), 512); viewQr.setImageBitmap(qrCodeBitmap); viewQr.setOnClickListener(new OnClickListener() { public void onClick(final View v) { new QrDialog(activity, qrCodeBitmap).show(); } }); } catch (final IOException x) { throw new RuntimeException(x); } }
From source file:com.jbirdvegas.mgerrit.dialogs.DiffDialog.java
private void setTextView(String result) { Pattern pattern = Pattern.compile("\\Qdiff --git \\E"); String[] filesChanged = pattern.split(result); StringBuilder builder = new StringBuilder(0); Diff currentDiff = null;//from www .j a va 2s .com for (String change : filesChanged) { String concat; try { concat = change.substring(2, change.lastIndexOf(mChangedFile.getPath())).trim(); concat = concat.split(" ")[0]; } catch (StringIndexOutOfBoundsException notFound) { Log.d(TAG, notFound.getMessage()); continue; } if (concat.equals(mChangedFile.getPath())) { builder.append(DIFF); change.replaceAll("\n", mLineSplit); currentDiff = new Diff(getContext(), change); builder.append(change); } } if (builder.length() == 0) { builder.append("Diff not found!"); } // reset text size to default mDiffTextView.setTextAppearance(getContext(), android.R.style.TextAppearance_DeviceDefault_Small); mDiffTextView.setTypeface(Typeface.MONOSPACE); // rebuild text; required to respect the \n SpannableString spannableString = currentDiff.getColorizedSpan(); if (spannableString != null) { mDiffTextView.setText(currentDiff.getColorizedSpan(), TextView.BufferType.SPANNABLE); } else { mDiffTextView.setText("Failed to load diff :("); } }