diff --git a/app/build.gradle b/app/build.gradle index 800da9bf46..cd01a7eec0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2111 - versionName "0.21.11" + versionCode 2112 + versionName "0.21.12" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/team/teamMember/AdapterJoinedMember.kt b/app/src/main/java/org/ole/planet/myplanet/ui/team/teamMember/AdapterJoinedMember.kt index a41d4607ef..bdd392837e 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/team/teamMember/AdapterJoinedMember.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/team/teamMember/AdapterJoinedMember.kt @@ -82,7 +82,11 @@ class AdapterJoinedMember(private val context: Context, private val list: List(context, android.R.layout.simple_list_item_1, overflowMenuOptions) { + val adapter = object : ArrayAdapter( + context, + android.R.layout.simple_list_item_1, + overflowMenuOptions + ) { override fun getView(position: Int, convertView: View?, parent: ViewGroup): View { val view = super.getView(position, convertView, parent) as TextView val color = ContextCompat.getColor(context, R.color.daynight_textColor) @@ -91,11 +95,22 @@ class AdapterJoinedMember(private val context: Context, private val list: List - if (i >= 0 && i < list.size) { - if (i == 0) { - reject(list[i], i) - } else { - makeLeader(list[i]) + + if (position >= 0 && position < list.size) { + when (i) { + 0 -> { + if (currentUser.id != list[position].id) { + reject(list[position], position) + } else { + Toast.makeText(context, R.string.cannot_remove_user, Toast.LENGTH_SHORT).show() + } + } + 1 -> { + makeLeader(list[position]) + } + else -> { + Toast.makeText(context, R.string.cannot_remove_user, Toast.LENGTH_SHORT).show() + } } } else { Toast.makeText(context, R.string.cannot_remove_user, Toast.LENGTH_SHORT).show()