Tusky-App-Android/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java

560 lines
24 KiB
Java
Raw Normal View History

package com.keylesspalace.tusky.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.content.res.AppCompatResources;
import android.support.v7.widget.RecyclerView;
Add support for collapsible statuses when they exceed 500 characters (#825) * Update Gradle plugin to work with Android Studio 3.3 Canary Android Studio 3.1.4 Stable doesn't render layout previews in this project for whatever reason. Switching to the latest 3.3 Canary release fixes the issue without affecting Gradle scripts but requires the new Android Gradle plugin to match the new Android Studio release. This commit will be reverted once development on the feature is done. * Update gradle build script to allow installing debug builds alongside store version This will allow developers, testers, etc to work on Tusky will not having to worry about overwriting, uninstalling, fiddling with a preinstalled application which would mean having to login again every time the development cycle starts/finishes and manually reinstalling the app. * Add UI changes to support collapsing statuses The button uses subtle styling to not be distracting like the CW button on the timeline The button is toggleable, full width to match the status textbox hitbox width and also is shorter to not be too intrusive between the status text and images, or the post below * Update status data model to store whether the message has been collapsed * Update status action listener to notify of collapsed state changing Provide stubs in all implementing classes and mark as TODO the stubs that require a proper implementation for the feature to work. * Add implementation code to handle status collapse/expand in timeline Code has not been added elsewhere to simplify testing. Once the code will be considered stable it will be also included in other status action listener implementers. * Add preferences so that users can toggle the collapsing of long posts This is currently limited to a simple toggle, it would be nice to implement a more advanced UI to offer the user more control over the feature. * Update Gradle plugin to work with latest Android Studio 3.3 Canary 8 Just like the other commit, this will be reverted once the feature is working. I simply don't want to deal with what changes in my installation of Android Studio 3.1.4 Stable which breaks the layout preview rendering. * Update data models and utils for statuses to better handle collapsing I forgot that data isn't available from the API and can't really be built from scratch using existing data due to preferences. A new, extra boolean should fix the issue. * Fix search breaking due to newly introduced variables in utils classes * Fix timeline breaking due to newly introduced variables in utils classes * Fix item status text for collapsed toggle being shown in the wrong state * Update timeline fragment to refresh the list when collapsed settings change * Add support for status content collapse in timeline viewholder * Fix view holder truncating posts using temporary debug settings at 50 chars * Add toggle support to notification layout as well * Add support for collapsed statuses to search results * Add support for expandable content to notifications too * Update codebase with some suggested changes by @charlang * Update more code with more suggestions and move null-safety into view data * Update even more code with even more suggested code changes * Revert a0a41ca and 0ee004d (Android Studio 3.1 to Android Studio 3.3 updates) * Add an input filter utility class to reuse code for trimming statuses * Update UI of statuses to show a taller collapsible button * Update notification fragment logging to simplify null checks * Add smartness to SmartLengthInputFilter such as word trimming and runway * Fix posts with show more button even if bad ratio didn't collapse * Fix thread view showing button but not collapsing by implementing the feature * Fix spannable losing spans when collapsed and restore length to 500 characters * Remove debug build suffix as per request * Fix all the merging happened in f66d689, 623cad2 and 7056ba5 * Fix notification button spanning full width rather than content width * Add a way to access a singleton to smart filter and use clearer code * Update view holders using smart input filters to use more singletons * Fix code style lacking spaces before boolean checks in ifs and others * Remove all code related to collapsibility preferences, strings included * Update style to match content warning toggle button * Update strings to give cleaner differentiation between CW and collapse * Update smart filter code to use fully qualified names to avoid confusion
2018-09-19 19:51:20 +02:00
import android.text.InputFilter;
import android.text.Spanned;
2017-11-30 20:12:09 +01:00
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.ToggleButton;
import com.keylesspalace.tusky.R;
2017-11-30 20:12:09 +01:00
import com.keylesspalace.tusky.entity.Attachment;
ComposeActivity improvements (#548) * do not add media urls to status text * add scrolling to content * add arrow icon and animation to replying-to toggle * remove unnecessary compose_button_colors.xml * improve toot button * improve bottom bar, add bottom sheet for compose options, dedicated cw button * fix crash on Android < API 21 * move media picking from dialog to bottom sheet * add small style tootbutton * fix colors/button background for light theme * add icons to media chose bottom sheet * improve hide media button, delete unused styles * fix crash on dev build when taking photo * consolidate drawables * consolidate strings and ids, add tooltips to buttons * allow media only toots * change error message to show max size of upload correctly * fix button color * add emoji * code cleanup * Merge branch 'master' into compose_activity_refactoring # Conflicts: # app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java * fix hidden snackbar * improve hint text color * add SendTootService * fix timeline refreshing * toot saving and error handling for sendtootservice * restructure some code * convert EditTextTyped to Kotlin * fixed pick media button disabled color * force sensitive media when content warning is shown * add db cache for emojis & fix tests * reorder buttons to match mastodon web * add possibility to cancel sending of toot * correctly delete sent toots * refresh SavedTootActivity after toot was sent * remove unused resources * correct params for toot saving in SendTootService * consolidate strings * bugfix * remove unused resources * fix notifications on old android for SendTootService * fix crash
2018-04-13 22:37:21 +02:00
import com.keylesspalace.tusky.entity.Emoji;
import com.keylesspalace.tusky.entity.Status;
import com.keylesspalace.tusky.interfaces.StatusActionListener;
2017-11-30 20:12:09 +01:00
import com.keylesspalace.tusky.util.CustomEmojiHelper;
import com.keylesspalace.tusky.util.DateUtils;
2017-11-30 20:12:09 +01:00
import com.keylesspalace.tusky.util.HtmlUtils;
import com.keylesspalace.tusky.util.LinkHelper;
Add support for collapsible statuses when they exceed 500 characters (#825) * Update Gradle plugin to work with Android Studio 3.3 Canary Android Studio 3.1.4 Stable doesn't render layout previews in this project for whatever reason. Switching to the latest 3.3 Canary release fixes the issue without affecting Gradle scripts but requires the new Android Gradle plugin to match the new Android Studio release. This commit will be reverted once development on the feature is done. * Update gradle build script to allow installing debug builds alongside store version This will allow developers, testers, etc to work on Tusky will not having to worry about overwriting, uninstalling, fiddling with a preinstalled application which would mean having to login again every time the development cycle starts/finishes and manually reinstalling the app. * Add UI changes to support collapsing statuses The button uses subtle styling to not be distracting like the CW button on the timeline The button is toggleable, full width to match the status textbox hitbox width and also is shorter to not be too intrusive between the status text and images, or the post below * Update status data model to store whether the message has been collapsed * Update status action listener to notify of collapsed state changing Provide stubs in all implementing classes and mark as TODO the stubs that require a proper implementation for the feature to work. * Add implementation code to handle status collapse/expand in timeline Code has not been added elsewhere to simplify testing. Once the code will be considered stable it will be also included in other status action listener implementers. * Add preferences so that users can toggle the collapsing of long posts This is currently limited to a simple toggle, it would be nice to implement a more advanced UI to offer the user more control over the feature. * Update Gradle plugin to work with latest Android Studio 3.3 Canary 8 Just like the other commit, this will be reverted once the feature is working. I simply don't want to deal with what changes in my installation of Android Studio 3.1.4 Stable which breaks the layout preview rendering. * Update data models and utils for statuses to better handle collapsing I forgot that data isn't available from the API and can't really be built from scratch using existing data due to preferences. A new, extra boolean should fix the issue. * Fix search breaking due to newly introduced variables in utils classes * Fix timeline breaking due to newly introduced variables in utils classes * Fix item status text for collapsed toggle being shown in the wrong state * Update timeline fragment to refresh the list when collapsed settings change * Add support for status content collapse in timeline viewholder * Fix view holder truncating posts using temporary debug settings at 50 chars * Add toggle support to notification layout as well * Add support for collapsed statuses to search results * Add support for expandable content to notifications too * Update codebase with some suggested changes by @charlang * Update more code with more suggestions and move null-safety into view data * Update even more code with even more suggested code changes * Revert a0a41ca and 0ee004d (Android Studio 3.1 to Android Studio 3.3 updates) * Add an input filter utility class to reuse code for trimming statuses * Update UI of statuses to show a taller collapsible button * Update notification fragment logging to simplify null checks * Add smartness to SmartLengthInputFilter such as word trimming and runway * Fix posts with show more button even if bad ratio didn't collapse * Fix thread view showing button but not collapsing by implementing the feature * Fix spannable losing spans when collapsed and restore length to 500 characters * Remove debug build suffix as per request * Fix all the merging happened in f66d689, 623cad2 and 7056ba5 * Fix notification button spanning full width rather than content width * Add a way to access a singleton to smart filter and use clearer code * Update view holders using smart input filters to use more singletons * Fix code style lacking spaces before boolean checks in ifs and others * Remove all code related to collapsibility preferences, strings included * Update style to match content warning toggle button * Update strings to give cleaner differentiation between CW and collapse * Update smart filter code to use fully qualified names to avoid confusion
2018-09-19 19:51:20 +02:00
import com.keylesspalace.tusky.util.SmartLengthInputFilter;
import com.keylesspalace.tusky.util.ThemeUtils;
import com.keylesspalace.tusky.viewdata.StatusViewData;
import com.mikepenz.iconics.utils.Utils;
import com.squareup.picasso.Picasso;
2018-08-16 15:51:23 +02:00
import java.text.SimpleDateFormat;
import java.util.Date;
2017-10-19 15:25:04 +02:00
import java.util.List;
2018-08-16 15:51:23 +02:00
import java.util.Locale;
import at.connyduck.sparkbutton.SparkButton;
import at.connyduck.sparkbutton.SparkEventListener;
2017-11-30 20:12:09 +01:00
abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
Add support for collapsible statuses when they exceed 500 characters (#825) * Update Gradle plugin to work with Android Studio 3.3 Canary Android Studio 3.1.4 Stable doesn't render layout previews in this project for whatever reason. Switching to the latest 3.3 Canary release fixes the issue without affecting Gradle scripts but requires the new Android Gradle plugin to match the new Android Studio release. This commit will be reverted once development on the feature is done. * Update gradle build script to allow installing debug builds alongside store version This will allow developers, testers, etc to work on Tusky will not having to worry about overwriting, uninstalling, fiddling with a preinstalled application which would mean having to login again every time the development cycle starts/finishes and manually reinstalling the app. * Add UI changes to support collapsing statuses The button uses subtle styling to not be distracting like the CW button on the timeline The button is toggleable, full width to match the status textbox hitbox width and also is shorter to not be too intrusive between the status text and images, or the post below * Update status data model to store whether the message has been collapsed * Update status action listener to notify of collapsed state changing Provide stubs in all implementing classes and mark as TODO the stubs that require a proper implementation for the feature to work. * Add implementation code to handle status collapse/expand in timeline Code has not been added elsewhere to simplify testing. Once the code will be considered stable it will be also included in other status action listener implementers. * Add preferences so that users can toggle the collapsing of long posts This is currently limited to a simple toggle, it would be nice to implement a more advanced UI to offer the user more control over the feature. * Update Gradle plugin to work with latest Android Studio 3.3 Canary 8 Just like the other commit, this will be reverted once the feature is working. I simply don't want to deal with what changes in my installation of Android Studio 3.1.4 Stable which breaks the layout preview rendering. * Update data models and utils for statuses to better handle collapsing I forgot that data isn't available from the API and can't really be built from scratch using existing data due to preferences. A new, extra boolean should fix the issue. * Fix search breaking due to newly introduced variables in utils classes * Fix timeline breaking due to newly introduced variables in utils classes * Fix item status text for collapsed toggle being shown in the wrong state * Update timeline fragment to refresh the list when collapsed settings change * Add support for status content collapse in timeline viewholder * Fix view holder truncating posts using temporary debug settings at 50 chars * Add toggle support to notification layout as well * Add support for collapsed statuses to search results * Add support for expandable content to notifications too * Update codebase with some suggested changes by @charlang * Update more code with more suggestions and move null-safety into view data * Update even more code with even more suggested code changes * Revert a0a41ca and 0ee004d (Android Studio 3.1 to Android Studio 3.3 updates) * Add an input filter utility class to reuse code for trimming statuses * Update UI of statuses to show a taller collapsible button * Update notification fragment logging to simplify null checks * Add smartness to SmartLengthInputFilter such as word trimming and runway * Fix posts with show more button even if bad ratio didn't collapse * Fix thread view showing button but not collapsing by implementing the feature * Fix spannable losing spans when collapsed and restore length to 500 characters * Remove debug build suffix as per request * Fix all the merging happened in f66d689, 623cad2 and 7056ba5 * Fix notification button spanning full width rather than content width * Add a way to access a singleton to smart filter and use clearer code * Update view holders using smart input filters to use more singletons * Fix code style lacking spaces before boolean checks in ifs and others * Remove all code related to collapsibility preferences, strings included * Update style to match content warning toggle button * Update strings to give cleaner differentiation between CW and collapse * Update smart filter code to use fully qualified names to avoid confusion
2018-09-19 19:51:20 +02:00
private static final InputFilter[] COLLAPSE_INPUT_FILTER = new InputFilter[] { SmartLengthInputFilter.INSTANCE };
private static final InputFilter[] NO_INPUT_FILTER = new InputFilter[0];
private View container;
private TextView displayName;
private TextView username;
private ImageButton replyButton;
private SparkButton reblogButton;
private SparkButton favouriteButton;
private ImageButton moreButton;
private boolean favourited;
private boolean reblogged;
private ImageView mediaPreview0;
private ImageView mediaPreview1;
private ImageView mediaPreview2;
private ImageView mediaPreview3;
2017-11-30 20:12:09 +01:00
private ImageView mediaOverlay0;
private ImageView mediaOverlay1;
private ImageView mediaOverlay2;
private ImageView mediaOverlay3;
private TextView sensitiveMediaWarning;
private View sensitiveMediaShow;
private TextView mediaLabel;
private ToggleButton contentWarningButton;
Add support for collapsible statuses when they exceed 500 characters (#825) * Update Gradle plugin to work with Android Studio 3.3 Canary Android Studio 3.1.4 Stable doesn't render layout previews in this project for whatever reason. Switching to the latest 3.3 Canary release fixes the issue without affecting Gradle scripts but requires the new Android Gradle plugin to match the new Android Studio release. This commit will be reverted once development on the feature is done. * Update gradle build script to allow installing debug builds alongside store version This will allow developers, testers, etc to work on Tusky will not having to worry about overwriting, uninstalling, fiddling with a preinstalled application which would mean having to login again every time the development cycle starts/finishes and manually reinstalling the app. * Add UI changes to support collapsing statuses The button uses subtle styling to not be distracting like the CW button on the timeline The button is toggleable, full width to match the status textbox hitbox width and also is shorter to not be too intrusive between the status text and images, or the post below * Update status data model to store whether the message has been collapsed * Update status action listener to notify of collapsed state changing Provide stubs in all implementing classes and mark as TODO the stubs that require a proper implementation for the feature to work. * Add implementation code to handle status collapse/expand in timeline Code has not been added elsewhere to simplify testing. Once the code will be considered stable it will be also included in other status action listener implementers. * Add preferences so that users can toggle the collapsing of long posts This is currently limited to a simple toggle, it would be nice to implement a more advanced UI to offer the user more control over the feature. * Update Gradle plugin to work with latest Android Studio 3.3 Canary 8 Just like the other commit, this will be reverted once the feature is working. I simply don't want to deal with what changes in my installation of Android Studio 3.1.4 Stable which breaks the layout preview rendering. * Update data models and utils for statuses to better handle collapsing I forgot that data isn't available from the API and can't really be built from scratch using existing data due to preferences. A new, extra boolean should fix the issue. * Fix search breaking due to newly introduced variables in utils classes * Fix timeline breaking due to newly introduced variables in utils classes * Fix item status text for collapsed toggle being shown in the wrong state * Update timeline fragment to refresh the list when collapsed settings change * Add support for status content collapse in timeline viewholder * Fix view holder truncating posts using temporary debug settings at 50 chars * Add toggle support to notification layout as well * Add support for collapsed statuses to search results * Add support for expandable content to notifications too * Update codebase with some suggested changes by @charlang * Update more code with more suggestions and move null-safety into view data * Update even more code with even more suggested code changes * Revert a0a41ca and 0ee004d (Android Studio 3.1 to Android Studio 3.3 updates) * Add an input filter utility class to reuse code for trimming statuses * Update UI of statuses to show a taller collapsible button * Update notification fragment logging to simplify null checks * Add smartness to SmartLengthInputFilter such as word trimming and runway * Fix posts with show more button even if bad ratio didn't collapse * Fix thread view showing button but not collapsing by implementing the feature * Fix spannable losing spans when collapsed and restore length to 500 characters * Remove debug build suffix as per request * Fix all the merging happened in f66d689, 623cad2 and 7056ba5 * Fix notification button spanning full width rather than content width * Add a way to access a singleton to smart filter and use clearer code * Update view holders using smart input filters to use more singletons * Fix code style lacking spaces before boolean checks in ifs and others * Remove all code related to collapsibility preferences, strings included * Update style to match content warning toggle button * Update strings to give cleaner differentiation between CW and collapse * Update smart filter code to use fully qualified names to avoid confusion
2018-09-19 19:51:20 +02:00
private ToggleButton contentCollapseButton;
ImageView avatar;
2017-11-30 20:12:09 +01:00
TextView timestampInfo;
TextView content;
TextView contentWarningDescription;
private boolean useAbsoluteTime;
private SimpleDateFormat shortSdf;
private SimpleDateFormat longSdf;
StatusBaseViewHolder(View itemView, boolean useAbsoluteTime) {
super(itemView);
container = itemView.findViewById(R.id.status_container);
displayName = itemView.findViewById(R.id.status_display_name);
username = itemView.findViewById(R.id.status_username);
2017-11-30 20:12:09 +01:00
timestampInfo = itemView.findViewById(R.id.status_timestamp_info);
content = itemView.findViewById(R.id.status_content);
avatar = itemView.findViewById(R.id.status_avatar);
replyButton = itemView.findViewById(R.id.status_reply);
reblogButton = itemView.findViewById(R.id.status_reblog);
favouriteButton = itemView.findViewById(R.id.status_favourite);
moreButton = itemView.findViewById(R.id.status_more);
reblogged = false;
favourited = false;
mediaPreview0 = itemView.findViewById(R.id.status_media_preview_0);
mediaPreview1 = itemView.findViewById(R.id.status_media_preview_1);
mediaPreview2 = itemView.findViewById(R.id.status_media_preview_2);
mediaPreview3 = itemView.findViewById(R.id.status_media_preview_3);
2017-11-30 20:12:09 +01:00
mediaOverlay0 = itemView.findViewById(R.id.status_media_overlay_0);
mediaOverlay1 = itemView.findViewById(R.id.status_media_overlay_1);
mediaOverlay2 = itemView.findViewById(R.id.status_media_overlay_2);
mediaOverlay3 = itemView.findViewById(R.id.status_media_overlay_3);
sensitiveMediaWarning = itemView.findViewById(R.id.status_sensitive_media_warning);
sensitiveMediaShow = itemView.findViewById(R.id.status_sensitive_media_button);
mediaLabel = itemView.findViewById(R.id.status_media_label);
2017-10-19 15:25:04 +02:00
contentWarningDescription = itemView.findViewById(R.id.status_content_warning_description);
contentWarningButton = itemView.findViewById(R.id.status_content_warning_button);
Add support for collapsible statuses when they exceed 500 characters (#825) * Update Gradle plugin to work with Android Studio 3.3 Canary Android Studio 3.1.4 Stable doesn't render layout previews in this project for whatever reason. Switching to the latest 3.3 Canary release fixes the issue without affecting Gradle scripts but requires the new Android Gradle plugin to match the new Android Studio release. This commit will be reverted once development on the feature is done. * Update gradle build script to allow installing debug builds alongside store version This will allow developers, testers, etc to work on Tusky will not having to worry about overwriting, uninstalling, fiddling with a preinstalled application which would mean having to login again every time the development cycle starts/finishes and manually reinstalling the app. * Add UI changes to support collapsing statuses The button uses subtle styling to not be distracting like the CW button on the timeline The button is toggleable, full width to match the status textbox hitbox width and also is shorter to not be too intrusive between the status text and images, or the post below * Update status data model to store whether the message has been collapsed * Update status action listener to notify of collapsed state changing Provide stubs in all implementing classes and mark as TODO the stubs that require a proper implementation for the feature to work. * Add implementation code to handle status collapse/expand in timeline Code has not been added elsewhere to simplify testing. Once the code will be considered stable it will be also included in other status action listener implementers. * Add preferences so that users can toggle the collapsing of long posts This is currently limited to a simple toggle, it would be nice to implement a more advanced UI to offer the user more control over the feature. * Update Gradle plugin to work with latest Android Studio 3.3 Canary 8 Just like the other commit, this will be reverted once the feature is working. I simply don't want to deal with what changes in my installation of Android Studio 3.1.4 Stable which breaks the layout preview rendering. * Update data models and utils for statuses to better handle collapsing I forgot that data isn't available from the API and can't really be built from scratch using existing data due to preferences. A new, extra boolean should fix the issue. * Fix search breaking due to newly introduced variables in utils classes * Fix timeline breaking due to newly introduced variables in utils classes * Fix item status text for collapsed toggle being shown in the wrong state * Update timeline fragment to refresh the list when collapsed settings change * Add support for status content collapse in timeline viewholder * Fix view holder truncating posts using temporary debug settings at 50 chars * Add toggle support to notification layout as well * Add support for collapsed statuses to search results * Add support for expandable content to notifications too * Update codebase with some suggested changes by @charlang * Update more code with more suggestions and move null-safety into view data * Update even more code with even more suggested code changes * Revert a0a41ca and 0ee004d (Android Studio 3.1 to Android Studio 3.3 updates) * Add an input filter utility class to reuse code for trimming statuses * Update UI of statuses to show a taller collapsible button * Update notification fragment logging to simplify null checks * Add smartness to SmartLengthInputFilter such as word trimming and runway * Fix posts with show more button even if bad ratio didn't collapse * Fix thread view showing button but not collapsing by implementing the feature * Fix spannable losing spans when collapsed and restore length to 500 characters * Remove debug build suffix as per request * Fix all the merging happened in f66d689, 623cad2 and 7056ba5 * Fix notification button spanning full width rather than content width * Add a way to access a singleton to smart filter and use clearer code * Update view holders using smart input filters to use more singletons * Fix code style lacking spaces before boolean checks in ifs and others * Remove all code related to collapsibility preferences, strings included * Update style to match content warning toggle button * Update strings to give cleaner differentiation between CW and collapse * Update smart filter code to use fully qualified names to avoid confusion
2018-09-19 19:51:20 +02:00
contentCollapseButton = itemView.findViewById(R.id.button_toggle_content);
this.useAbsoluteTime = useAbsoluteTime;
shortSdf = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
longSdf = new SimpleDateFormat("MM/dd HH:mm:ss", Locale.getDefault());
}
2017-11-30 20:12:09 +01:00
protected abstract int getMediaPreviewHeight(Context context);
2018-06-24 09:53:23 +02:00
private void setDisplayName(String name, List<Emoji> customEmojis) {
CharSequence emojifiedName = CustomEmojiHelper.emojifyString(name, customEmojis, displayName);
displayName.setText(emojifiedName);
}
private void setUsername(String name) {
Context context = username.getContext();
String format = context.getString(R.string.status_username_format);
String usernameText = String.format(format, name);
username.setText(usernameText);
}
ComposeActivity improvements (#548) * do not add media urls to status text * add scrolling to content * add arrow icon and animation to replying-to toggle * remove unnecessary compose_button_colors.xml * improve toot button * improve bottom bar, add bottom sheet for compose options, dedicated cw button * fix crash on Android < API 21 * move media picking from dialog to bottom sheet * add small style tootbutton * fix colors/button background for light theme * add icons to media chose bottom sheet * improve hide media button, delete unused styles * fix crash on dev build when taking photo * consolidate drawables * consolidate strings and ids, add tooltips to buttons * allow media only toots * change error message to show max size of upload correctly * fix button color * add emoji * code cleanup * Merge branch 'master' into compose_activity_refactoring # Conflicts: # app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java * fix hidden snackbar * improve hint text color * add SendTootService * fix timeline refreshing * toot saving and error handling for sendtootservice * restructure some code * convert EditTextTyped to Kotlin * fixed pick media button disabled color * force sensitive media when content warning is shown * add db cache for emojis & fix tests * reorder buttons to match mastodon web * add possibility to cancel sending of toot * correctly delete sent toots * refresh SavedTootActivity after toot was sent * remove unused resources * correct params for toot saving in SendTootService * consolidate strings * bugfix * remove unused resources * fix notifications on old android for SendTootService * fix crash
2018-04-13 22:37:21 +02:00
private void setContent(Spanned content, Status.Mention[] mentions, List<Emoji> emojis,
StatusActionListener listener) {
2017-11-30 20:12:09 +01:00
Spanned emojifiedText = CustomEmojiHelper.emojifyText(content, emojis, this.content);
2017-10-19 15:25:04 +02:00
2017-11-30 20:12:09 +01:00
LinkHelper.setClickableText(this.content, emojifiedText, mentions, listener);
}
void setAvatar(String url, @Nullable String rebloggedUrl) {
2018-03-15 22:08:12 +01:00
if (TextUtils.isEmpty(url)) {
avatar.setImageResource(R.drawable.avatar_default);
} else {
Picasso.with(avatar.getContext())
.load(url)
.placeholder(R.drawable.avatar_default)
.into(avatar);
}
}
protected void setCreatedAt(@Nullable Date createdAt) {
if (useAbsoluteTime) {
2018-08-20 10:47:19 +02:00
String time;
2018-08-16 15:51:23 +02:00
if (createdAt != null) {
if (System.currentTimeMillis() - createdAt.getTime() > 86400000L) {
time = longSdf.format(createdAt);
} else {
time = shortSdf.format(createdAt);
2018-08-16 15:51:23 +02:00
}
} else {
time = "??:??:??";
2018-08-16 15:51:23 +02:00
}
timestampInfo.setText(time);
} else {
2018-08-16 15:51:23 +02:00
// This is the visible timestampInfo.
String readout;
/* This one is for screen-readers. Frequently, they would mispronounce timestamps like "17m"
* as 17 meters instead of minutes. */
CharSequence readoutAloud;
if (createdAt != null) {
long then = createdAt.getTime();
long now = new Date().getTime();
readout = DateUtils.getRelativeTimeSpanString(timestampInfo.getContext(), then, now);
readoutAloud = android.text.format.DateUtils.getRelativeTimeSpanString(then, now,
android.text.format.DateUtils.SECOND_IN_MILLIS,
android.text.format.DateUtils.FORMAT_ABBREV_RELATIVE);
} else {
// unknown minutes~
readout = "?m";
readoutAloud = "? minutes";
}
timestampInfo.setText(readout);
timestampInfo.setContentDescription(readoutAloud);
}
2017-11-30 20:12:09 +01:00
}
protected void showContent(boolean show) {
if (show) {
container.setVisibility(View.VISIBLE);
container.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
} else {
container.setVisibility(View.INVISIBLE);
container.getLayoutParams().height = Utils.convertDpToPx(container.getContext(), 24);
}
}
2017-11-30 20:12:09 +01:00
private void setIsReply(boolean isReply) {
if (isReply) {
2017-11-30 20:12:09 +01:00
replyButton.setImageResource(R.drawable.ic_reply_all_24dp);
} else {
replyButton.setImageResource(R.drawable.ic_reply_24dp);
}
}
private void setReblogged(boolean reblogged) {
this.reblogged = reblogged;
reblogButton.setChecked(reblogged);
}
// This should only be called after setReblogged, in order to override the tint correctly.
private void setRebloggingEnabled(boolean enabled, Status.Visibility visibility) {
reblogButton.setEnabled(enabled && visibility != Status.Visibility.PRIVATE);
if (enabled) {
int inactiveId;
int activeId;
if (visibility == Status.Visibility.PRIVATE) {
inactiveId = ThemeUtils.getDrawableId(reblogButton.getContext(),
R.attr.status_reblog_disabled_drawable, R.drawable.reblog_private_dark);
activeId = R.drawable.reblog_private_active;
} else {
inactiveId = ThemeUtils.getDrawableId(reblogButton.getContext(),
R.attr.status_reblog_inactive_drawable, R.drawable.reblog_inactive_dark);
activeId = R.drawable.reblog_active;
}
reblogButton.setInactiveImage(inactiveId);
reblogButton.setActiveImage(activeId);
} else {
int disabledId;
if (visibility == Status.Visibility.DIRECT) {
disabledId = ThemeUtils.getDrawableId(reblogButton.getContext(),
R.attr.status_reblog_direct_drawable, R.drawable.reblog_direct_dark);
} else {
disabledId = ThemeUtils.getDrawableId(reblogButton.getContext(),
R.attr.status_reblog_disabled_drawable, R.drawable.reblog_private_dark);
}
reblogButton.setInactiveImage(disabledId);
reblogButton.setActiveImage(disabledId);
}
}
private void setFavourited(boolean favourited) {
this.favourited = favourited;
favouriteButton.setChecked(favourited);
}
private void setMediaPreviews(final List<Attachment> attachments, boolean sensitive,
2017-11-30 20:12:09 +01:00
final StatusActionListener listener, boolean showingContent) {
final ImageView[] previews = {
2017-10-19 15:25:04 +02:00
mediaPreview0, mediaPreview1, mediaPreview2, mediaPreview3
};
2017-11-30 20:12:09 +01:00
final ImageView[] overlays = {
mediaOverlay0, mediaOverlay1, mediaOverlay2, mediaOverlay3
};
Context context = mediaPreview0.getContext();
2017-10-19 15:25:04 +02:00
int mediaPreviewUnloadedId =
ThemeUtils.getDrawableId(itemView.getContext(), R.attr.media_preview_unloaded_drawable,
android.R.color.black);
final int n = Math.min(attachments.size(), Status.MAX_MEDIA_ATTACHMENTS);
for (int i = 0; i < n; i++) {
String previewUrl = attachments.get(i).getPreviewUrl();
String description = attachments.get(i).getDescription();
2017-11-30 20:12:09 +01:00
if (TextUtils.isEmpty(description)) {
2017-11-30 20:12:09 +01:00
previews[i].setContentDescription(context.getString(R.string.action_view_media));
} else {
previews[i].setContentDescription(description);
}
previews[i].setVisibility(View.VISIBLE);
2018-03-30 19:46:36 +02:00
if (TextUtils.isEmpty(previewUrl)) {
Picasso.with(context)
.load(mediaPreviewUnloadedId)
.into(previews[i]);
} else {
Picasso.with(context)
.load(previewUrl)
.placeholder(mediaPreviewUnloadedId)
.into(previews[i]);
}
final Attachment.Type type = attachments.get(i).getType();
2017-11-30 20:12:09 +01:00
if (type == Attachment.Type.VIDEO | type == Attachment.Type.GIFV) {
overlays[i].setVisibility(View.VISIBLE);
} else {
overlays[i].setVisibility(View.GONE);
}
final int urlIndex = i;
2018-08-15 11:20:57 +02:00
previews[i].setOnClickListener(v -> {
2018-08-16 15:51:23 +02:00
if (getAdapterPosition() != RecyclerView.NO_POSITION) {
2018-08-15 11:20:57 +02:00
listener.onViewMedia(getAdapterPosition(), urlIndex, v);
}
});
2017-11-30 20:12:09 +01:00
if (n <= 2) {
previews[0].getLayoutParams().height = getMediaPreviewHeight(context) * 2;
previews[1].getLayoutParams().height = getMediaPreviewHeight(context) * 2;
2017-11-30 20:12:09 +01:00
} else {
previews[0].getLayoutParams().height = getMediaPreviewHeight(context);
previews[1].getLayoutParams().height = getMediaPreviewHeight(context);
previews[2].getLayoutParams().height = getMediaPreviewHeight(context);
previews[3].getLayoutParams().height = getMediaPreviewHeight(context);
}
}
2017-11-30 20:12:09 +01:00
String hiddenContentText;
if (sensitive) {
2017-11-30 20:12:09 +01:00
hiddenContentText = context.getString(R.string.status_sensitive_media_template,
context.getString(R.string.status_sensitive_media_title),
context.getString(R.string.status_sensitive_media_directions));
} else {
hiddenContentText = context.getString(R.string.status_sensitive_media_template,
context.getString(R.string.status_media_hidden_title),
context.getString(R.string.status_sensitive_media_directions));
}
sensitiveMediaWarning.setText(HtmlUtils.fromHtml(hiddenContentText));
sensitiveMediaWarning.setVisibility(showingContent ? View.GONE : View.VISIBLE);
sensitiveMediaShow.setVisibility(showingContent ? View.VISIBLE : View.GONE);
sensitiveMediaShow.setOnClickListener(v -> {
if (getAdapterPosition() != RecyclerView.NO_POSITION) {
listener.onContentHiddenChange(false, getAdapterPosition());
2017-11-30 20:12:09 +01:00
}
v.setVisibility(View.GONE);
sensitiveMediaWarning.setVisibility(View.VISIBLE);
2017-11-30 20:12:09 +01:00
});
sensitiveMediaWarning.setOnClickListener(v -> {
if (getAdapterPosition() != RecyclerView.NO_POSITION) {
listener.onContentHiddenChange(true, getAdapterPosition());
2017-11-30 20:12:09 +01:00
}
v.setVisibility(View.GONE);
sensitiveMediaShow.setVisibility(View.VISIBLE);
2017-11-30 20:12:09 +01:00
});
// Hide any of the placeholder previews beyond the ones set.
for (int i = n; i < Status.MAX_MEDIA_ATTACHMENTS; i++) {
previews[i].setVisibility(View.GONE);
}
}
@NonNull
2017-11-30 20:12:09 +01:00
private static String getLabelTypeText(Context context, Attachment.Type type) {
switch (type) {
default:
case IMAGE:
return context.getString(R.string.status_media_images);
case GIFV:
case VIDEO:
return context.getString(R.string.status_media_video);
}
}
@DrawableRes
2017-11-30 20:12:09 +01:00
private static int getLabelIcon(Attachment.Type type) {
switch (type) {
default:
case IMAGE:
return R.drawable.ic_photo_24dp;
case GIFV:
case VIDEO:
return R.drawable.ic_videocam_24dp;
}
}
private void setMediaLabel(List<Attachment> attachments, boolean sensitive,
final StatusActionListener listener) {
if (attachments.size() == 0) {
mediaLabel.setVisibility(View.GONE);
return;
}
mediaLabel.setVisibility(View.VISIBLE);
// Set the label's text.
Context context = itemView.getContext();
String labelText = getLabelTypeText(context, attachments.get(0).getType());
if (sensitive) {
String sensitiveText = context.getString(R.string.status_sensitive_media_title);
labelText += String.format(" (%s)", sensitiveText);
}
mediaLabel.setText(labelText);
// Set the icon next to the label.
int drawableId = getLabelIcon(attachments.get(0).getType());
Drawable drawable = AppCompatResources.getDrawable(context, drawableId);
ThemeUtils.setDrawableTint(context, drawable, android.R.attr.textColorTertiary);
mediaLabel.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
mediaLabel.setOnClickListener(v -> listener.onViewMedia(getAdapterPosition(), 0, null));
}
private void hideSensitiveMediaWarning() {
sensitiveMediaWarning.setVisibility(View.GONE);
sensitiveMediaShow.setVisibility(View.GONE);
}
ComposeActivity improvements (#548) * do not add media urls to status text * add scrolling to content * add arrow icon and animation to replying-to toggle * remove unnecessary compose_button_colors.xml * improve toot button * improve bottom bar, add bottom sheet for compose options, dedicated cw button * fix crash on Android < API 21 * move media picking from dialog to bottom sheet * add small style tootbutton * fix colors/button background for light theme * add icons to media chose bottom sheet * improve hide media button, delete unused styles * fix crash on dev build when taking photo * consolidate drawables * consolidate strings and ids, add tooltips to buttons * allow media only toots * change error message to show max size of upload correctly * fix button color * add emoji * code cleanup * Merge branch 'master' into compose_activity_refactoring # Conflicts: # app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java * fix hidden snackbar * improve hint text color * add SendTootService * fix timeline refreshing * toot saving and error handling for sendtootservice * restructure some code * convert EditTextTyped to Kotlin * fixed pick media button disabled color * force sensitive media when content warning is shown * add db cache for emojis & fix tests * reorder buttons to match mastodon web * add possibility to cancel sending of toot * correctly delete sent toots * refresh SavedTootActivity after toot was sent * remove unused resources * correct params for toot saving in SendTootService * consolidate strings * bugfix * remove unused resources * fix notifications on old android for SendTootService * fix crash
2018-04-13 22:37:21 +02:00
private void setSpoilerText(String spoilerText, List<Emoji> emojis,
2017-11-30 20:12:09 +01:00
final boolean expanded, final StatusActionListener listener) {
CharSequence emojiSpoiler =
CustomEmojiHelper.emojifyString(spoilerText, emojis, contentWarningDescription);
contentWarningDescription.setText(emojiSpoiler);
contentWarningDescription.setVisibility(View.VISIBLE);
contentWarningButton.setVisibility(View.VISIBLE);
contentWarningButton.setChecked(expanded);
contentWarningButton.setOnCheckedChangeListener((buttonView, isChecked) -> {
contentWarningDescription.invalidate();
if (getAdapterPosition() != RecyclerView.NO_POSITION) {
listener.onExpandedChange(isChecked, getAdapterPosition());
}
if (isChecked) {
content.setVisibility(View.VISIBLE);
} else {
content.setVisibility(View.GONE);
2017-10-19 15:25:04 +02:00
}
});
if (expanded) {
content.setVisibility(View.VISIBLE);
} else {
content.setVisibility(View.GONE);
}
}
private void hideSpoilerText() {
contentWarningDescription.setVisibility(View.GONE);
contentWarningButton.setVisibility(View.GONE);
content.setVisibility(View.VISIBLE);
}
private void setupButtons(final StatusActionListener listener, final String accountId) {
/* Originally position was passed through to all these listeners, but it caused several
* bugs where other statuses in the list would be removed or added and cause the position
* here to become outdated. So, getting the adapter position at the time the listener is
* actually called is the appropriate solution. */
2018-06-24 09:53:23 +02:00
avatar.setOnClickListener(v -> listener.onViewAccount(accountId));
replyButton.setOnClickListener(v -> {
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION) {
listener.onReply(position);
}
});
reblogButton.setEventListener(new SparkEventListener() {
@Override
public void onEvent(ImageView button, boolean buttonState) {
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION) {
listener.onReblog(!reblogged, position);
}
}
@Override
public void onEventAnimationEnd(ImageView button, boolean buttonState) {
}
@Override
public void onEventAnimationStart(ImageView button, boolean buttonState) {
}
});
favouriteButton.setEventListener(new SparkEventListener() {
@Override
public void onEvent(ImageView button, boolean buttonState) {
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION) {
listener.onFavourite(!favourited, position);
}
}
@Override
public void onEventAnimationEnd(ImageView button, boolean buttonState) {
}
@Override
public void onEventAnimationStart(ImageView button, boolean buttonState) {
}
});
2018-06-24 09:53:23 +02:00
moreButton.setOnClickListener(v -> {
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION) {
listener.onMore(v, position);
}
});
/* Even though the content TextView is a child of the container, it won't respond to clicks
* if it contains URLSpans without also setting its listener. The surrounding spans will
* just eat the clicks instead of deferring to the parent listener, but WILL respond to a
* listener directly on the TextView, for whatever reason. */
View.OnClickListener viewThreadListener = v -> {
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION) {
listener.onViewThread(position);
}
};
content.setOnClickListener(viewThreadListener);
container.setOnClickListener(viewThreadListener);
}
void setupWithStatus(StatusViewData.Concrete status, final StatusActionListener listener,
boolean mediaPreviewEnabled) {
2018-06-24 09:53:23 +02:00
setDisplayName(status.getUserFullName(), status.getAccountEmojis());
setUsername(status.getNickname());
setCreatedAt(status.getCreatedAt());
2017-11-30 20:12:09 +01:00
setIsReply(status.getInReplyToId() != null);
setAvatar(status.getAvatar(), status.getRebloggedAvatar());
setReblogged(status.isReblogged());
setFavourited(status.isFavourited());
List<Attachment> attachments = status.getAttachments();
boolean sensitive = status.isSensitive();
if (mediaPreviewEnabled) {
2017-11-30 20:12:09 +01:00
setMediaPreviews(attachments, sensitive, listener, status.isShowingContent());
if (attachments.size() == 0) {
2017-11-30 20:12:09 +01:00
hideSensitiveMediaWarning();
}
// Hide the unused label.
mediaLabel.setVisibility(View.GONE);
} else {
setMediaLabel(attachments, sensitive, listener);
// Hide all unused views.
mediaPreview0.setVisibility(View.GONE);
mediaPreview1.setVisibility(View.GONE);
mediaPreview2.setVisibility(View.GONE);
mediaPreview3.setVisibility(View.GONE);
hideSensitiveMediaWarning();
}
setupButtons(listener, status.getSenderId());
setRebloggingEnabled(status.getRebloggingEnabled(), status.getVisibility());
if (status.getSpoilerText() == null || status.getSpoilerText().isEmpty()) {
hideSpoilerText();
} else {
2018-06-24 09:53:23 +02:00
setSpoilerText(status.getSpoilerText(), status.getStatusEmojis(), status.isExpanded(), listener);
}
2017-10-19 15:25:04 +02:00
Add support for collapsible statuses when they exceed 500 characters (#825) * Update Gradle plugin to work with Android Studio 3.3 Canary Android Studio 3.1.4 Stable doesn't render layout previews in this project for whatever reason. Switching to the latest 3.3 Canary release fixes the issue without affecting Gradle scripts but requires the new Android Gradle plugin to match the new Android Studio release. This commit will be reverted once development on the feature is done. * Update gradle build script to allow installing debug builds alongside store version This will allow developers, testers, etc to work on Tusky will not having to worry about overwriting, uninstalling, fiddling with a preinstalled application which would mean having to login again every time the development cycle starts/finishes and manually reinstalling the app. * Add UI changes to support collapsing statuses The button uses subtle styling to not be distracting like the CW button on the timeline The button is toggleable, full width to match the status textbox hitbox width and also is shorter to not be too intrusive between the status text and images, or the post below * Update status data model to store whether the message has been collapsed * Update status action listener to notify of collapsed state changing Provide stubs in all implementing classes and mark as TODO the stubs that require a proper implementation for the feature to work. * Add implementation code to handle status collapse/expand in timeline Code has not been added elsewhere to simplify testing. Once the code will be considered stable it will be also included in other status action listener implementers. * Add preferences so that users can toggle the collapsing of long posts This is currently limited to a simple toggle, it would be nice to implement a more advanced UI to offer the user more control over the feature. * Update Gradle plugin to work with latest Android Studio 3.3 Canary 8 Just like the other commit, this will be reverted once the feature is working. I simply don't want to deal with what changes in my installation of Android Studio 3.1.4 Stable which breaks the layout preview rendering. * Update data models and utils for statuses to better handle collapsing I forgot that data isn't available from the API and can't really be built from scratch using existing data due to preferences. A new, extra boolean should fix the issue. * Fix search breaking due to newly introduced variables in utils classes * Fix timeline breaking due to newly introduced variables in utils classes * Fix item status text for collapsed toggle being shown in the wrong state * Update timeline fragment to refresh the list when collapsed settings change * Add support for status content collapse in timeline viewholder * Fix view holder truncating posts using temporary debug settings at 50 chars * Add toggle support to notification layout as well * Add support for collapsed statuses to search results * Add support for expandable content to notifications too * Update codebase with some suggested changes by @charlang * Update more code with more suggestions and move null-safety into view data * Update even more code with even more suggested code changes * Revert a0a41ca and 0ee004d (Android Studio 3.1 to Android Studio 3.3 updates) * Add an input filter utility class to reuse code for trimming statuses * Update UI of statuses to show a taller collapsible button * Update notification fragment logging to simplify null checks * Add smartness to SmartLengthInputFilter such as word trimming and runway * Fix posts with show more button even if bad ratio didn't collapse * Fix thread view showing button but not collapsing by implementing the feature * Fix spannable losing spans when collapsed and restore length to 500 characters * Remove debug build suffix as per request * Fix all the merging happened in f66d689, 623cad2 and 7056ba5 * Fix notification button spanning full width rather than content width * Add a way to access a singleton to smart filter and use clearer code * Update view holders using smart input filters to use more singletons * Fix code style lacking spaces before boolean checks in ifs and others * Remove all code related to collapsibility preferences, strings included * Update style to match content warning toggle button * Update strings to give cleaner differentiation between CW and collapse * Update smart filter code to use fully qualified names to avoid confusion
2018-09-19 19:51:20 +02:00
// When viewing threads this ViewHolder is used and the main post does not have a collapse
// button by design so avoid crashing the app when that happens
if (contentCollapseButton != null) {
if (status.isCollapsible() && (status.isExpanded() || status.getSpoilerText() == null || status.getSpoilerText().isEmpty())) {
contentCollapseButton.setOnCheckedChangeListener((buttonView, isChecked) -> {
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION)
listener.onContentCollapsedChange(isChecked, position);
});
contentCollapseButton.setVisibility(View.VISIBLE);
if (status.isCollapsed()) {
contentCollapseButton.setChecked(true);
content.setFilters(COLLAPSE_INPUT_FILTER);
} else {
contentCollapseButton.setChecked(false);
content.setFilters(NO_INPUT_FILTER);
}
} else {
contentCollapseButton.setVisibility(View.GONE);
content.setFilters(NO_INPUT_FILTER);
}
}
2017-10-19 15:25:04 +02:00
Add support for collapsible statuses when they exceed 500 characters (#825) * Update Gradle plugin to work with Android Studio 3.3 Canary Android Studio 3.1.4 Stable doesn't render layout previews in this project for whatever reason. Switching to the latest 3.3 Canary release fixes the issue without affecting Gradle scripts but requires the new Android Gradle plugin to match the new Android Studio release. This commit will be reverted once development on the feature is done. * Update gradle build script to allow installing debug builds alongside store version This will allow developers, testers, etc to work on Tusky will not having to worry about overwriting, uninstalling, fiddling with a preinstalled application which would mean having to login again every time the development cycle starts/finishes and manually reinstalling the app. * Add UI changes to support collapsing statuses The button uses subtle styling to not be distracting like the CW button on the timeline The button is toggleable, full width to match the status textbox hitbox width and also is shorter to not be too intrusive between the status text and images, or the post below * Update status data model to store whether the message has been collapsed * Update status action listener to notify of collapsed state changing Provide stubs in all implementing classes and mark as TODO the stubs that require a proper implementation for the feature to work. * Add implementation code to handle status collapse/expand in timeline Code has not been added elsewhere to simplify testing. Once the code will be considered stable it will be also included in other status action listener implementers. * Add preferences so that users can toggle the collapsing of long posts This is currently limited to a simple toggle, it would be nice to implement a more advanced UI to offer the user more control over the feature. * Update Gradle plugin to work with latest Android Studio 3.3 Canary 8 Just like the other commit, this will be reverted once the feature is working. I simply don't want to deal with what changes in my installation of Android Studio 3.1.4 Stable which breaks the layout preview rendering. * Update data models and utils for statuses to better handle collapsing I forgot that data isn't available from the API and can't really be built from scratch using existing data due to preferences. A new, extra boolean should fix the issue. * Fix search breaking due to newly introduced variables in utils classes * Fix timeline breaking due to newly introduced variables in utils classes * Fix item status text for collapsed toggle being shown in the wrong state * Update timeline fragment to refresh the list when collapsed settings change * Add support for status content collapse in timeline viewholder * Fix view holder truncating posts using temporary debug settings at 50 chars * Add toggle support to notification layout as well * Add support for collapsed statuses to search results * Add support for expandable content to notifications too * Update codebase with some suggested changes by @charlang * Update more code with more suggestions and move null-safety into view data * Update even more code with even more suggested code changes * Revert a0a41ca and 0ee004d (Android Studio 3.1 to Android Studio 3.3 updates) * Add an input filter utility class to reuse code for trimming statuses * Update UI of statuses to show a taller collapsible button * Update notification fragment logging to simplify null checks * Add smartness to SmartLengthInputFilter such as word trimming and runway * Fix posts with show more button even if bad ratio didn't collapse * Fix thread view showing button but not collapsing by implementing the feature * Fix spannable losing spans when collapsed and restore length to 500 characters * Remove debug build suffix as per request * Fix all the merging happened in f66d689, 623cad2 and 7056ba5 * Fix notification button spanning full width rather than content width * Add a way to access a singleton to smart filter and use clearer code * Update view holders using smart input filters to use more singletons * Fix code style lacking spaces before boolean checks in ifs and others * Remove all code related to collapsibility preferences, strings included * Update style to match content warning toggle button * Update strings to give cleaner differentiation between CW and collapse * Update smart filter code to use fully qualified names to avoid confusion
2018-09-19 19:51:20 +02:00
setContent(status.getContent(), status.getMentions(), status.getStatusEmojis(), listener);
}
}