Fix issues
Lockscreen controls and screen wakes when locked Removed animaked `peakheight` for Bottomsheet Added padding for details items to show last item Fix suggestion text for less than 26 API
This commit is contained in:
parent
0e8010ad78
commit
b9c12e20dd
11 changed files with 59 additions and 32 deletions
|
@ -34,8 +34,9 @@ android {
|
|||
}
|
||||
buildTypes {
|
||||
release {
|
||||
debuggable true
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
//shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
|
|
6
app/proguard-rules.pro
vendored
6
app/proguard-rules.pro
vendored
|
@ -45,8 +45,10 @@
|
|||
-keep interface com.squareup.okhttp3.** { *; }
|
||||
-dontwarn com.squareup.okhttp3.**
|
||||
|
||||
-dontwarn
|
||||
-ignorewarnings
|
||||
#-dontwarn
|
||||
#-ignorewarnings
|
||||
-dontshrink
|
||||
-dontobfuscate
|
||||
|
||||
-dontwarn org.jaudiotagger.**
|
||||
-keep class org.jaudiotagger.** { *; }
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package="code.name.monkey.retromusic">
|
||||
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
@ -119,11 +120,7 @@
|
|||
<activity android:name=".activities.ShareInstagramStory" />
|
||||
<activity android:name=".activities.DriveModeActivity" />
|
||||
<activity android:name=".activities.PermissionActivity" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.LockScreenActivity"
|
||||
android:noHistory="true"
|
||||
android:showOnLockScreen="true" />
|
||||
<activity android:name=".activities.LockScreenActivity" />
|
||||
|
||||
<activity
|
||||
android:name=".appshortcuts.AppShortcutLauncherActivity"
|
||||
|
|
|
@ -9,7 +9,8 @@ import android.view.WindowManager
|
|||
import androidx.core.view.ViewCompat
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
|
||||
import code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenPlayerControlsFragment
|
||||
import code.name.monkey.retromusic.extensions.whichFragment
|
||||
import code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenControlsFragment
|
||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||
import code.name.monkey.retromusic.glide.SongGlideRequest
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
|
@ -22,19 +23,19 @@ import com.r0adkll.slidr.model.SlidrPosition
|
|||
import kotlinx.android.synthetic.main.activity_lock_screen.*
|
||||
|
||||
class LockScreenActivity : AbsMusicServiceActivity() {
|
||||
private var fragment: LockScreenPlayerControlsFragment? = null
|
||||
private var fragment: LockScreenControlsFragment? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
setDrawUnderStatusBar()
|
||||
super.onCreate(savedInstanceState)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
setShowWhenLocked(true)
|
||||
setTurnScreenOn(true)
|
||||
val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
||||
keyguardManager.requestDismissKeyguard(this, null)
|
||||
} else {
|
||||
this.window.addFlags(
|
||||
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
|
||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
|
||||
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
|
||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
|
||||
)
|
||||
}
|
||||
setContentView(R.layout.activity_lock_screen)
|
||||
|
@ -67,8 +68,7 @@ class LockScreenActivity : AbsMusicServiceActivity() {
|
|||
|
||||
Slidr.attach(this, config)
|
||||
|
||||
fragment =
|
||||
supportFragmentManager.findFragmentById(R.id.playback_controls_fragment) as LockScreenPlayerControlsFragment?
|
||||
fragment = whichFragment<LockScreenControlsFragment>(R.id.playback_controls_fragment)
|
||||
|
||||
findViewById<View>(R.id.slide).apply {
|
||||
translationY = 100f
|
||||
|
|
|
@ -330,7 +330,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
|
|||
ViewCompat.setElevation(slidingPanel, 0f)
|
||||
ViewCompat.setElevation(bottomNavigationView, 10f)
|
||||
bottomSheetBehavior.isHideable = true
|
||||
bottomSheetBehavior.setPeekHeight(0, true)
|
||||
bottomSheetBehavior.setPeekHeight(0, false)
|
||||
bottomSheetBehavior.state = STATE_COLLAPSED
|
||||
}
|
||||
COLLAPSED_WITH -> {
|
||||
|
@ -341,7 +341,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
|
|||
bottomSheetBehavior.isHideable = false
|
||||
bottomSheetBehavior.setPeekHeight(
|
||||
if (isQueueEmpty) 0 else (heightOfBar * 2) - 24,
|
||||
true
|
||||
false
|
||||
)
|
||||
bottomNavigationView.isVisible = true
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
|
|||
bottomSheetBehavior.isHideable = false
|
||||
bottomSheetBehavior.setPeekHeight(
|
||||
if (isQueueEmpty) 0 else heightOfBar - 24,
|
||||
true
|
||||
false
|
||||
)
|
||||
bottomNavigationView.isGone = true
|
||||
}
|
||||
|
|
|
@ -10,11 +10,13 @@ import androidx.navigation.fragment.findNavController
|
|||
import androidx.navigation.fragment.navArgs
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver
|
||||
import code.name.monkey.retromusic.*
|
||||
import code.name.monkey.retromusic.adapter.album.AlbumAdapter
|
||||
import code.name.monkey.retromusic.adapter.artist.ArtistAdapter
|
||||
import code.name.monkey.retromusic.adapter.song.SongAdapter
|
||||
import code.name.monkey.retromusic.db.toSong
|
||||
import code.name.monkey.retromusic.extensions.dipToPix
|
||||
import code.name.monkey.retromusic.fragments.albums.AlbumClickListener
|
||||
import code.name.monkey.retromusic.fragments.artists.ArtistClickListener
|
||||
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
|
||||
|
@ -52,6 +54,15 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
|
|||
LAST_ADDED_PLAYLIST -> lastAddedSongs()
|
||||
TOP_PLAYED_PLAYLIST -> topPlayed()
|
||||
}
|
||||
|
||||
|
||||
recyclerView.adapter?.registerAdapterDataObserver(object : AdapterDataObserver() {
|
||||
override fun onChanged() {
|
||||
super.onChanged()
|
||||
val height = dipToPix(52f)
|
||||
recyclerView.setPadding(0, 0, 0, height.toInt())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun lastAddedSongs() {
|
||||
|
@ -84,7 +95,6 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
|
|||
libraryViewModel.playCountSongs().observe(viewLifecycleOwner, Observer { songs ->
|
||||
songAdapter.swapDataSet(songs)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
private fun loadHistory() {
|
||||
|
@ -116,8 +126,8 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
|
|||
adapter = songAdapter
|
||||
layoutManager = linearLayoutManager()
|
||||
}
|
||||
libraryViewModel.favorites().observe(viewLifecycleOwner, {
|
||||
val songs = it.map { songEntity -> songEntity.toSong() }
|
||||
libraryViewModel.favorites().observe(viewLifecycleOwner, { songEntities ->
|
||||
val songs = songEntities.map { songEntity -> songEntity.toSong() }
|
||||
songAdapter.swapDataSet(songs)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.*
|
|||
/**
|
||||
* @author Hemanth S (h4h13).
|
||||
*/
|
||||
class LockScreenPlayerControlsFragment :
|
||||
class LockScreenControlsFragment :
|
||||
AbsPlayerControlsFragment(R.layout.fragment_lock_screen_playback_controls) {
|
||||
|
||||
private var progressViewUpdateHelper: MusicProgressViewUpdateHelper? = null
|
|
@ -154,13 +154,17 @@ class RealSongRepository(private val context: Context) : SongRepository {
|
|||
} else {
|
||||
Media.EXTERNAL_CONTENT_URI
|
||||
}
|
||||
return context.contentResolver.query(
|
||||
uri,
|
||||
baseProjection,
|
||||
selectionFinal,
|
||||
selectionValuesFinal,
|
||||
sortOrder
|
||||
)
|
||||
return try {
|
||||
context.contentResolver.query(
|
||||
uri,
|
||||
baseProjection,
|
||||
selectionFinal,
|
||||
selectionValuesFinal,
|
||||
sortOrder
|
||||
)
|
||||
} catch (ex: SecurityException) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
private fun generateBlacklistSelection(
|
||||
|
|
|
@ -63,6 +63,7 @@ import java.util.Objects;
|
|||
import java.util.Random;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.activities.LockScreenActivity;
|
||||
import code.name.monkey.retromusic.appwidgets.AppWidgetBig;
|
||||
import code.name.monkey.retromusic.appwidgets.AppWidgetCard;
|
||||
import code.name.monkey.retromusic.appwidgets.AppWidgetClassic;
|
||||
|
@ -245,7 +246,16 @@ public class MusicService extends Service implements
|
|||
updateNotification();
|
||||
}
|
||||
};
|
||||
|
||||
private final BroadcastReceiver lockScreenReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (PreferenceUtil.INSTANCE.isLockScreen() && isPlaying()) {
|
||||
Intent lockIntent = new Intent(context, LockScreenActivity.class);
|
||||
lockIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(lockIntent);
|
||||
}
|
||||
}
|
||||
};
|
||||
private QueueSaveHandler queueSaveHandler;
|
||||
private HandlerThread queueSaveHandlerThread;
|
||||
private boolean queuesRestored;
|
||||
|
@ -362,6 +372,7 @@ public class MusicService extends Service implements
|
|||
|
||||
registerReceiver(widgetIntentReceiver, new IntentFilter(APP_WIDGET_UPDATE));
|
||||
registerReceiver(updateFavoriteReceiver, new IntentFilter(FAVORITE_STATE_CHANGED));
|
||||
registerReceiver(lockScreenReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
|
||||
|
||||
initNotification();
|
||||
|
||||
|
@ -403,6 +414,7 @@ public class MusicService extends Service implements
|
|||
public void onDestroy() {
|
||||
unregisterReceiver(widgetIntentReceiver);
|
||||
unregisterReceiver(updateFavoriteReceiver);
|
||||
unregisterReceiver(lockScreenReceiver);
|
||||
if (becomingNoisyReceiverRegistered) {
|
||||
unregisterReceiver(becomingNoisyReceiver);
|
||||
becomingNoisyReceiverRegistered = false;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
<fragment
|
||||
android:id="@+id/playback_controls_fragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenPlayerControlsFragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenControlsFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:layout="@layout/fragment_lock_screen_playback_controls" />
|
||||
|
|
|
@ -145,8 +145,9 @@
|
|||
android:text="New music mix"
|
||||
android:textAppearance="@style/TextViewNormal"
|
||||
android:textStyle="bold"
|
||||
android:textSize="32sp"
|
||||
app:autoSizeMaxTextSize="32sp"
|
||||
app:autoSizeMinTextSize="18sp"
|
||||
app:autoSizeMinTextSize="24sp"
|
||||
app:autoSizeStepGranularity="1sp" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
|
Loading…
Reference in a new issue