Convert MarkdownPresenter to Kotlin

This commit is contained in:
Billy Brawner 2019-08-15 18:41:13 -05:00 committed by William Brawner
parent a887a5b06a
commit a927851a30
2 changed files with 40 additions and 42 deletions

View file

@ -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);
}
}

View file

@ -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)
}
}