change inline reply notification
This commit is contained in:
parent
c5e8460516
commit
70e4cb2286
|
@ -27,6 +27,7 @@ import org.joinmastodon.android.model.Account;
|
||||||
import org.joinmastodon.android.model.NotificationAction;
|
import org.joinmastodon.android.model.NotificationAction;
|
||||||
import org.joinmastodon.android.model.Preferences;
|
import org.joinmastodon.android.model.Preferences;
|
||||||
import org.joinmastodon.android.model.PushNotification;
|
import org.joinmastodon.android.model.PushNotification;
|
||||||
|
import org.joinmastodon.android.model.Status;
|
||||||
import org.joinmastodon.android.model.StatusPrivacy;
|
import org.joinmastodon.android.model.StatusPrivacy;
|
||||||
import org.joinmastodon.android.ui.utils.UiUtils;
|
import org.joinmastodon.android.ui.utils.UiUtils;
|
||||||
import org.parceler.Parcels;
|
import org.parceler.Parcels;
|
||||||
|
@ -278,18 +279,36 @@ public class PushNotificationReceiver extends BroadcastReceiver{
|
||||||
req.spoilerText = "re: " + notification.status.spoilerText;
|
req.spoilerText = "re: " + notification.status.spoilerText;
|
||||||
}
|
}
|
||||||
|
|
||||||
new CreateStatus(req, UUID.randomUUID().toString()).exec(accountID);
|
new CreateStatus(req, UUID.randomUUID().toString()).setCallback(new Callback<Status>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Status status) {
|
||||||
|
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
Notification.Builder builder = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O ?
|
||||||
|
new Notification.Builder(context, accountID+"_"+notification.type) :
|
||||||
|
new Notification.Builder(context)
|
||||||
|
.setPriority(Notification.PRIORITY_DEFAULT)
|
||||||
|
.setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
|
||||||
|
|
||||||
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
notification.status = status;
|
||||||
Notification.Builder builder = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O ?
|
Intent contentIntent=new Intent(context, MainActivity.class);
|
||||||
new Notification.Builder(context, accountID+"_"+notification.type) :
|
contentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
new Notification.Builder(context)
|
contentIntent.putExtra("fromNotification", true);
|
||||||
.setPriority(Notification.PRIORITY_DEFAULT)
|
contentIntent.putExtra("accountID", accountID);
|
||||||
.setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
|
contentIntent.putExtra("notification", Parcels.wrap(notification));
|
||||||
|
|
||||||
Notification repliedNotification = builder.setSmallIcon(R.drawable.ic_ntf_logo)
|
Notification repliedNotification = builder.setSmallIcon(R.drawable.ic_ntf_logo)
|
||||||
.setContentText(context.getString(R.string.sk_notification_action_replied, notification.status.account.getDisplayUsername()))
|
.setContentTitle(context.getString(R.string.sk_notification_action_replied, notification.status.account.displayName))
|
||||||
.build();
|
.setContentText(status.getStrippedText())
|
||||||
notificationManager.notify(accountID, notificationId, repliedNotification);
|
.setCategory(Notification.CATEGORY_SOCIAL)
|
||||||
|
.setContentIntent(PendingIntent.getActivity(context, notificationId, contentIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT))
|
||||||
|
.build();
|
||||||
|
notificationManager.notify(accountID, notificationId, repliedNotification);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(ErrorResponse errorResponse) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}).exec(accountID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,7 +267,7 @@
|
||||||
<string name="sk_follow_as">Follow from other account</string>
|
<string name="sk_follow_as">Follow from other account</string>
|
||||||
<string name="sk_followed_as">Followed from %s</string>
|
<string name="sk_followed_as">Followed from %s</string>
|
||||||
<string name="sk_settings_hide_fab">Auto-hide Compose button</string>
|
<string name="sk_settings_hide_fab">Auto-hide Compose button</string>
|
||||||
<string name="sk_notification_action_replied">Successfully replied to the post by %s</string>
|
<string name="sk_notification_action_replied">Sent reply to %s</string>
|
||||||
<string name="sk_in_reply">In reply</string>
|
<string name="sk_in_reply">In reply</string>
|
||||||
<string name="sk_reply_line_above_avatar">“In reply to” line above avatar</string>
|
<string name="sk_reply_line_above_avatar">“In reply to” line above avatar</string>
|
||||||
<string name="sk_show_thread">Show thread</string>
|
<string name="sk_show_thread">Show thread</string>
|
||||||
|
|
Loading…
Reference in New Issue