Update poll layout.
This commit is contained in:
		
							parent
							
								
									486968fdc2
								
							
						
					
					
						commit
						374445eed6
					
				| @ -53,35 +53,36 @@ class PollOptionView @JvmOverloads constructor( | ||||
| 
 | ||||
|     private fun renderPollSending() { | ||||
|         views.optionCheckImageView.isVisible = false | ||||
|         views.optionWinnerImageView.isVisible = false | ||||
|         views.optionVoteCountTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0) | ||||
|         hideVotes() | ||||
|         renderVoteSelection(false) | ||||
|     } | ||||
| 
 | ||||
|     private fun renderPollEnded(state: PollOptionViewState.PollEnded) { | ||||
|         views.optionCheckImageView.isVisible = false | ||||
|         views.optionWinnerImageView.isVisible = state.isWinner | ||||
|         val drawableStart = if (state.isWinner) R.drawable.ic_poll_winner else 0 | ||||
|         views.optionVoteCountTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(drawableStart, 0, 0, 0) | ||||
|         showVotes(state.voteCount, state.votePercentage) | ||||
|         renderVoteSelection(state.isWinner) | ||||
|     } | ||||
| 
 | ||||
|     private fun renderPollReady() { | ||||
|         views.optionCheckImageView.isVisible = true | ||||
|         views.optionWinnerImageView.isVisible = false | ||||
|         views.optionVoteCountTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0) | ||||
|         hideVotes() | ||||
|         renderVoteSelection(false) | ||||
|     } | ||||
| 
 | ||||
|     private fun renderPollVoted(state: PollOptionViewState.PollVoted) { | ||||
|         views.optionCheckImageView.isVisible = true | ||||
|         views.optionWinnerImageView.isVisible = false | ||||
|         views.optionVoteCountTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0) | ||||
|         showVotes(state.voteCount, state.votePercentage) | ||||
|         renderVoteSelection(state.isSelected) | ||||
|     } | ||||
| 
 | ||||
|     private fun renderPollUndisclosed(state: PollOptionViewState.PollUndisclosed) { | ||||
|         views.optionCheckImageView.isVisible = true | ||||
|         views.optionWinnerImageView.isVisible = false | ||||
|         views.optionVoteCountTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0) | ||||
|         hideVotes() | ||||
|         renderVoteSelection(state.isSelected) | ||||
|     } | ||||
|  | ||||
| @ -36,34 +36,23 @@ | ||||
|         android:layout_marginStart="12dp" | ||||
|         android:layout_marginTop="16dp" | ||||
|         android:layout_marginEnd="12dp" | ||||
|         app:layout_constraintEnd_toEndOf="@id/optionWinnerImageView" | ||||
|         app:layout_constraintEnd_toStartOf="@id/optionVoteCountTextView" | ||||
|         app:layout_constraintStart_toEndOf="@id/optionCheckImageView" | ||||
|         app:layout_constraintTop_toTopOf="parent" | ||||
|         tools:text="@sample/poll.json/data/answer" /> | ||||
| 
 | ||||
|     <ImageView | ||||
|         android:id="@+id/optionWinnerImageView" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginTop="16dp" | ||||
|         android:layout_marginEnd="16dp" | ||||
|         android:contentDescription="@string/a11y_poll_winner_option" | ||||
|         android:src="@drawable/ic_poll_winner" | ||||
|         android:visibility="gone" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintTop_toTopOf="parent" | ||||
|         tools:visibility="visible" /> | ||||
| 
 | ||||
|     <TextView | ||||
|         android:id="@+id/optionVoteCountTextView" | ||||
|         style="@style/Widget.Vector.TextView.Caption" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginEnd="8dp" | ||||
|         android:layout_marginEnd="10dp" | ||||
|         android:drawablePadding="6dp" | ||||
|         android:visibility="gone" | ||||
|         app:layout_constraintBottom_toBottomOf="@id/optionVoteProgress" | ||||
|         app:layout_constraintBottom_toBottomOf="@id/optionNameTextView" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintTop_toTopOf="@id/optionVoteProgress" | ||||
|         app:layout_constraintTop_toTopOf="@id/optionNameTextView" | ||||
|         tools:drawableStartCompat="@drawable/ic_poll_winner" | ||||
|         tools:text="@sample/poll.json/data/votes" | ||||
|         tools:visibility="visible" /> | ||||
| 
 | ||||
| @ -78,9 +67,9 @@ | ||||
|         android:layout_marginBottom="8dp" | ||||
|         android:progressDrawable="@drawable/poll_option_progressbar_checked" | ||||
|         app:layout_constraintBottom_toBottomOf="@id/optionBorderImageView" | ||||
|         app:layout_constraintEnd_toStartOf="@id/optionVoteCountTextView" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         app:layout_constraintTop_toBottomOf="@id/optionNameTextView" | ||||
|         tools:progress="60" /> | ||||
| 
 | ||||
| </androidx.constraintlayout.widget.ConstraintLayout> | ||||
| </androidx.constraintlayout.widget.ConstraintLayout> | ||||
|  | ||||
| @ -13,7 +13,6 @@ | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginTop="8dp" | ||||
|         android:textColor="?vctr_content_primary" | ||||
|         android:textStyle="bold" | ||||
|         app:layout_constraintHorizontal_bias="0" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user