mirror of
https://github.com/accelforce/Yuito
synced 2025-02-08 23:58:46 +01:00
Merge remote-tracking branch 'tuskyapp/develop'
This commit is contained in:
commit
41f4219b6e
@ -70,6 +70,9 @@ android {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
androidExtensions {
|
||||
experimental = true
|
||||
}
|
||||
testOptions {
|
||||
unitTests {
|
||||
returnDefaultValues = true
|
||||
|
@ -77,6 +77,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView sensitiveMediaWarning;
|
||||
private View sensitiveMediaShow;
|
||||
protected TextView[] mediaLabels;
|
||||
protected CharSequence[] mediaDescriptions;
|
||||
private MaterialButton contentWarningButton;
|
||||
private ImageView avatarInset;
|
||||
|
||||
@ -140,6 +141,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
itemView.findViewById(R.id.status_media_label_2),
|
||||
itemView.findViewById(R.id.status_media_label_3)
|
||||
};
|
||||
mediaDescriptions = new CharSequence[mediaLabels.length];
|
||||
contentWarningDescription = itemView.findViewById(R.id.status_content_warning_description);
|
||||
contentWarningButton = itemView.findViewById(R.id.status_content_warning_button);
|
||||
avatarInset = itemView.findViewById(R.id.status_avatar_inset);
|
||||
@ -191,11 +193,8 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
@NonNull StatusDisplayOptions statusDisplayOptions,
|
||||
final StatusActionListener listener,
|
||||
boolean removeQuote) {
|
||||
if (TextUtils.isEmpty(spoilerText)) {
|
||||
contentWarningDescription.setVisibility(View.GONE);
|
||||
contentWarningButton.setVisibility(View.GONE);
|
||||
this.setTextVisible(true, content, mentions, emojis, poll, statusDisplayOptions, listener, removeQuote);
|
||||
} else {
|
||||
boolean sensitive = !TextUtils.isEmpty(spoilerText);
|
||||
if (sensitive) {
|
||||
CharSequence emojiSpoiler = CustomEmojiHelper.emojifyString(spoilerText, emojis, contentWarningDescription);
|
||||
contentWarningDescription.setText(emojiSpoiler);
|
||||
contentWarningDescription.setVisibility(View.VISIBLE);
|
||||
@ -208,9 +207,13 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
}
|
||||
setContentWarningButtonText(!expanded);
|
||||
|
||||
this.setTextVisible(!expanded, content, mentions, emojis, poll, statusDisplayOptions, listener, removeQuote);
|
||||
this.setTextVisible(sensitive, !expanded, content, mentions, emojis, poll, statusDisplayOptions, listener, removeQuote);
|
||||
});
|
||||
this.setTextVisible(expanded, content, mentions, emojis, poll, statusDisplayOptions, listener, removeQuote);
|
||||
this.setTextVisible(sensitive, expanded, content, mentions, emojis, poll, statusDisplayOptions, listener, removeQuote);
|
||||
} else {
|
||||
contentWarningDescription.setVisibility(View.GONE);
|
||||
contentWarningButton.setVisibility(View.GONE);
|
||||
this.setTextVisible(sensitive, true, content, mentions, emojis, poll, statusDisplayOptions, listener, removeQuote);
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,7 +225,8 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
}
|
||||
}
|
||||
|
||||
private void setTextVisible(boolean expanded,
|
||||
private void setTextVisible(boolean sensitive,
|
||||
boolean expanded,
|
||||
Spanned content,
|
||||
Status.Mention[] mentions,
|
||||
List<Emoji> emojis,
|
||||
@ -233,6 +237,9 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
if (expanded) {
|
||||
Spanned emojifiedText = CustomEmojiHelper.emojifyText(content, emojis, this.content);
|
||||
LinkHelper.setClickableText(this.content, emojifiedText, mentions, listener, removeQuote);
|
||||
for (int i = 0; i < mediaLabels.length; ++i) {
|
||||
updateMediaLabel(i, sensitive, expanded);
|
||||
}
|
||||
if (poll != null) {
|
||||
setupPoll(poll, emojis, statusDisplayOptions, listener);
|
||||
} else {
|
||||
@ -601,6 +608,14 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateMediaLabel(int index, boolean sensitive, boolean showingContent) {
|
||||
Context context = itemView.getContext();
|
||||
CharSequence label = (sensitive && !showingContent) ?
|
||||
context.getString(R.string.status_sensitive_media_title) :
|
||||
mediaDescriptions[index];
|
||||
mediaLabels[index].setText(label);
|
||||
}
|
||||
|
||||
protected void setMediaLabel(List<Attachment> attachments, boolean sensitive,
|
||||
final StatusActionListener listener, boolean showingContent) {
|
||||
Context context = itemView.getContext();
|
||||
@ -609,12 +624,8 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
if (i < attachments.size()) {
|
||||
Attachment attachment = attachments.get(i);
|
||||
mediaLabel.setVisibility(View.VISIBLE);
|
||||
|
||||
if (sensitive && !showingContent) {
|
||||
mediaLabel.setText(R.string.status_sensitive_media_title);
|
||||
} else {
|
||||
mediaLabel.setText(getAttachmentDescription(context, attachment));
|
||||
}
|
||||
mediaDescriptions[i] = getAttachmentDescription(context, attachment);
|
||||
updateMediaLabel(i, sensitive, showingContent);
|
||||
|
||||
// Set the icon next to the label.
|
||||
int drawableId = getLabelIcon(attachments.get(0).getType());
|
||||
|
@ -74,6 +74,7 @@ class ConversationsViewModel @Inject constructor(
|
||||
}
|
||||
.subscribeOn(Schedulers.io())
|
||||
.doOnError { t -> Log.w("ConversationViewModel", "Failed to bookmark conversation", t) }
|
||||
.onErrorReturnItem(0)
|
||||
.subscribe()
|
||||
.autoDispose()
|
||||
}
|
||||
@ -127,7 +128,7 @@ class ConversationsViewModel @Inject constructor(
|
||||
}
|
||||
|
||||
fun remove(position: Int) {
|
||||
conversations.value?.getOrNull(position)?.let { conversation ->
|
||||
conversations.value?.getOrNull(position)?.let {
|
||||
refresh()
|
||||
}
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ public final class ViewThreadFragment extends SFragment implements
|
||||
.setIsExpanded(expanded)
|
||||
.createStatusViewData();
|
||||
statuses.setPairedItem(position, newViewData);
|
||||
adapter.setItem(position, newViewData, false);
|
||||
adapter.setItem(position, newViewData, true);
|
||||
updateRevealIcon();
|
||||
}
|
||||
|
||||
|
@ -2,5 +2,5 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<size android:height="1dp" />
|
||||
<solid android:color="?attr/colorBackgroundAccent" />
|
||||
<solid android:color="?attr/dividerColor" />
|
||||
</shape>
|
@ -3,8 +3,8 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:background="?attr/windowBackgroundColor"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/windowBackgroundColor">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="640dp"
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/pager"
|
||||
android:background="?android:windowBackground"
|
||||
android:background="?attr/windowBackgroundColor"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/tab_layout"
|
||||
|
@ -3,7 +3,8 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/colorBackground">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBarOptions"
|
||||
|
@ -15,6 +15,7 @@
|
||||
<color name="iconColor">@color/tusky_grey_70</color>
|
||||
|
||||
<color name="colorBackgroundAccent">@color/tusky_grey_30</color>
|
||||
<color name="dividerColor">@color/tusky_grey_25</color>
|
||||
|
||||
<color name="favoriteButtonActiveColor">@color/tusky_orange</color>
|
||||
|
||||
|
@ -7,20 +7,20 @@
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowLightNavigationBar">false</item>
|
||||
<item name="android:navigationBarColor">@color/tusky_grey_20</item>
|
||||
<item name="android:navigationBarDividerColor">@color/tusky_grey_30</item>
|
||||
<item name="android:navigationBarDividerColor">@color/tusky_grey_25</item>
|
||||
</style>
|
||||
|
||||
<style name="TuskyTheme" parent="TuskyBaseTheme">
|
||||
<item name="android:windowLightNavigationBar">@bool/lightNavigationBar</item>
|
||||
<item name="android:navigationBarColor">@color/colorBackground</item>
|
||||
<item name="android:navigationBarDividerColor">@color/colorBackgroundAccent</item>
|
||||
<item name="android:navigationBarDividerColor">?attr/dividerColor</item>
|
||||
</style>
|
||||
|
||||
<!--Black Application Theme Styles-->
|
||||
<style name="TuskyBlackTheme" parent="TuskyBlackThemeBase">
|
||||
<item name="android:windowLightNavigationBar">false</item>
|
||||
<item name="android:navigationBarColor">@color/black</item>
|
||||
<item name="android:navigationBarDividerColor">@color/tusky_grey_05</item>
|
||||
<item name="android:navigationBarDividerColor">?attr/dividerColor</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
@ -13,6 +13,7 @@
|
||||
<attr name="textColorDisabled" format="reference|color" />
|
||||
<attr name="iconColor" format="reference|color" />
|
||||
<attr name="windowBackgroundColor" format="reference|color" />
|
||||
<attr name="dividerColor" format="reference|color" />
|
||||
|
||||
<attr name="status_text_small" format="dimension" />
|
||||
<attr name="status_text_medium" format="dimension" />
|
||||
|
@ -9,7 +9,7 @@
|
||||
<dimen name="compose_media_preview_size">120dp</dimen>
|
||||
<dimen name="compose_options_margin">8dp</dimen>
|
||||
<dimen name="account_avatar_margin">14dp</dimen>
|
||||
<dimen name="tab_page_margin">8dp</dimen>
|
||||
<dimen name="tab_page_margin">16dp</dimen>
|
||||
<dimen name="status_line_margin_start">36dp</dimen>
|
||||
<dimen name="text_content_margin">16dp</dimen>
|
||||
<dimen name="status_sensitive_media_button_padding">5dp</dimen>
|
||||
|
@ -63,6 +63,7 @@
|
||||
<item name="iconColor">@color/iconColor</item>
|
||||
|
||||
<item name="android:listDivider">@drawable/status_divider</item>
|
||||
<item name="dividerColor">@color/dividerColor</item>
|
||||
|
||||
<item name="textColorDisabled">@color/textColorDisabled</item>
|
||||
|
||||
@ -71,7 +72,7 @@
|
||||
<item name="material_drawer_primary_icon">@color/iconColor</item>
|
||||
<item name="material_drawer_secondary_text">@color/textColorTertiary</item>
|
||||
<item name="material_drawer_hint_text">@color/textColorTertiary</item>
|
||||
<item name="material_drawer_divider">@color/colorBackgroundAccent</item>
|
||||
<item name="material_drawer_divider">?attr/dividerColor</item>
|
||||
<item name="material_drawer_header_selection_text">@color/white</item>
|
||||
<item name="material_drawer_header_selection_subtext">@color/white</item>
|
||||
|
||||
@ -115,6 +116,7 @@
|
||||
</style>
|
||||
|
||||
<style name="TuskyButton.Outlined" parent="Widget.MaterialComponents.Button.OutlinedButton">
|
||||
<item name="strokeColor">?attr/colorBackgroundAccent</item>
|
||||
<item name="android:letterSpacing">0</item>
|
||||
</style>
|
||||
|
||||
@ -137,11 +139,12 @@
|
||||
<item name="colorSurface">@color/tusky_grey_10</item>
|
||||
|
||||
<item name="iconColor">@color/tusky_grey_40</item>
|
||||
<item name="colorBackgroundAccent">@color/tusky_grey_05</item>
|
||||
<item name="colorBackgroundAccent">@color/tusky_grey_20</item>
|
||||
|
||||
<item name="dividerColor">@color/tusky_grey_10</item>
|
||||
|
||||
<item name="material_drawer_background">@color/black</item>
|
||||
<item name="material_drawer_primary_icon">@color/tusky_grey_40</item>
|
||||
<item name="material_drawer_divider">@color/tusky_grey_05</item>
|
||||
</style>
|
||||
|
||||
<style name="TuskyBlackTheme" parent="TuskyBlackThemeBase" />
|
||||
|
@ -14,7 +14,8 @@
|
||||
|
||||
<color name="iconColor">@color/tusky_grey_50</color>
|
||||
|
||||
<color name="colorBackgroundAccent">@color/tusky_grey_80</color>
|
||||
<color name="colorBackgroundAccent">@color/tusky_grey_70</color>
|
||||
<color name="dividerColor">@color/tusky_grey_80</color>
|
||||
|
||||
<color name="favoriteButtonActiveColor">@color/tusky_orange_light</color>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user