Pinnable timelines (#338)

* implement draggable list

* implement pinning timelines

* fix TimelineDefinition equals not working

* implement removing timelines

* implement pinned lists/hashtags

* per-account pinned timelines

* implement pin button

* fix issues with pinning

* improve pin button

* improve pinning timelines

* implement custom icons

* fix home switcher menu

* make hashtags pinnable

* edit timelines in options menu
This commit is contained in:
sk22
2023-01-21 02:17:47 +01:00
committed by GitHub
parent 8e507e7970
commit 88851a085e
22 changed files with 943 additions and 135 deletions

View File

@@ -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="M11.75 3c0.38 0 0.693 0.282 0.743 0.648L12.5 3.75 12.501 11h7.253c0.415 0 0.75 0.336 0.75 0.75 0 0.38-0.282 0.694-0.648 0.743L19.754 12.5h-7.253l0.002 7.25c0 0.413-0.335 0.75-0.75 0.75-0.38 0-0.693-0.283-0.743-0.649l-0.007-0.102-0.002-7.249H3.752c-0.414 0-0.75-0.336-0.75-0.75 0-0.38 0.282-0.694 0.648-0.743L3.752 11h7.25L11 3.75C11 3.336 11.336 3 11.75 3z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@@ -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="M21.068 7.758l-4.826-4.826c-1.327-1.327-3.564-0.964-4.404 0.715l-2.435 4.87c-0.088 0.176-0.24 0.31-0.426 0.374l-4.166 1.44c-0.873 0.3-1.129 1.412-0.476 2.065L7.439 15.5 3 19.94V21h1.06l4.44-4.44 3.104 3.105c0.653 0.653 1.764 0.397 2.066-0.476l1.44-4.166c0.063-0.185 0.197-0.338 0.373-0.426l4.87-2.435c1.68-0.84 2.042-3.077 0.715-4.404z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@@ -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="M15.25 13c0.967 0 1.75 0.784 1.75 1.75v4.5c0 0.966-0.783 1.75-1.75 1.75H3.75C2.785 21 2 20.216 2 19.25v-4.5C2 13.784 2.785 13 3.75 13h11.5zM21 14.899v5.351c0 0.414-0.335 0.75-0.75 0.75-0.38 0-0.693-0.282-0.743-0.648L19.5 20.25v-5.338C19.732 14.969 19.975 15 20.226 15c0.268 0 0.527-0.035 0.775-0.101zM15.25 14.5H3.75c-0.138 0-0.25 0.112-0.25 0.25v4.5c0 0.138 0.112 0.25 0.25 0.25h11.5c0.139 0 0.25-0.112 0.25-0.25v-4.5c0-0.138-0.111-0.25-0.25-0.25zm5-4.408c1.054 0 1.908 0.854 1.908 1.908 0 1.054-0.854 1.908-1.908 1.908-1.053 0-1.908-0.854-1.908-1.908 0-1.054 0.855-1.908 1.908-1.908zM15.246 3c0.967 0 1.75 0.784 1.75 1.75v4.5c0 0.966-0.783 1.75-1.75 1.75h-11.5c-0.966 0-1.75-0.784-1.75-1.75v-4.5c0-0.918 0.707-1.671 1.607-1.744L3.746 3h11.5zm0 1.5h-11.5L3.69 4.507C3.579 4.533 3.496 4.632 3.496 4.75v4.5c0 0.138 0.112 0.25 0.25 0.25h11.5c0.138 0 0.25-0.112 0.25-0.25v-4.5c0-0.138-0.112-0.25-0.25-0.25zM20.25 3c0.38 0 0.694 0.282 0.744 0.648L21 3.75v5.351C20.754 9.035 20.495 9 20.227 9c-0.25 0-0.494 0.03-0.726 0.088V3.75C19.5 3.336 19.836 3 20.25 3z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageButton
style="?android:editTextStyle"
android:id="@+id/button"
android:contentDescription="@string/sk_timeline_icon"
android:paddingHorizontal="14dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="4dp"
android:layout_marginStart="24dp"
android:layout_marginBottom="16dp" />
<org.joinmastodon.android.ui.views.TextInputFrameLayout
android:id="@+id/input"
android:layout_marginStart="-8dp"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content" />
</LinearLayout>

View File

@@ -26,6 +26,17 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:visibility="gone"
android:paddingRight="16dp"/>
android:paddingHorizontal="8dp"
tools:ignore="RtlSymmetry" />
<ImageView
android:id="@+id/dragger_thingy"
android:layout_width="56dp"
android:layout_height="56dp"
android:scaleType="center"
android:tint="?colorDarkIcon"
android:importantForAccessibility="no"
android:src="@drawable/ic_fluent_re_order_dots_vertical_24_regular"
android:visibility="gone" />
</LinearLayout>

View File

@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/pin"
android:title="@string/sk_pin_timeline"
android:icon="@drawable/ic_fluent_pin_24_regular"
android:showAsAction="always" />
<item
android:id="@+id/follow_hashtag"
android:icon="@drawable/ic_fluent_person_add_24_regular"

View File

@@ -3,11 +3,13 @@
<item
android:id="@+id/announcements"
android:icon="@drawable/ic_fluent_megaphone_24_regular"
android:showAsAction="always"
android:title="@string/sk_announcements" />
<item
android:id="@+id/edit_timelines"
android:icon="@drawable/ic_fluent_edit_24_regular"
android:title="@string/sk_edit_timelines" />
<item
android:id="@+id/settings"
android:icon="@drawable/ic_fluent_settings_24_regular"
android:showAsAction="always"
android:title="@string/settings" />
</menu>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/home" android:icon="@drawable/ic_fluent_home_24_regular" android:title="@string/sk_timeline_home" />
<item android:id="@+id/local" android:icon="@drawable/ic_fluent_people_community_24_regular" android:title="@string/sk_timeline_local" />
<item android:id="@+id/federated" android:icon="@drawable/ic_fluent_earth_24_regular" android:title="@string/sk_timeline_federated" />
<item android:id="@+id/post_notifications" android:icon="@drawable/ic_fluent_alert_24_regular" android:title="@string/sk_notify_posts" />
<item android:id="@+id/lists" android:icon="@drawable/ic_fluent_people_list_24_regular" android:title="@string/sk_list_timelines" android:visible="false">
<menu />
</item>
<item android:id="@+id/followed_hashtags" android:icon="@drawable/ic_fluent_number_symbol_24_regular" android:title="@string/sk_hashtags_you_follow" android:visible="false">
<menu />
</item>
</menu>

View File

@@ -1,13 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/pin"
android:title="@string/sk_pin_timeline"
android:icon="@drawable/ic_fluent_pin_24_regular"
android:showAsAction="always" />
<item
android:id="@+id/edit"
android:title="@string/edit"
android:icon="@drawable/ic_fluent_edit_24_regular"
android:showAsAction="always"/>
android:icon="@drawable/ic_fluent_edit_24_regular" />
<item
android:id="@+id/delete"
android:title="@string/delete"
android:icon="@drawable/ic_fluent_delete_24_regular"
android:showAsAction="always"/>
android:icon="@drawable/ic_fluent_delete_24_regular" />
</menu>

View File

@@ -19,5 +19,6 @@
<item name="notifications_all" type="id"/>
<item name="notifications_mentions" type="id"/>
<item name="timeline_home" type="id" />
<item name="menu_add_timeline" type="id" />
<item name="menu_back" type="id" />
</resources>

View File

@@ -154,4 +154,20 @@
<string name="sk_publish_anyway">Publish anyway</string>
<string name="sk_settings_disable_alt_text_reminder">Disable alt text reminder</string>
<string name="sk_notify_posts_info_banner">If you enable post notifications for some people, their new posts will appear here.</string>
<string name="sk_timelines">Timelines</string>
<string name="sk_timeline_posts">Posts</string>
<string name="sk_timelines_add">Add</string>
<string name="sk_timeline">Timeline</string>
<string name="sk_list">List</string>
<string name="sk_hashtag">Hashtag</string>
<string name="sk_pin_timeline">Pin timeline</string>
<string name="sk_unpin_timeline">Unpin timeline</string>
<string name="sk_pinned_timeline">Pinned to home</string>
<string name="sk_unpinned_timeline">Unpinned from home</string>
<string name="sk_remove">Remove</string>
<string name="sk_timeline_icon">Icon</string>
<string name="sk_icon_heart">Heart</string>
<string name="sk_icon_star">Star</string>
<string name="sk_edit_timeline">Edit timeline</string>
<string name="sk_edit_timelines">Edit timelines</string>
</resources>