hide follow requests icon when none waiting
This commit is contained in:
@@ -16,7 +16,6 @@ import android.widget.LinearLayout;
|
|||||||
import org.joinmastodon.android.E;
|
import org.joinmastodon.android.E;
|
||||||
import org.joinmastodon.android.R;
|
import org.joinmastodon.android.R;
|
||||||
import org.joinmastodon.android.api.requests.accounts.GetFollowRequests;
|
import org.joinmastodon.android.api.requests.accounts.GetFollowRequests;
|
||||||
import org.joinmastodon.android.api.requests.accounts.GetOwnAccount;
|
|
||||||
import org.joinmastodon.android.events.FollowRequestHandledEvent;
|
import org.joinmastodon.android.events.FollowRequestHandledEvent;
|
||||||
import org.joinmastodon.android.model.Account;
|
import org.joinmastodon.android.model.Account;
|
||||||
import org.joinmastodon.android.ui.SimpleViewHolder;
|
import org.joinmastodon.android.ui.SimpleViewHolder;
|
||||||
@@ -75,16 +74,6 @@ public class NotificationsFragment extends MastodonToolbarFragment implements Sc
|
|||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater){
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater){
|
||||||
inflater.inflate(R.menu.notifications, menu);
|
inflater.inflate(R.menu.notifications, menu);
|
||||||
|
|
||||||
new GetOwnAccount().setCallback(new Callback<>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Account account) {
|
|
||||||
if (!account.locked) menu.findItem(R.id.follow_requests).setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(ErrorResponse error) {}
|
|
||||||
}).exec(accountID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -173,7 +162,7 @@ public class NotificationsFragment extends MastodonToolbarFragment implements Sc
|
|||||||
new GetFollowRequests(null, null, 1).setCallback(new Callback<>() {
|
new GetFollowRequests(null, null, 1).setCallback(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<Account> accounts) {
|
public void onSuccess(List<Account> accounts) {
|
||||||
getToolbar().getMenu().findItem(R.id.follow_requests).setIcon(accounts.isEmpty() ? R.drawable.ic_fluent_person_add_24_regular : R.drawable.ic_follow_requests_24_badged);
|
getToolbar().getMenu().findItem(R.id.follow_requests).setVisible(!accounts.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item
|
<item
|
||||||
android:id="@+id/follow_requests"
|
android:id="@+id/follow_requests"
|
||||||
android:icon="@drawable/ic_fluent_person_add_24_regular"
|
android:icon="@drawable/ic_follow_requests_24_badged"
|
||||||
android:showAsAction="always"
|
android:showAsAction="always"
|
||||||
android:title="@string/follow_requests" />
|
android:title="@string/follow_requests" />
|
||||||
</menu>
|
</menu>
|
||||||
Reference in New Issue
Block a user