use material buttons in timeline (#1627)

* use material buttons in timeline

* remove wrong switch option
This commit is contained in:
Konrad Pozniak 2020-01-07 19:40:52 +01:00 committed by GitHub
parent b87a1711f2
commit e5b78f65cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 96 additions and 107 deletions

View file

@ -28,10 +28,9 @@ import android.text.style.StyleSpan;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.CompoundButton; import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.ToggleButton;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -332,7 +331,7 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
} }
private static class StatusNotificationViewHolder extends RecyclerView.ViewHolder private static class StatusNotificationViewHolder extends RecyclerView.ViewHolder
implements View.OnClickListener, ToggleButton.OnCheckedChangeListener { implements View.OnClickListener {
private final TextView message; private final TextView message;
private final View statusNameBar; private final View statusNameBar;
private final TextView displayName; private final TextView displayName;
@ -342,8 +341,8 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
private final ImageView statusAvatar; private final ImageView statusAvatar;
private final ImageView notificationAvatar; private final ImageView notificationAvatar;
private final TextView contentWarningDescriptionTextView; private final TextView contentWarningDescriptionTextView;
private final ToggleButton contentWarningButton; private final Button contentWarningButton;
private final ToggleButton contentCollapseButton; // TODO: This code SHOULD be based on StatusBaseViewHolder private final Button contentCollapseButton; // TODO: This code SHOULD be based on StatusBaseViewHolder
private StatusDisplayOptions statusDisplayOptions; private StatusDisplayOptions statusDisplayOptions;
private String accountId; private String accountId;
@ -375,7 +374,6 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
itemView.setOnClickListener(this); itemView.setOnClickListener(this);
message.setOnClickListener(this); message.setOnClickListener(this);
statusContent.setOnClickListener(this); statusContent.setOnClickListener(this);
contentWarningButton.setOnCheckedChangeListener(this);
shortSdf = new SimpleDateFormat("HH:mm:ss", Locale.getDefault()); shortSdf = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
longSdf = new SimpleDateFormat("MM/dd HH:mm:ss", Locale.getDefault()); longSdf = new SimpleDateFormat("MM/dd HH:mm:ss", Locale.getDefault());
} }
@ -481,6 +479,14 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
boolean hasSpoiler = !TextUtils.isEmpty(statusViewData.getSpoilerText()); boolean hasSpoiler = !TextUtils.isEmpty(statusViewData.getSpoilerText());
contentWarningDescriptionTextView.setVisibility(hasSpoiler ? View.VISIBLE : View.GONE); contentWarningDescriptionTextView.setVisibility(hasSpoiler ? View.VISIBLE : View.GONE);
contentWarningButton.setVisibility(hasSpoiler ? View.VISIBLE : View.GONE); contentWarningButton.setVisibility(hasSpoiler ? View.VISIBLE : View.GONE);
contentWarningButton.setOnClickListener(view -> {
if (getAdapterPosition() != RecyclerView.NO_POSITION) {
notificationActionListener.onExpandedChange(!statusViewData.isExpanded(), getAdapterPosition());
}
statusContent.setVisibility(statusViewData.isExpanded() ? View.GONE : View.VISIBLE);
});
setupContentAndSpoiler(notificationViewData, listener); setupContentAndSpoiler(notificationViewData, listener);
} }
@ -537,19 +543,19 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
List<Emoji> emojis = statusViewData.getStatusEmojis(); List<Emoji> emojis = statusViewData.getStatusEmojis();
if (statusViewData.isCollapsible() && (notificationViewData.isExpanded() || !hasSpoiler)) { if (statusViewData.isCollapsible() && (notificationViewData.isExpanded() || !hasSpoiler)) {
contentCollapseButton.setOnCheckedChangeListener((buttonView, isChecked) -> { contentCollapseButton.setOnClickListener(view -> {
int position = getAdapterPosition(); int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION && notificationActionListener != null) { if (position != RecyclerView.NO_POSITION && notificationActionListener != null) {
notificationActionListener.onNotificationContentCollapsedChange(isChecked, position); notificationActionListener.onNotificationContentCollapsedChange(statusViewData.isCollapsed(), position);
} }
}); });
contentCollapseButton.setVisibility(View.VISIBLE); contentCollapseButton.setVisibility(View.VISIBLE);
if (statusViewData.isCollapsed()) { if (statusViewData.isCollapsed()) {
contentCollapseButton.setChecked(true); contentCollapseButton.setText(R.string.status_content_warning_show_more);
statusContent.setFilters(COLLAPSE_INPUT_FILTER); statusContent.setFilters(COLLAPSE_INPUT_FILTER);
} else { } else {
contentCollapseButton.setChecked(false); contentCollapseButton.setText(R.string.status_content_warning_show_less);
statusContent.setFilters(NO_INPUT_FILTER); statusContent.setFilters(NO_INPUT_FILTER);
} }
} else { } else {
@ -565,12 +571,5 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
contentWarningDescriptionTextView.setText(emojifiedContentWarning); contentWarningDescriptionTextView.setText(emojifiedContentWarning);
} }
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (getAdapterPosition() != RecyclerView.NO_POSITION) {
notificationActionListener.onExpandedChange(isChecked, getAdapterPosition());
}
statusContent.setVisibility(isChecked ? View.VISIBLE : View.GONE);
}
} }
} }

View file

@ -13,7 +13,6 @@ import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import android.widget.ToggleButton;
import androidx.annotation.DrawableRes; import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -23,6 +22,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.google.android.material.button.MaterialButton;
import com.keylesspalace.tusky.R; import com.keylesspalace.tusky.R;
import com.keylesspalace.tusky.entity.Attachment; import com.keylesspalace.tusky.entity.Attachment;
import com.keylesspalace.tusky.entity.Attachment.Focus; import com.keylesspalace.tusky.entity.Attachment.Focus;
@ -73,7 +73,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
private TextView sensitiveMediaWarning; private TextView sensitiveMediaWarning;
private View sensitiveMediaShow; private View sensitiveMediaShow;
protected TextView[] mediaLabels; protected TextView[] mediaLabels;
private ToggleButton contentWarningButton; private MaterialButton contentWarningButton;
private ImageView avatarInset; private ImageView avatarInset;
public ImageView avatar; public ImageView avatar;
@ -173,7 +173,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
} }
public void toggleContentWarning() { public void toggleContentWarning() {
contentWarningButton.toggle(); contentWarningButton.performClick();
} }
protected void setSpoilerAndContent(boolean expanded, protected void setSpoilerAndContent(boolean expanded,
@ -193,18 +193,28 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
contentWarningDescription.setText(emojiSpoiler); contentWarningDescription.setText(emojiSpoiler);
contentWarningDescription.setVisibility(View.VISIBLE); contentWarningDescription.setVisibility(View.VISIBLE);
contentWarningButton.setVisibility(View.VISIBLE); contentWarningButton.setVisibility(View.VISIBLE);
contentWarningButton.setChecked(expanded); setContentWarningButtonText(expanded);
contentWarningButton.setOnCheckedChangeListener((buttonView, isChecked) -> { contentWarningButton.setOnClickListener( view -> {
contentWarningDescription.invalidate(); contentWarningDescription.invalidate();
if (getAdapterPosition() != RecyclerView.NO_POSITION) { if (getAdapterPosition() != RecyclerView.NO_POSITION) {
listener.onExpandedChange(isChecked, getAdapterPosition()); listener.onExpandedChange(!expanded, getAdapterPosition());
} }
this.setTextVisible(isChecked, content, mentions, emojis, poll, statusDisplayOptions, listener); setContentWarningButtonText(!expanded);
this.setTextVisible(!expanded, content, mentions, emojis, poll, statusDisplayOptions, listener);
}); });
this.setTextVisible(expanded, content, mentions, emojis, poll, statusDisplayOptions, listener); this.setTextVisible(expanded, content, mentions, emojis, poll, statusDisplayOptions, listener);
} }
} }
private void setContentWarningButtonText(boolean expanded) {
if(expanded) {
contentWarningButton.setText(R.string.status_content_warning_show_less);
} else {
contentWarningButton.setText(R.string.status_content_warning_show_more);
}
}
private void setTextVisible(boolean expanded, private void setTextVisible(boolean expanded,
Spanned content, Spanned content,
Status.Mention[] mentions, Status.Mention[] mentions,

View file

@ -19,8 +19,8 @@ import android.content.Context;
import android.text.InputFilter; import android.text.InputFilter;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import android.widget.ToggleButton;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -38,7 +38,7 @@ public class StatusViewHolder extends StatusBaseViewHolder {
private static final InputFilter[] NO_INPUT_FILTER = new InputFilter[0]; private static final InputFilter[] NO_INPUT_FILTER = new InputFilter[0];
private TextView statusInfo; private TextView statusInfo;
private ToggleButton contentCollapseButton; private Button contentCollapseButton;
public StatusViewHolder(View itemView) { public StatusViewHolder(View itemView) {
super(itemView); super(itemView);
@ -96,18 +96,18 @@ public class StatusViewHolder extends StatusBaseViewHolder {
private void setupCollapsedState(final StatusViewData.Concrete status, final StatusActionListener listener) { private void setupCollapsedState(final StatusViewData.Concrete status, final StatusActionListener listener) {
/* input filter for TextViews have to be set before text */ /* input filter for TextViews have to be set before text */
if (status.isCollapsible() && (status.isExpanded() || TextUtils.isEmpty(status.getSpoilerText()))) { if (status.isCollapsible() && (status.isExpanded() || TextUtils.isEmpty(status.getSpoilerText()))) {
contentCollapseButton.setOnCheckedChangeListener((buttonView, isChecked) -> { contentCollapseButton.setOnClickListener(view -> {
int position = getAdapterPosition(); int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION) if (position != RecyclerView.NO_POSITION)
listener.onContentCollapsedChange(isChecked, position); listener.onContentCollapsedChange(!status.isCollapsed(), position);
}); });
contentCollapseButton.setVisibility(View.VISIBLE); contentCollapseButton.setVisibility(View.VISIBLE);
if (status.isCollapsed()) { if (status.isCollapsed()) {
contentCollapseButton.setChecked(true); contentCollapseButton.setText(R.string.status_content_warning_show_more);
content.setFilters(COLLAPSE_INPUT_FILTER); content.setFilters(COLLAPSE_INPUT_FILTER);
} else { } else {
contentCollapseButton.setChecked(false); contentCollapseButton.setText(R.string.status_content_warning_show_less);
content.setFilters(NO_INPUT_FILTER); content.setFilters(NO_INPUT_FILTER);
} }
} else { } else {

View file

@ -19,9 +19,9 @@ import android.content.Context;
import android.text.InputFilter; import android.text.InputFilter;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.ToggleButton;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -41,7 +41,7 @@ public class ConversationViewHolder extends StatusBaseViewHolder {
private static final InputFilter[] NO_INPUT_FILTER = new InputFilter[0]; private static final InputFilter[] NO_INPUT_FILTER = new InputFilter[0];
private TextView conversationNameTextView; private TextView conversationNameTextView;
private ToggleButton contentCollapseButton; private Button contentCollapseButton;
private ImageView[] avatars; private ImageView[] avatars;
private StatusDisplayOptions statusDisplayOptions; private StatusDisplayOptions statusDisplayOptions;
@ -145,18 +145,18 @@ public class ConversationViewHolder extends StatusBaseViewHolder {
private void setupCollapsedState(boolean collapsible, boolean collapsed, boolean expanded, String spoilerText, final StatusActionListener listener) { private void setupCollapsedState(boolean collapsible, boolean collapsed, boolean expanded, String spoilerText, final StatusActionListener listener) {
/* input filter for TextViews have to be set before text */ /* input filter for TextViews have to be set before text */
if (collapsible && (expanded || TextUtils.isEmpty(spoilerText))) { if (collapsible && (expanded || TextUtils.isEmpty(spoilerText))) {
contentCollapseButton.setOnCheckedChangeListener((buttonView, isChecked) -> { contentCollapseButton.setOnClickListener(view -> {
int position = getAdapterPosition(); int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION) if (position != RecyclerView.NO_POSITION)
listener.onContentCollapsedChange(isChecked, position); listener.onContentCollapsedChange(!collapsed, position);
}); });
contentCollapseButton.setVisibility(View.VISIBLE); contentCollapseButton.setVisibility(View.VISIBLE);
if (collapsed) { if (collapsed) {
contentCollapseButton.setChecked(true); contentCollapseButton.setText(R.string.status_content_warning_show_more);
content.setFilters(COLLAPSE_INPUT_FILTER); content.setFilters(COLLAPSE_INPUT_FILTER);
} else { } else {
contentCollapseButton.setChecked(false); contentCollapseButton.setText(R.string.status_content_warning_show_less);
content.setFilters(NO_INPUT_FILTER); content.setFilters(NO_INPUT_FILTER);
} }
} else { } else {

View file

@ -93,12 +93,14 @@ class StatusViewHolder(
itemView.statusContentWarningDescription.text = emojiSpoiler itemView.statusContentWarningDescription.text = emojiSpoiler
itemView.statusContentWarningDescription.show() itemView.statusContentWarningDescription.show()
itemView.statusContentWarningButton.show() itemView.statusContentWarningButton.show()
itemView.statusContentWarningButton.isChecked = viewState.isContentShow(status.id, true) setContentWarningButtonText(viewState.isContentShow(status.id, true))
itemView.statusContentWarningButton.setOnCheckedChangeListener { _, isViewChecked -> itemView.statusContentWarningButton.setOnClickListener {
status()?.let { status -> status()?.let { status ->
val contentShown = viewState.isContentShow(status.id, true)
itemView.statusContentWarningDescription.invalidate() itemView.statusContentWarningDescription.invalidate()
viewState.setContentShow(status.id, isViewChecked) viewState.setContentShow(status.id, !contentShown)
setTextVisible(isViewChecked, status.content, status.mentions, status.emojis, adapterHandler) setTextVisible(!contentShown, status.content, status.mentions, status.emojis, adapterHandler)
setContentWarningButtonText(!contentShown)
} }
} }
setTextVisible(viewState.isContentShow(status.id, true), status.content, status.mentions, status.emojis, adapterHandler) setTextVisible(viewState.isContentShow(status.id, true), status.content, status.mentions, status.emojis, adapterHandler)
@ -106,6 +108,13 @@ class StatusViewHolder(
} }
} }
private fun setContentWarningButtonText(contentShown: Boolean) {
if(contentShown) {
itemView.statusContentWarningButton.setText(R.string.status_content_warning_show_less)
} else {
itemView.statusContentWarningButton.setText(R.string.status_content_warning_show_more)
}
}
private fun setTextVisible(expanded: Boolean, private fun setTextVisible(expanded: Boolean,
content: Spanned, content: Spanned,
@ -144,19 +153,19 @@ class StatusViewHolder(
private fun setupCollapsedState(collapsible: Boolean, collapsed: Boolean, expanded: Boolean, spoilerText: String) { private fun setupCollapsedState(collapsible: Boolean, collapsed: Boolean, expanded: Boolean, spoilerText: String) {
/* input filter for TextViews have to be set before text */ /* input filter for TextViews have to be set before text */
if (collapsible && (expanded || TextUtils.isEmpty(spoilerText))) { if (collapsible && (expanded || TextUtils.isEmpty(spoilerText))) {
itemView.buttonToggleContent.setOnCheckedChangeListener { _, isChecked -> itemView.buttonToggleContent.setOnClickListener{
status()?.let { status -> status()?.let { status ->
viewState.setCollapsed(status.id, isChecked) viewState.setCollapsed(status.id, !collapsed)
updateTextView() updateTextView()
} }
} }
itemView.buttonToggleContent.show() itemView.buttonToggleContent.show()
if (collapsed) { if (collapsed) {
itemView.buttonToggleContent.isChecked = true itemView.buttonToggleContent.setText(R.string.status_content_show_more)
itemView.statusContent.filters = COLLAPSE_INPUT_FILTER itemView.statusContent.filters = COLLAPSE_INPUT_FILTER
} else { } else {
itemView.buttonToggleContent.isChecked = false itemView.buttonToggleContent.setText(R.string.status_content_show_less)
itemView.statusContent.filters = NO_INPUT_FILTER itemView.statusContent.filters = NO_INPUT_FILTER
} }
} else { } else {

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/color_background_dark" />
<corners android:radius="4dp" />
</shape>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#dedede" />
<corners android:radius="4dp" />
</shape>

View file

@ -136,13 +136,13 @@
tools:text="content warning which is very long and it doesn't fit" tools:text="content warning which is very long and it doesn't fit"
tools:visibility="visible" /> tools:visibility="visible" />
<ToggleButton <Button
android:id="@+id/status_content_warning_button" android:id="@+id/status_content_warning_button"
style="@style/TuskyButton.Outlined"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:background="?attr/content_warning_button"
android:minWidth="150dp" android:minWidth="150dp"
android:minHeight="0dp" android:minHeight="0dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
@ -150,12 +150,11 @@
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:textAllCaps="true" android:textAllCaps="true"
android:textOff="@string/status_content_warning_show_more"
android:textOn="@string/status_content_warning_show_less"
android:textSize="?attr/status_text_medium" android:textSize="?attr/status_text_medium"
android:visibility="gone" android:visibility="gone"
app:layout_constraintStart_toStartOf="@id/status_display_name" app:layout_constraintStart_toStartOf="@id/status_display_name"
app:layout_constraintTop_toBottomOf="@id/status_content_warning_description" app:layout_constraintTop_toBottomOf="@id/status_content_warning_description"
tools:text="@string/status_content_warning_show_more"
tools:visibility="visible" /> tools:visibility="visible" />
<androidx.emoji.widget.EmojiTextView <androidx.emoji.widget.EmojiTextView
@ -172,13 +171,13 @@
app:layout_constraintTop_toBottomOf="@id/status_content_warning_button" app:layout_constraintTop_toBottomOf="@id/status_content_warning_button"
tools:text="This is a status" /> tools:text="This is a status" />
<ToggleButton <Button
android:id="@+id/button_toggle_content" android:id="@+id/button_toggle_content"
style="@style/TuskyButton.Outlined"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:background="?attr/content_warning_button"
android:minWidth="150dp" android:minWidth="150dp"
android:minHeight="0dp" android:minHeight="0dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
@ -186,12 +185,11 @@
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:textAllCaps="true" android:textAllCaps="true"
android:textOff="@string/status_content_show_less"
android:textOn="@string/status_content_show_more"
android:textSize="?attr/status_text_medium" android:textSize="?attr/status_text_medium"
android:visibility="gone" android:visibility="gone"
app:layout_constraintStart_toStartOf="@id/status_display_name" app:layout_constraintStart_toStartOf="@id/status_display_name"
app:layout_constraintTop_toBottomOf="@id/status_content" app:layout_constraintTop_toBottomOf="@id/status_content"
tools:text="@string/status_content_show_less"
tools:visibility="visible" /> tools:visibility="visible" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
@ -225,7 +223,6 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<com.keylesspalace.tusky.view.MediaPreviewImageView <com.keylesspalace.tusky.view.MediaPreviewImageView
android:id="@+id/status_media_preview_2" android:id="@+id/status_media_preview_2"
android:layout_width="0dp" android:layout_width="0dp"
@ -384,7 +381,6 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/status_media_label_2" /> app:layout_constraintTop_toBottomOf="@id/status_media_label_2" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
@ -398,13 +394,12 @@
app:layout_constraintStart_toStartOf="@id/status_display_name" app:layout_constraintStart_toStartOf="@id/status_display_name"
app:layout_constraintTop_toBottomOf="@id/status_media_preview_container" /> app:layout_constraintTop_toBottomOf="@id/status_media_preview_container" />
<!-- using AppCompatButton because we don't want the inflater to turn it into a MaterialButton --> <Button
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/status_poll_button" android:id="@+id/status_poll_button"
style="@style/TuskyButton.Outlined"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:background="?attr/content_warning_button"
android:gravity="center" android:gravity="center"
android:minWidth="150dp" android:minWidth="150dp"
android:minHeight="0dp" android:minHeight="0dp"

View file

@ -28,13 +28,13 @@
tools:text="content warning which is very long and it doesn't fit" tools:text="content warning which is very long and it doesn't fit"
tools:visibility="visible" /> tools:visibility="visible" />
<ToggleButton <Button
android:id="@+id/statusContentWarningButton" android:id="@+id/statusContentWarningButton"
style="@style/TuskyButton.Outlined"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:background="?attr/content_warning_button"
android:minWidth="150dp" android:minWidth="150dp"
android:minHeight="0dp" android:minHeight="0dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
@ -42,12 +42,11 @@
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:textAllCaps="true" android:textAllCaps="true"
android:textOff="@string/status_content_warning_show_more"
android:textOn="@string/status_content_warning_show_less"
android:textSize="?attr/status_text_medium" android:textSize="?attr/status_text_medium"
android:visibility="gone" android:visibility="gone"
app:layout_constraintStart_toStartOf="@id/guideBegin" app:layout_constraintStart_toStartOf="@id/guideBegin"
app:layout_constraintTop_toBottomOf="@id/statusContentWarningDescription" app:layout_constraintTop_toBottomOf="@id/statusContentWarningDescription"
tools:text="@string/status_content_warning_show_more"
tools:visibility="visible" /> tools:visibility="visible" />
<androidx.emoji.widget.EmojiTextView <androidx.emoji.widget.EmojiTextView
@ -62,13 +61,13 @@
app:layout_constraintStart_toStartOf="@id/guideBegin" app:layout_constraintStart_toStartOf="@id/guideBegin"
app:layout_constraintTop_toBottomOf="@id/statusContentWarningButton" /> app:layout_constraintTop_toBottomOf="@id/statusContentWarningButton" />
<ToggleButton <Button
android:id="@+id/buttonToggleContent" android:id="@+id/buttonToggleContent"
style="@style/TuskyButton.Outlined"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:background="?attr/content_warning_button"
android:minWidth="150dp" android:minWidth="150dp"
android:minHeight="0dp" android:minHeight="0dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
@ -76,12 +75,11 @@
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:textAllCaps="true" android:textAllCaps="true"
android:textOff="@string/status_content_show_less"
android:textOn="@string/status_content_show_more"
android:textSize="?attr/status_text_medium" android:textSize="?attr/status_text_medium"
android:visibility="gone" android:visibility="gone"
app:layout_constraintStart_toStartOf="@id/guideBegin" app:layout_constraintStart_toStartOf="@id/guideBegin"
app:layout_constraintTop_toBottomOf="@id/statusContent" app:layout_constraintTop_toBottomOf="@id/statusContent"
tools:text="@string/status_content_show_less"
tools:visibility="visible" /> tools:visibility="visible" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout

View file

@ -117,13 +117,13 @@
tools:text="content warning which is very long and it doesn't fit" tools:text="content warning which is very long and it doesn't fit"
tools:visibility="visible" /> tools:visibility="visible" />
<ToggleButton <Button
android:id="@+id/status_content_warning_button" android:id="@+id/status_content_warning_button"
style="@style/TuskyButton.Outlined"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:background="?attr/content_warning_button"
android:importantForAccessibility="no" android:importantForAccessibility="no"
android:minWidth="150dp" android:minWidth="150dp"
android:minHeight="0dp" android:minHeight="0dp"
@ -138,6 +138,7 @@
android:visibility="gone" android:visibility="gone"
app:layout_constraintStart_toStartOf="@id/status_display_name" app:layout_constraintStart_toStartOf="@id/status_display_name"
app:layout_constraintTop_toBottomOf="@id/status_content_warning_description" app:layout_constraintTop_toBottomOf="@id/status_content_warning_description"
tools:text="@string/status_content_warning_show_more"
tools:visibility="visible" /> tools:visibility="visible" />
<androidx.emoji.widget.EmojiTextView <androidx.emoji.widget.EmojiTextView
@ -156,13 +157,13 @@
app:layout_constraintTop_toBottomOf="@id/status_content_warning_button" app:layout_constraintTop_toBottomOf="@id/status_content_warning_button"
tools:text="This is a status" /> tools:text="This is a status" />
<ToggleButton <Button
android:id="@+id/button_toggle_content" android:id="@+id/button_toggle_content"
style="@style/TuskyButton.Outlined"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:background="?attr/content_warning_button"
android:importantForAccessibility="no" android:importantForAccessibility="no"
android:minWidth="150dp" android:minWidth="150dp"
android:minHeight="0dp" android:minHeight="0dp"
@ -171,12 +172,11 @@
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:textAllCaps="true" android:textAllCaps="true"
android:textOff="@string/status_content_show_less"
android:textOn="@string/status_content_show_more"
android:textSize="?attr/status_text_medium" android:textSize="?attr/status_text_medium"
android:visibility="gone" android:visibility="gone"
app:layout_constraintStart_toStartOf="@id/status_display_name" app:layout_constraintStart_toStartOf="@id/status_display_name"
app:layout_constraintTop_toBottomOf="@id/status_content" app:layout_constraintTop_toBottomOf="@id/status_content"
tools:text="@string/status_content_show_less"
tools:visibility="visible" /> tools:visibility="visible" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
@ -386,13 +386,12 @@
app:layout_constraintStart_toStartOf="@id/status_display_name" app:layout_constraintStart_toStartOf="@id/status_display_name"
app:layout_constraintTop_toBottomOf="@id/status_media_preview_container" /> app:layout_constraintTop_toBottomOf="@id/status_media_preview_container" />
<!-- using AppCompatButton because we don't want the inflater to turn it into a MaterialButton --> <Button
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/status_poll_button" android:id="@+id/status_poll_button"
style="@style/TuskyButton.Outlined"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:background="?attr/content_warning_button"
android:gravity="center" android:gravity="center"
android:minWidth="150dp" android:minWidth="150dp"
android:minHeight="0dp" android:minHeight="0dp"

View file

@ -93,13 +93,13 @@
app:layout_constraintTop_toBottomOf="@id/status_avatar" app:layout_constraintTop_toBottomOf="@id/status_avatar"
tools:text="CW this is a long long long long long long long long content warning" /> tools:text="CW this is a long long long long long long long long content warning" />
<ToggleButton <com.google.android.material.button.MaterialButton
android:id="@+id/status_content_warning_button" android:id="@+id/status_content_warning_button"
style="@style/TuskyButton.Outlined"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:background="?attr/content_warning_button"
android:importantForAccessibility="no" android:importantForAccessibility="no"
android:minWidth="160dp" android:minWidth="160dp"
android:minHeight="0dp" android:minHeight="0dp"
@ -108,11 +108,10 @@
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:textAllCaps="true" android:textAllCaps="true"
android:textOff="@string/status_content_warning_show_more"
android:textOn="@string/status_content_warning_show_less"
android:textSize="?attr/status_text_large" android:textSize="?attr/status_text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/status_content_warning_description" /> app:layout_constraintTop_toBottomOf="@+id/status_content_warning_description"
tools:text="@string/status_content_warning_show_more" />
<androidx.emoji.widget.EmojiTextView <androidx.emoji.widget.EmojiTextView
android:id="@+id/status_content" android:id="@+id/status_content"
@ -387,7 +386,6 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/status_media_label_2" /> app:layout_constraintTop_toBottomOf="@id/status_media_label_2" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
@ -401,13 +399,12 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/status_media_preview_container" /> app:layout_constraintTop_toBottomOf="@id/status_media_preview_container" />
<!-- using AppCompatButton because we don't want the inflater to turn it into a MaterialButton --> <Button
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/status_poll_button" android:id="@+id/status_poll_button"
style="@style/TuskyButton.Outlined"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:background="?attr/content_warning_button"
android:gravity="center" android:gravity="center"
android:minWidth="150dp" android:minWidth="150dp"
android:minHeight="0dp" android:minHeight="0dp"

View file

@ -83,7 +83,7 @@
android:textSize="?attr/status_text_medium" android:textSize="?attr/status_text_medium"
tools:text="Example CW text" /> tools:text="Example CW text" />
<ToggleButton <Button
android:id="@+id/notification_content_warning_button" android:id="@+id/notification_content_warning_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -91,7 +91,6 @@
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:layout_toEndOf="@id/notification_status_avatar" android:layout_toEndOf="@id/notification_status_avatar"
android:background="?attr/content_warning_button"
android:minWidth="150dp" android:minWidth="150dp"
android:minHeight="0dp" android:minHeight="0dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
@ -99,8 +98,8 @@
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:textAllCaps="true" android:textAllCaps="true"
android:textOff="@string/status_content_warning_show_more" tools:text="@string/status_content_warning_show_more"
android:textOn="@string/status_content_warning_show_less" style="@style/TuskyButton.Outlined"
android:textSize="?attr/status_text_medium" /> android:textSize="?attr/status_text_medium" />
<androidx.emoji.widget.EmojiTextView <androidx.emoji.widget.EmojiTextView
@ -116,8 +115,7 @@
android:textSize="?attr/status_text_medium" android:textSize="?attr/status_text_medium"
tools:text="Example status here" /> tools:text="Example status here" />
<Button
<ToggleButton
android:id="@+id/button_toggle_notification_content" android:id="@+id/button_toggle_notification_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -125,7 +123,6 @@
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:layout_toEndOf="@id/notification_status_avatar" android:layout_toEndOf="@id/notification_status_avatar"
android:background="?attr/content_warning_button"
android:minWidth="150dp" android:minWidth="150dp"
android:minHeight="0dp" android:minHeight="0dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
@ -133,8 +130,8 @@
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:textAllCaps="true" android:textAllCaps="true"
android:textOff="@string/status_content_show_less" tools:text="@string/status_content_show_less"
android:textOn="@string/status_content_show_more" style="@style/TuskyButton.Outlined"
android:textSize="?attr/status_text_medium" android:textSize="?attr/status_text_medium"
android:visibility="gone" /> android:visibility="gone" />

View file

@ -35,7 +35,6 @@
<item name="status_reblog_direct_drawable">@drawable/reblog_direct_dark</item> <item name="status_reblog_direct_drawable">@drawable/reblog_direct_dark</item>
<item name="status_favourite_active_drawable">@drawable/favourite_active_dark</item> <item name="status_favourite_active_drawable">@drawable/favourite_active_dark</item>
<item name="status_favourite_inactive_drawable">@drawable/favourite_inactive_dark</item> <item name="status_favourite_inactive_drawable">@drawable/favourite_inactive_dark</item>
<item name="content_warning_button">@drawable/toggle_small</item>
<item name="sensitive_media_warning_background_color">#80000000</item> <item name="sensitive_media_warning_background_color">#80000000</item>
<item name="media_preview_unloaded_drawable">@drawable/media_preview_unloaded_dark</item> <item name="media_preview_unloaded_drawable">@drawable/media_preview_unloaded_dark</item>
<item name="android:listDivider">@drawable/status_divider_dark</item> <item name="android:listDivider">@drawable/status_divider_dark</item>

View file

@ -20,7 +20,6 @@
<attr name="status_reblog_direct_drawable" format="reference" /> <attr name="status_reblog_direct_drawable" format="reference" />
<attr name="status_favourite_active_drawable" format="reference" /> <attr name="status_favourite_active_drawable" format="reference" />
<attr name="status_favourite_inactive_drawable" format="reference" /> <attr name="status_favourite_inactive_drawable" format="reference" />
<attr name="content_warning_button" format="reference" />
<attr name="sensitive_media_warning_background_color" format="reference|color" /> <attr name="sensitive_media_warning_background_color" format="reference|color" />
<attr name="media_preview_unloaded_drawable" format="reference" /> <attr name="media_preview_unloaded_drawable" format="reference" />
<attr name="conversation_thread_line_drawable" format="reference" /> <attr name="conversation_thread_line_drawable" format="reference" />

View file

@ -87,7 +87,6 @@
<item name="status_reblog_direct_drawable">@drawable/reblog_direct_light</item> <item name="status_reblog_direct_drawable">@drawable/reblog_direct_light</item>
<item name="status_favourite_active_drawable">@drawable/favourite_active_light</item> <item name="status_favourite_active_drawable">@drawable/favourite_active_light</item>
<item name="status_favourite_inactive_drawable">@drawable/favourite_inactive_light</item> <item name="status_favourite_inactive_drawable">@drawable/favourite_inactive_light</item>
<item name="content_warning_button">@drawable/toggle_small_light</item>
<item name="sensitive_media_warning_background_color">#80B0B0B0</item> <item name="sensitive_media_warning_background_color">#80B0B0B0</item>
<item name="media_preview_unloaded_drawable">@drawable/media_preview_unloaded_light</item> <item name="media_preview_unloaded_drawable">@drawable/media_preview_unloaded_light</item>
<item name="android:listDivider">@drawable/status_divider_light</item> <item name="android:listDivider">@drawable/status_divider_light</item>