tweak collapse button
This commit is contained in:
@@ -239,7 +239,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
|
|||||||
GlobalUserPreferences.showNoAltIndicator=i.checked;
|
GlobalUserPreferences.showNoAltIndicator=i.checked;
|
||||||
GlobalUserPreferences.save();
|
GlobalUserPreferences.save();
|
||||||
}));
|
}));
|
||||||
items.add(new SwitchItem(R.string.sk_settings_collapse_long_posts, R.drawable.ic_fluent_more_horizontal_24_regular, GlobalUserPreferences.collapseLongPosts, i->{
|
items.add(new SwitchItem(R.string.sk_settings_collapse_long_posts, R.drawable.ic_fluent_chevron_down_24_filled, GlobalUserPreferences.collapseLongPosts, i->{
|
||||||
GlobalUserPreferences.collapseLongPosts=i.checked;
|
GlobalUserPreferences.collapseLongPosts=i.checked;
|
||||||
GlobalUserPreferences.save();
|
GlobalUserPreferences.save();
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -139,7 +139,8 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
|
|||||||
|
|
||||||
public static class Holder extends StatusDisplayItem.Holder<HeaderStatusDisplayItem> implements ImageLoaderViewHolder{
|
public static class Holder extends StatusDisplayItem.Holder<HeaderStatusDisplayItem> implements ImageLoaderViewHolder{
|
||||||
private final TextView name, username, timestamp, extraText, separator;
|
private final TextView name, username, timestamp, extraText, separator;
|
||||||
private final ImageView avatar, more, visibility, deleteNotification, unreadIndicator, collapseBtn;
|
private final View collapseBtn;
|
||||||
|
private final ImageView avatar, more, visibility, deleteNotification, unreadIndicator, collapseBtnIcon;
|
||||||
private final PopupMenu optionsMenu;
|
private final PopupMenu optionsMenu;
|
||||||
private Relationship relationship;
|
private Relationship relationship;
|
||||||
private APIRequest<?> currentRelationshipRequest;
|
private APIRequest<?> currentRelationshipRequest;
|
||||||
@@ -163,6 +164,7 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
|
|||||||
deleteNotification=findViewById(R.id.delete_notification);
|
deleteNotification=findViewById(R.id.delete_notification);
|
||||||
unreadIndicator=findViewById(R.id.unread_indicator);
|
unreadIndicator=findViewById(R.id.unread_indicator);
|
||||||
collapseBtn=findViewById(R.id.collapse_btn);
|
collapseBtn=findViewById(R.id.collapse_btn);
|
||||||
|
collapseBtnIcon=findViewById(R.id.collapse_btn_icon);
|
||||||
extraText=findViewById(R.id.extra_text);
|
extraText=findViewById(R.id.extra_text);
|
||||||
avatar.setOnClickListener(this::onAvaClick);
|
avatar.setOnClickListener(this::onAvaClick);
|
||||||
avatar.setOutlineProvider(roundCornersOutline);
|
avatar.setOutlineProvider(roundCornersOutline);
|
||||||
@@ -384,7 +386,8 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
|
|||||||
String collapseText = item.parentFragment.getString(item.status.textExpanded ? R.string.sk_collapse : R.string.sk_expand);
|
String collapseText = item.parentFragment.getString(item.status.textExpanded ? R.string.sk_collapse : R.string.sk_expand);
|
||||||
collapseBtn.setVisibility(item.status.textExpandable ? View.VISIBLE : View.GONE);
|
collapseBtn.setVisibility(item.status.textExpandable ? View.VISIBLE : View.GONE);
|
||||||
collapseBtn.setContentDescription(collapseText);
|
collapseBtn.setContentDescription(collapseText);
|
||||||
collapseBtn.animate().scaleY(item.status.textExpanded ? -1 : 1).start();
|
if (GlobalUserPreferences.reduceMotion) collapseBtnIcon.setScaleY(item.status.textExpanded ? -1 : 1);
|
||||||
|
else collapseBtnIcon.animate().scaleY(item.status.textExpanded ? -1 : 1).start();
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) collapseBtn.setTooltipText(collapseText);
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) collapseBtn.setTooltipText(collapseText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||||
|
<path android:pathData="M4.293 8.293c0.39-0.39 1.024-0.39 1.414 0L12 14.586l6.293-6.293c0.39-0.39 1.024-0.39 1.414 0 0.39 0.39 0.39 1.024 0 1.414l-7 7c-0.39 0.39-1.024 0.39-1.414 0l-7-7c-0.39-0.39-0.39-1.024 0-1.414z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||||
|
</vector>
|
||||||
@@ -41,16 +41,28 @@
|
|||||||
android:src="@drawable/ic_visibility"
|
android:src="@drawable/ic_visibility"
|
||||||
android:tint="?android:textColorSecondary" />
|
android:tint="?android:textColorSecondary" />
|
||||||
|
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:id="@+id/collapse_btn"
|
android:id="@+id/collapse_btn"
|
||||||
android:layout_width="36dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:layout_toStartOf="@id/visibility"
|
android:layout_toStartOf="@id/visibility"
|
||||||
android:background="?android:actionBarItemBackground"
|
android:background="?android:actionBarItemBackground"
|
||||||
android:scaleType="center"
|
android:visibility="gone">
|
||||||
android:src="@drawable/ic_fluent_chevron_down_20_filled"
|
|
||||||
android:visibility="gone"
|
<!-- wrapping this button so the flip animation doesn't flip the background and the tooltip
|
||||||
android:tint="?android:textColorSecondary" />
|
isn't displaced by the -1 scale -->
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/collapse_btn_icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/ic_fluent_chevron_down_20_filled"
|
||||||
|
android:tint="?android:textColorSecondary" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/unread_indicator"
|
android:id="@+id/unread_indicator"
|
||||||
|
|||||||
@@ -255,5 +255,5 @@
|
|||||||
<string name="sk_filtered">Filtered: %s</string>
|
<string name="sk_filtered">Filtered: %s</string>
|
||||||
<string name="sk_expand">Expand</string>
|
<string name="sk_expand">Expand</string>
|
||||||
<string name="sk_collapse">Collapse</string>
|
<string name="sk_collapse">Collapse</string>
|
||||||
<string name="sk_settings_collapse_long_posts">Collapse long posts</string>
|
<string name="sk_settings_collapse_long_posts">Collapse very long posts</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user