mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Shorten selected country in account creation spinner
This commit is contained in:
parent
7f5a9763e7
commit
464865c091
3 changed files with 16 additions and 5 deletions
|
|
@ -30,6 +30,7 @@ import android.view.ViewGroup
|
|||
import android.widget.AdapterView
|
||||
import android.widget.ArrayAdapter
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.findNavController
|
||||
|
|
@ -167,11 +168,18 @@ class RegisterFragment : Fragment() {
|
|||
}
|
||||
|
||||
coreContext.postOnCoreThread {
|
||||
val adapter = ArrayAdapter(
|
||||
val adapter = object : ArrayAdapter<String>(
|
||||
requireContext(),
|
||||
R.layout.drop_down_item,
|
||||
viewModel.dialPlansLabelList
|
||||
)
|
||||
) {
|
||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
||||
val view = convertView ?: super.getView(position, convertView, parent)
|
||||
val label = viewModel.dialPlansShortLabelList[position]
|
||||
(view as? AppCompatTextView)?.text = label
|
||||
return view
|
||||
}
|
||||
}
|
||||
adapter.setDropDownViewResource(R.layout.assistant_country_picker_dropdown_cell)
|
||||
|
||||
val dialPlan = PhoneNumberUtils.getDeviceDialPlan(requireContext())
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ class AccountCreationViewModel @UiThread constructor() : ViewModel() {
|
|||
|
||||
val dialPlansLabelList = arrayListOf<String>()
|
||||
|
||||
val dialPlansShortLabelList = arrayListOf<String>()
|
||||
|
||||
val dialPlansList = arrayListOf<DialPlan>()
|
||||
|
||||
val selectedDialPlan = MutableLiveData<DialPlan>()
|
||||
|
|
@ -285,6 +287,9 @@ class AccountCreationViewModel @UiThread constructor() : ViewModel() {
|
|||
dialPlansLabelList.add(
|
||||
"${dialPlan.flag} ${dialPlan.country} | +${dialPlan.countryCallingCode}"
|
||||
)
|
||||
dialPlansShortLabelList.add(
|
||||
"${dialPlan.flag} +${dialPlan.countryCallingCode}"
|
||||
)
|
||||
}
|
||||
|
||||
accountCreator = core.createAccountCreator(core.accountCreatorUrl)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,4 @@
|
|||
android:layout_marginBottom="15dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray_main2_600"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"/>
|
||||
android:gravity="center_vertical"/>
|
||||
Loading…
Add table
Reference in a new issue