layout fix

This commit is contained in:
nuclearfog 2023-04-17 12:58:35 +02:00
parent ae349e0125
commit c23ec48721
No known key found for this signature in database
GPG Key ID: 03488A185C476379
7 changed files with 39 additions and 29 deletions

View File

@ -50,7 +50,7 @@ public class PollHolder extends ViewHolder implements OnClickListener {
votesCount.setTypeface(settings.getTypeFace());
expiration.setTextColor(settings.getTextColor());
expiration.setTypeface(settings.getTypeFace());
itemView.getLayoutParams().width = Resources.getSystem().getDisplayMetrics().widthPixels * 2 / 3;
itemView.getLayoutParams().width = Resources.getSystem().getDisplayMetrics().widthPixels * 3 / 4;
optionsList.setAdapter(adapter);
optionsList.setItemAnimator(null); // disable animation
@ -79,19 +79,17 @@ public class PollHolder extends ViewHolder implements OnClickListener {
*/
public void setContent(Poll poll) {
if (poll.closed()) {
votesCount.setText(R.string.poll_total_votes);
expiration.setText(R.string.poll_finished);
voteButton.setVisibility(View.GONE);
} else {
votesCount.setText(R.string.poll_total_votes);
expiration.setText(StringUtils.formatExpirationTime(expiration.getResources(), poll.getEndTime()));
if (poll.voted()) {
voteButton.setVisibility(View.INVISIBLE);
voteButton.setVisibility(View.GONE);
} else if (poll.getLimit() > 0) {
voteButton.setVisibility(View.VISIBLE);
}
}
votesCount.append(StringUtils.NUMBER_FORMAT.format(poll.voteCount()));
votesCount.setText(votesCount.getResources().getQuantityString(R.plurals.poll_votes, poll.voteCount(), poll.voteCount()));
adapter.addAll(poll);
}
}

View File

@ -17,7 +17,10 @@
android:layout_weight="1"
android:layout_marginBottom="@dimen/item_poll_layout_margin"
android:descendantFocusability="blocksDescendants"
android:nestedScrollingEnabled="true" />
android:nestedScrollingEnabled="true"
android:scrollbars="vertical"
android:fadeScrollbars="false"
android:scrollbarStyle="outsideInset"/>
<LinearLayout
android:layout_width="match_parent"
@ -26,34 +29,33 @@
<TextView
android:id="@+id/item_poll_votes_count"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/item_poll_text_size"
android:lines="1"
android:layout_weight="1" />
android:layout_marginStart="@dimen/item_poll_layout_margin"
android:textSize="@dimen/item_poll_text_size" />
<TextView
android:id="@+id/item_poll_expiration"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/item_poll_layout_margin_label"
android:textSize="@dimen/item_poll_text_size"
android:lines="1"
android:layout_weight="1" />
<Button
android:id="@+id/item_poll_vote_button"
android:layout_width="0dp"
android:layout_height="@dimen/item_poll_button_height"
android:visibility="invisible"
android:drawablePadding="@dimen/item_poll_drawable_padding"
android:lines="1"
android:textSize="@dimen/item_poll_text_size"
android:layout_weight="1"
android:text="@string/item_poll_option_vote"
style="@style/FeedbackButton" />
android:lines="1" />
</LinearLayout>
<Button
android:id="@+id/item_poll_vote_button"
android:layout_width="wrap_content"
android:layout_height="@dimen/item_poll_button_height"
android:visibility="gone"
android:layout_marginTop="@dimen/item_poll_layout_margin"
android:drawablePadding="@dimen/item_poll_drawable_padding"
android:lines="1"
android:textSize="@dimen/item_poll_text_size"
android:text="@string/item_poll_option_vote"
style="@style/FeedbackButton" />
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@ -51,4 +51,9 @@
<item quantity="other">noch <xliff:g id="count">%d</xliff:g> Wochen</item>
</plurals>
<plurals name="poll_votes">
<item quantity="one"><xliff:g id="count">%d</xliff:g> Stimme</item>
<item quantity="other"><xliff:g id="count">%d</xliff:g> Stimmen</item>
</plurals>
</resources>

View File

@ -255,9 +255,8 @@
<string name="error_api_access_limited">Fehler! API Zugang wurde von Twitter beschränkt.</string>
<string name="status_media_preview">Medienvorschau</string>
<string name="status_media_preview_button">Videovorschau Button</string>
<string name="poll_total_votes">"Anzahl:\u0020"</string>
<string name="description_poll_vote_icon">abgestimmt</string>
<string name="poll_finished">Abstimmung beendet:\u0020</string>
<string name="poll_finished">Abstimmung beendet</string>
<string name="description_attachment_icon">Status/Nachricht Anhang</string>
<string name="notification_status_poll">Umfrage abgeschlossen</string>
<string name="login_network_selector_label">Netzwerk auswählen</string>

View File

@ -269,7 +269,8 @@
<!-- dimens of item_poll.xml -->
<dimen name="item_poll_layout_padding">5dp</dimen>
<dimen name="item_poll_layout_margin">3dp</dimen>
<dimen name="item_poll_text_size">13sp</dimen>
<dimen name="item_poll_layout_margin_label">20dp</dimen>
<dimen name="item_poll_text_size">12sp</dimen>
<dimen name="item_poll_button_height">16sp</dimen>
<dimen name="item_poll_drawable_padding">5dp</dimen>

View File

@ -51,4 +51,9 @@
<item quantity="other"><xliff:g id="count">%d</xliff:g> weeks remain</item>
</plurals>
<plurals name="poll_votes">
<item quantity="one"><xliff:g id="count">%d</xliff:g> Vote</item>
<item quantity="other"><xliff:g id="count">%d</xliff:g> Votes</item>
</plurals>
</resources>

View File

@ -310,7 +310,7 @@
<string name="status_media_preview">Media preview</string>
<string name="status_media_preview_button">Video preview button</string>
<string name="poll_total_votes">Total votes:\u0020</string>
<string name="poll_finished">Vote finished:\u0020</string>
<string name="poll_finished">Vote finished</string>
<string name="description_poll_vote_icon">voted</string>
<string name="description_attachment_icon">Status/Message attachment</string>
<string name="notification_status_poll">vote finished</string>