Merge pull request #1048 from owncloud/shareWithYou_icon_in_fileList
[pub/Android/ownCloud.git] / src / com / owncloud / android / media / MediaControlView.java
index 9db76df..653943b 100644 (file)
@@ -1,11 +1,12 @@
-/* ownCloud Android client application
- * 
- *   Copyright (C) 2012-2013  ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *
  *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
  *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -43,6 +44,7 @@ import java.util.Locale;
 
 import com.owncloud.android.R;
 
 
 import com.owncloud.android.R;
 
+
 /**
  * View containing controls for a {@link MediaPlayer}. 
  * 
 /**
  * View containing controls for a {@link MediaPlayer}. 
  * 
@@ -51,8 +53,6 @@ import com.owncloud.android.R;
  * 
  * It synchronizes itself with the state of the 
  * {@link MediaPlayer}.
  * 
  * It synchronizes itself with the state of the 
  * {@link MediaPlayer}.
- * 
- * @author David A. Velasco
  */
 
 public class MediaControlView extends FrameLayout /* implements OnLayoutChangeListener, OnTouchListener */ implements OnClickListener, OnSeekBarChangeListener {
  */
 
 public class MediaControlView extends FrameLayout /* implements OnLayoutChangeListener, OnTouchListener */ implements OnClickListener, OnSeekBarChangeListener {
@@ -391,6 +391,7 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
     @Override
     public void onClick(View v) {
         int pos;
     @Override
     public void onClick(View v) {
         int pos;
+        boolean playing = mPlayer.isPlaying();
         switch (v.getId()) {
         
         case R.id.playBtn: 
         switch (v.getId()) {
         
         case R.id.playBtn: 
@@ -401,6 +402,7 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
             pos = mPlayer.getCurrentPosition();
             pos -= 5000;
             mPlayer.seekTo(pos);
             pos = mPlayer.getCurrentPosition();
             pos -= 5000;
             mPlayer.seekTo(pos);
+            if (!playing) mPlayer.pause();  // necessary in some 2.3.x devices 
             setProgress();
             break;
 
             setProgress();
             break;
 
@@ -408,6 +410,7 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
             pos = mPlayer.getCurrentPosition();
             pos += 15000;
             mPlayer.seekTo(pos);
             pos = mPlayer.getCurrentPosition();
             pos += 15000;
             mPlayer.seekTo(pos);
+            if (!playing) mPlayer.pause(); // necessary in some 2.3.x devices
             setProgress();
             break;
         
             setProgress();
             break;