layout fix

This commit is contained in:
nuclearfog 2022-12-28 21:46:09 +01:00
parent 8d2f8d0df7
commit 713766c032
No known key found for this signature in database
GPG Key ID: 03488A185C476379
9 changed files with 26 additions and 20 deletions

View File

@ -1,7 +1,6 @@
package org.nuclearfog.twidda.adapter.holder;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
@ -26,7 +25,6 @@ import org.nuclearfog.twidda.model.Poll;
public class PollHolder extends ViewHolder implements OnOptionClickListener {
private TextView votesCount;
private TextView expiresAt;
private OptionsAdapter adapter;
@ -42,11 +40,9 @@ public class PollHolder extends ViewHolder implements OnOptionClickListener {
CardView cardBackground = (CardView) itemView;
RecyclerView optionsList = itemView.findViewById(R.id.item_poll_options_list);
votesCount = itemView.findViewById(R.id.item_poll_votes_count);
expiresAt = itemView.findViewById(R.id.item_poll_expiration_date);
cardBackground.setCardBackgroundColor(settings.getCardColor());
votesCount.setTextColor(settings.getFontColor());
expiresAt.setTextColor(settings.getFontColor());
itemView.getLayoutParams().width = parent.getMeasuredHeight() * 2;
adapter = new OptionsAdapter(settings, this);
@ -70,13 +66,12 @@ public class PollHolder extends ViewHolder implements OnOptionClickListener {
* @param poll poll information
*/
public void setContent(Poll poll) {
votesCount.setText(R.string.poll_total_votes);
votesCount.append(StringTools.NUMBER_FORMAT.format(poll.voteCount()));
if (poll.closed()) {
expiresAt.setText(R.string.poll_finished);
votesCount.setText(R.string.poll_finished);
} else {
expiresAt.setVisibility(View.GONE);
votesCount.setText(R.string.poll_total_votes);
}
votesCount.append(StringTools.NUMBER_FORMAT.format(poll.voteCount()));
adapter.addAll(poll);
}

View File

@ -221,6 +221,11 @@ public class StatusHolder extends ViewHolder implements OnClickListener {
text = resources.getString(R.string.info_user_favorited, name);
iconRes = R.drawable.favorite;
break;
case Notification.TYPE_POLL:
text = resources.getString(R.string.notification_status_poll);
iconRes = R.drawable.poll;
break;
}
label.setVisibility(View.VISIBLE);
label.setText(text);

View File

@ -1,6 +1,6 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:width="16sp"
android:height="16sp"
android:viewportWidth="20"
android:viewportHeight="20">
<path

View File

@ -24,17 +24,14 @@
<TextView
android:id="@+id/item_poll_votes_count"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:textSize="@dimen/tiem_poll_text_size"
android:lines="1"/>
<!--todo add vote button here-->
</LinearLayout>
<TextView
android:id="@+id/item_poll_expiration_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@ -165,6 +165,7 @@
android:id="@+id/item_status_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/item_status_layout_margin"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/item_status_text_barrier"
app:layout_constraintEnd_toEndOf="parent" />
@ -173,6 +174,7 @@
android:id="@+id/item_status_attachment_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/item_status_layout_margin"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/item_status_text"
app:layout_constraintEnd_toEndOf="parent" />
@ -181,6 +183,7 @@
android:id="@+id/item_status_indicator_placeholder"
android:layout_width="0dp"
android:layout_height="@dimen/item_status_icon_size"
android:layout_marginTop="@dimen/item_status_layout_margin"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/item_status_attachment_list"
app:layout_constraintEnd_toStartOf="@id/item_status_repost_icon" />
@ -190,6 +193,7 @@
android:layout_width="@dimen/item_status_icon_size"
android:layout_height="@dimen/item_status_icon_size"
android:src="@drawable/repost"
android:layout_marginTop="@dimen/item_status_layout_margin"
app:layout_constraintStart_toEndOf="@id/item_status_indicator_placeholder"
app:layout_constraintTop_toBottomOf="@id/item_status_attachment_list"
app:layout_constraintEnd_toStartOf="@id/item_status_repost_count"
@ -213,6 +217,7 @@
android:layout_width="@dimen/item_status_icon_size"
android:layout_height="@dimen/item_status_icon_size"
android:src="@drawable/favorite"
android:layout_marginTop="@dimen/item_status_layout_margin"
app:layout_constraintStart_toEndOf="@id/item_status_repost_count"
app:layout_constraintTop_toBottomOf="@id/item_status_attachment_list"
app:layout_constraintEnd_toStartOf="@id/item_status_favorite_count"

View File

@ -226,6 +226,7 @@
android:linksClickable="false"
android:singleLine="true"
android:textSize="@dimen/page_status_textsize_small"
android:layout_marginTop="@dimen/page_status_textview_margin"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/page_status_api_barrier"
app:layout_constraintEnd_toEndOf="parent" />

View File

@ -247,7 +247,7 @@
<string name="status_metrics_title">Statusmetriken</string>
<string name="error_empty_text">Text ist leer!</string>
<string name="error_api_access_limited">Fehler! API Zugang wurde von Twitter beschränkt.</string>
<string name="poll_total_votes">"Total:\u0020"</string>
<string name="poll_total_votes">"Anzahl:\u0020"</string>
<string name="description_poll_vote_icon">abgestimmt</string>
<string name="poll_finished">Resultat</string>
<string name="poll_finished">Abstimmung beendet:\u0020</string>
</resources>

View File

@ -72,6 +72,7 @@
<!--dimens of item_status.xml-->
<dimen name="item_status_profile_size">36sp</dimen>
<dimen name="item_status_layout_padding">5dp</dimen>
<dimen name="item_status_layout_margin">3dp</dimen>
<dimen name="item_status_text_margin">5dp</dimen>
<dimen name="item_status_label_margin">8dp</dimen>
<dimen name="item_status_drawable_margin">5dp</dimen>
@ -246,7 +247,7 @@
<dimen name="controller_text_width">36sp</dimen>
<!--dimens of item_card.xml-->
<dimen name="item_card_textsize">12sp</dimen>
<dimen name="item_card_textsize">11sp</dimen>
<dimen name="item_card_layout_padding">5dp</dimen>
<dimen name="item_card_text_padding">5dp</dimen>
@ -255,6 +256,7 @@
<!-- dimens of item_poll.xml -->
<dimen name="item_poll_layout_padding">5dp</dimen>
<dimen name="tiem_poll_text_size">11sp</dimen>
<!-- dimens of item_attachment.xml -->
<dimen name="item_attachment_indicator_size">28sp</dimen>

View File

@ -285,8 +285,9 @@
<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">final results</string>
<string name="poll_finished">Vote finished:\u0020</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>
</resources>