Search in sources :

Example 6 with Notification

use of com.keylesspalace.tusky.entity.Notification in project Tusky by Vavassor.

the class NotificationsAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
    if (position < notifications.size()) {
        Notification notification = notifications.get(position);
        Notification.Type type = notification.type;
        switch(type) {
            case MENTION:
                {
                    StatusViewHolder holder = (StatusViewHolder) viewHolder;
                    Status status = notification.status;
                    holder.setupWithStatus(status, statusListener);
                    break;
                }
            case FAVOURITE:
            case REBLOG:
                {
                    StatusNotificationViewHolder holder = (StatusNotificationViewHolder) viewHolder;
                    holder.setMessage(type, notification.account.getDisplayName(), notification.status);
                    holder.setupButtons(notificationActionListener, notification.account.id);
                    break;
                }
            case FOLLOW:
                {
                    FollowViewHolder holder = (FollowViewHolder) viewHolder;
                    holder.setMessage(notification.account.getDisplayName(), notification.account.username, notification.account.avatar);
                    holder.setupButtons(notificationActionListener, notification.account.id);
                    break;
                }
        }
    }
}
Also used : Status(com.keylesspalace.tusky.entity.Status) Notification(com.keylesspalace.tusky.entity.Notification)

Example 7 with Notification

use of com.keylesspalace.tusky.entity.Notification in project Tusky by Vavassor.

the class NotificationsFragment method onMore.

public void onMore(View view, int position) {
    Notification notification = adapter.getItem(position);
    super.more(notification.status, view, adapter, position);
}
Also used : Notification(com.keylesspalace.tusky.entity.Notification)

Example 8 with Notification

use of com.keylesspalace.tusky.entity.Notification in project Tusky by Vavassor.

the class NotificationsFragment method onReply.

public void onReply(int position) {
    Notification notification = adapter.getItem(position);
    super.reply(notification.status);
}
Also used : Notification(com.keylesspalace.tusky.entity.Notification)

Example 9 with Notification

use of com.keylesspalace.tusky.entity.Notification in project Tusky by Vavassor.

the class PushNotificationClient method onMessageReceived.

private void onMessageReceived(final Context context, String message) {
    Log.v(TAG, "Notification received: " + message);
    Gson gson = new GsonBuilder().registerTypeAdapter(Spanned.class, new SpannedTypeAdapter()).registerTypeAdapter(StringWithEmoji.class, new StringWithEmojiTypeAdapter()).create();
    Notification notification = gson.fromJson(message, Notification.class);
    NotificationMaker.make(context, NOTIFY_ID, notification);
}
Also used : StringWithEmojiTypeAdapter(com.keylesspalace.tusky.json.StringWithEmojiTypeAdapter) GsonBuilder(com.google.gson.GsonBuilder) SpannedTypeAdapter(com.keylesspalace.tusky.json.SpannedTypeAdapter) Gson(com.google.gson.Gson) StringWithEmoji(com.keylesspalace.tusky.json.StringWithEmoji) Notification(com.keylesspalace.tusky.entity.Notification)

Aggregations

Notification (com.keylesspalace.tusky.entity.Notification)9 SharedPreferences (android.content.SharedPreferences)1 FloatingActionButton (android.support.design.widget.FloatingActionButton)1 RecyclerView (android.support.v7.widget.RecyclerView)1 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 MainActivity (com.keylesspalace.tusky.MainActivity)1 NotificationsAdapter (com.keylesspalace.tusky.adapter.NotificationsAdapter)1 Status (com.keylesspalace.tusky.entity.Status)1 SpannedTypeAdapter (com.keylesspalace.tusky.json.SpannedTypeAdapter)1 StringWithEmoji (com.keylesspalace.tusky.json.StringWithEmoji)1 StringWithEmojiTypeAdapter (com.keylesspalace.tusky.json.StringWithEmojiTypeAdapter)1 EndlessOnScrollListener (com.keylesspalace.tusky.view.EndlessOnScrollListener)1