Added type to view variables

This commit is contained in:
Juha Heinanen
2024-05-05 14:38:54 +03:00
parent 4ce0956bc5
commit f469a67b69
9 changed files with 30 additions and 31 deletions
@@ -19,8 +19,8 @@ class AccountListAdapter(private val cxt: Context, private val rows: ArrayList<A
private val layoutInflater = LayoutInflater.from(context) private val layoutInflater = LayoutInflater.from(context)
private class ViewHolder(view: View?) { private class ViewHolder(view: View?) {
val aorView = view?.findViewById(R.id.aor) as TextView val aorView: TextView = view?.findViewById(R.id.aor)!!
val actionView = view?.findViewById(R.id.action) as ImageButton val actionView: ImageButton = view?.findViewById(R.id.action)!!
} }
override fun getView(position: Int, view: View?, parent: ViewGroup): View { override fun getView(position: Int, view: View?, parent: ViewGroup): View {
@@ -16,9 +16,9 @@ class AndroidUriListAdapter(private val ctx: Context, private val rows: ArrayLis
private val layoutInflater = LayoutInflater.from(context) private val layoutInflater = LayoutInflater.from(context)
private class ViewHolder(view: View?) { private class ViewHolder(view: View?) {
val uriView = view?.findViewById(R.id.uri) as TextView val uriView: TextView = view?.findViewById(R.id.uri)!!
val messageView = view?.findViewById(R.id.message) as ImageButton val messageView: ImageButton = view?.findViewById(R.id.message)!!
val callView = view?.findViewById(R.id.call) as ImageButton val callView: ImageButton = view?.findViewById(R.id.call)!!
} }
override fun getView(position: Int, view: View?, parent: ViewGroup): View { override fun getView(position: Int, view: View?, parent: ViewGroup): View {
@@ -2,7 +2,6 @@ package com.tutpro.baresip
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.graphics.Typeface
import android.media.AudioAttributes import android.media.AudioAttributes
import android.media.MediaPlayer import android.media.MediaPlayer
import android.text.format.DateUtils import android.text.format.DateUtils
@@ -28,9 +27,9 @@ class CallDetailsAdapter(private val ctx: Context, private val rows: ArrayList<C
context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
private class ViewHolder(view: View?) { private class ViewHolder(view: View?) {
val directionView = view?.findViewById(R.id.direction) as ImageView val directionView: ImageView = view?.findViewById(R.id.direction)!!
val timeView = view?.findViewById(R.id.time) as TextView val timeView: TextView = view?.findViewById(R.id.time)!!
val durationView = view?.findViewById(R.id.duration) as TextView val durationView: TextView = view?.findViewById(R.id.duration)!!
} }
@SuppressLint("SimpleDateFormat") @SuppressLint("SimpleDateFormat")
@@ -19,12 +19,12 @@ class CallListAdapter(private val ctx: Context, private val account: Account,
private val layoutInflater = LayoutInflater.from(context) private val layoutInflater = LayoutInflater.from(context)
private class ViewHolder(view: View?) { private class ViewHolder(view: View?) {
val textAvatarView = view?.findViewById(R.id.TextAvatar) as TextView val textAvatarView: TextView = view?.findViewById(R.id.TextAvatar)!!
val imageAvatarView = view?.findViewById(R.id.ImageAvatar) as ImageView val imageAvatarView: ImageView = view?.findViewById(R.id.ImageAvatar)!!
val directionsView = view?.findViewById(R.id.directions) as LinearLayout val directionsView: LinearLayout = view?.findViewById(R.id.directions)!!
val etcView = view?.findViewById(R.id.etc) as TextView val etcView: TextView = view?.findViewById(R.id.etc)!!
val peerURIView = view?.findViewById(R.id.peer_uri) as TextView val peerURIView: TextView = view?.findViewById(R.id.peer_uri)!!
val timeView = view?.findViewById(R.id.time) as TextView val timeView: TextView = view?.findViewById(R.id.time)!!
} }
override fun getView(position: Int, view: View?, parent: ViewGroup): View { override fun getView(position: Int, view: View?, parent: ViewGroup): View {
@@ -20,12 +20,12 @@ class ChatListAdapter(private val ctx: Context, private val account: Account, pr
private val layoutInflater = LayoutInflater.from(context) private val layoutInflater = LayoutInflater.from(context)
private class ViewHolder(view: View?) { private class ViewHolder(view: View?) {
val textAvatarView = view?.findViewById(R.id.TextAvatar) as TextView val textAvatarView: TextView = view?.findViewById(R.id.TextAvatar)!!
val imageAvatarView = view?.findViewById(R.id.ImageAvatar) as ImageView val imageAvatarView: ImageView = view?.findViewById(R.id.ImageAvatar)!!
val layoutView = view?.findViewById(R.id.chat) as LinearLayout val layoutView: LinearLayout = view?.findViewById(R.id.chat)!!
val peerView = view?.findViewById(R.id.peer) as TextView val peerView: TextView = view?.findViewById(R.id.peer)!!
val infoView = view?.findViewById(R.id.info) as TextView val infoView: TextView = view?.findViewById(R.id.info)!!
val textView = view?.findViewById(R.id.text) as TextView val textView: TextView = view?.findViewById(R.id.text)!!
} }
override fun getView(position: Int, view: View?, parent: ViewGroup): View { override fun getView(position: Int, view: View?, parent: ViewGroup): View {
@@ -91,7 +91,7 @@ class CodecsActivity : AppCompatActivity() {
} }
private val itemTouchHelper by lazy { private val itemTouchHelper by lazy {
val simpleItemTouchCallback = object : ItemTouchHelper.SimpleCallback( val simpleItemTouchCallback = object : SimpleCallback(
UP or DOWN or START or END, RIGHT) { UP or DOWN or START or END, RIGHT) {
override fun onMove( override fun onMove(
@@ -28,10 +28,10 @@ class ContactListAdapter(private val ctx: Context, private val rows: ArrayList<C
private var lastClick: Long = 0 private var lastClick: Long = 0
private class ViewHolder(view: View?) { private class ViewHolder(view: View?) {
val textAvatarView = view?.findViewById(R.id.TextAvatar) as TextView val textAvatarView: TextView = view?.findViewById(R.id.TextAvatar)!!
val imageAvatarView = view?.findViewById(R.id.ImageAvatar) as ImageView val imageAvatarView: ImageView = view?.findViewById(R.id.ImageAvatar)!!
val nameView = view?.findViewById(R.id.contactName) as TextView val nameView: TextView = view?.findViewById(R.id.contactName)!!
val actionView = view?.findViewById(R.id.edit) as ImageButton val actionView: ImageButton = view?.findViewById(R.id.edit)!!
} }
override fun getView(position: Int, view: View?, parent: ViewGroup): View { override fun getView(position: Int, view: View?, parent: ViewGroup): View {
@@ -24,9 +24,9 @@ class MessageListAdapter(private val ctx: Context, private val peerUri: String,
private val layoutInflater = LayoutInflater.from(context) private val layoutInflater = LayoutInflater.from(context)
private class ViewHolder(view: View?) { private class ViewHolder(view: View?) {
val layoutView = view?.findViewById(R.id.message) as LinearLayout val layoutView: LinearLayout = view?.findViewById(R.id.message)!!
val infoView = view?.findViewById(R.id.info) as TextView val infoView: TextView = view?.findViewById(R.id.info)!!
val textView = view?.findViewById(R.id.text) as TextView val textView: TextView = view?.findViewById(R.id.text)!!
} }
override fun getView(position: Int, view: View?, parent: ViewGroup): View { override fun getView(position: Int, view: View?, parent: ViewGroup): View {
@@ -15,8 +15,8 @@ class UaSpinnerAdapter(cxt: Context, private val uas: ArrayList<UserAgent>) :
private val layoutInflater = LayoutInflater.from(context) private val layoutInflater = LayoutInflater.from(context)
private class ViewHolder(view: View?) { private class ViewHolder(view: View?) {
val textView = view?.findViewById(R.id.spinnerText) as TextView val textView: TextView = view?.findViewById(R.id.spinnerText)!!
val imageView = view?.findViewById(R.id.spinnerImage) as ImageView val imageView: ImageView = view?.findViewById(R.id.spinnerImage)!!
} }
override fun getDropDownView(position: Int, view: View?, parent: ViewGroup): View { override fun getDropDownView(position: Int, view: View?, parent: ViewGroup): View {