improve the default rendering for all elements
This commit is contained in:
parent
3cba46ad5d
commit
5cb3af8d12
|
@ -55,11 +55,12 @@ class ContentAdapter(private var content: List<Line>, private val listener: Cont
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onBindViewHolder(holder: ContentViewHolder, position: Int) {
|
||||
val line = content[position]
|
||||
when (holder) {
|
||||
is ContentViewHolder.Paragraph -> holder.binding.textView.text =
|
||||
(line as ParagraphLine).text
|
||||
is ContentViewHolder.Paragraph ->
|
||||
holder.binding.textView.text = (line as ParagraphLine).text
|
||||
is ContentViewHolder.Title1 -> holder.binding.textView.text = (line as TitleLine).text
|
||||
is ContentViewHolder.Title2 -> holder.binding.textView.text = (line as TitleLine).text
|
||||
is ContentViewHolder.Title3 -> holder.binding.textView.text = (line as TitleLine).text
|
||||
|
@ -70,6 +71,12 @@ class ContentAdapter(private var content: List<Line>, private val listener: Cont
|
|||
holder.binding.textView.text = underlined
|
||||
holder.binding.root.setOnClickListener { listener.onLinkClick(line.url) }
|
||||
}
|
||||
is ContentViewHolder.PreText ->
|
||||
holder.binding.textView.text = (line as PreTextLine).text
|
||||
is ContentViewHolder.Blockquote ->
|
||||
holder.binding.textView.text = (line as BlockquoteLine).text
|
||||
is ContentViewHolder.ListItem ->
|
||||
holder.binding.textView.text = "\u25CF ${(line as ListItemLine).text}"
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/text_view"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/text"
|
||||
android:textStyle="italic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/teal_200" />
|
||||
android:paddingStart="32dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp" />
|
|
@ -1,6 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Space xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"
|
||||
android:background="@color/black"
|
||||
android:orientation="vertical"></Space>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="4dp" />
|
|
@ -2,11 +2,11 @@
|
|||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/text_view"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/teal_700"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:background="@color/teal_200"
|
||||
android:textIsSelectable="false" />
|
|
@ -1,6 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/text_view"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/teal_200" />
|
||||
android:paddingStart="32dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp" />
|
|
@ -2,10 +2,10 @@
|
|||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/text_view"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:background="@color/teal_200" />
|
||||
android:paddingBottom="4dp" />
|
|
@ -1,6 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/text_view"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text"
|
||||
android:typeface="monospace"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/teal_200" />
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:background="@color/purple_200" />
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/text_view"
|
||||
android:textSize="30sp"
|
||||
android:textColor="@color/text"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="30sp"
|
||||
android:textStyle="bold"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:background="@color/teal_700" />
|
||||
android:paddingBottom="4dp" />
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/text_view"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/text"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:background="@color/teal_700" />
|
||||
android:paddingBottom="4dp" />
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/text_view"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/text"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:background="@color/teal_700" />
|
||||
android:paddingBottom="4dp" />
|
|
@ -1,6 +1,6 @@
|
|||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Comet" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<style name="Theme.Comet" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="text">#222222</color>
|
||||
</resources>
|
|
@ -9,6 +9,8 @@
|
|||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
Reference in a new issue