Skip to content

Commit

Permalink
minor bug fix, bump version to 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoxinghuo committed Oct 23, 2019
1 parent 62578a3 commit aa0bfa5
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 45 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.terrynow.quview"
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
versionCode 101
versionName "1.0.1"
}
buildTypes {
release {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/terrynow/quview/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ public class MainApplication extends Application {
@Override
public void onCreate() {
super.onCreate();

// CodeProcessor.init(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import com.protectsoft.webviewcode.Codeview;
import com.terrynow.quview.R;
Expand Down Expand Up @@ -44,29 +45,32 @@ public NoteCellListAdapter(@NonNull Context context, int resource,
@NonNull
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LinearLayout view = (LinearLayout) LayoutInflater.from(getContext()).inflate(layoutId,
parent, false);
NoteCellModel notecellModel = getItem(position);
String type = notecellModel.getType();
if ("markdown".equals(type)) {
View view = LayoutInflater.from(getContext()).inflate(R.layout.list_notecell_markdown
, parent, false);
MarkdownView markdownView = view.findViewById(R.id.cell);
MarkdownView markdownView = view.findViewById(R.id.cell_markdown);
markdownView.setVisibility(View.VISIBLE);
markdownView.loadMarkdown(notecellModel.getData());
return view;
}

View view = LayoutInflater.from(getContext()).inflate(layoutId, parent, false);
WebView cellView = view.findViewById(R.id.cell);
Codeview codeview = Codeview.with(getContext()).setAutoWrap(true);
if ("text".equals(type)) {
} else if ("code".equals(type)) {
// CodeView codeView = view.findViewById(R.id.cell_code);
// codeView.setVisibility(View.VISIBLE);
// codeView.setCode(notecellModel.getData(), notecellModel.getLanguage());
WebView webView = view.findViewById(R.id.cell_web);
webView.setVisibility(View.VISIBLE);
Codeview codeview = Codeview.with(getContext()).setAutoWrap(true);
codeview.withCode(notecellModel.getData()).setLang(notecellModel.getLanguage()).into(webView);
} else {
//type: text
WebView webView = view.findViewById(R.id.cell_web);
webView.setVisibility(View.VISIBLE);
Codeview codeview = Codeview.with(getContext()).setAutoWrap(true);
String imagePath = "file://" + dir + "/resources/";
String str = notecellModel.getData()
.replaceAll(" src=\"quiver-image-url/"
, " style=\"width: 100%;height: auto;\" src=\"" + imagePath);
codeview.withHtml(str)
.into(cellView);
} else if ("code".equals(type)) {
codeview.setLang(notecellModel.getLanguage()).withCode(notecellModel.getData())
.into(cellView);
codeview.withHtml(str).into(webView);
}
//TODO how about latex, diagram?

Expand Down
25 changes: 19 additions & 6 deletions app/src/main/res/layout/list_notecell.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2019.
~
~ Unless required by applicable law or agreed to in writing, software
Expand All @@ -11,12 +10,26 @@
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<WebView
android:id="@+id/cell"
android:id="@+id/cell_web"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:visibility="gone" />

<!-- <io.github.kbiakov.codeview.CodeView-->
<!-- android:id="@+id/cell_code"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:visibility="gone" />-->

<us.feras.mdv.MarkdownView
android:id="@+id/cell_markdown"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />

</LinearLayout>
22 changes: 0 additions & 22 deletions app/src/main/res/layout/list_notecell_markdown.xml

This file was deleted.

0 comments on commit aa0bfa5

Please sign in to comment.