mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-16 11:16:12 -04:00
Remove NoPairedDevice card, too missleading.
This commit is contained in:
@@ -13,7 +13,6 @@ import eu.darken.capod.common.lists.modular.mods.DataBinderMod
|
|||||||
import eu.darken.capod.common.lists.modular.mods.TypedVHCreatorMod
|
import eu.darken.capod.common.lists.modular.mods.TypedVHCreatorMod
|
||||||
import eu.darken.capod.main.ui.overview.cards.BluetoothDisabledVH
|
import eu.darken.capod.main.ui.overview.cards.BluetoothDisabledVH
|
||||||
import eu.darken.capod.main.ui.overview.cards.MissingMainDeviceVH
|
import eu.darken.capod.main.ui.overview.cards.MissingMainDeviceVH
|
||||||
import eu.darken.capod.main.ui.overview.cards.NoPairedDeviceCardVH
|
|
||||||
import eu.darken.capod.main.ui.overview.cards.PermissionCardVH
|
import eu.darken.capod.main.ui.overview.cards.PermissionCardVH
|
||||||
import eu.darken.capod.main.ui.overview.cards.pods.BasicSingleApplePodsCardVH
|
import eu.darken.capod.main.ui.overview.cards.pods.BasicSingleApplePodsCardVH
|
||||||
import eu.darken.capod.main.ui.overview.cards.pods.DualApplePodsCardVH
|
import eu.darken.capod.main.ui.overview.cards.pods.DualApplePodsCardVH
|
||||||
@@ -34,7 +33,6 @@ class OverviewAdapter @Inject constructor() :
|
|||||||
modules.add(TypedVHCreatorMod({ data[it] is SingleApplePodsCardVH.Item }) { SingleApplePodsCardVH(it) })
|
modules.add(TypedVHCreatorMod({ data[it] is SingleApplePodsCardVH.Item }) { SingleApplePodsCardVH(it) })
|
||||||
modules.add(TypedVHCreatorMod({ data[it] is BasicSingleApplePodsCardVH.Item }) { BasicSingleApplePodsCardVH(it) })
|
modules.add(TypedVHCreatorMod({ data[it] is BasicSingleApplePodsCardVH.Item }) { BasicSingleApplePodsCardVH(it) })
|
||||||
modules.add(TypedVHCreatorMod({ data[it] is UnknownPodDeviceCardVH.Item }) { UnknownPodDeviceCardVH(it) })
|
modules.add(TypedVHCreatorMod({ data[it] is UnknownPodDeviceCardVH.Item }) { UnknownPodDeviceCardVH(it) })
|
||||||
modules.add(TypedVHCreatorMod({ data[it] is NoPairedDeviceCardVH.Item }) { NoPairedDeviceCardVH(it) })
|
|
||||||
modules.add(TypedVHCreatorMod({ data[it] is MissingMainDeviceVH.Item }) { MissingMainDeviceVH(it) })
|
modules.add(TypedVHCreatorMod({ data[it] is MissingMainDeviceVH.Item }) { MissingMainDeviceVH(it) })
|
||||||
modules.add(TypedVHCreatorMod({ data[it] is BluetoothDisabledVH.Item }) { BluetoothDisabledVH(it) })
|
modules.add(TypedVHCreatorMod({ data[it] is BluetoothDisabledVH.Item }) { BluetoothDisabledVH(it) })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import eu.darken.capod.main.core.MonitorMode
|
|||||||
import eu.darken.capod.main.core.PermissionTool
|
import eu.darken.capod.main.core.PermissionTool
|
||||||
import eu.darken.capod.main.ui.overview.cards.BluetoothDisabledVH
|
import eu.darken.capod.main.ui.overview.cards.BluetoothDisabledVH
|
||||||
import eu.darken.capod.main.ui.overview.cards.MissingMainDeviceVH
|
import eu.darken.capod.main.ui.overview.cards.MissingMainDeviceVH
|
||||||
import eu.darken.capod.main.ui.overview.cards.NoPairedDeviceCardVH
|
|
||||||
import eu.darken.capod.main.ui.overview.cards.PermissionCardVH
|
import eu.darken.capod.main.ui.overview.cards.PermissionCardVH
|
||||||
import eu.darken.capod.main.ui.overview.cards.pods.*
|
import eu.darken.capod.main.ui.overview.cards.pods.*
|
||||||
import eu.darken.capod.monitor.core.PodMonitor
|
import eu.darken.capod.monitor.core.PodMonitor
|
||||||
@@ -153,11 +152,7 @@ class OverviewFragmentVM @Inject constructor(
|
|||||||
if (permissions.isEmpty()) {
|
if (permissions.isEmpty()) {
|
||||||
if (!isBluetoothEnabled) {
|
if (!isBluetoothEnabled) {
|
||||||
items.add(0, BluetoothDisabledVH.Item)
|
items.add(0, BluetoothDisabledVH.Item)
|
||||||
} else if (!showAll && items.none { it is PodDeviceVH.Item }) {
|
} else if (mainPod == null) {
|
||||||
NoPairedDeviceCardVH.Item {
|
|
||||||
generalSettings.showAll.value = true
|
|
||||||
}.run { items.add(this) }
|
|
||||||
} else if (showAll && mainPod == null) {
|
|
||||||
items.add(0, MissingMainDeviceVH.Item)
|
items.add(0, MissingMainDeviceVH.Item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
package eu.darken.capod.main.ui.overview.cards
|
|
||||||
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import eu.darken.capod.R
|
|
||||||
import eu.darken.capod.common.lists.binding
|
|
||||||
import eu.darken.capod.common.lists.differ.DifferItem
|
|
||||||
import eu.darken.capod.databinding.OverviewNopaireddeviceItemBinding
|
|
||||||
import eu.darken.capod.main.ui.overview.OverviewAdapter
|
|
||||||
|
|
||||||
class NoPairedDeviceCardVH(parent: ViewGroup) :
|
|
||||||
OverviewAdapter.BaseVH<NoPairedDeviceCardVH.Item, OverviewNopaireddeviceItemBinding>(
|
|
||||||
R.layout.overview_nopaireddevice_item,
|
|
||||||
parent
|
|
||||||
) {
|
|
||||||
|
|
||||||
override val viewBinding = lazy {
|
|
||||||
OverviewNopaireddeviceItemBinding.bind(itemView)
|
|
||||||
}
|
|
||||||
|
|
||||||
override val onBindData: OverviewNopaireddeviceItemBinding.(
|
|
||||||
item: Item,
|
|
||||||
payloads: List<Any>
|
|
||||||
) -> Unit = binding(payload = true) { item ->
|
|
||||||
showAllAction.setOnClickListener { item.onShowAll() }
|
|
||||||
}
|
|
||||||
|
|
||||||
data class Item(
|
|
||||||
val onShowAll: () -> Unit
|
|
||||||
) : OverviewAdapter.Item {
|
|
||||||
override val stableId: Long = Item::class.hashCode().toLong()
|
|
||||||
|
|
||||||
override val payloadProvider: ((DifferItem, DifferItem) -> DifferItem?)
|
|
||||||
get() = { old, new -> if (new::class.isInstance(old)) new else null }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/card"
|
|
||||||
style="@style/MyCardView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
tools:context=".main.ui.MainActivity">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
|
||||||
android:id="@+id/permission_label"
|
|
||||||
style="@style/TextAppearance.MaterialComponents.Body1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginHorizontal="16dp"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:text="@string/overview_nopaireddevices_label" />
|
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
|
||||||
android:id="@+id/permission_description"
|
|
||||||
style="@style/TextAppearance.MaterialComponents.Body2"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:layout_marginHorizontal="16dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/permission_label"
|
|
||||||
android:text="@string/overview_nopaireddevices_description" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/show_all_action"
|
|
||||||
style="@style/Widget.MaterialComponents.Button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_marginHorizontal="16dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:text="@string/settings_showall_label"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/permission_description" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
@@ -71,9 +71,7 @@
|
|||||||
<string name="pods_microphone_label">Microphone</string>
|
<string name="pods_microphone_label">Microphone</string>
|
||||||
<string name="pods_yours">Yours</string>
|
<string name="pods_yours">Yours</string>
|
||||||
|
|
||||||
<string name="overview_nopaireddevices_label">No paired device connected.</string>
|
<string name="overview_nomaindevice_label">No primary device</string>
|
||||||
<string name="overview_nopaireddevices_description">Connect a paired device or enable the \'Show all\' option.</string>
|
|
||||||
<string name="overview_nomaindevice_label">Missing main device</string>
|
|
||||||
<string name="overview_nomaindevice_description">All detected devices are unlikely to be yours. Power on and connect your device or adjust the settings.</string>
|
<string name="overview_nomaindevice_description">All detected devices are unlikely to be yours. Power on and connect your device or adjust the settings.</string>
|
||||||
|
|
||||||
<string name="settings_label">Settings</string>
|
<string name="settings_label">Settings</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user