From aaf686b63ec3b49ec70ff7de35819478958994df Mon Sep 17 00:00:00 2001 From: alexishiniker Date: Thu, 23 Aug 2018 22:53:14 -0700 Subject: [PATCH] Minor cleanup to PlaybackFragment.java --- .../kidsrecorder/UI/PlaybackFragment.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/userempowermentlab/kidsrecorder/UI/PlaybackFragment.java b/app/src/main/java/com/userempowermentlab/kidsrecorder/UI/PlaybackFragment.java index eee1a56..7d20b31 100644 --- a/app/src/main/java/com/userempowermentlab/kidsrecorder/UI/PlaybackFragment.java +++ b/app/src/main/java/com/userempowermentlab/kidsrecorder/UI/PlaybackFragment.java @@ -50,10 +50,10 @@ public class PlaybackFragment extends DialogFragment { private TextView mFileNameTextView = null; private TextView mFileLengthTextView = null; - //stores whether or not the mediaplayer is currently playing audio + // stores whether or not the mediaplayer is currently playing audio private boolean isPlaying = false; - //stores minutes and seconds of the length of the file. + // stores minutes and seconds of the length of the file. long minutes = 0; long seconds = 0; @@ -98,7 +98,6 @@ public void onActivityCreated(Bundle savedInstanceState) { @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - Dialog dialog = super.onCreateDialog(savedInstanceState); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); @@ -212,17 +211,15 @@ public void onDestroy() { } // Play start/stop - private void onPlay(boolean isPlaying){ + private void onPlay(boolean isPlaying) { if (!isPlaying) { - //currently MediaPlayer is not playing audio if(mMediaPlayer == null) { - startPlaying(); //start from beginning + startPlaying(); // start from beginning } else { - resumePlaying(); //resume the currently paused MediaPlayer + resumePlaying(); // resume the currently paused MediaPlayer } } else { - //pause the MediaPlayer pausePlaying(); } } @@ -281,7 +278,7 @@ public void onCompletion(MediaPlayer mp) { e.printStackTrace(); } - //keep screen on while playing audio + // keep screen on while playing audio getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } @@ -312,11 +309,11 @@ private void stopPlaying() { mCurrentProgressTextView.setText(mFileLengthTextView.getText()); mSeekBar.setProgress(mSeekBar.getMax()); - //allow the screen to turn off again once audio is finished playing + // allow the screen to turn off again once audio is finished playing getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } - //updating mSeekBar + // updating mSeekBar private Runnable mRunnable = new Runnable() { @Override public void run() {