Skip to content

Commit

Permalink
update: test markdown view
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalamirsda committed Oct 24, 2024
1 parent ccd3e04 commit 9f4c3a3
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 11 deletions.
4 changes: 3 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ dependencies {
implementation("com.google.android.material:material:1.12.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")

implementation("androidx.activity:activity-ktx:1.9.2")
implementation("androidx.activity:activity-ktx:1.9.3")
implementation("androidx.fragment:fragment-ktx:1.8.4")

implementation("androidx.lifecycle:lifecycle-livedata-core-ktx:2.8.6")
Expand All @@ -73,6 +73,8 @@ dependencies {
implementation("androidx.lifecycle:lifecycle-process:2.8.6")
implementation("androidx.lifecycle:lifecycle-reactivestreams-ktx:2.8.6")

implementation("io.noties.markwon:core:4.6.2")

testImplementation("androidx.arch.core:core-testing:2.2.0")
testImplementation ("androidx.lifecycle:lifecycle-runtime-testing:2.8.6")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.os.Bundle
import androidx.activity.viewModels
import com.qomunal.opensource.androidresearch.common.base.BaseActivity
import com.qomunal.opensource.androidresearch.databinding.ActivityMainBinding
import io.noties.markwon.Markwon

class MainActivity : BaseActivity<ActivityMainBinding>() {

Expand All @@ -22,7 +23,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {

override fun initUI() {
binding.apply {

setupMarkdown()
}
}

Expand All @@ -32,4 +33,19 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
}
}

fun setupMarkdown() {
// obtain an instance of Markwon
val markwon = Markwon.create(this)

// parse markdown and create styled text
val markdown = markwon.toMarkdown(dataMarkdown())

// set markdown
markwon.setMarkdown(binding.tvMarkdown, dataMarkdown())
}

fun dataMarkdown() : String {
return "# Cara Pembayaran BRIVA\n\n## 1. Cara Bayar BRIVA melalui ATM BRI\n\n1. Pilih menu **Transaksi Lain**.\n2. Pilih menu **Pembayaran**.\n3. Pilih menu **Lainnya**.\n4. Masukkan nomor virtual account.\n5. Pilih **Ya** untuk memproses pembayaran.\n\n## 2. Cara Bayar BRIVA dengan Mobile Banking BRI\n\n1. Masuk ke aplikasi **BRI Mobile (BRImo)**.\n2. Login dengan username dan password yang dimiliki.\n3. Pilih **\"Briva\"**.\n4. Klik **\"Pembayaran Baru\"**.\n5. Masukkan nomor Briva.\n6. Klik **\"Lanjutkan\"**.\n7. Cek transaksi apakah sudah sesuai, lalu klik **\"Bayar\"**.\n\n## 3. Pembayaran BRIVA melalui Teller BRI\n\n1. Ambil nomor antrian transaksi Teller dan isi slip setoran.\n2. Serahkan slip dan jumlah setoran kepada Teller BRI.\n3. Teller BRI akan melakukan validasi transaksi.\n4. Simpan slip setoran hasil validasi sebagai bukti pembayaran.\n\n## 4. Cara Bayar BRIVA dengan ATM Bank Lain\n\n1. Setelah memasukkan kartu ATM dan nomor PIN, pilih menu **Transaksi Lainnya**.\n2. Pilih menu **Transfer**.\n3. Pilih menu **ke Rek Bank Lain**.\n4. Masukkan Kode Bank Tujuan: **BRI (Kode Bank: 002)**, lalu klik **Benar**.\n5. Masukkan jumlah pembayaran sesuai tagihan, lalu klik **Benar**.\n6. Masukkan nomor virtual account.\n7. Pilih rekening yang akan di-debet untuk pembayaran.\n8. Sistem akan memverifikasi data yang dimasukkan. Pilih **Benar** untuk memproses pembayaran.\n"
}

}
28 changes: 19 additions & 9 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.MainActivity">

<TextView
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:orientation="vertical"
android:padding="16dp">

</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tv_markdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello World!"
android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</LinearLayout>

</ScrollView>

0 comments on commit 9f4c3a3

Please sign in to comment.