diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 42ce6080..4f39ddd1 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -259,6 +259,8 @@
+
+
@@ -272,4 +274,8 @@
+
+
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.kt
index 1e4f79fc..96cb287d 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.kt
@@ -55,7 +55,9 @@ class MainActivity : AbsSlidingMusicPanelActivity(), SharedPreferences.OnSharedP
return contentView
}
- override fun onCreate(savedInstanceState: Bundle?) {
+ override fun onCreate(
+ savedInstanceState: Bundle?
+ ) {
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
@@ -64,12 +66,9 @@ class MainActivity : AbsSlidingMusicPanelActivity(), SharedPreferences.OnSharedP
getBottomNavigationView().setOnNavigationItemSelectedListener {
PreferenceUtil.getInstance().lastPage = it.itemId
selectedFragment(it.itemId)
-
true
-
}
-
if (savedInstanceState == null) {
selectedFragment(PreferenceUtil.getInstance().lastPage)
} else {
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt
index 613c986f..d2f629af 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt
@@ -169,7 +169,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
slidingLayout.panelHeight = 0
collapsePanel()
} else {
- if (!MusicPlayerRemote.playingQueue.isEmpty()) {
+ if (MusicPlayerRemote.playingQueue.isNotEmpty()) {
slidingLayout.panelHeight = if (bottomNavigationView.visibility == View.VISIBLE) heightOfBarWithTabs else heightOfBar
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt
index 4bc202ed..b5b30d65 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt
@@ -173,6 +173,7 @@ abstract class AbsThemeActivity : ATHActivity(), Runnable {
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_FULLSCREEN
or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY)
+
if (PreferenceUtil.getInstance().fullScreenMode) {
window.decorView.systemUiVisibility = flags
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/auto/AutoMusicProvider.java b/app/src/main/java/code/name/monkey/retromusic/auto/AutoMusicProvider.java
index 13900e94..77cae609 100644
--- a/app/src/main/java/code/name/monkey/retromusic/auto/AutoMusicProvider.java
+++ b/app/src/main/java/code/name/monkey/retromusic/auto/AutoMusicProvider.java
@@ -57,9 +57,7 @@ public class AutoMusicProvider {
private static final int PATH_SEGMENT_ID = 0;
private static final int PATH_SEGMENT_TITLE = 1;
private static final int PATH_SEGMENT_ARTIST = 2;
- private static final int PATH_SEGMENT_ALBUM_ID = 3;
- private WeakReference mMusicService;
// Categorized caches for music data
private ConcurrentMap mMusicListByHistory;
diff --git a/app/src/main/java/code/name/monkey/retromusic/auto/CarHelper.java b/app/src/main/java/code/name/monkey/retromusic/auto/CarHelper.java
new file mode 100644
index 00000000..9c6ebd36
--- /dev/null
+++ b/app/src/main/java/code/name/monkey/retromusic/auto/CarHelper.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2019 Hemanth Savarala.
+ *
+ * Licensed under the GNU General Public License v3
+ *
+ * This 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.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ */
+package code.name.monkey.retromusic.auto;
+
+import android.app.UiModeManager;
+import android.content.Context;
+import android.content.res.Configuration;
+
+public class CarHelper {
+
+ private static final String TAG = "CarHelper";
+
+ public static boolean isCarUiMode(Context c) {
+ UiModeManager uiModeManager = (UiModeManager) c.getSystemService(Context.UI_MODE_SERVICE);
+ return uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/code/name/monkey/retromusic/deezer/DeezerApiService.kt b/app/src/main/java/code/name/monkey/retromusic/deezer/DeezerApiService.kt
index 6378be4b..ff9b9a8d 100644
--- a/app/src/main/java/code/name/monkey/retromusic/deezer/DeezerApiService.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/deezer/DeezerApiService.kt
@@ -24,7 +24,9 @@ interface DeezerApiService {
): Call
companion object {
- operator fun invoke(client: okhttp3.Call.Factory): DeezerApiService {
+ operator fun invoke(
+ client: okhttp3.Call.Factory
+ ): DeezerApiService {
return Retrofit.Builder()
.baseUrl(BASE_URL)
.callFactory(client)
@@ -33,12 +35,16 @@ interface DeezerApiService {
.create()
}
- fun createDefaultOkHttpClient(context: Context): OkHttpClient.Builder =
+ fun createDefaultOkHttpClient(
+ context: Context
+ ): OkHttpClient.Builder =
OkHttpClient.Builder()
.cache(createDefaultCache(context))
.addInterceptor(createCacheControlInterceptor())
- private fun createDefaultCache(context: Context): Cache? {
+ private fun createDefaultCache(
+ context: Context
+ ): Cache? {
val cacheDir = File(context.applicationContext.cacheDir.absolutePath, "/okhttp-deezer/")
if (cacheDir.mkdir() or cacheDir.isDirectory) {
return Cache(cacheDir, 1024 * 1024 * 10)
diff --git a/app/src/main/java/code/name/monkey/retromusic/loaders/AlbumLoader.kt b/app/src/main/java/code/name/monkey/retromusic/loaders/AlbumLoader.kt
index de47266c..db1f770d 100644
--- a/app/src/main/java/code/name/monkey/retromusic/loaders/AlbumLoader.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/loaders/AlbumLoader.kt
@@ -32,20 +32,25 @@ object AlbumLoader {
fun getAllAlbumsFlowable(
context: Context
): Observable> {
- val songs = SongLoader.getSongsFlowable(SongLoader.makeSongCursor(
- context, null, null,
- getSongLoaderSortOrder())
+ val songs = SongLoader.getSongsFlowable(
+ SongLoader.makeSongCursor(
+ context, null, null,
+ getSongLoaderSortOrder())
)
return splitIntoAlbumsFlowable(songs)
}
- fun getAlbumsFlowable(context: Context, query: String): Observable> {
- val songs = SongLoader.getSongsFlowable(SongLoader.makeSongCursor(
- context,
- AudioColumns.ALBUM + " LIKE ?",
- arrayOf("%$query%"),
- getSongLoaderSortOrder())
+ fun getAlbumsFlowable(
+ context: Context,
+ query: String
+ ): Observable> {
+ val songs = SongLoader.getSongsFlowable(
+ SongLoader.makeSongCursor(
+ context,
+ AudioColumns.ALBUM + " LIKE ?",
+ arrayOf("%$query%"),
+ getSongLoaderSortOrder())
)
return splitIntoAlbumsFlowable(songs)
}
@@ -68,7 +73,14 @@ object AlbumLoader {
albumId: Int
): Observable {
return Observable.create { e ->
- val songs = SongLoader.getSongsFlowable(SongLoader.makeSongCursor(context, AudioColumns.ALBUM_ID + "=?", arrayOf(albumId.toString()), getSongLoaderSortOrder()))
+ val songs = SongLoader.getSongsFlowable(
+ SongLoader.makeSongCursor(
+ context,
+ AudioColumns.ALBUM_ID + "=?",
+ arrayOf(albumId.toString()),
+ getSongLoaderSortOrder()
+ )
+ )
songs.subscribe { songs1 ->
e.onNext(Album(songs1))
e.onComplete()
@@ -114,9 +126,10 @@ object AlbumLoader {
fun getAllAlbums(
context: Context
): ArrayList {
- val songs = SongLoader.getSongs(SongLoader.makeSongCursor(
- context, null, null,
- getSongLoaderSortOrder())
+ val songs = SongLoader.getSongs(
+ SongLoader.makeSongCursor(
+ context, null, null,
+ getSongLoaderSortOrder())
)
return splitIntoAlbums(songs)
@@ -178,7 +191,6 @@ object AlbumLoader {
private fun getSongLoaderSortOrder(): String {
return PreferenceUtil.getInstance().albumSortOrder + ", " +
- //PreferenceUtil.getInstance().getAlbumSongSortOrder() + "," +
PreferenceUtil.getInstance().albumDetailSongSortOrder
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt b/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt
index 44301c60..516b02df 100644
--- a/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt
@@ -24,8 +24,11 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.util.PreferenceUtil
import com.google.android.material.bottomnavigation.BottomNavigationView
-class BottomNavigationBarTinted @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
- BottomNavigationView(context, attrs, defStyleAttr) {
+class BottomNavigationBarTinted @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = 0
+) : BottomNavigationView(context, attrs, defStyleAttr) {
init {
labelVisibilityMode = PreferenceUtil.getInstance().tabTitleMode