- Now the received funds sound is played

master
Javier Varona 2018-04-30 21:25:11 -04:00
parent b42b2e27ce
commit 4276fd0e7c
2 changed files with 39 additions and 0 deletions

View File

@ -17,6 +17,8 @@ import cy.agorise.crystalwallet.models.BitsharesAssetInfo;
import cy.agorise.crystalwallet.models.CryptoCurrencyEquivalence;
import cy.agorise.crystalwallet.models.GeneralSetting;
import cy.agorise.crystalwallet.network.CryptoNetManager;
import cy.agorise.crystalwallet.notifiers.CrystalWalletNotifier;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetEvents;
import cy.agorise.crystalwallet.service.CrystalWalletService;
/**
@ -83,6 +85,10 @@ public class CrystalApplication extends Application {
}
//The crystal notifier is initialized
CrystalWalletNotifier crystalWalletNotifier = new CrystalWalletNotifier(getApplicationContext());
CryptoNetEvents.getInstance().addListener(crystalWalletNotifier);
//Next line is for use the bitshares main net
//CryptoNetManager.addCryptoNetURL(CryptoNet.BITSHARES,BITSHARES_URL);

View File

@ -0,0 +1,33 @@
package cy.agorise.crystalwallet.notifiers;
import android.content.Context;
import android.media.MediaPlayer;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetEvent;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetEventsListener;
import cy.agorise.crystalwallet.requestmanagers.ReceivedFundsCryptoNetEvent;
/**
* Created by Henry Varona on 29/4/2018.
*/
public class CrystalWalletNotifier implements CryptoNetEventsListener{
private Context context;
public CrystalWalletNotifier(Context context){
this.context = context;
}
public void onCryptoNetEvent(CryptoNetEvent event) {
if (event instanceof ReceivedFundsCryptoNetEvent){
playReceivedFundsSound();
}
}
private void playReceivedFundsSound() {
MediaPlayer defaultMediaPlayer = MediaPlayer.create(this.context, R.raw.woohoo);
defaultMediaPlayer.start();
}
}