add accept/decline buttons
This commit is contained in:
parent
ae50e618c0
commit
5fa81e6c8a
|
@ -78,7 +78,7 @@ public class NotificationsListFragment extends BaseStatusListFragment<Notificati
|
||||||
items.add(0, titleItem);
|
items.add(0, titleItem);
|
||||||
return items;
|
return items;
|
||||||
}else if(titleItem!=null){
|
}else if(titleItem!=null){
|
||||||
AccountCardStatusDisplayItem card=new AccountCardStatusDisplayItem(n.id, this, n.account);
|
AccountCardStatusDisplayItem card=new AccountCardStatusDisplayItem(n.id, this, n.account, n.type);
|
||||||
return Arrays.asList(titleItem, card);
|
return Arrays.asList(titleItem, card);
|
||||||
}else{
|
}else{
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.widget.TextView;
|
||||||
import org.joinmastodon.android.R;
|
import org.joinmastodon.android.R;
|
||||||
import org.joinmastodon.android.fragments.BaseStatusListFragment;
|
import org.joinmastodon.android.fragments.BaseStatusListFragment;
|
||||||
import org.joinmastodon.android.model.Account;
|
import org.joinmastodon.android.model.Account;
|
||||||
|
import org.joinmastodon.android.model.Notification;
|
||||||
import org.joinmastodon.android.model.Relationship;
|
import org.joinmastodon.android.model.Relationship;
|
||||||
import org.joinmastodon.android.ui.OutlineProviders;
|
import org.joinmastodon.android.ui.OutlineProviders;
|
||||||
import org.joinmastodon.android.ui.text.HtmlParser;
|
import org.joinmastodon.android.ui.text.HtmlParser;
|
||||||
|
@ -31,13 +32,15 @@ import me.grishka.appkit.utils.V;
|
||||||
|
|
||||||
public class AccountCardStatusDisplayItem extends StatusDisplayItem{
|
public class AccountCardStatusDisplayItem extends StatusDisplayItem{
|
||||||
private final Account account;
|
private final Account account;
|
||||||
|
private final Notification.Type type;
|
||||||
public ImageLoaderRequest avaRequest, coverRequest;
|
public ImageLoaderRequest avaRequest, coverRequest;
|
||||||
public CustomEmojiHelper emojiHelper=new CustomEmojiHelper();
|
public CustomEmojiHelper emojiHelper=new CustomEmojiHelper();
|
||||||
public CharSequence parsedName, parsedBio;
|
public CharSequence parsedName, parsedBio;
|
||||||
|
|
||||||
public AccountCardStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, Account account){
|
public AccountCardStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, Account account, Notification.Type type){
|
||||||
super(parentID, parentFragment);
|
super(parentID, parentFragment);
|
||||||
this.account=account;
|
this.account=account;
|
||||||
|
this.type=type;
|
||||||
if(!TextUtils.isEmpty(account.avatar))
|
if(!TextUtils.isEmpty(account.avatar))
|
||||||
avaRequest=new UrlImageLoaderRequest(account.avatar, V.dp(50), V.dp(50));
|
avaRequest=new UrlImageLoaderRequest(account.avatar, V.dp(50), V.dp(50));
|
||||||
if(!TextUtils.isEmpty(account.header))
|
if(!TextUtils.isEmpty(account.header))
|
||||||
|
@ -73,9 +76,9 @@ public class AccountCardStatusDisplayItem extends StatusDisplayItem{
|
||||||
public static class Holder extends StatusDisplayItem.Holder<AccountCardStatusDisplayItem> implements ImageLoaderViewHolder{
|
public static class Holder extends StatusDisplayItem.Holder<AccountCardStatusDisplayItem> implements ImageLoaderViewHolder{
|
||||||
private final ImageView cover, avatar;
|
private final ImageView cover, avatar;
|
||||||
private final TextView name, username, bio, followersCount, followingCount, postsCount, followersLabel, followingLabel, postsLabel;
|
private final TextView name, username, bio, followersCount, followingCount, postsCount, followersLabel, followingLabel, postsLabel;
|
||||||
private final ProgressBarButton actionButton;
|
private final ProgressBarButton actionButton, rejectButton;
|
||||||
private final ProgressBar actionProgress;
|
private final ProgressBar actionProgress, rejectProgress;
|
||||||
private final View actionWrap;
|
private final View actionWrap, rejectWrap;
|
||||||
|
|
||||||
private Relationship relationship;
|
private Relationship relationship;
|
||||||
|
|
||||||
|
@ -96,6 +99,9 @@ public class AccountCardStatusDisplayItem extends StatusDisplayItem{
|
||||||
actionButton=findViewById(R.id.action_btn);
|
actionButton=findViewById(R.id.action_btn);
|
||||||
actionProgress=findViewById(R.id.action_progress);
|
actionProgress=findViewById(R.id.action_progress);
|
||||||
actionWrap=findViewById(R.id.action_btn_wrap);
|
actionWrap=findViewById(R.id.action_btn_wrap);
|
||||||
|
rejectButton=findViewById(R.id.reject_btn);
|
||||||
|
rejectProgress=findViewById(R.id.reject_progress);
|
||||||
|
rejectWrap=findViewById(R.id.reject_btn_wrap);
|
||||||
|
|
||||||
View card=findViewById(R.id.card);
|
View card=findViewById(R.id.card);
|
||||||
card.setOutlineProvider(OutlineProviders.roundedRect(6));
|
card.setOutlineProvider(OutlineProviders.roundedRect(6));
|
||||||
|
@ -121,7 +127,23 @@ public class AccountCardStatusDisplayItem extends StatusDisplayItem{
|
||||||
relationship=item.parentFragment.getRelationship(item.account.id);
|
relationship=item.parentFragment.getRelationship(item.account.id);
|
||||||
if(relationship==null){
|
if(relationship==null){
|
||||||
actionWrap.setVisibility(View.GONE);
|
actionWrap.setVisibility(View.GONE);
|
||||||
|
}else if(item.type == Notification.Type.FOLLOW_REQUEST){
|
||||||
|
actionWrap.setVisibility(View.VISIBLE);
|
||||||
|
rejectWrap.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
// i hate that i wasn't able to do this in xml
|
||||||
|
actionButton.setCompoundDrawableTintList(actionButton.getTextColors());
|
||||||
|
actionProgress.setIndeterminateTintList(actionButton.getTextColors());
|
||||||
|
actionButton.setContentDescription(item.parentFragment.getString(R.string.accept_follow_request));
|
||||||
|
rejectButton.setCompoundDrawableTintList(rejectButton.getTextColors());
|
||||||
|
rejectProgress.setIndeterminateTintList(rejectButton.getTextColors());
|
||||||
|
rejectButton.setContentDescription(item.parentFragment.getString(R.string.reject_follow_request));
|
||||||
|
|
||||||
|
actionButton.setOnClickListener(i -> {
|
||||||
|
|
||||||
|
});
|
||||||
}else{
|
}else{
|
||||||
|
actionButton.setCompoundDrawables(null, null, null, null);
|
||||||
actionWrap.setVisibility(View.VISIBLE);
|
actionWrap.setVisibility(View.VISIBLE);
|
||||||
UiUtils.setRelationshipToActionButton(relationship, actionButton);
|
UiUtils.setRelationshipToActionButton(relationship, actionButton);
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,6 +156,35 @@
|
||||||
android:layout_height="1px"
|
android:layout_height="1px"
|
||||||
android:layout_weight="1"/>
|
android:layout_weight="1"/>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/reject_btn_wrap"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:paddingVertical="8dp"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<org.joinmastodon.android.ui.views.ProgressBarButton
|
||||||
|
android:id="@+id/reject_btn"
|
||||||
|
style="?secondaryButtonStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableStart="@drawable/ic_fluent_dismiss_24_filled"
|
||||||
|
android:singleLine="true"/>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/reject_progress"
|
||||||
|
style="?android:progressBarStyleSmall"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:elevation="10dp"
|
||||||
|
android:indeterminate="true"
|
||||||
|
android:outlineProvider="none"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/action_btn_wrap"
|
android:id="@+id/action_btn_wrap"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -169,6 +198,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
android:drawableStart="@drawable/ic_fluent_checkmark_24_filled"
|
||||||
tools:text="@string/follow_back"/>
|
tools:text="@string/follow_back"/>
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/action_progress"
|
android:id="@+id/action_progress"
|
||||||
|
|
|
@ -377,4 +377,6 @@
|
||||||
<!-- %s is file size -->
|
<!-- %s is file size -->
|
||||||
<string name="download_update">Download (%s)</string>
|
<string name="download_update">Download (%s)</string>
|
||||||
<string name="install_update">Installieren</string>
|
<string name="install_update">Installieren</string>
|
||||||
|
<string name="accept_follow_request">Folgeanfrage akzeptieren</string>
|
||||||
|
<string name="reject_follow_request">Folgeanfrage ablehnen</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -387,4 +387,6 @@
|
||||||
<string name="privacy_policy_title">Mastodon and your privacy</string>
|
<string name="privacy_policy_title">Mastodon and your privacy</string>
|
||||||
<string name="privacy_policy_subtitle">Although the Mastodon app does not collect any data, the server you sign up through may have a different policy. Take a minute to review and agree to the Mastodon app privacy policy and your server\'s privacy policy.</string>
|
<string name="privacy_policy_subtitle">Although the Mastodon app does not collect any data, the server you sign up through may have a different policy. Take a minute to review and agree to the Mastodon app privacy policy and your server\'s privacy policy.</string>
|
||||||
<string name="i_agree">I Agree</string>
|
<string name="i_agree">I Agree</string>
|
||||||
|
<string name="accept_follow_request">Accept follow request</string>
|
||||||
|
<string name="reject_follow_request">Reject follow request</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue