v0.8.0: removed android call state listener functionality (was buggy)

This commit is contained in:
Evan Debenham 2019-11-13 18:53:40 -05:00
parent cc4866cb5b
commit b6b3c107f9

View File

@ -21,14 +21,11 @@
package com.shatteredpixel.shatteredpixeldungeon.android; package com.shatteredpixel.shatteredpixeldungeon.android;
import android.app.Activity;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.opengl.GLSurfaceView; import android.opengl.GLSurfaceView;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import com.badlogic.gdx.Files; import com.badlogic.gdx.Files;
import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplication;
@ -36,7 +33,6 @@ import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.watabou.noosa.Game; import com.watabou.noosa.Game;
import com.watabou.noosa.audio.Music;
import com.watabou.utils.FileUtils; import com.watabou.utils.FileUtils;
public class AndroidGame extends AndroidApplication { public class AndroidGame extends AndroidApplication {
@ -95,28 +91,7 @@ public class AndroidGame extends AndroidApplication {
initialize(new ShatteredPixelDungeon(support), config); initialize(new ShatteredPixelDungeon(support), config);
view = (GLSurfaceView)graphics.getView(); view = (GLSurfaceView)graphics.getView();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
TelephonyManager mgr =
(TelephonyManager) instance.getSystemService(Activity.TELEPHONY_SERVICE);
mgr.listen(new PhoneStateListener(){
@Override
public void onCallStateChanged(int state, String incomingNumber)
{
if( state == TelephonyManager.CALL_STATE_RINGING ) {
Music.INSTANCE.pause();
} else if( state == TelephonyManager.CALL_STATE_IDLE ) {
if (!Game.instance.isPaused()) {
Music.INSTANCE.resume();
}
}
super.onCallStateChanged(state, incomingNumber);
}
}, PhoneStateListener.LISTEN_CALL_STATE);
}
} }
@Override @Override