pull/49/head
parent
e49978b336
commit
84f41bfc34
@ -0,0 +1,43 @@ |
|||||||
|
package io.legado.app.ui.about |
||||||
|
|
||||||
|
import android.os.Bundle |
||||||
|
import android.util.DisplayMetrics |
||||||
|
import android.view.LayoutInflater |
||||||
|
import android.view.View |
||||||
|
import android.view.ViewGroup |
||||||
|
import androidx.fragment.app.DialogFragment |
||||||
|
import io.legado.app.R |
||||||
|
import kotlinx.android.synthetic.main.dialog_text_view.* |
||||||
|
import ru.noties.markwon.Markwon |
||||||
|
|
||||||
|
class UpdateLog : DialogFragment() { |
||||||
|
|
||||||
|
override fun onStart() { |
||||||
|
super.onStart() |
||||||
|
val dm = DisplayMetrics() |
||||||
|
activity?.windowManager?.defaultDisplay?.getMetrics(dm) |
||||||
|
dialog?.window?.setLayout((dm.widthPixels * 0.9).toInt(), (dm.heightPixels * 0.9).toInt()) |
||||||
|
} |
||||||
|
|
||||||
|
override fun onCreateView( |
||||||
|
inflater: LayoutInflater, |
||||||
|
container: ViewGroup?, |
||||||
|
savedInstanceState: Bundle? |
||||||
|
): View? { |
||||||
|
return inflater.inflate(R.layout.dialog_text_view, container) |
||||||
|
} |
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
||||||
|
super.onViewCreated(view, savedInstanceState) |
||||||
|
tool_bar.setTitle(R.string.update_log) |
||||||
|
text_view.post { |
||||||
|
Markwon.create(requireContext()) |
||||||
|
.setMarkdown( |
||||||
|
text_view, |
||||||
|
String(requireContext().assets.open("updateLog.md").readBytes()) |
||||||
|
) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:orientation="vertical"> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar |
||||||
|
android:id="@+id/tool_bar" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:background="@color/background" |
||||||
|
android:elevation="5dp" |
||||||
|
app:displayHomeAsUp="false" |
||||||
|
app:fitStatusBar="false" |
||||||
|
app:layout_constraintTop_toTopOf="parent" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/text_view" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:textIsSelectable="true" /> |
||||||
|
|
||||||
|
</LinearLayout> |
Loading…
Reference in new issue