diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/requests/accounts/GetAccountBlocks.java b/mastodon/src/main/java/org/joinmastodon/android/api/requests/accounts/GetAccountBlocks.java new file mode 100644 index 000000000..16d0403a4 --- /dev/null +++ b/mastodon/src/main/java/org/joinmastodon/android/api/requests/accounts/GetAccountBlocks.java @@ -0,0 +1,16 @@ +package org.joinmastodon.android.api.requests.accounts; + +import com.google.gson.reflect.TypeToken; + +import org.joinmastodon.android.api.requests.HeaderPaginationRequest; +import org.joinmastodon.android.model.Account; + +public class GetAccountBlocks extends HeaderPaginationRequest{ + public GetAccountBlocks(String maxID, int limit){ + super(HttpMethod.GET, "/blocks", new TypeToken<>(){}); + if(maxID!=null) + addQueryParameter("max_id", maxID); + if(limit>0) + addQueryParameter("limit", limit+""); + } +} diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/requests/accounts/GetAccountMutes.java b/mastodon/src/main/java/org/joinmastodon/android/api/requests/accounts/GetAccountMutes.java new file mode 100644 index 000000000..966b36c51 --- /dev/null +++ b/mastodon/src/main/java/org/joinmastodon/android/api/requests/accounts/GetAccountMutes.java @@ -0,0 +1,16 @@ +package org.joinmastodon.android.api.requests.accounts; + +import com.google.gson.reflect.TypeToken; + +import org.joinmastodon.android.api.requests.HeaderPaginationRequest; +import org.joinmastodon.android.model.Account; + +public class GetAccountMutes extends HeaderPaginationRequest{ + public GetAccountMutes(String maxID, int limit){ + super(HttpMethod.GET, "/mutes/", new TypeToken<>(){}); + if(maxID!=null) + addQueryParameter("max_id", maxID); + if(limit>0) + addQueryParameter("limit", limit+""); + } +} diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java index b6723ab87..66adff199 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java @@ -68,8 +68,10 @@ import org.joinmastodon.android.api.requests.accounts.SetPrivateNote; import org.joinmastodon.android.api.requests.accounts.UpdateAccountCredentials; import org.joinmastodon.android.api.requests.instance.GetInstance; import org.joinmastodon.android.api.session.AccountSessionManager; +import org.joinmastodon.android.fragments.account_list.BlocksListFragment; import org.joinmastodon.android.fragments.account_list.FollowerListFragment; import org.joinmastodon.android.fragments.account_list.FollowingListFragment; +import org.joinmastodon.android.fragments.account_list.MutesListFragment; import org.joinmastodon.android.fragments.report.ReportReasonChoiceFragment; import org.joinmastodon.android.fragments.settings.SettingsServerFragment; import org.joinmastodon.android.model.Account; @@ -917,6 +919,16 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList args.putString("profileDisplayUsername", account.getDisplayUsername()); } Nav.go(getActivity(), ListsFragment.class, args); + }else if(id==R.id.mutes){ + final Bundle args=new Bundle(); + args.putString("account", accountID); + args.putParcelable("targetAccount", Parcels.wrap(account)); + Nav.go(getActivity(), MutesListFragment.class, args); + }else if(id==R.id.blocks){ + final Bundle args=new Bundle(); + args.putString("account", accountID); + args.putParcelable("targetAccount", Parcels.wrap(account)); + Nav.go(getActivity(), BlocksListFragment.class, args); }else if(id==R.id.followed_hashtags){ Bundle args=new Bundle(); args.putString("account", accountID); diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/BlocksListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/BlocksListFragment.java new file mode 100644 index 000000000..38a4c80b7 --- /dev/null +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/BlocksListFragment.java @@ -0,0 +1,37 @@ +package org.joinmastodon.android.fragments.account_list; + +import android.net.Uri; +import android.os.Bundle; + +import org.joinmastodon.android.R; +import org.joinmastodon.android.api.requests.HeaderPaginationRequest; +import org.joinmastodon.android.api.requests.accounts.GetAccountBlocks; +import org.joinmastodon.android.api.requests.accounts.GetAccountMutes; +import org.joinmastodon.android.model.Account; +import org.joinmastodon.android.ui.viewholders.AccountViewHolder; + +public class BlocksListFragment extends AccountRelatedAccountListFragment{ + + @Override + public void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + setTitle(R.string.sk_blocked_account); + } + + @Override + public HeaderPaginationRequest onCreateRequest(String maxID, int count){ + return new GetAccountBlocks(maxID, count); + } + + @Override + protected void onConfigureViewHolder(AccountViewHolder holder){ + super.onConfigureViewHolder(holder); + holder.setStyle(AccountViewHolder.AccessoryType.NONE, false); + } + + @Override + public Uri getWebUri(Uri.Builder base) { + return super.getWebUri(base).buildUpon() + .appendPath("/blocks").build(); + } +} diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/MutesListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/MutesListFragment.java new file mode 100644 index 000000000..35ff5a4fb --- /dev/null +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/MutesListFragment.java @@ -0,0 +1,36 @@ +package org.joinmastodon.android.fragments.account_list; + +import android.net.Uri; +import android.os.Bundle; + +import org.joinmastodon.android.R; +import org.joinmastodon.android.api.requests.HeaderPaginationRequest; +import org.joinmastodon.android.api.requests.accounts.GetAccountMutes; +import org.joinmastodon.android.model.Account; +import org.joinmastodon.android.ui.viewholders.AccountViewHolder; + +public class MutesListFragment extends AccountRelatedAccountListFragment{ + + @Override + public void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + setTitle(R.string.sk_muted_account); + } + + @Override + public HeaderPaginationRequest onCreateRequest(String maxID, int count){ + return new GetAccountMutes(maxID, count); + } + + @Override + protected void onConfigureViewHolder(AccountViewHolder holder){ + super.onConfigureViewHolder(holder); + holder.setStyle(AccountViewHolder.AccessoryType.NONE, false); + } + + @Override + public Uri getWebUri(Uri.Builder base) { + return super.getWebUri(base).buildUpon() + .appendPath("/mutes").build(); + } +} diff --git a/mastodon/src/main/res/menu/profile_own.xml b/mastodon/src/main/res/menu/profile_own.xml index efaac2533..4e9f8f05c 100644 --- a/mastodon/src/main/res/menu/profile_own.xml +++ b/mastodon/src/main/res/menu/profile_own.xml @@ -8,5 +8,7 @@ + + \ No newline at end of file diff --git a/mastodon/src/main/res/values/strings_sk.xml b/mastodon/src/main/res/values/strings_sk.xml index 3b297d259..d8fadf3c2 100644 --- a/mastodon/src/main/res/values/strings_sk.xml +++ b/mastodon/src/main/res/values/strings_sk.xml @@ -269,7 +269,7 @@ Indicator for alt texts Indicator for missing alt texts Enable pre-releases - “Show new posts” button + “See new posts” button local-only mentioned-only · @@ -404,4 +404,8 @@ %d day %d days + Muted accounts + Mutes + Blocked accounts + Blocks \ No newline at end of file