Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61080f6c authored by Niedermann IT-Dienstleistungen's avatar Niedermann IT-Dienstleistungen
Browse files

#359 Use monospace font

Introduces a new setting and displays edit and view mode in monospace if it is set.
parent ba19a6b6
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
package it.niedermann.owncloud.notes.android.fragment;

import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.text.Editable;
import android.text.TextWatcher;
@@ -108,6 +111,11 @@ public class NoteEditFragment extends BaseNoteFragment {
                        editContent.setText(charSequence, TextView.BufferType.SPANNABLE);
                    }
                });

        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
        if(sp.getBoolean("font", false)) {
            editContent.setTypeface(Typeface.MONOSPACE);
        }
    }

    private final TextWatcher textWatcher = new TextWatcher() {
+8 −0
Original line number Diff line number Diff line
package it.niedermann.owncloud.notes.android.fragment;

import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.text.method.LinkMovementMethod;
import android.util.Log;
@@ -91,6 +94,11 @@ public class NotePreviewFragment extends BaseNoteFragment {
                });
        noteContent.setText(content);
        noteContent.setMovementMethod(LinkMovementMethod.getInstance());

        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
        if(sp.getBoolean("font", false)) {
            noteContent.setTypeface(Typeface.MONOSPACE);
        }
    }

    @Override
+5 −0
Original line number Diff line number Diff line
<vector android:height="24dp" android:tint="#757575"
    android:viewportHeight="24.0" android:viewportWidth="24.0"
    android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#FF000000" android:pathData="M2.5,4v3h5v12h3L10.5,7h5L15.5,4h-13zM21.5,9h-9v3h3v7h3v-7h3L21.5,9z"/>
</vector>
+3 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@
    <string name="settings_submitting">Connecting &#8230;</string>
    <string name="settings_note_mode">Display mode for Notes</string>
    <string name="settings_theme_title">Theme</string>
    <string name="settings_font_title">Mono-Font</string>
    <string name="settings_cert_category">Manage certificates</string>
    <string name="settings_cert_trust_system">Trust system certificates</string>
    <string name="settings_cert_trust_system_on">System and user-added CAs will be trusted (recommended)</string>
@@ -135,6 +136,7 @@
    <string name="pref_key_reset_trust" translatable="false">resetTrust</string>
    <string name="pref_key_note_mode" translatable="false">noteMode</string>
    <string name="pref_key_theme" translatable="false">darkTheme</string>
    <string name="pref_key_font" translatable="false">font</string>
    <string name="pref_key_last_note_mode" translatable="false">lastNoteMode</string>
    <string name="pref_value_mode_edit" translatable="false">edit</string>
    <string name="pref_value_mode_preview" translatable="false">preview</string>
@@ -142,6 +144,7 @@
    <string name="pref_value_mode_note" translatable="false">note</string>
    <string name="pref_value_theme_light">Light</string>
    <string name="pref_value_theme_dark">Dark</string>
    <string name="pref_value_font_normal">Normal</string>

    <!-- Array: note modes -->
    <string-array name="noteMode_entries">
+6 −0
Original line number Diff line number Diff line
@@ -25,6 +25,12 @@
        android:summary="%s"
        android:title="@string/settings_theme_title" />

    <SwitchPreference
        android:defaultValue="@string/pref_value_font_normal"
        android:icon="@drawable/ic_text_fields_black_24dp"
        android:key="@string/pref_key_font"
        android:title="@string/settings_font_title" />

    <PreferenceScreen
        android:key="@string/pref_key_certs"
        android:persistent="false"