From 478034cf2261eec669de119e869d8aad6fbf4707 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Sat, 17 Aug 2019 13:51:01 -0500 Subject: [PATCH] Delete MarkdownViewModel --- .../simplemarkdown/MarkdownViewModel.java | 76 ------------------- 1 file changed, 76 deletions(-) delete mode 100644 app/src/main/java/com/wbrawner/simplemarkdown/MarkdownViewModel.java diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/MarkdownViewModel.java b/app/src/main/java/com/wbrawner/simplemarkdown/MarkdownViewModel.java deleted file mode 100644 index 3cf17fa..0000000 --- a/app/src/main/java/com/wbrawner/simplemarkdown/MarkdownViewModel.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.wbrawner.simplemarkdown; - -public class MarkdownViewModel { -/* - private static final String TAG = MarkdownViewModel.class.getSimpleName(); - private File file; - public MutableLiveData markdownLiveData; - private MutableLiveData htmlLiveData = new MutableLiveData<>();; - - public MarkdownViewModel() { - markdownLiveData = new MutableLiveData<>(); - } - - public void updateMarkdown(String data) { - if (markdownLiveData == null) - markdownLiveData = new MutableLiveData<>(); - markdownLiveData.postValue(data); - Runnable generateMarkdown = () -> { - AndDown andDown = new AndDown(); - int hoedownFlags = - AndDown.HOEDOWN_EXT_STRIKETHROUGH | AndDown.HOEDOWN_EXT_TABLES | - AndDown.HOEDOWN_EXT_UNDERLINE | AndDown.HOEDOWN_EXT_SUPERSCRIPT | - AndDown.HOEDOWN_EXT_FENCED_CODE; - htmlLiveData.postValue(andDown.markdownToHtml(markdownLiveData.getValue(), hoedownFlags, 0)); - }; - if (markdownLiveData.getValue() != null) - generateMarkdown.run(); - } - - public LiveData getHtml() { - return htmlLiveData; - } - - public void openFile(String filePath) { - file = new File(filePath); - } - - public String getFileName() { - if (file == null || file.getName().isEmpty()) - return "Untitled.md"; - return file.getName(); - } - - public boolean saveFile(String filePath, @Nullable String fileName) { - if (fileName == null) { - if (file != null) - fileName = file.getName(); - else - fileName = "Untitled.md"; - } - if (!filePath.endsWith("/")) - filePath += "/"; - final boolean result; - new AsyncTask() { - @Override - protected Void doInBackground(String... strings) { - try { - PrintWriter writer = new PrintWriter(strings[0], "UTF-8"); - writer.write(markdownLiveData.getValue()); - } catch (IOException e) { - Log.e(TAG, "Error saving file: ", e); - } - return null; - } - }.execute(filePath + fileName); - return true; - } - - public void requestSave(String s) { - // Do something to save the file? - } - - public String getMarkdown() { - return markdownLiveData.getValue(); - } */ -}