From a927851a30115c4e8c65ab581b7971d62836ebe2 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Thu, 15 Aug 2019 18:41:13 -0500 Subject: [PATCH] Convert MarkdownPresenter to Kotlin --- .../presentation/MarkdownPresenter.java | 42 ------------------- .../presentation/MarkdownPresenter.kt | 40 ++++++++++++++++++ 2 files changed, 40 insertions(+), 42 deletions(-) delete mode 100644 app/src/main/java/com/wbrawner/simplemarkdown/presentation/MarkdownPresenter.java create mode 100644 app/src/main/java/com/wbrawner/simplemarkdown/presentation/MarkdownPresenter.kt diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/presentation/MarkdownPresenter.java b/app/src/main/java/com/wbrawner/simplemarkdown/presentation/MarkdownPresenter.java deleted file mode 100644 index 010f6a8..0000000 --- a/app/src/main/java/com/wbrawner/simplemarkdown/presentation/MarkdownPresenter.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.wbrawner.simplemarkdown.presentation; - -import android.content.Context; -import android.net.Uri; - -import com.wbrawner.simplemarkdown.view.MarkdownEditView; -import com.wbrawner.simplemarkdown.view.MarkdownPreviewView; - -import java.io.InputStream; -import java.io.OutputStream; - -public interface MarkdownPresenter { - void loadMarkdown(String fileName, InputStream in); - void loadFromUri(Context context, Uri fileUri); - - void loadMarkdown(String fileName, InputStream in, FileLoadedListener listener, - boolean replaceCurrentFile); - - void newFile(String newName); - void setEditView(MarkdownEditView editView); - void setPreviewView(MarkdownPreviewView previewView); - - void saveMarkdown(MarkdownSavedListener listener, String name, OutputStream outputStream); - void onMarkdownEdited(); - void onMarkdownEdited(String markdown); - String getFileName(); - void setFileName(String name); - String generateHTML(); - String generateHTML(String markdown); - String getMarkdown(); - void setMarkdown(String markdown); - - interface FileLoadedListener { - void onSuccess(String markdown); - - void onError(); - } - - interface MarkdownSavedListener { - void saveComplete(boolean success); - } -} diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/presentation/MarkdownPresenter.kt b/app/src/main/java/com/wbrawner/simplemarkdown/presentation/MarkdownPresenter.kt new file mode 100644 index 0000000..0cffc0a --- /dev/null +++ b/app/src/main/java/com/wbrawner/simplemarkdown/presentation/MarkdownPresenter.kt @@ -0,0 +1,40 @@ +package com.wbrawner.simplemarkdown.presentation + +import android.content.Context +import android.net.Uri + +import com.wbrawner.simplemarkdown.view.MarkdownEditView +import com.wbrawner.simplemarkdown.view.MarkdownPreviewView + +import java.io.InputStream +import java.io.OutputStream + +interface MarkdownPresenter { + var fileName: String + var markdown: String + fun loadMarkdown(fileName: String, `in`: InputStream) + fun loadFromUri(context: Context, fileUri: Uri) + + fun loadMarkdown(fileName: String, `in`: InputStream, listener: FileLoadedListener, + replaceCurrentFile: Boolean) + + fun newFile(newName: String) + fun setEditView(editView: MarkdownEditView) + fun setPreviewView(previewView: MarkdownPreviewView) + + fun saveMarkdown(listener: MarkdownSavedListener, name: String, outputStream: OutputStream) + fun onMarkdownEdited() + fun onMarkdownEdited(markdown: String) + fun generateHTML(): String + fun generateHTML(markdown: String): String + + interface FileLoadedListener { + fun onSuccess(markdown: String) + + fun onError() + } + + interface MarkdownSavedListener { + fun saveComplete(success: Boolean) + } +}