mirror of
https://github.com/ev-map/EVMap.git
synced 2026-06-10 23:38:25 -04:00
viewbinding migration cleanup
This commit is contained in:
@@ -19,7 +19,7 @@ class DonationAdapter : DataBindingAdapter<DonationItem>() {
|
||||
override fun bind(holder: ViewHolder, item: DonationItem) {
|
||||
super.bind(holder, item)
|
||||
val binding = holder.binding as ItemDonationBinding
|
||||
binding.textView15.text = item.product.title
|
||||
binding.textView21.text = item.product.oneTimePurchaseOfferDetails?.formattedPrice
|
||||
binding.txtName.text = item.product.title
|
||||
binding.txtPrice.text = item.product.oneTimePurchaseOfferDetails?.formattedPrice
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import net.vonforst.evmap.adapter.SingleViewAdapter
|
||||
import net.vonforst.evmap.databinding.FragmentDonateBinding
|
||||
import net.vonforst.evmap.databinding.FragmentDonateHeaderBinding
|
||||
import net.vonforst.evmap.databinding.FragmentDonateReferralBinding
|
||||
import net.vonforst.evmap.ui.goneUnless
|
||||
import net.vonforst.evmap.viewmodel.DonateViewModel
|
||||
import net.vonforst.evmap.viewmodel.Status
|
||||
|
||||
@@ -73,11 +74,7 @@ class DonateFragment : DonateFragmentBase() {
|
||||
|
||||
vm.products.observe(viewLifecycleOwner) {
|
||||
donationAdapter.submitList(it.data)
|
||||
binding.progressBar3.visibility = if (it.status == Status.LOADING) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
binding.progressBar.visibility = goneUnless(it.status == Status.LOADING)
|
||||
}
|
||||
|
||||
vm.purchaseSuccessful.observe(viewLifecycleOwner) {
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
tools:listitem="@layout/fragment_donate_preview" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar3"
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -15,20 +15,20 @@
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView15"
|
||||
android:id="@+id/txtName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/textView21"
|
||||
app:layout_constraintEnd_toStartOf="@+id/txtPrice"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Spende (extrem langer Beschreibungstext)" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView21"
|
||||
android:id="@+id/txtPrice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
|
||||
|
||||
@@ -111,24 +111,24 @@ class ConnectorAdapter : DataBindingAdapter<ConnectorAdapter.ChargepointWithAvai
|
||||
binding.imageView.imageTintList =
|
||||
ColorStateList.valueOf(availabilityColor(item.status, context))
|
||||
|
||||
binding.textView5.text = String.format(locale, "x %d", item.chargepoint.count)
|
||||
goneUnless(binding.textView5, item.status == null)
|
||||
binding.txtNumber.text = String.format(locale, "x %d", item.chargepoint.count)
|
||||
binding.txtNumber.visibility = goneUnless(item.status == null)
|
||||
|
||||
if (item.status != null) {
|
||||
binding.textView7.text = String.format(
|
||||
binding.txtStatus.text = String.format(
|
||||
locale,
|
||||
"%s/%d",
|
||||
availabilityText(item.status),
|
||||
item.chargepoint.count
|
||||
)
|
||||
binding.textView7.backgroundTintList =
|
||||
binding.txtStatus.backgroundTintList =
|
||||
ColorStateList.valueOf(availabilityColor(item.status, context))
|
||||
}
|
||||
goneUnless(binding.textView7, item.status != null)
|
||||
binding.txtStatus.visibility = goneUnless(item.status != null)
|
||||
|
||||
binding.textView6.text = item.chargepoint.formatPower(locale)
|
||||
goneUnless(binding.textView6, item.chargepoint.hasKnownPower())
|
||||
binding.textView6.setTextColor(availabilityColor(item.status, context))
|
||||
binding.txtPower.text = item.chargepoint.formatPower(locale)
|
||||
binding.txtPower.visibility = goneUnless(item.chargepoint.hasKnownPower())
|
||||
binding.txtPower.setTextColor(availabilityColor(item.status, context))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,6 +164,6 @@ class ConnectorDetailsAdapter : DataBindingAdapter<ConnectorDetailsAdapter.Conne
|
||||
}
|
||||
|
||||
binding.txtStatus.text = availabilityText(item.status, item.lastChange, context)
|
||||
goneUnless(binding.txtStatus, item.status != null)
|
||||
binding.txtStatus.visibility = goneUnless(item.status != null)
|
||||
}
|
||||
}
|
||||
@@ -23,9 +23,9 @@ import net.vonforst.evmap.model.ChargeLocation
|
||||
import net.vonforst.evmap.model.OpeningHoursDays
|
||||
import net.vonforst.evmap.plus
|
||||
import net.vonforst.evmap.ui.applySelectableItemBackground
|
||||
import net.vonforst.evmap.ui.currency
|
||||
import net.vonforst.evmap.ui.goneUnless
|
||||
import net.vonforst.evmap.ui.setLinkify
|
||||
import net.vonforst.evmap.ui.currency
|
||||
import net.vonforst.evmap.utils.formatDMS
|
||||
import net.vonforst.evmap.utils.formatDecimal
|
||||
import java.time.DayOfWeek
|
||||
@@ -82,13 +82,13 @@ class DetailsAdapter : DataBindingAdapter<DetailsAdapter.Detail>() {
|
||||
binding.root.isClickable = item.clickable
|
||||
applySelectableItemBackground(binding.root, item.clickable)
|
||||
|
||||
binding.imageView3.setImageResource(item.icon)
|
||||
binding.imageView3.contentDescription =
|
||||
binding.imgIcon.setImageResource(item.icon)
|
||||
binding.imgIcon.contentDescription =
|
||||
binding.root.context.getString(item.contentDescription)
|
||||
binding.txtTariff.text = item.text
|
||||
|
||||
binding.txtProvider.text = item.detailText
|
||||
goneUnless(binding.txtProvider, item.detailText != null)
|
||||
binding.txtProvider.visibility = goneUnless(item.detailText != null)
|
||||
setLinkify(
|
||||
binding.txtProvider,
|
||||
if (item.links) Linkify.WEB_URLS or Linkify.PHONE_NUMBERS else 0,
|
||||
@@ -106,7 +106,7 @@ class DetailsAdapter : DataBindingAdapter<DetailsAdapter.Detail>() {
|
||||
binding.txtTariff.text = item.text
|
||||
|
||||
binding.txtProvider.text = item.detailText
|
||||
goneUnless(binding.txtProvider, item.detailText != null)
|
||||
binding.txtProvider.visibility = goneUnless(item.detailText != null)
|
||||
setLinkify(
|
||||
binding.txtProvider,
|
||||
if (item.links) Linkify.WEB_URLS or Linkify.PHONE_NUMBERS else 0,
|
||||
@@ -166,12 +166,12 @@ class DetailsAdapter : DataBindingAdapter<DetailsAdapter.Detail>() {
|
||||
dayOfWeek: DayOfWeek?,
|
||||
hours: OpeningHoursDays
|
||||
) {
|
||||
include.textView24.text = if (dayOfWeek != null) {
|
||||
include.txtDay.text = if (dayOfWeek != null) {
|
||||
dayOfWeek.getDisplayName(TextStyle.FULL, Locale.getDefault())
|
||||
} else {
|
||||
include.root.context.getString(R.string.holiday)
|
||||
}
|
||||
include.textView25.text = hours.getHoursForDayOfWeek(dayOfWeek)?.toString()
|
||||
include.txtHours.text = hours.getHoursForDayOfWeek(dayOfWeek)?.toString()
|
||||
?: include.root.context.getString(R.string.closed_unfmt)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,29 +45,29 @@ class FavoritesAdapter(val onDelete: (FavoritesViewModel.FavoritesListItem) -> U
|
||||
val context = binding.root.context
|
||||
val locale = Locale.getDefault()
|
||||
|
||||
binding.textView15.text = item.charger.name
|
||||
binding.textView2.text = item.charger.address?.toString()
|
||||
invisibleUnless(binding.textView2, item.charger.address != null)
|
||||
binding.txtName.text = item.charger.name
|
||||
binding.txtAddress.text = item.charger.address?.toString()
|
||||
binding.txtAddress.visibility = invisibleUnless(item.charger.address != null)
|
||||
|
||||
binding.txtConnectors.text =
|
||||
item.charger.formatChargepoints(context.stringProvider(), locale)
|
||||
|
||||
binding.textView16.text = distance(item.distance, context)
|
||||
goneUnless(binding.textView16, item.distance != null)
|
||||
binding.txtDistance.text = distance(item.distance, context)
|
||||
binding.txtDistance.visibility = goneUnless(item.distance != null)
|
||||
|
||||
val availableData = item.available.data
|
||||
if (availableData != null) {
|
||||
binding.textView7.text = String.format(
|
||||
binding.txtStatus.text = String.format(
|
||||
locale,
|
||||
"%s/%d",
|
||||
availabilityText(availableData),
|
||||
item.total
|
||||
)
|
||||
binding.textView7.backgroundTintList =
|
||||
binding.txtStatus.backgroundTintList =
|
||||
ColorStateList.valueOf(availabilityColor(availableData, context))
|
||||
}
|
||||
invisibleUnless(binding.textView7, item.available.status == Status.SUCCESS)
|
||||
goneUnless(binding.progressBar4, item.available.status == Status.LOADING)
|
||||
binding.txtStatus.visibility = invisibleUnless(item.available.status == Status.SUCCESS)
|
||||
binding.progressBar.visibility = goneUnless(item.available.status == Status.LOADING)
|
||||
|
||||
binding.foreground.translationX = 0f
|
||||
binding.btnDelete.setOnClickListener {
|
||||
|
||||
@@ -34,7 +34,7 @@ class FilterProfilesAdapter(
|
||||
super.bind(holder, item)
|
||||
|
||||
val binding = holder.binding as ItemFilterProfileBinding
|
||||
binding.textView9.text = item.name
|
||||
binding.txtName.text = item.name
|
||||
binding.handle.setOnTouchListener { _, event ->
|
||||
if (event?.action == MotionEvent.ACTION_DOWN) {
|
||||
dragHelper.startDrag(holder)
|
||||
|
||||
@@ -109,10 +109,10 @@ class FiltersAdapter : DataBindingAdapter<FilterWithValue<FilterValue>>() {
|
||||
) {
|
||||
val filter = item.filter as BooleanFilter
|
||||
val value = item.value as BooleanFilterValue
|
||||
binding.textView17.text = filter.name
|
||||
binding.switch1.setOnCheckedChangeListener(null)
|
||||
binding.switch1.isChecked = value.value
|
||||
binding.switch1.setOnCheckedChangeListener { _: CompoundButton, isChecked: Boolean ->
|
||||
binding.txtName.text = filter.name
|
||||
binding.toggle.setOnCheckedChangeListener(null)
|
||||
binding.toggle.isChecked = value.value
|
||||
binding.toggle.setOnCheckedChangeListener { _: CompoundButton, isChecked: Boolean ->
|
||||
value.value = isChecked
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ class FiltersAdapter : DataBindingAdapter<FilterWithValue<FilterValue>>() {
|
||||
value: MultipleChoiceFilterValue
|
||||
) {
|
||||
val inflater = LayoutInflater.from(binding.root.context)
|
||||
binding.textView17.text = filter.name
|
||||
binding.txtName.text = filter.name
|
||||
|
||||
value.values.toList().forEach {
|
||||
if (it !in filter.choices.keys) value.values.remove(it)
|
||||
@@ -231,8 +231,8 @@ class FiltersAdapter : DataBindingAdapter<FilterWithValue<FilterValue>>() {
|
||||
value.values = filter.choices.keys.toMutableSet()
|
||||
}
|
||||
|
||||
binding.textView17.text = filter.name
|
||||
binding.textView26.text = binding.root.context.getString(
|
||||
binding.txtName.text = filter.name
|
||||
binding.txtDetail.text = binding.root.context.getString(
|
||||
if (value.all) {
|
||||
R.string.all_selected
|
||||
} else {
|
||||
@@ -251,7 +251,7 @@ class FiltersAdapter : DataBindingAdapter<FilterWithValue<FilterValue>>() {
|
||||
dialog.okListener = { selected ->
|
||||
value.values = selected.toMutableSet()
|
||||
value.all = value.values == filter.choices.keys
|
||||
binding.textView26.text = binding.root.context.getString(
|
||||
binding.txtDetail.text = binding.root.context.getString(
|
||||
if (value.all) {
|
||||
R.string.all_selected
|
||||
} else {
|
||||
@@ -269,7 +269,7 @@ class FiltersAdapter : DataBindingAdapter<FilterWithValue<FilterValue>>() {
|
||||
filter: SliderFilter,
|
||||
value: SliderFilterValue
|
||||
) {
|
||||
binding.textView17.text = filter.name
|
||||
binding.txtName.text = filter.name
|
||||
val progress = max(filter.inverseMapping(value.value) - filter.min, 0)
|
||||
binding.seekBar.max = filter.max - filter.min
|
||||
binding.seekBar.setOnSeekBarChangeListener(null)
|
||||
@@ -278,8 +278,7 @@ class FiltersAdapter : DataBindingAdapter<FilterWithValue<FilterValue>>() {
|
||||
|
||||
binding.seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
||||
val mapped = filter.mapping(progress + filter.min)
|
||||
value.value = mapped
|
||||
value.value = filter.mapping(progress + filter.min)
|
||||
updateSliderValueText(binding, filter, progress)
|
||||
}
|
||||
|
||||
@@ -294,7 +293,7 @@ class FiltersAdapter : DataBindingAdapter<FilterWithValue<FilterValue>>() {
|
||||
progress: Int
|
||||
) {
|
||||
val mappedValue = filter.mapping(progress + filter.min)
|
||||
binding.textView18.text = if (filter.unit.isNullOrBlank()) {
|
||||
binding.txtValue.text = if (filter.unit.isNullOrBlank()) {
|
||||
mappedValue.toString()
|
||||
} else {
|
||||
"$mappedValue ${filter.unit}"
|
||||
|
||||
@@ -118,7 +118,7 @@ class PlaceAutocompleteAdapter(val context: Context, val location: LiveData<LatL
|
||||
binding.icon.backgroundTintList = ColorStateList.valueOf(tint)
|
||||
|
||||
binding.textView16.text = distance(place.distanceMeters, binding.root.context)
|
||||
goneUnless(binding.textView16, place.distanceMeters != null)
|
||||
binding.textView16.visibility = goneUnless(place.distanceMeters != null)
|
||||
}
|
||||
|
||||
override fun getFilter(): Filter {
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package net.vonforst.evmap.fragment
|
||||
|
||||
import android.content.res.ColorStateList
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.ConcatAdapter
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import net.vonforst.evmap.adapter.ConnectorDetailsAdapter
|
||||
import net.vonforst.evmap.adapter.SingleViewAdapter
|
||||
import net.vonforst.evmap.api.availability.ChargeLocationStatus
|
||||
import net.vonforst.evmap.api.iconForPlugType
|
||||
import net.vonforst.evmap.api.nameForPlugType
|
||||
import net.vonforst.evmap.api.stringProvider
|
||||
import net.vonforst.evmap.api.availability.ChargeLocationStatus
|
||||
import net.vonforst.evmap.databinding.DialogConnectorDetailsBinding
|
||||
import net.vonforst.evmap.databinding.DialogConnectorDetailsHeaderBinding
|
||||
import net.vonforst.evmap.model.Chargepoint
|
||||
@@ -63,7 +62,7 @@ class ConnectorDetailsDialog(
|
||||
} else emptyList()
|
||||
detailsAdapter.submitList(items)
|
||||
|
||||
headerBinding.divider.visibility = if (items.isEmpty()) View.GONE else View.VISIBLE
|
||||
headerBinding.divider.visibility = goneUnless(items.isNotEmpty())
|
||||
|
||||
val context = headerBinding.root.context
|
||||
val locale = Locale.getDefault()
|
||||
@@ -74,30 +73,30 @@ class ConnectorDetailsDialog(
|
||||
headerBinding.imageView.imageTintList =
|
||||
ColorStateList.valueOf(availabilityColor(cpStatus, context))
|
||||
|
||||
headerBinding.textView5.text = String.format(locale, "x %d", cp.count)
|
||||
goneUnless(headerBinding.textView5, cpStatus == null)
|
||||
headerBinding.txtNumber.text = String.format(locale, "x %d", cp.count)
|
||||
headerBinding.txtNumber.visibility = goneUnless(cpStatus == null)
|
||||
|
||||
if (cpStatus != null) {
|
||||
headerBinding.textView7.text = String.format(
|
||||
headerBinding.txtStatus.text = String.format(
|
||||
locale,
|
||||
"%s/%d",
|
||||
availabilityText(cpStatus),
|
||||
cp.count
|
||||
)
|
||||
headerBinding.textView7.backgroundTintList =
|
||||
headerBinding.txtStatus.backgroundTintList =
|
||||
ColorStateList.valueOf(availabilityColor(cpStatus, context))
|
||||
}
|
||||
goneUnless(headerBinding.textView7, cpStatus != null)
|
||||
headerBinding.txtStatus.visibility = goneUnless(cpStatus != null)
|
||||
|
||||
val name = nameForPlugType(provider, cp.type)
|
||||
headerBinding.textView6.text = if (cp.hasKnownPower()) {
|
||||
headerBinding.txtTitle.text = if (cp.hasKnownPower()) {
|
||||
"$name - ${cp.formatPower(locale)}"
|
||||
} else {
|
||||
name
|
||||
}
|
||||
|
||||
headerBinding.textView8.text = cp.formatVoltageAndCurrent()
|
||||
goneUnless(headerBinding.textView8, cp.hasKnownVoltageAndCurrent())
|
||||
headerBinding.txtDetail.text = cp.formatVoltageAndCurrent()
|
||||
headerBinding.txtDetail.visibility = goneUnless(cp.hasKnownVoltageAndCurrent())
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
|
||||
@@ -31,6 +31,7 @@ import net.vonforst.evmap.databinding.ItemFavoriteBinding
|
||||
import net.vonforst.evmap.location.FusionEngine
|
||||
import net.vonforst.evmap.location.LocationEngine
|
||||
import net.vonforst.evmap.model.FavoriteWithDetail
|
||||
import net.vonforst.evmap.ui.goneUnless
|
||||
import net.vonforst.evmap.utils.checkAnyLocationPermission
|
||||
import net.vonforst.evmap.viewmodel.FavoritesViewModel
|
||||
import net.vonforst.evmap.viewmodel.viewModelFactory
|
||||
@@ -111,8 +112,8 @@ class FavoritesFragment : Fragment() {
|
||||
vm.listData.observe(viewLifecycleOwner) { items ->
|
||||
adapter.submitList(items)
|
||||
val isEmpty = items.isNullOrEmpty()
|
||||
binding.animationView.visibility = if (isEmpty) View.VISIBLE else View.GONE
|
||||
binding.textView19.visibility = if (isEmpty) View.VISIBLE else View.GONE
|
||||
binding.animationView.visibility = goneUnless(isEmpty)
|
||||
binding.txtEmptyState.visibility = goneUnless(isEmpty)
|
||||
}
|
||||
|
||||
createTouchHelper().attachToRecyclerView(binding.favsList)
|
||||
|
||||
@@ -31,6 +31,7 @@ import net.vonforst.evmap.adapter.FilterProfilesAdapter
|
||||
import net.vonforst.evmap.databinding.FragmentFilterProfilesBinding
|
||||
import net.vonforst.evmap.databinding.ItemFilterProfileBinding
|
||||
import net.vonforst.evmap.storage.FilterProfile
|
||||
import net.vonforst.evmap.ui.goneUnless
|
||||
import net.vonforst.evmap.ui.showEditTextDialog
|
||||
import net.vonforst.evmap.viewmodel.FilterProfilesViewModel
|
||||
import net.vonforst.evmap.viewmodel.viewModelFactory
|
||||
@@ -223,8 +224,7 @@ class FilterProfilesFragment : Fragment() {
|
||||
|
||||
vm.filterProfiles.observe(viewLifecycleOwner) { profiles ->
|
||||
adapter.submitList(profiles)
|
||||
binding.textView19.visibility =
|
||||
if (profiles.isNullOrEmpty()) View.VISIBLE else View.GONE
|
||||
binding.txtEmptyState.visibility = goneUnless(profiles.isNullOrEmpty())
|
||||
}
|
||||
|
||||
touchHelper.attachToRecyclerView(binding.filterProfilesList)
|
||||
|
||||
@@ -115,6 +115,8 @@ import net.vonforst.evmap.ui.availabilityColor
|
||||
import net.vonforst.evmap.ui.availabilityText
|
||||
import net.vonforst.evmap.ui.distance
|
||||
import net.vonforst.evmap.ui.flatten
|
||||
import net.vonforst.evmap.ui.goneUnless
|
||||
import net.vonforst.evmap.ui.invisibleUnless
|
||||
import net.vonforst.evmap.ui.isFabActive
|
||||
import net.vonforst.evmap.ui.setTouchModal
|
||||
import net.vonforst.evmap.utils.boundingBox
|
||||
@@ -449,19 +451,15 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
binding.fabLayers.setOnClickListener {
|
||||
openLayersMenu()
|
||||
}
|
||||
binding.layers.rbStandard.setOnClickListener {
|
||||
vm.setMapType(AnyMap.Type.NORMAL)
|
||||
}
|
||||
binding.layers.rbSatellite.setOnClickListener {
|
||||
vm.setMapType(AnyMap.Type.HYBRID)
|
||||
}
|
||||
binding.layers.rbTerrain.setOnClickListener {
|
||||
vm.setMapType(AnyMap.Type.TERRAIN)
|
||||
binding.layers.radioGroup.setOnCheckedChangeListener { group, i ->
|
||||
when (i) {
|
||||
R.id.rbStandard -> vm.setMapType(AnyMap.Type.NORMAL)
|
||||
R.id.rbSatellite -> vm.setMapType(AnyMap.Type.HYBRID)
|
||||
R.id.rbTerrain -> vm.setMapType(AnyMap.Type.TERRAIN)
|
||||
}
|
||||
}
|
||||
binding.layers.cbTraffic.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (vm.mapTrafficEnabled.value != isChecked) {
|
||||
vm.mapTrafficEnabled.value = isChecked
|
||||
}
|
||||
vm.mapTrafficEnabled.value = isChecked
|
||||
}
|
||||
binding.layers.btnClose.setOnClickListener {
|
||||
closeLayersMenu()
|
||||
@@ -648,16 +646,11 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
}
|
||||
|
||||
private fun updateClearSearchVisibility() {
|
||||
binding.clearSearch.visibility = if (binding.search.text.isNullOrEmpty()) {
|
||||
View.INVISIBLE
|
||||
} else {
|
||||
View.VISIBLE
|
||||
}
|
||||
binding.clearSearch.visibility = invisibleUnless(!binding.search.text.isNullOrEmpty())
|
||||
}
|
||||
|
||||
private fun updateChargepointsUi(res: Resource<List<ChargepointListItem>>) {
|
||||
binding.progressBar2.visibility =
|
||||
if (res.status == Status.LOADING) View.VISIBLE else View.GONE
|
||||
binding.progressBar2.visibility = goneUnless(res.status == Status.LOADING)
|
||||
binding.progressBar2.isIndeterminate = res.progress == null
|
||||
binding.progressBar2.progress = ((res.progress ?: 0f) * 100f).toInt().coerceIn(0, 100)
|
||||
binding.search.hint = if (res.progress != null) {
|
||||
@@ -670,8 +663,7 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
private fun updateGallery(photos: List<ChargerPhoto>?) {
|
||||
val galleryAdapter = binding.gallery.adapter as? GalleryAdapter ?: return
|
||||
galleryAdapter.submitList(photos)
|
||||
binding.galleryPlaceholder.visibility =
|
||||
if (photos.isNullOrEmpty()) View.VISIBLE else View.INVISIBLE
|
||||
binding.galleryPlaceholder.visibility = invisibleUnless(photos.isNullOrEmpty())
|
||||
}
|
||||
|
||||
private fun renderDetailView() {
|
||||
@@ -693,21 +685,21 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
txtName.text = charger?.name
|
||||
txtName.maxLines = if (expanded) 3 else 1
|
||||
|
||||
textView2.text = charger?.address?.toString() ?: charger?.coordinates?.formatDMS()
|
||||
textView2.visibility = if (charger != null) View.VISIBLE else View.INVISIBLE
|
||||
txtAddress.text = charger?.address?.toString() ?: charger?.coordinates?.formatDMS()
|
||||
txtAddress.visibility = invisibleUnless(charger != null)
|
||||
|
||||
txtDistance.text = distance(distanceMeters, context)
|
||||
txtConnectors.text =
|
||||
charger?.formatChargepoints(context.stringProvider(), Locale.getDefault())
|
||||
|
||||
val hasConnectors = charger?.chargepointsMerged?.isNotEmpty() == true
|
||||
connectors.visibility = if (hasConnectors) View.VISIBLE else View.GONE
|
||||
textView7.visibility = if (hasConnectors) View.VISIBLE else View.GONE
|
||||
textView13.visibility = if (hasConnectors) View.VISIBLE else View.GONE
|
||||
btnRefreshLiveData.visibility = if (hasConnectors) View.VISIBLE else View.GONE
|
||||
connectors.visibility = goneUnless(hasConnectors)
|
||||
txtConnectorsHeading.visibility = goneUnless(hasConnectors)
|
||||
txtRealtimeDesc.visibility = goneUnless(hasConnectors)
|
||||
btnRefreshLiveData.visibility = goneUnless(hasConnectors)
|
||||
btnRefreshLiveData.isEnabled = availability?.status != Status.LOADING
|
||||
|
||||
val realtimeText = when {
|
||||
txtRealtimeDesc.text = when {
|
||||
availability?.status == Status.SUCCESS -> getString(
|
||||
R.string.realtime_data_source,
|
||||
availability.data?.source.orEmpty()
|
||||
@@ -717,15 +709,10 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
availability?.message == "not signed in" -> getString(R.string.realtime_data_login_needed)
|
||||
else -> getString(R.string.realtime_data_unavailable)
|
||||
}
|
||||
textView13.text = realtimeText
|
||||
|
||||
btnLogin.visibility = if (
|
||||
btnLogin.visibility = goneUnless(
|
||||
hasConnectors && availability?.status == Status.ERROR && availability.message == "not signed in"
|
||||
) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
)
|
||||
|
||||
val flattenedAvailability = flatten(filteredAvailability?.data?.status?.values)
|
||||
if (flattenedAvailability != null && !expanded) {
|
||||
@@ -756,15 +743,15 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
|
||||
val amenities = charger?.amenities
|
||||
val hasAmenities = !amenities.isNullOrBlank()
|
||||
textView12.visibility = if (hasAmenities) View.VISIBLE else View.GONE
|
||||
textView11.visibility = if (hasAmenities) View.VISIBLE else View.GONE
|
||||
textView11.text = amenities
|
||||
txtAmenitiesHeading.visibility = goneUnless(hasAmenities)
|
||||
txtAmenities.visibility = goneUnless(hasAmenities)
|
||||
txtAmenities.text = amenities
|
||||
|
||||
val generalInformation = charger?.generalInformation
|
||||
val hasGeneralInformation = !generalInformation.isNullOrBlank()
|
||||
textView10.visibility = if (hasGeneralInformation) View.VISIBLE else View.GONE
|
||||
textView4.visibility = if (hasGeneralInformation) View.VISIBLE else View.GONE
|
||||
textView4.text = generalInformation
|
||||
txtGeneralInformationHeading.visibility = goneUnless(hasGeneralInformation)
|
||||
txtGeneralInformation.visibility = goneUnless(hasGeneralInformation)
|
||||
txtGeneralInformation.text = generalInformation
|
||||
|
||||
sourceButton.text = getString(R.string.source, apiName)
|
||||
|
||||
@@ -772,50 +759,45 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
val hasChargerWebsite = charger?.chargerUrl != null
|
||||
val hasExternalLinks = charger != null && (hasChargeprice || hasChargerWebsite)
|
||||
|
||||
buttonsScroller.visibility = if (hasExternalLinks) View.VISIBLE else View.GONE
|
||||
divider3.visibility = if (hasExternalLinks) View.VISIBLE else View.GONE
|
||||
btnChargeprice.visibility = if (hasChargeprice) View.VISIBLE else View.GONE
|
||||
btnChargerWebsite.visibility = if (hasChargerWebsite) View.VISIBLE else View.GONE
|
||||
buttonsScroller.visibility = goneUnless(hasExternalLinks)
|
||||
divider3.visibility = goneUnless(hasExternalLinks)
|
||||
btnChargeprice.visibility = goneUnless(hasChargeprice)
|
||||
btnChargerWebsite.visibility = goneUnless(hasChargerWebsite)
|
||||
|
||||
val hasPredictionGraph = predictionData?.predictionGraph != null
|
||||
val isPredictionPercentage = predictionData?.isPercentage == true
|
||||
val predictionDescription = predictionData?.description
|
||||
val showPredictionInfo = hasPredictionGraph && !isPredictionPercentage
|
||||
|
||||
textView8.visibility = if (hasPredictionGraph) View.VISIBLE else View.GONE
|
||||
textView8.text = if (isPredictionPercentage) {
|
||||
txtPredictionHeading.visibility = goneUnless(hasPredictionGraph)
|
||||
txtPredictionHeading.text = if (isPredictionPercentage) {
|
||||
getString(R.string.average_utilization)
|
||||
} else {
|
||||
getString(R.string.utilization_prediction)
|
||||
}
|
||||
|
||||
prediction.visibility = if (hasPredictionGraph) View.VISIBLE else View.GONE
|
||||
prediction.visibility = goneUnless(hasPredictionGraph)
|
||||
prediction.data = predictionData?.predictionGraph
|
||||
prediction.maxValue = predictionData?.maxValue
|
||||
prediction.isPercentage = isPredictionPercentage
|
||||
|
||||
textView29.text = predictionDescription
|
||||
textView29.visibility =
|
||||
if (showPredictionInfo && !predictionDescription.isNullOrBlank()) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
btnPredictionHelp.visibility = if (showPredictionInfo) View.VISIBLE else View.GONE
|
||||
imgPredictionSource.visibility = if (showPredictionInfo) View.VISIBLE else View.GONE
|
||||
divider1.visibility = if (hasPredictionGraph) View.VISIBLE else View.GONE
|
||||
txtPredictionDescription.text = predictionDescription
|
||||
txtPredictionDescription.visibility =
|
||||
goneUnless(showPredictionInfo && !predictionDescription.isNullOrBlank())
|
||||
btnPredictionHelp.visibility = goneUnless(showPredictionInfo)
|
||||
imgPredictionSource.visibility = goneUnless(showPredictionInfo)
|
||||
divider1.visibility = goneUnless(hasPredictionGraph)
|
||||
|
||||
imgVerified.visibility = if (charger?.verified == true) View.VISIBLE else View.GONE
|
||||
imgVerified.visibility = goneUnless(charger?.verified == true)
|
||||
TooltipCompat.setTooltipText(imgVerified, getString(R.string.verified_desc, apiName))
|
||||
|
||||
imgFaultReport.visibility =
|
||||
if (charger?.faultReport != null) View.VISIBLE else View.GONE
|
||||
imgFaultReport.visibility = goneUnless(charger?.faultReport != null)
|
||||
TooltipCompat.setTooltipText(imgFaultReport, getString(R.string.fault_report))
|
||||
|
||||
val timeRetrieved = charger?.timeRetrieved
|
||||
val showTimeRetrieved = timeRetrieved != null &&
|
||||
Duration.between(timeRetrieved, Instant.now()) > Duration.ofHours(1)
|
||||
txtTimeRetrieved.visibility = if (showTimeRetrieved) View.VISIBLE else View.GONE
|
||||
txtTimeRetrieved.visibility = goneUnless(showTimeRetrieved)
|
||||
val shownTimeRetrieved = if (showTimeRetrieved) timeRetrieved else null
|
||||
if (shownTimeRetrieved != null) {
|
||||
txtTimeRetrieved.text = getString(
|
||||
@@ -831,7 +813,7 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
}
|
||||
|
||||
val license = charger?.license
|
||||
txtLicense.visibility = if (license.isNullOrBlank()) View.GONE else View.VISIBLE
|
||||
txtLicense.visibility = goneUnless(!license.isNullOrBlank())
|
||||
txtLicense.text = license
|
||||
}
|
||||
}
|
||||
@@ -1027,13 +1009,12 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
isFabActive(binding.fabLocate, it == true)
|
||||
}
|
||||
vm.bottomSheetState.observe(viewLifecycleOwner) {
|
||||
binding.navBarScrim.visibility =
|
||||
if (it == STATE_COLLAPSED) View.VISIBLE else View.INVISIBLE
|
||||
binding.navBarScrim.visibility = invisibleUnless(it == STATE_COLLAPSED)
|
||||
}
|
||||
vm.layersMenuOpen.observe(viewLifecycleOwner) { open ->
|
||||
HideOnScrollFabBehavior.from(binding.fabLayers)?.hidden = open
|
||||
binding.fabLayers.visibility = if (open) View.INVISIBLE else View.VISIBLE
|
||||
binding.layersSheet.visibility = if (open) View.VISIBLE else View.INVISIBLE
|
||||
binding.fabLayers.visibility = invisibleUnless(!open)
|
||||
binding.layersSheet.visibility = invisibleUnless(open)
|
||||
updateBackPressedCallback()
|
||||
}
|
||||
vm.mapType.observe(viewLifecycleOwner) {
|
||||
@@ -1056,13 +1037,12 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
}
|
||||
}
|
||||
vm.mapTrafficSupported.observe(viewLifecycleOwner) { supported ->
|
||||
val visibility = if (supported) View.VISIBLE else View.GONE
|
||||
val visibility = goneUnless(supported)
|
||||
binding.layers.textView23.visibility = visibility
|
||||
binding.layers.cbTraffic.visibility = visibility
|
||||
}
|
||||
vm.selectedChargepoint.observe(viewLifecycleOwner) {
|
||||
binding.detailView.connectorDetailsCard.visibility =
|
||||
if (it != null) View.VISIBLE else View.INVISIBLE
|
||||
binding.detailView.connectorDetailsCard.visibility = invisibleUnless(it != null)
|
||||
if (it != null) {
|
||||
detailsDialog.setData(it, vm.availability.value?.data)
|
||||
}
|
||||
@@ -1543,7 +1523,7 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
if (filterBadge != null) {
|
||||
// set up badge showing number of active filters
|
||||
vm.filtersCount.observe(viewLifecycleOwner) {
|
||||
filterBadge.visibility = if (it > 0) View.VISIBLE else View.GONE
|
||||
filterBadge.visibility = goneUnless(it > 0)
|
||||
filterBadge.text = it.toString()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,13 +17,9 @@ import net.vonforst.evmap.meterPerFt
|
||||
import net.vonforst.evmap.shouldUseImperialUnits
|
||||
import java.time.Instant
|
||||
|
||||
fun goneUnless(view: View, visible: Boolean) {
|
||||
view.visibility = if (visible) View.VISIBLE else View.GONE
|
||||
}
|
||||
fun goneUnless(visible: Boolean): Int = if (visible) View.VISIBLE else View.GONE
|
||||
|
||||
fun invisibleUnless(view: View, visible: Boolean) {
|
||||
view.visibility = if (visible) View.VISIBLE else View.INVISIBLE
|
||||
}
|
||||
fun invisibleUnless(visible: Boolean): Int = if (visible) View.VISIBLE else View.INVISIBLE
|
||||
|
||||
fun isFabActive(view: FloatingActionButton, isColored: Boolean) {
|
||||
view.imageTintList = activeTint(view.context, isColored)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
tools:text="Parkhaus" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:id="@+id/txtAddress"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
@@ -90,7 +90,7 @@
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodySmall"
|
||||
app:layout_constraintEnd_toStartOf="@+id/txtDistance"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtAddress"
|
||||
tools:text="2x Typ 2 22 kW" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
@@ -100,14 +100,14 @@
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView7"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtConnectorsHeading"
|
||||
tools:itemCount="3"
|
||||
tools:layoutManager="LinearLayoutManager"
|
||||
tools:listitem="@layout/item_connector"
|
||||
tools:orientation="horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:id="@+id/txtConnectorsHeading"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
@@ -122,7 +122,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtConnectors" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView12"
|
||||
android:id="@+id/txtAmenitiesHeading"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
@@ -136,7 +136,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/details" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView11"
|
||||
android:id="@+id/txtAmenities"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
@@ -147,11 +147,11 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView12"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtAmenitiesHeading"
|
||||
tools:text="Toilet" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView10"
|
||||
android:id="@+id/txtGeneralInformationHeading"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
@@ -162,10 +162,10 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView11" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtAmenities" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:id="@+id/txtGeneralInformation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
@@ -176,7 +176,7 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline3"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView10"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtGeneralInformationHeading"
|
||||
tools:text="Only for guests" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
@@ -222,11 +222,11 @@
|
||||
android:text=""
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView4"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtGeneralInformation"
|
||||
tools:text="Source: DataSource" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView13"
|
||||
android:id="@+id/txtRealtimeDesc"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
@@ -256,7 +256,7 @@
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView13" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtRealtimeDesc" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider3"
|
||||
@@ -268,7 +268,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/buttonsScroller" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:id="@+id/txtPredictionHeading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
@@ -281,16 +281,16 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/divider2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView29"
|
||||
android:id="@+id/txtPredictionDescription"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodySmall"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/textView8"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/txtPredictionHeading"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btnPredictionHelp"
|
||||
app:layout_constraintStart_toEndOf="@+id/textView8"
|
||||
app:layout_constraintStart_toEndOf="@+id/txtPredictionHeading"
|
||||
tools:text="(DC plugs only)" />
|
||||
|
||||
<Button
|
||||
@@ -302,9 +302,9 @@
|
||||
android:visibility="gone"
|
||||
app:icon="@drawable/ic_help"
|
||||
app:iconTint="?android:textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/textView8"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/txtPredictionHeading"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/textView8" />
|
||||
app:layout_constraintTop_toTopOf="@+id/txtPredictionHeading" />
|
||||
|
||||
<net.vonforst.evmap.ui.BarGraphView
|
||||
android:id="@+id/prediction"
|
||||
@@ -314,7 +314,7 @@
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView8"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtPredictionHeading"
|
||||
tools:itemCount="3"
|
||||
tools:layoutManager="LinearLayoutManager"
|
||||
tools:listitem="@layout/item_connector"
|
||||
@@ -415,9 +415,9 @@
|
||||
android:visibility="gone"
|
||||
app:icon="@drawable/ic_refresh"
|
||||
app:iconTint="?android:textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/textView7"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/txtConnectorsHeading"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/textView7" />
|
||||
app:layout_constraintTop_toTopOf="@+id/txtConnectorsHeading" />
|
||||
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/buttonsScroller"
|
||||
@@ -464,9 +464,9 @@
|
||||
android:layout_height="40dp"
|
||||
android:text="@string/login"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/textView13"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/txtRealtimeDesc"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="@+id/textView13" />
|
||||
app:layout_constraintTop_toTopOf="@+id/txtRealtimeDesc" />
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="?attr/materialCardViewElevatedStyle"
|
||||
android:id="@+id/connector_details_card"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
tools:tint="@color/available" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:id="@+id/txtNumber"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="38dp"
|
||||
@@ -34,7 +34,7 @@
|
||||
tools:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:id="@+id/txtStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="30dp"
|
||||
@@ -49,28 +49,28 @@
|
||||
tools:text="80/99" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:id="@+id/txtTitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="36dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
|
||||
app:layout_constraintBottom_toTopOf="@id/textView8"
|
||||
app:layout_constraintBottom_toTopOf="@id/txtDetail"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView"
|
||||
app:layout_constraintTop_toTopOf="@id/imageView"
|
||||
tools:text="CCS - 350 kW" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:id="@+id/txtDetail"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodySmall"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/imageView"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/textView6"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView6"
|
||||
app:layout_constraintStart_toStartOf="@+id/txtTitle"
|
||||
app:layout_constraintTop_toBottomOf="@id/txtTitle"
|
||||
tools:text="1000 V - 500 A" />
|
||||
|
||||
<View
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/textView19"
|
||||
app:layout_constraintBottom_toTopOf="@+id/txtEmptyState"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.497"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -56,7 +56,7 @@
|
||||
app:lottie_rawRes="@raw/ev_anim" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView19"
|
||||
android:id="@+id/txtEmptyState"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView19"
|
||||
android:id="@+id/txtEmptyState"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
tools:srcCompat="@drawable/ic_connector_typ2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:id="@+id/txtNumber"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="38dp"
|
||||
@@ -33,7 +33,7 @@
|
||||
tools:text="×99" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:id="@+id/txtStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="30dp"
|
||||
@@ -48,7 +48,7 @@
|
||||
tools:text="80/99" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:id="@+id/txtPower"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView3"
|
||||
app:layout_constraintStart_toEndOf="@+id/imgIcon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
tools:text="Lorem ipsum" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView3"
|
||||
android:id="@+id/imgIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView24"
|
||||
android:id="@+id/txtDay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodySmall"
|
||||
@@ -15,7 +15,7 @@
|
||||
tools:text="Montag" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView25"
|
||||
android:id="@+id/txtHours"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="100dp"
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
android:background="@drawable/selectable_opaque_background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView15"
|
||||
android:id="@+id/txtName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
@@ -40,14 +40,14 @@
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:hyphenationFrequency="normal"
|
||||
app:layout_constraintEnd_toStartOf="@+id/textView16"
|
||||
app:layout_constraintEnd_toStartOf="@+id/txtDistance"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:textAlignment="viewStart"
|
||||
tools:text="Nikola-Tesla-Parkhaus mit extra langem Namen, der auf mehrere Zeilen umbricht" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:id="@+id/txtAddress"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
@@ -55,9 +55,9 @@
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodySmall"
|
||||
android:textAlignment="viewStart"
|
||||
app:layout_constraintEnd_toStartOf="@+id/textView7"
|
||||
app:layout_constraintEnd_toStartOf="@+id/txtStatus"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView15"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtName"
|
||||
tools:text="Beispielstraße 10, 12345 Berlin" />
|
||||
|
||||
<TextView
|
||||
@@ -69,13 +69,13 @@
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodySmall"
|
||||
android:textAlignment="viewStart"
|
||||
app:layout_constraintEnd_toStartOf="@+id/textView7"
|
||||
app:layout_constraintStart_toStartOf="@+id/textView2"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2"
|
||||
app:layout_constraintEnd_toStartOf="@+id/txtStatus"
|
||||
app:layout_constraintStart_toStartOf="@+id/txtAddress"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtAddress"
|
||||
tools:text="2x Typ 2 22 kW" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView16"
|
||||
android:id="@+id/txtDistance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
@@ -85,7 +85,7 @@
|
||||
tools:text="9999,9 km" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:id="@+id/txtStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
@@ -99,7 +99,7 @@
|
||||
tools:text="80/99" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar4"
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView17"
|
||||
android:id="@+id/txtName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
@@ -15,13 +15,13 @@
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
|
||||
android:textAlignment="viewStart"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/switch1"
|
||||
app:layout_constraintEnd_toStartOf="@+id/toggle"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Free charging" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/switch1"
|
||||
android:id="@+id/toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView17"
|
||||
android:id="@+id/txtName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
@@ -58,7 +58,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/none"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/textView17"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/txtName"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView17"
|
||||
android:id="@+id/txtName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
@@ -36,7 +36,7 @@
|
||||
app:srcCompat="@drawable/ic_edit" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView26"
|
||||
android:id="@+id/txtDetail"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
@@ -45,7 +45,7 @@
|
||||
android:textAlignment="viewStart"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btnEdit"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView17"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtName"
|
||||
tools:text="4 selected" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
android:background="?android:colorBackground">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView9"
|
||||
android:id="@+id/txtName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView17"
|
||||
android:id="@+id/txtName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
@@ -26,12 +26,12 @@
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/textView18"
|
||||
app:layout_constraintEnd_toStartOf="@+id/txtValue"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView17" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtName" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView18"
|
||||
android:id="@+id/txtValue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
|
||||
Reference in New Issue
Block a user