feat: add mute hashtag option

Fixes https://github.com/LucasGGamerM/moshidon/issues/260, by opening the create filter page
This commit is contained in:
FineFindus
2023-09-24 12:33:17 +02:00
parent 4b79d35854
commit f293619189
3 changed files with 21 additions and 0 deletions

View File

@@ -13,17 +13,23 @@ import android.widget.Toast;
import org.joinmastodon.android.E;
import org.joinmastodon.android.R;
import org.joinmastodon.android.api.requests.filters.GetFilters;
import org.joinmastodon.android.api.requests.tags.GetHashtag;
import org.joinmastodon.android.api.requests.tags.SetHashtagFollowed;
import org.joinmastodon.android.api.requests.timelines.GetHashtagTimeline;
import org.joinmastodon.android.events.HashtagUpdatedEvent;
import org.joinmastodon.android.fragments.settings.EditFilterFragment;
import org.joinmastodon.android.model.Filter;
import org.joinmastodon.android.model.FilterContext;
import org.joinmastodon.android.model.FilterKeyword;
import org.joinmastodon.android.model.Hashtag;
import org.joinmastodon.android.model.Status;
import org.joinmastodon.android.model.TimelineDefinition;
import org.joinmastodon.android.ui.utils.UiUtils;
import org.joinmastodon.android.utils.StatusFilterPredicate;
import org.parceler.Parcels;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -116,6 +122,14 @@ public class HashtagTimelineFragment extends PinnableStatusListFragment {
}
}).exec(accountID);
return true;
} else if (item.getItemId() == R.id.mute_hashtag) {
Bundle args=new Bundle();
args.putString("account", accountID);
FilterKeyword hashtagFilter=new FilterKeyword();
hashtagFilter.wholeWord=true;
hashtagFilter.keyword=hashtag;
args.putParcelableArrayList("words", new ArrayList<>(List.of(Parcels.wrap(hashtagFilter))));
Nav.go(getActivity(), EditFilterFragment.class, args);
}
return false;
}

View File

@@ -10,4 +10,8 @@
android:icon="@drawable/ic_fluent_person_add_24_regular"
android:showAsAction="always"
android:title="@string/button_follow"/>
<item
android:id="@+id/mute_hashtag"
android:icon="@drawable/ic_fluent_speaker_mute_24_regular"
android:title="@string/mo_mute_hashtag"/>
</menu>

View File

@@ -106,4 +106,7 @@
<string name="mo_confirm_unfollow">Confirm to unfollow %s</string>
<string name="mo_recent_emoji_cleared">Recent emoji cleared</string>
<string name="mo_show_media_preview">Show media preview in timelines</string>
<string name="mo_mute_hashtag">Mute Hashtag</string>
</resources>