From 993110be2b1416551838843583adee63e06471ed Mon Sep 17 00:00:00 2001 From: JasonLiuZhuoCheng Date: Wed, 3 Nov 2021 22:07:46 -0400 Subject: [PATCH] fix parameter response ui alignment issue --- .../ClusterDetailFragment.kt | 5 +-- .../app/src/main/res/layout/callback_item.xml | 33 +++++++++++++----- .../src/main/res/layout/parameter_item.xml | 34 +++++++++++++------ 3 files changed, 51 insertions(+), 21 deletions(-) diff --git a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt index a782a50628df89..e04673ca7fa293 100644 --- a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt +++ b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt @@ -11,6 +11,7 @@ import android.widget.ArrayAdapter import android.widget.AutoCompleteTextView import android.widget.LinearLayout import android.widget.Toast +import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.view.forEach import androidx.fragment.app.Fragment import chip.clusterinfo.ClusterCommandCallback @@ -161,7 +162,7 @@ class ClusterDetailFragment : Fragment() { private fun populateCommandParameter(inflater: LayoutInflater, parameterList: LinearLayout) { selectedCommandInfo.commandParameters.forEach { (paramName, paramInfo) -> - val param = inflater.inflate(R.layout.parameter_item, null, false) as LinearLayout + val param = inflater.inflate(R.layout.parameter_item, null, false) as ConstraintLayout param.parameterName.text = "${paramName}" param.parameterType.text = "${paramInfo.type}" parameterList.addView(param) @@ -174,7 +175,7 @@ class ClusterDetailFragment : Fragment() { callbackList: LinearLayout ) { responseValues.forEach { (variableNameType, response) -> - val callback = inflater.inflate(R.layout.callback_item, null, false) as LinearLayout + val callback = inflater.inflate(R.layout.callback_item, null, false) as ConstraintLayout callback.callbackName.text = variableNameType.name callback.callbackData.text = response.toString() callback.callbackType.text = variableNameType.type diff --git a/src/android/CHIPTool/app/src/main/res/layout/callback_item.xml b/src/android/CHIPTool/app/src/main/res/layout/callback_item.xml index db460903cfd5db..d17648f4108c95 100644 --- a/src/android/CHIPTool/app/src/main/res/layout/callback_item.xml +++ b/src/android/CHIPTool/app/src/main/res/layout/callback_item.xml @@ -1,6 +1,6 @@ - - + android:padding="16dp" + android:singleLine="false" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@id/callbackType" + app:layout_constraintStart_toEndOf="@id/callbackName" + app:layout_constraintTop_toTopOf="parent" /> - \ No newline at end of file + android:padding="16dp" + android:singleLine="false" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@id/callbackData" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + \ No newline at end of file diff --git a/src/android/CHIPTool/app/src/main/res/layout/parameter_item.xml b/src/android/CHIPTool/app/src/main/res/layout/parameter_item.xml index a2b819ba2b3615..60b585894e9d06 100644 --- a/src/android/CHIPTool/app/src/main/res/layout/parameter_item.xml +++ b/src/android/CHIPTool/app/src/main/res/layout/parameter_item.xml @@ -1,31 +1,45 @@ - + android:layout_height="wrap_content"> - + android:padding="16dp" + android:singleLine="false" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@id/parameterType" + app:layout_constraintStart_toEndOf="@id/parameterData" + app:layout_constraintTop_toTopOf="parent" /> - \ No newline at end of file + android:padding="16dp" + android:singleLine="false" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@id/parameterName" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + \ No newline at end of file