com.github.kaiwinter.androidremotenotifications.model.impl.AbstractUserNotification Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of android-remote-notifications Show documentation
Show all versions of android-remote-notifications Show documentation
Pulls notifications from a remote JSON file and shows them in your app.
package com.github.kaiwinter.androidremotenotifications.model.impl;
import com.github.kaiwinter.androidremotenotifications.model.UserNotification;
/**
* Abstract implementation of {@link UserNotification} which implements common functionality.
*/
public abstract class AbstractUserNotification implements UserNotification {
private static final NotificationConfiguration DEFAULT_CONFIGURATION = new NotificationConfiguration();
/**
* The configuration about when to show this Notification.
*/
private final NotificationConfiguration notificationConfiguration;
public AbstractUserNotification() {
this(DEFAULT_CONFIGURATION);
}
public AbstractUserNotification(NotificationConfiguration notificationConfiguration) {
if (notificationConfiguration == null) {
this.notificationConfiguration = DEFAULT_CONFIGURATION;
} else {
this.notificationConfiguration = notificationConfiguration;
}
}
@Override
public NotificationConfiguration getNotificationConfiguration() {
return notificationConfiguration;
}
/**
* hashCode/equals must be implemented to synchronized the notifications with the ones from the server.
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AbstractUserNotification that = (AbstractUserNotification) o;
return !(notificationConfiguration != null ? !notificationConfiguration.equals(that.notificationConfiguration) : that.notificationConfiguration != null);
}
/**
* hashCode/equals must be implemented to synchronized the notifications with the ones from the server.
*/
@Override
public int hashCode() {
return notificationConfiguration != null ? notificationConfiguration.hashCode() : 0;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy