diff --git a/app/src/main/java/cy/agorise/crystalwallet/requestmanagers/CryptoNetEvent.java b/app/src/main/java/cy/agorise/crystalwallet/requestmanagers/CryptoNetEvent.java new file mode 100644 index 0000000..a6c7fae --- /dev/null +++ b/app/src/main/java/cy/agorise/crystalwallet/requestmanagers/CryptoNetEvent.java @@ -0,0 +1,21 @@ +package cy.agorise.crystalwallet.requestmanagers; + +import cy.agorise.crystalwallet.enums.CryptoCoin; + +/** + * An event fired from the service + * + * + * Created by Henry Varona on 4/28/2018. + */ + +public abstract class CryptoNetEvent { + /** + * The cryptocoin this events belongs to + */ + protected CryptoCoin coin; + + protected CryptoNetEvent(CryptoCoin coin){ + this.coin = coin; + } +} diff --git a/app/src/main/java/cy/agorise/crystalwallet/requestmanagers/CryptoNetEvents.java b/app/src/main/java/cy/agorise/crystalwallet/requestmanagers/CryptoNetEvents.java new file mode 100644 index 0000000..3ce60c3 --- /dev/null +++ b/app/src/main/java/cy/agorise/crystalwallet/requestmanagers/CryptoNetEvents.java @@ -0,0 +1,48 @@ +package cy.agorise.crystalwallet.requestmanagers; + +import java.util.ArrayList; +import java.util.List; + +/** + * This class will be used to communicate events related to crypto net accounts data + * + * Created by Henry Varona on 4/28/2018. + */ + +public class CryptoNetEvents { + private List listeners; + private static CryptoNetEvents instance; + + /** + * Private constructor for singleton pattern + */ + private void CryptoNetEvents(){ + } + + /** + * Gets an instance of this manager + * @return the instance to manage the cryptonetinforequest + */ + public static CryptoNetEvents getInstance(){ + if (CryptoNetEvents.instance == null){ + CryptoNetEvents.instance = new CryptoNetEvents(); + CryptoNetEvents.instance.listeners = new ArrayList<>(); + } + + return CryptoNetEvents.instance; + } + + public void fireEvent(CryptoNetEvent event){ + for (int i=0;i