fix layouts to handle poll with many options

make options scrollable

replace constraint layout with linear layouts + layout_weight="1"

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-07-01 15:40:19 +02:00 committed by Andy Scherzinger (Rebase PR Action)
parent cedbcaefee
commit 6ab5dace1c
5 changed files with 95 additions and 87 deletions

View file

@ -16,34 +16,37 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:padding="@dimen/standard_padding"
android:orientation="vertical"
tools:background="@color/white">
<ImageView
android:id="@+id/message_poll_icon"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:contentDescription="@null"
android:src="@drawable/ic_baseline_bar_chart_24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="@color/high_emphasis_menu_icon" />
<ImageView
android:id="@+id/message_poll_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_baseline_bar_chart_24"
app:tint="@color/high_emphasis_menu_icon" />
<androidx.emoji.widget.EmojiTextView
android:id="@+id/message_poll_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:textStyle="bold"
app:layout_constraintStart_toEndOf="@id/message_poll_icon"
app:layout_constraintTop_toTopOf="@+id/message_poll_icon"
tools:text="This is the poll title?" />
<androidx.emoji.widget.EmojiTextView
android:id="@+id/message_poll_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:textStyle="bold"
tools:text="This is the poll title?" />
</LinearLayout>
<TextView
android:id="@+id/poll_details_text"
@ -51,16 +54,13 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:textColor="@color/low_emphasis_text"
app:layout_constraintStart_toStartOf="@id/message_poll_icon"
app:layout_constraintTop_toBottomOf="@+id/message_poll_title"
tools:text="Poll results - 93 votes" />
<FrameLayout
android:id="@+id/message_poll_content_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/poll_details_text"
tools:layout_height="400dp" />
android:layout_weight="1" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View file

@ -16,19 +16,19 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
tools:background="@color/white">
tools:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:id="@+id/poll_results_list_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
android:layout_height="0dp"
android:layout_weight="1">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/poll_results_list"
@ -37,25 +37,27 @@
tools:listitem="@layout/poll_result_header_item" />
</LinearLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/poll_results_end_poll_button"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/polls_end_poll"
style="@style/OutlinedButton"
android:layout_marginEnd="@dimen/standard_margin"
app:cornerRadius="@dimen/button_corner_radius"
app:layout_constraintEnd_toStartOf="@+id/edit_vote_button"
app:layout_constraintTop_toBottomOf="@+id/poll_results_list_wrapper" />
android:gravity="end">
<com.google.android.material.button.MaterialButton
android:id="@+id/edit_vote_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:theme="@style/Button.Primary"
app:cornerRadius="@dimen/button_corner_radius"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/poll_results_list_wrapper" />
<com.google.android.material.button.MaterialButton
android:id="@+id/poll_results_end_poll_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/polls_end_poll"
style="@style/OutlinedButton"
android:layout_marginEnd="@dimen/standard_margin"
app:cornerRadius="@dimen/button_corner_radius" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/edit_vote_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:theme="@style/Button.Primary"
app:cornerRadius="@dimen/button_corner_radius" />
</LinearLayout>
</LinearLayout>

View file

@ -16,60 +16,62 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:background="@color/white">
tools:background="@color/white"
android:orientation="vertical">
<LinearLayout
<ScrollView
android:id="@+id/vote_options_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:orientation="vertical">
android:layout_height="0dp"
android:layout_weight="1"
android:padding="@dimen/standard_half_padding">
<LinearLayout
android:id="@+id/vote_options_checkboxes_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/vote_options_checkboxes_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<RadioGroup
android:id="@+id/poll_vote_radio_group"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
tools:layout_height="400dp"
tools:layout_width="match_parent" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end">
<RadioGroup
android:id="@+id/poll_vote_radio_group"
android:layout_height="wrap_content"
<com.google.android.material.button.MaterialButton
android:id="@+id/poll_vote_end_poll_button"
android:layout_width="wrap_content"
tools:layout_height="400dp"
tools:layout_width="match_parent" />
android:layout_height="wrap_content"
android:text="@string/polls_end_poll"
style="@style/OutlinedButton"
android:layout_marginEnd="@dimen/standard_margin"
app:cornerRadius="@dimen/button_corner_radius" />
<com.google.android.material.button.MaterialButton
android:id="@+id/poll_vote_submit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:theme="@style/Button.Primary"
app:cornerRadius="@dimen/button_corner_radius" />
</LinearLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/poll_vote_end_poll_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/polls_end_poll"
style="@style/OutlinedButton"
android:layout_marginEnd="@dimen/standard_margin"
app:cornerRadius="@dimen/button_corner_radius"
app:layout_constraintEnd_toStartOf="@+id/poll_vote_submit_button"
app:layout_constraintTop_toBottomOf="@+id/vote_options_wrapper" />
<com.google.android.material.button.MaterialButton
android:id="@+id/poll_vote_submit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cornerRadius="@dimen/button_corner_radius"
android:text="@string/nc_common_submit"
android:theme="@style/Button.Primary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vote_options_wrapper" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View file

@ -3,6 +3,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/standard_half_padding"
android:paddingEnd="@dimen/standard_half_padding"
tools:background="@color/white">
<TextView

View file

@ -3,6 +3,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/standard_half_padding"
android:paddingEnd="@dimen/standard_half_padding"
android:paddingBottom="4dp"
tools:background="@color/white">