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

Commit 10de6d0a authored by stefan-niedermann's avatar stefan-niedermann
Browse files

#439 Allow Rendering of any markdown file

Some refactorings
parent 5cde97fe
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="content" />
                <data android:host="*" />
                <data android:mimeType="*/*" />
                <data android:mimeType="text/*" />
            </intent-filter>
        </activity>

+5 −5
Original line number Diff line number Diff line
@@ -177,19 +177,19 @@ public class EditNoteActivity extends AppCompatActivity implements BaseNoteFragm

    private void launchReadonlyNote() {
        Intent intent = getIntent();
        StringBuilder text = new StringBuilder();
        StringBuilder content = new StringBuilder();
        try {
            InputStream inputStream = getContentResolver().openInputStream(Objects.requireNonNull(intent.getData()));
            BufferedReader r = new BufferedReader(new InputStreamReader(Objects.requireNonNull(inputStream)));
            String mLine;
            while ((mLine = r.readLine()) != null) {
                text.append(mLine).append('\n');
            String line;
            while ((line = r.readLine()) != null) {
                content.append(line).append('\n');
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

        fragment = NoteReadonlyFragment.newInstance(text.toString());
        fragment = NoteReadonlyFragment.newInstance(content.toString());
        getSupportFragmentManager().beginTransaction().replace(android.R.id.content, fragment).commit();
    }

+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ public abstract class BaseNoteFragment extends Fragment implements CategoryDialo
                        if (content == null) {
                            throw new IllegalArgumentException(PARAM_NOTE_ID + " is not given, argument " + PARAM_NEWNOTE + " is missing and " + PARAM_CONTENT + " is missing.");
                        } else {
                            note = new DBNote(-1, -1, null, NoteUtil.generateNonEmptyNoteTitle(content, getContext()), content, false, "", null, DBStatus.VOID, -1, "");
                            note = new DBNote(-1, -1, null, NoteUtil.generateNonEmptyNoteTitle(content, getContext()), content, false, getString(R.string.category_readonly), null, DBStatus.VOID, -1, "");
                        }
                    } else {
                        note = db.getNote(localAccount.getId(), db.addNoteAndSync(localAccount.getId(), cloudNote));
+1 −0
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@
    <string name="checkbox_could_not_be_toggled">Checkbox could not be toggled.</string>
    <string name="bulk_notes_deleted">Deleted %1$d notes</string>
    <string name="bulk_notes_restored">Restored %1$d notes</string>
    <string name="category_readonly">Read only</string>

    <!-- Array: note modes -->
    <string-array name="noteMode_entries">