Premerge commit
This commit is contained in:
parent
6369d29e1d
commit
4a60c27d32
4 changed files with 13 additions and 7 deletions
|
@ -20,7 +20,7 @@ android {
|
|||
}
|
||||
defaultConfig {
|
||||
applicationId "com.wbrawner.simplemarkdown"
|
||||
minSdkVersion 15
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 26
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
|
|
@ -83,6 +83,7 @@ public class MarkdownPresenterImpl implements MarkdownPresenter {
|
|||
|
||||
@Override
|
||||
public void onMarkdownEdited(String markdown) {
|
||||
setMarkdown(markdown);
|
||||
Runnable generateMarkdown = () -> {
|
||||
AndDown andDown = new AndDown();
|
||||
int hoedownFlags =
|
||||
|
|
|
@ -59,7 +59,7 @@ public class MainActivity extends AppCompatActivity
|
|||
setContentView(R.layout.activity_main);
|
||||
|
||||
((MarkdownApplication) getApplication()).getComponent().inject(this);
|
||||
|
||||
setTitle(presenter.getFileName());
|
||||
// Reset the background color
|
||||
getWindow().setBackgroundDrawable(new ColorDrawable(0xFFFFFFFF));
|
||||
ButterKnife.bind(this);
|
||||
|
@ -142,8 +142,7 @@ public class MainActivity extends AppCompatActivity
|
|||
presenter.setFileName(input.getText().toString());
|
||||
setTitle(input.getText());
|
||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
String path = Environment.getExternalStorageDirectory() + "/" +
|
||||
Environment.DIRECTORY_DOCUMENTS + "/" + input.getText();
|
||||
String path = getDocsPath() + input.getText();
|
||||
presenter.saveMarkdown(path);
|
||||
}
|
||||
}
|
||||
|
@ -155,6 +154,11 @@ public class MainActivity extends AppCompatActivity
|
|||
builder.show();
|
||||
}
|
||||
|
||||
private String getDocsPath() {
|
||||
return Environment.getExternalStorageDirectory() + "/" +
|
||||
Environment.DIRECTORY_DOCUMENTS + "/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode,
|
||||
String permissions[], int[] grantResults) {
|
||||
|
|
|
@ -7,8 +7,10 @@ import android.support.v4.app.Fragment;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import com.wbrawner.simplemarkdown.BuildConfig;
|
||||
import com.wbrawner.simplemarkdown.MarkdownApplication;
|
||||
import com.wbrawner.simplemarkdown.R;
|
||||
import com.wbrawner.simplemarkdown.presentation.MarkdownPresenter;
|
||||
|
@ -39,9 +41,8 @@ public class PreviewFragment extends Fragment implements MarkdownPreviewView {
|
|||
View view = inflater.inflate(R.layout.fragment_preview, container, false);
|
||||
ButterKnife.bind(this, view);
|
||||
((MarkdownApplication) getActivity().getApplication()).getComponent().inject(this);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
if (BuildConfig.DEBUG)
|
||||
WebView.setWebContentsDebuggingEnabled(true);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -55,7 +56,7 @@ public class PreviewFragment extends Fragment implements MarkdownPreviewView {
|
|||
@Override
|
||||
public void updatePreview(String html) {
|
||||
markdownPreview.post(() -> {
|
||||
markdownPreview.loadData(html, "text/html", "UTF-8");
|
||||
markdownPreview.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue