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-20 22:17:47 -03:00
committed by LucasGGamerM
parent 901f1763ab
commit b63c0010a9
22 changed files with 926 additions and 201 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

@@ -1,3 +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>
</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,7 +26,18 @@
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" />
<!-- <ImageView-->
<!-- android:id="@+id/edit"-->

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

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

View File

@@ -33,7 +33,7 @@
<string name="sk_follow_requests">Follow requests</string>
<string name="sk_accept_follow_request">Accept follow request</string>
<string name="sk_reject_follow_request">Reject follow request</string>
<string name="sk_lists_with_user">Lists with %s</string>
<string name="sk_lists_with_user">Edit lists with %s</string>
<string name="sk_settings_always_reveal_content_warnings">Always reveal content warnings</string>
<string name="sk_disable_marquee">Disable scrolling text in title bars</string>
<string name="sk_settings_contribute">Contribute to Megalodon</string>
@@ -143,7 +143,7 @@
<string name="sk_timeline_home">Home</string>
<string name="sk_timeline_local">Local</string>
<string name="sk_timeline_federated">Federation</string>
<string name="sk_recent_searches_placeholder">Type to start searching</string>
<string name="sk_recent_searches_placeholder">Type something to start searching</string>
<string name="sk_remove_follower">Remove as follower</string>
<string name="sk_remove_follower_confirm">Remove %s as a follower by blocking and immediately unblocking them?</string>
<string name="sk_do_remove_follower">Remove</string>
@@ -168,70 +168,6 @@
<string name="sk_timeline_icon">Icon</string>
<string name="sk_icon_heart">Heart</string>
<string name="sk_icon_star">Star</string>
<string name="sk_icon_city">City</string>
<string name="sk_icon_cat">Cat</string>
<string name="sk_icon_dog">Dog</string>
<string name="sk_icon_rabbit">Rabbit</string>
<string name="sk_icon_turtle">Turtle</string>
<string name="sk_icon_balloon">Balloon</string>
<string name="sk_icon_image">Image</string>
<string name="sk_icon_bot">Bot</string>
<string name="sk_icon_language">Language</string>
<string name="sk_icon_location">Location</string>
<string name="sk_icon_megaphone">Megaphone</string>
<string name="sk_icon_microphone">Microphone</string>
<string name="sk_icon_microscope">Microscope</string>
<string name="sk_icon_keyboard">Keyboard</string>
<string name="sk_icon_coffee">Coffee</string>
<string name="sk_icon_laugh">Laugh</string>
<string name="sk_icon_news">News</string>
<string name="sk_icon_pi">Pi</string>
<string name="sk_icon_color_palette">Color palette</string>
<string name="sk_icon_academic_cap">Academic cap</string>
<string name="sk_icon_tag">Tag</string>
<string name="sk_icon_stethoscope">Stethoscope</string>
<string name="sk_icon_weather">Weather</string>
<string name="sk_icon_games">Games</string>
<string name="sk_icon_code">Code</string>
<string name="sk_icon_light_bulb">Light bulb</string>
<string name="sk_icon_train">Train</string>
<string name="sk_icon_clapper_board">Clapper board</string>
<string name="sk_icon_leaves">Leaves</string>
<string name="sk_icon_sport">Sport</string>
<string name="sk_icon_aperture">Aperture</string>
<string name="sk_icon_music">Music</string>
<string name="sk_icon_people">People</string>
<string name="sk_icon_health">Health</string>
<string name="sk_icon_important">Important</string>
<string name="sk_icon_chat">Chat</string>
<string name="sk_icon_shield">Shield</string>
<string name="sk_icon_book">Book</string>
<string name="sk_icon_bicycle">Bicycle</string>
<string name="sk_icon_map">Map</string>
<string name="sk_icon_math_formula">Math formula</string>
<string name="sk_icon_backpack">Backpack</string>
<string name="sk_icon_briefcase">Briefcase</string>
<string name="sk_icon_fire">Fire</string>
<string name="sk_icon_bug">Bug</string>
<string name="sk_icon_pizza">Pizza</string>
<string name="sk_icon_gavel">Gavel</string>
<string name="sk_icon_gauge">Gauge</string>
<string name="sk_icon_headphones">Headphones</string>
<string name="sk_icon_human">Human</string>
<string name="sk_icon_globe">Globe</string>
<string name="sk_icon_pin">Pin</string>
<string name="sk_edit_timeline">Edit timeline</string>
<string name="sk_edit_timelines">Edit timelines</string>
<string name="sk_alt_button">ALT</string>
<string name="sk_post_edited">edited</string>
<string name="sk_notification_type_update">Edited posts</string>
<string name="sk_notify_update">Edits a reblogged post</string>
<string name="sk_attach_file">Attach file</string>
<string name="sk_searching">Searching…</string>
<string name="sk_no_results">No results</string>
<string name="sk_save_draft">Save draft?</string>
<string name="sk_save_draft_message">Do you want to save your changes to this draft or publish it now?</string>
<string name="sk_no_alt_text">No alt text available</string>
<string name="sk_settings_show_alt_indicator">Indicator for alt texts</string>
<string name="sk_settings_show_no_alt_indicator">Indicator for missing alt texts</string>
</resources>