- Now the received funds sound is played
This commit is contained in:
parent
b42b2e27ce
commit
4276fd0e7c
2 changed files with 39 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue