Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Update Subscribe UI update to clarify options #24460

Merged
merged 6 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.EditText
import android.widget.Spinner
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import chip.devicecontroller.ChipDeviceController
import chip.devicecontroller.ChipIdLookup
import chip.devicecontroller.ReportCallback
import chip.devicecontroller.ReportEventCallback
import chip.devicecontroller.ResubscriptionAttemptCallback
import chip.devicecontroller.SubscriptionEstablishedCallback
import chip.devicecontroller.model.ChipAttributePath
Expand Down Expand Up @@ -186,7 +186,7 @@ class WildcardFragment : Fragment() {
setView(dialogView)
}.create()

val isFabricFilteredEd = dialogView.findViewById<EditText>(R.id.isFabricFilteredEd)
val isFabricFilteredEd = dialogView.findViewById<EditText>(R.id.isFabricFilteredSp)
dialogView.findViewById<Button>(R.id.readBtn).setOnClickListener {
scope.launch {
read(type, isFabricFilteredEd.text.toString().toBoolean())
Expand All @@ -204,11 +204,21 @@ class WildcardFragment : Fragment() {

val minIntervalEd = dialogView.findViewById<EditText>(R.id.minIntervalEd)
val maxIntervalEd = dialogView.findViewById<EditText>(R.id.maxIntervalEd)
val keepSubscriptionsEd = dialogView.findViewById<EditText>(R.id.keepSubscriptionsEd)
val isFabricFilteredEd = dialogView.findViewById<EditText>(R.id.isFabricFilteredEd)
val keepSubscriptionsSp = dialogView.findViewById<Spinner>(R.id.keepSubscriptionsSp)
val isFabricFilteredSp = dialogView.findViewById<Spinner>(R.id.isFabricFilteredSp)
dialogView.findViewById<Button>(R.id.subscribeBtn).setOnClickListener {
scope.launch {
subscribe(type, minIntervalEd.text.toString().toInt(), maxIntervalEd.text.toString().toInt(), keepSubscriptionsEd.text.toString().toBoolean(), isFabricFilteredEd.text.toString().toBoolean())
if(minIntervalEd.text.isNotBlank() && maxIntervalEd.text.isNotBlank()) {
subscribe(
type,
minIntervalEd.text.toString().toInt(),
maxIntervalEd.text.toString().toInt(),
keepSubscriptionsSp.selectedItem.toString().toBoolean(),
isFabricFilteredSp.selectedItem.toString().toBoolean()
)
} else {
Log.e(TAG, "minInterval or maxInterval is empty!" )
}
requireActivity().runOnUiThread { dialog.dismiss() }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
app:layout_constraintTop_toTopOf="parent" />

<EditText
android:id="@+id/isFabricFilteredEd"
android:id="@+id/isFabricFilteredSp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/read_dialog_is_fabric_filtered_hint"
android:inputType="text"
android:textSize="16sp"
android:layout_marginBottom="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/isFabricFilteredEd"
app:layout_constraintTop_toBottomOf="@id/isFabricFilteredSp"
app:layout_constraintBottom_toTopOf="@+id/subscribeBtn"/>

<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,52 @@
android:layout_marginBottom="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/minIntervalEd" />

<EditText
android:id="@+id/keepSubscriptionsEd"
<TextView
android:id="@+id/titleKeepSubscriptions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/subscribe_dialog_keep_subscriptions_hint"
android:textSize="16sp"
android:layout_marginTop="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/maxIntervalEd"
/>
<Spinner
android:id="@+id/keepSubscriptionsSp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/subscribe_dialog_keep_subscriptions_hint"
android:entries="@array/chip_select_menu"
android:inputType="text"
android:spinnerMode="dropdown"
android:textSize="16sp"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/maxIntervalEd" />
app:layout_constraintTop_toBottomOf="@id/titleKeepSubscriptions" />

<EditText
android:id="@+id/isFabricFilteredEd"
<TextView
android:id="@+id/titleIsFabricFilter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/subscribe_dialog_is_fabric_filtered_hint"
android:textSize="16sp"
android:layout_marginTop="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/keepSubscriptionsSp"
/>

<Spinner
android:id="@+id/isFabricFilteredSp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/subscribe_dialog_is_fabric_filtered_hint"
android:inputType="text"
android:entries="@array/chip_select_menu"
android:spinnerMode="dropdown"
android:textSize="16sp"
android:layout_marginBottom="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/keepSubscriptionsEd"
app:layout_constraintTop_toBottomOf="@id/titleIsFabricFilter"
app:layout_constraintBottom_toTopOf="@+id/subscribeBtn"/>

<Button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string-array name="chip_select_menu">
<item>false</item>
<item>true</item>
</string-array>
</resources>