Skip to content

Commit

Permalink
Merge pull request #45 from Trendyol/selectionDialogUiBugFix
Browse files Browse the repository at this point in the history
selection dialog ui and checked bug
  • Loading branch information
belfuogretir authored May 29, 2020
2 parents 44909d0 + 789d0b9 commit 7187e7c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ data class DialogListItemViewState(
if (selectedTextColor == null || isChecked.not()) R.color.primary_text_color else selectedTextColor

fun getRadioButtonVisibility() =
if(showRadioButton) View.VISIBLE else View.GONE
if (showRadioButton) View.VISIBLE else View.GONE

fun getRadioButtonChecked() = (selectedTextColor == null || isChecked.not()).not()
fun getRadioButtonChecked() = isChecked
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:fillColor="?attr/colorAccent"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
</vector>
16 changes: 9 additions & 7 deletions libraries/dialogs/src/main/res/layout/item_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,31 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:padding="@dimen/dialogs_margin_outer">
android:paddingTop="@dimen/dialogs_margin_outer"
android:paddingEnd="@dimen/dialogs_margin_outer"
android:paddingBottom="@dimen/dialogs_margin_outer">

<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/imageViewLeftImageDrawable"
style="@style/Trendyol.UIComponents.Dialogs.RadioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="@{viewState.getRadioButtonChecked}"
android:paddingEnd="@dimen/dialogs_margin_inner"
android:visibility="@{viewState.getRadioButtonVisibility}"
android:clickable="false"
android:visibility="@{viewState.getRadioButtonVisibility}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/radioButtonItem"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@id/radioButtonItem"
tools:src="@tools:sample/avatars"/>
tools:src="@tools:sample/avatars" />

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/radioButtonItem"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/imageViewCheckedDrawable"
android:paddingStart="@dimen/dialogs_margin_inner"
android:text="@{viewState.text}"
android:textAppearance="@style/Trendyol.UIComponents.Dialogs.PrimaryText.Body"
app:layout_constraintBottom_toBottomOf="parent"
Expand All @@ -56,10 +58,10 @@
android:src="@{viewState.getSelectedItemDrawable(context)}"
android:visibility="@{viewState.selectedItemDrawableVisibility}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/radioButtonItem"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toEndOf="@id/radioButtonItem"
app:layout_constraintTop_toTopOf="parent"
tools:src="@tools:sample/avatars" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
1 change: 1 addition & 0 deletions libraries/dialogs/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<style name="Trendyol.UIComponents.Sample.Dialogs" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge">
<!-- Customize your theme here. -->
<item name="colorPrimary">#F27A1A</item>
<item name="colorAccent">#666666</item>
</style>

</resources>

0 comments on commit 7187e7c

Please sign in to comment.