Skip to content

Commit f4b8e06

Browse files
committed
fixed bug
BUG: can only play next song when the player is playing. NOW: if player is paused, skipping the current song is accessible.
1 parent f3f58a0 commit f4b8e06

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

app/src/main/java/com/junnanhao/next/player/Player.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class Player private constructor() : IPlayer {
5151

5252
override fun play(song: Song): Boolean {
5353
playList.reset(song = song)
54+
isPause = currentSong == song
5455
return play()
5556
}
5657

app/src/main/java/com/junnanhao/next/ui/player/PlayerActivity.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.junnanhao.next.ui.player
22

3-
import android.Manifest
43
import android.support.v7.app.AppCompatActivity
54
import android.os.Bundle
65
import android.os.Handler
@@ -11,9 +10,6 @@ import com.junnanhao.next.R
1110
import com.junnanhao.next.common.App
1211
import com.junnanhao.next.ui.player.PlayerFragment
1312
import javax.inject.Inject
14-
import android.Manifest.permission
15-
import com.tbruyelle.rxpermissions2.RxPermissions
16-
1713

1814
/**
1915
* An example full-screen activity that shows and hides the system UI (i.e.

app/src/main/java/com/junnanhao/next/ui/player/PlayerFragment.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class PlayerFragment : Fragment(), PlayerContract.View {
4343
fun instance(): PlayerFragment {
4444
return PlayerFragment()
4545
}
46-
4746
private val SWIPE_MIN_DISTANCE = 120
4847
private val SWIPE_MAX_OFF_PATH = 250
4948
private val SWIPE_THRESHOLD_VELOCITY = 200
@@ -69,16 +68,17 @@ class PlayerFragment : Fragment(), PlayerContract.View {
6968
val size: Point = Point()
7069
wm.defaultDisplay.getSize(size)
7170
rect = Rect(0,
72-
(size.y * 0.1).toInt(),
71+
(size.y * 0.2).toInt(),
7372
size.x,
74-
(size.y * 0.9).toInt())
73+
(size.y * 0.8).toInt())
7574
}
7675

7776

7877
override fun onCreate(savedInstanceState: Bundle?) {
7978
super.onCreate(savedInstanceState)
8079
mDetector = GestureDetectorCompat(context, object : GestureDetector.SimpleOnGestureListener() {
8180
override fun onFling(e1: MotionEvent, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
81+
Timber.wtf("fling")
8282
if (rect.contains(
8383
if (e1.x < e2.x) (e1.x).toInt() else e2.x.toInt(),
8484
if (e1.y < e2.y) (e1.y).toInt() else e2.y.toInt(),
@@ -100,7 +100,7 @@ class PlayerFragment : Fragment(), PlayerContract.View {
100100
e.printStackTrace()
101101
}
102102
}
103-
return false
103+
return true
104104
}
105105
})
106106
}

0 commit comments

Comments
 (0)