diff --git a/KidPhone/app/src/main/java/kidtoys/az/kidphone/PhoneActivity.java b/KidPhone/app/src/main/java/kidtoys/az/kidphone/PhoneActivity.java index 5c0a4a4..71ad815 100644 --- a/KidPhone/app/src/main/java/kidtoys/az/kidphone/PhoneActivity.java +++ b/KidPhone/app/src/main/java/kidtoys/az/kidphone/PhoneActivity.java @@ -6,10 +6,7 @@ import android.os.Build; import android.os.Bundle; import android.os.Handler; - -import androidx.appcompat.app.AppCompatActivity; import android.util.Log; -import android.view.Display; import android.view.Gravity; import android.view.KeyEvent; import android.view.View; @@ -17,6 +14,8 @@ import android.view.WindowManager; import android.widget.LinearLayout; +import androidx.appcompat.app.AppCompatActivity; + public class PhoneActivity extends AppCompatActivity implements Phone, View.OnClickListener { @@ -211,12 +210,7 @@ public boolean onKeyDown(int keyCode, KeyEvent event) { @Override public void onBackPressed() { if (mode != null) mode.onSave(); - this.soundPlayer.playPhoneCloseMode(new SoundCallBack() { - @Override - public void soundPlayFinished() { - PhoneActivity.this.finish(); - } - }); + this.soundPlayer.playPhoneCloseMode(PhoneActivity.this::finish); started = 0; // super.onBackPressed(); } diff --git a/KidPhone/app/src/main/java/kidtoys/az/kidphone/SoundPlayer.java b/KidPhone/app/src/main/java/kidtoys/az/kidphone/SoundPlayer.java index 2632c90..212f780 100644 --- a/KidPhone/app/src/main/java/kidtoys/az/kidphone/SoundPlayer.java +++ b/KidPhone/app/src/main/java/kidtoys/az/kidphone/SoundPlayer.java @@ -40,12 +40,7 @@ public void PlayMp3(int fileId,final SoundCallBack callback) { mediaPlayer = MediaPlayer.create(context, fileId); mediaPlayer.start(); if(callback!=null) { - mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { - @Override - public void onCompletion(MediaPlayer mp) { - callback.soundPlayFinished(); - } - }); + mediaPlayer.setOnCompletionListener(mp -> callback.soundPlayFinished()); } }