mirror of https://git.sr.ht/~oppen/ariane
tidy up
This commit is contained in:
parent
6f0e208009
commit
a6b3ee45ac
|
@ -1,4 +1,4 @@
|
|||
package oppen.tva.ui.gemtext
|
||||
package oppen.tva.ui
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -38,13 +38,35 @@ class GemtextAdapter(val onLink: (link: URI) -> Unit): RecyclerView.Adapter<Gemt
|
|||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
return when(viewType){
|
||||
typeText -> ViewHolder.Text( LayoutInflater.from(parent.context).inflate(R.layout.gemtext_text, parent, false) )
|
||||
typeH1 -> ViewHolder.H1( LayoutInflater.from(parent.context).inflate(R.layout.gemtext_h1, parent, false) )
|
||||
typeH2 -> ViewHolder.H2( LayoutInflater.from(parent.context).inflate(R.layout.gemtext_h2, parent, false) )
|
||||
typeH3 -> ViewHolder.H3( LayoutInflater.from(parent.context).inflate(R.layout.gemtext_h3, parent, false) )
|
||||
typeListItem -> ViewHolder.ListItem( LayoutInflater.from(parent.context).inflate(R.layout.gemtext_text, parent, false) )
|
||||
typeLink -> ViewHolder.Link( LayoutInflater.from(parent.context).inflate(R.layout.gemtext_link, parent, false) )
|
||||
else -> ViewHolder.Text( LayoutInflater.from(parent.context).inflate(R.layout.gemtext_text, parent, false) )
|
||||
typeText -> ViewHolder.Text(
|
||||
LayoutInflater.from(parent.context).inflate(R.layout.gemtext_text, parent, false)
|
||||
)
|
||||
typeH1 -> ViewHolder.H1(
|
||||
LayoutInflater.from(
|
||||
parent.context
|
||||
).inflate(R.layout.gemtext_h1, parent, false)
|
||||
)
|
||||
typeH2 -> ViewHolder.H2(
|
||||
LayoutInflater.from(
|
||||
parent.context
|
||||
).inflate(R.layout.gemtext_h2, parent, false)
|
||||
)
|
||||
typeH3 -> ViewHolder.H3(
|
||||
LayoutInflater.from(
|
||||
parent.context
|
||||
).inflate(R.layout.gemtext_h3, parent, false)
|
||||
)
|
||||
typeListItem -> ViewHolder.ListItem(
|
||||
LayoutInflater.from(parent.context).inflate(R.layout.gemtext_text, parent, false)
|
||||
)
|
||||
typeLink -> ViewHolder.Link(
|
||||
LayoutInflater.from(parent.context).inflate(R.layout.gemtext_link, parent, false)
|
||||
)
|
||||
else -> ViewHolder.Text(
|
||||
LayoutInflater.from(
|
||||
parent.context
|
||||
).inflate(R.layout.gemtext_text, parent, false)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -13,14 +13,13 @@ import oppen.tva.R
|
|||
import oppen.tva.databinding.ActivityTvaBinding
|
||||
import oppen.tva.io.TvaState
|
||||
import oppen.tva.io.history.CacheInterface
|
||||
import oppen.tva.ui.gemtext.GemtextAdapter
|
||||
|
||||
|
||||
class TvaActivity : AppCompatActivity() {
|
||||
|
||||
private val model by viewModels<TvaViewModel>()
|
||||
private lateinit var binding: ActivityTvaBinding
|
||||
private val adapter = GemtextAdapter{ uri ->
|
||||
private val adapter = GemtextAdapter { uri ->
|
||||
model.request(uri)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
package oppen.tva.ui.gemtext
|
||||
|
||||
sealed class Gemtext {
|
||||
data class Text(val text: String): Gemtext()
|
||||
data class Header(val text: String): Gemtext()
|
||||
data class HalfHeader(val text: String): Gemtext()
|
||||
data class ThirdHeader(val text: String): Gemtext()
|
||||
}
|
Loading…
Reference in New Issue