Hashtag timelines with multiple tags (#584)
* feat(api/hashtag): add any, all, and none parameter * feat(timeline/hashtag): load with any, all and none parameter * feat(timeline/hashtag): save any, all and none in timeline definition * feat: set hastag parameter in UI * feat: move strings to string res * feat: show hint for tags * refactor: use method for setting up tags text * improve edit dialog, allow creating hashtag timelines * add chips for hashtags * add option for displaying only local posts in hashtag * improve layout and wording --------- Co-authored-by: sk <sk22@mailbox.org>
This commit is contained in:
4
mastodon/src/main/res/color/chip_material_background.xml
Normal file
4
mastodon/src/main/res/color/chip_material_background.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="#F0F0F0"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</selector>
|
||||
@@ -0,0 +1,3 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="20dp" android:height="20dp" android:viewportWidth="20" android:viewportHeight="20">
|
||||
<path android:pathData="M2 4.5C2 3.12 3.12 2 4.5 2h6C11.88 2 13 3.12 13 4.5V7h2.5C16.88 7 18 8.12 18 9.5v6c0 1.38-1.12 2.5-2.5 2.5h-6C8.12 18 7 16.88 7 15.5V13H4.5C3.12 13 2 11.88 2 10.5v-6zM7 12V9.5C7 8.12 8.12 7 9.5 7H12V4.5C12 3.672 11.328 3 10.5 3h-6C3.672 3 3 3.672 3 4.5v6C3 11.328 3.672 12 4.5 12H7zm1 1v2.5C8 16.328 8.672 17 9.5 17h6c0.828 0 1.5-0.672 1.5-1.5v-6C17 8.672 16.328 8 15.5 8H13v2.5c0 1.38-1.12 2.5-2.5 2.5H8z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,3 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="20dp" android:height="20dp" android:viewportWidth="20" android:viewportHeight="20">
|
||||
<path android:pathData="M2 4.5C2 3.12 3.12 2 4.5 2h6C11.88 2 13 3.12 13 4.5V7h2.5C16.88 7 18 8.12 18 9.5v6c0 1.38-1.12 2.5-2.5 2.5h-6C8.12 18 7 16.88 7 15.5V13H4.5C3.12 13 2 11.88 2 10.5v-6zm10 0C12 3.672 11.328 3 10.5 3h-6C3.672 3 3 3.672 3 4.5v6C3 11.328 3.672 12 4.5 12H7V9.5c0-0.356 0.074-0.695 0.209-1.001 0.24-0.548 0.67-0.994 1.207-1.253L8.5 7.21C8.805 7.074 9.144 7 9.5 7H12V4.5zm-4 6.207V12h0.293L12 8.293V8h-1.293L8 10.707zm0.017-1.43l1.26-1.26c-0.65 0.097-1.163 0.61-1.26 1.26zM13 8v2.5c0 1.38-1.12 2.5-2.5 2.5H8v2.5C8 16.328 8.672 17 9.5 17h6c0.828 0 1.5-0.672 1.5-1.5v-6C17 8.672 16.328 8 15.5 8H13zm-3.293 4H10.5c0.828 0 1.5-0.672 1.5-1.5V9.707L9.707 12z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,3 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="20dp" android:height="20dp" android:viewportWidth="20" android:viewportHeight="20">
|
||||
<path android:pathData="M4.5 2C3.12 2 2 3.12 2 4.5v6C2 11.88 3.12 13 4.5 13H7v2.5C7 16.88 8.12 18 9.5 18h6c1.38 0 2.5-1.12 2.5-2.5v-6C18 8.12 16.88 7 15.5 7H13V4.5C13 3.12 11.88 2 10.5 2h-6zM8 9.5C8 8.672 8.672 8 9.5 8h6C16.328 8 17 8.672 17 9.5v6c0 0.828-0.672 1.5-1.5 1.5h-6C8.672 17 8 16.328 8 15.5v-6z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,3 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="20dp" android:height="20dp" android:viewportWidth="20" android:viewportHeight="20">
|
||||
<path android:pathData="M4.5 2C3.12 2 2 3.12 2 4.5v6C2 11.88 3.12 13 4.5 13H7v2.5C7 16.88 8.12 18 9.5 18h6c1.38 0 2.5-1.12 2.5-2.5v-6C18 8.12 16.88 7 15.5 7H13V4.5C13 3.12 11.88 2 10.5 2h-6z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,3 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="20dp" android:height="20dp" android:viewportWidth="20" android:viewportHeight="20">
|
||||
<path android:pathData="M4.5 2C3.12 2 2 3.12 2 4.5v6c0 0.818 0.393 1.544 1 2l0.004 0.003c0.038 0.029 0.078 0.056 0.117 0.083 0.344 0.227 0.746 0.372 1.18 0.406h0.007C4.37 12.998 4.435 13 4.5 13H7v2.5c0 0.241 0.034 0.474 0.098 0.695l0.014 0.048c0.101 0.324 0.266 0.62 0.48 0.872 0.246 0.29 0.556 0.523 0.909 0.677l0.026 0.011C8.826 17.93 9.155 18 9.5 18h6c0.073 0 0.145-0.003 0.216-0.01 1.208-0.103 2.171-1.066 2.275-2.274v-0.008C17.997 15.64 18 15.57 18 15.5v-6c0-0.355-0.074-0.693-0.208-1-0.154-0.352-0.387-0.663-0.677-0.908L17.09 7.57c-0.26-0.214-0.563-0.377-0.895-0.473C15.975 7.034 15.741 7 15.5 7H13V4.5c0-0.067-0.003-0.133-0.008-0.2-0.034-0.433-0.179-0.835-0.406-1.179L12.58 3.115C12.554 3.075 12.527 3.037 12.5 3c-0.457-0.607-1.183-1-2.001-1h-6zm6.647 1.146l-8 8C3.052 10.952 3 10.733 3 10.5V9.557L9.557 3H10.5c0.232 0 0.45 0.053 0.647 0.146zm-7.294 8.708l8-8C11.949 4.048 12 4.267 12 4.5v0.793L5.293 12H4.5c-0.231 0-0.45-0.053-0.647-0.146zM12 6.707V7.5c0 0.214 0.135 0.397 0.325 0.468l-4.357 4.357C7.898 12.135 7.714 12 7.5 12H6.707L12 6.707zM13.707 8h1.586L8 15.293v-1.586L13.707 8zm2.697 0.303c0.313 0.237 0.53 0.594 0.584 1.002l-7.682 7.683c-0.409-0.053-0.766-0.27-1.003-0.584l8.101-8.101zM17 10.707v1.586L12.293 17h-1.586L17 10.707zm0 3v1.586L15.293 17h-1.586L17 13.707zM3 8.143V6.557L6.557 3h1.586L3 8.143zm0-3V4.5C3 3.672 3.672 3 4.5 3h0.643L3 5.143z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||
</vector>
|
||||
@@ -1,22 +1,201 @@
|
||||
<?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>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button"
|
||||
style="?android:editTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:contentDescription="@string/sk_timeline_icon"
|
||||
android:paddingHorizontal="14dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/input"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?colorPollVoted" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/advanced"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:minHeight="32dp"
|
||||
android:background="@drawable/bg_inline_button"
|
||||
android:elevation="0dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/sk_advanced_options_show" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tag_wrap"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/sk_edit_timeline_tag_main"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:drawableStart="@drawable/ic_fluent_number_symbol_20_filled"
|
||||
android:drawablePadding="12dp"
|
||||
android:drawableTint="?android:textColorSecondary"
|
||||
android:textColor="?android:textColorSecondary" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/tag_main"
|
||||
android:hint="@string/sk_edit_timeline_tag_hint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/sk_edit_timeline_tag_any"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:drawableStart="@drawable/ic_fluent_shape_union_20_filled"
|
||||
android:drawablePadding="12dp"
|
||||
android:drawableTint="?android:textColorSecondary"
|
||||
android:textColor="?android:textColorSecondary" />
|
||||
|
||||
<com.hootsuite.nachos.NachoTextView
|
||||
style="@style/Widget.Mastodon.EditText"
|
||||
android:id="@+id/tags_any"
|
||||
android:hint="@string/sk_edit_timeline_tags_hint"
|
||||
android:paddingVertical="8sp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
app:chipBackground="?colorAccentLightest"
|
||||
app:chipTextColor="?android:textColorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/sk_edit_timeline_tag_all"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:drawableStart="@drawable/ic_fluent_shape_intersect_20_filled"
|
||||
android:drawablePadding="12dp"
|
||||
android:drawableTint="?android:textColorSecondary"
|
||||
android:textColor="?android:textColorSecondary" />
|
||||
|
||||
<com.hootsuite.nachos.NachoTextView
|
||||
style="@style/Widget.Mastodon.EditText"
|
||||
android:id="@+id/tags_all"
|
||||
android:hint="@string/sk_edit_timeline_tags_hint"
|
||||
android:paddingVertical="8sp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
app:chipBackground="?colorAccentLightest"
|
||||
app:chipTextColor="?android:textColorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/sk_edit_timeline_tag_none"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:drawableStart="@drawable/ic_fluent_shape_subtract_20_filled"
|
||||
android:drawablePadding="16dp"
|
||||
android:drawableTint="?android:textColorSecondary"
|
||||
android:textColor="?android:textColorSecondary" />
|
||||
|
||||
<com.hootsuite.nachos.NachoTextView
|
||||
style="@style/Widget.Mastodon.EditText"
|
||||
android:id="@+id/tags_none"
|
||||
android:hint="@string/sk_edit_timeline_tags_hint"
|
||||
android:paddingVertical="8sp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
app:chipBackground="?colorAccentLightest"
|
||||
app:chipTextColor="?android:textColorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/sk_edit_timeline_tags_explanation" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/local_only"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:minHeight="48dp"
|
||||
android:gravity="center_vertical"
|
||||
android:layoutDirection="locale">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingVertical="8dp"
|
||||
android:textSize="16sp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:drawableStart="@drawable/ic_fluent_eye_24_regular"
|
||||
android:drawableTint="?android:textColorPrimary"
|
||||
android:drawablePadding="16dp"
|
||||
android:text="@string/sk_hashtag_timeline_local_only_switch" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/local_only_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:focusable="false"
|
||||
android:clickable="false"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
@@ -50,15 +50,6 @@
|
||||
android:gravity="center_vertical"
|
||||
android:layoutDirection="locale">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:tint="?android:textColorPrimary"
|
||||
android:src="@drawable/ic_fluent_rss_24_regular"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -66,6 +57,9 @@
|
||||
android:paddingVertical="8dp"
|
||||
android:textSize="16sp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:drawableStart="@drawable/ic_fluent_rss_24_regular"
|
||||
android:drawableTint="?android:textColorPrimary"
|
||||
android:drawablePadding="16dp"
|
||||
android:text="@string/sk_list_exclusive_switch" />
|
||||
|
||||
<Switch
|
||||
@@ -73,7 +67,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:duplicateParentState="true"
|
||||
android:focusable="false"
|
||||
android:clickable="false"/>
|
||||
|
||||
|
||||
12
mastodon/src/main/res/values/nachos_attrs.xml
Normal file
12
mastodon/src/main/res/values/nachos_attrs.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="NachoTextView">
|
||||
<attr name="chipHorizontalSpacing" format="reference|dimension" />
|
||||
<attr name="chipBackground" format="reference|color"/>
|
||||
<attr name="chipCornerRadius" format="reference|dimension"/>
|
||||
<attr name="chipTextColor" format="reference|color"/>
|
||||
<attr name="chipTextSize" format="reference|dimension"/>
|
||||
<attr name="chipHeight" format="reference|dimension"/>
|
||||
<attr name="chipVerticalSpacing" format="reference|dimension"/>
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
5
mastodon/src/main/res/values/nachos_colors.xml
Normal file
5
mastodon/src/main/res/values/nachos_colors.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="chip_default_text_color">#DE000000</color>
|
||||
<color name="chip_default_icon_background_color">#517FA4</color>
|
||||
</resources>
|
||||
7
mastodon/src/main/res/values/nachos_dimens.xml
Normal file
7
mastodon/src/main/res/values/nachos_dimens.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="chip_default_padding_edge">12dp</dimen>
|
||||
<dimen name="chip_default_padding_between_image">8dp</dimen>
|
||||
<dimen name="chip_default_left_margin">0dp</dimen>
|
||||
<dimen name="chip_default_right_margin">0dp</dimen>
|
||||
</resources>
|
||||
3
mastodon/src/main/res/values/nachos_strings.xml
Normal file
3
mastodon/src/main/res/values/nachos_strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="chip_ellipsis">…</string>
|
||||
</resources>
|
||||
10
mastodon/src/main/res/values/nachos_styles.xml
Normal file
10
mastodon/src/main/res/values/nachos_styles.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<style name="DefaultChipSuggestionTextView">
|
||||
<item name="chipHorizontalSpacing">6dp</item>
|
||||
<item name="chipBackground">@color/chip_material_background</item>
|
||||
<item name="chipTextSize">14sp</item>
|
||||
<item name="chipHeight">32dp</item>
|
||||
<item name="chipVerticalSpacing">4dp</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -229,7 +229,17 @@
|
||||
<string name="sk_icon_pin">Pin</string>
|
||||
<string name="sk_icon_feed">Feed</string>
|
||||
<string name="sk_edit_timeline">Edit timeline</string>
|
||||
<string name="sk_add_timeline">Add timeline</string>
|
||||
<string name="sk_edit_timelines">Edit timelines</string>
|
||||
<string name="sk_edit_timeline_tag_main">Posts containing hashtag…</string>
|
||||
<string name="sk_edit_timeline_tag_any">…or any of these</string>
|
||||
<string name="sk_edit_timeline_tag_all">…and every one of these</string>
|
||||
<string name="sk_edit_timeline_tag_none">…but none of these</string>
|
||||
<string name="sk_edit_timeline_tag_hint">Enter hashtag…</string>
|
||||
<string name="sk_edit_timeline_tags_hint">Enter hashtags…</string>
|
||||
<string name="sk_edit_timeline_tags_explanation">Please note that the server handles these operations. Combining them might not be supported.</string>
|
||||
<string name="sk_hashtag_timeline_local_only_switch">Show only local posts?</string>
|
||||
<string name="sk_add_timeline_tag_error_empty">Hashtag must not be empty</string>
|
||||
<string name="sk_alt_button">ALT</string>
|
||||
<string name="sk_post_edited">edited</string>
|
||||
<string name="sk_notification_type_update">Edited posts</string>
|
||||
@@ -309,4 +319,6 @@
|
||||
<string name="sk_exclusive_list">Exclusive list</string>
|
||||
<string name="sk_list_exclusive_switch">Make list exclusive</string>
|
||||
<string name="sk_list_exclusive_switch_explanation">Members of an exclusive list will not show up on your home timeline – if your instance supports it.</string>
|
||||
<string name="sk_advanced_options_show">Show advanced options</string>
|
||||
<string name="sk_advanced_options_hide">Hide advanced options</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user