Skip to content

Commit

Permalink
update deprecated in java
Browse files Browse the repository at this point in the history
  • Loading branch information
Okuro3499 committed Apr 16, 2024
1 parent 414bb4c commit ef74bc4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ class ViewHolderSSHAllKeyRow(private val binding: RowKeyBinding, private val lis
}

override fun onMenuItemClick(item: MenuItem): Boolean {
when (item.itemId) {
R.id.copy_public -> listener.onCopyPub(adapterPosition)
R.id.delete_key -> listener.onDelete(adapterPosition)
R.id.send_key -> listener.onSendToRaspberry(adapterPosition)
val position = bindingAdapterPosition
if (position != RecyclerView.NO_POSITION) {
when (item.itemId) {
R.id.copy_public -> listener.onCopyPub(position)
R.id.delete_key -> listener.onDelete(position)
R.id.send_key -> listener.onSendToRaspberry(position)
}
}
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ class ViewHolderSSHRow(private val binding: RowSshBinding, private val listener:
fun bind(host: HostBean) {
binding.title.text = host.getPrettyFormat()
binding.editButton.setOnClickListener {
listener.onButtonClick(adapterPosition)
val position = bindingAdapterPosition
if (position != RecyclerView.NO_POSITION) {
listener.onButtonClick(position)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.annotation.TargetApi
import android.content.Context
import android.content.SharedPreferences
import android.graphics.*
import android.preference.PreferenceManager
import androidx.preference.PreferenceManager
import android.text.ClipboardManager
import android.view.KeyEvent
import android.view.View
Expand Down

0 comments on commit ef74bc4

Please sign in to comment.