Skip to content

Commit

Permalink
release v1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
naman14 committed Feb 9, 2019
1 parent 987653f commit 1fc64eb
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 29 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/naman14/timberx/PrefsModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.naman14.timberx.constants.AppThemes.LIGHT
import com.naman14.timberx.constants.SongSortOrder
import com.naman14.timberx.constants.SongSortOrder.SONG_A_Z
import com.naman14.timberx.constants.StartPage
import com.naman14.timberx.constants.StartPage.ALBUMS
import com.naman14.timberx.constants.StartPage.SONGS
import org.koin.dsl.module.module

const val PREF_APP_THEME = "theme_preference"
Expand Down Expand Up @@ -53,7 +53,7 @@ val prefsModule = module {
}

factory(name = PREF_START_PAGE) {
get<RxkPrefs>().enum(PREF_START_PAGE, ALBUMS,
get<RxkPrefs>().enum(PREF_START_PAGE, SONGS,
StartPage.Companion::fromString, StartPage.Companion::toString)
}

Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/naman14/timberx/cast/CastServer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.naman14.timberx.cast

import android.content.Context
import com.naman14.timberx.extensions.closeQuietly
import com.naman14.timberx.util.MusicUtils.getRealPathFromURI
import com.naman14.timberx.util.MusicUtils.getSongUri
import com.naman14.timberx.util.Utils.getAlbumArtUri
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ enum class AlbumSortOrder(val rawValue: String) {
/* Album sort order A-Z */
ALBUM_A_Z(MediaStore.Audio.Albums.DEFAULT_SORT_ORDER),
/* Album sort order Z-A */
ALBUM_Z_A("$ALBUM_A_Z DESC"),
ALBUM_Z_A(MediaStore.Audio.Albums.DEFAULT_SORT_ORDER + " DESC"),
/* Album sort order songs */
ALBUM_NUMBER_OF_SONGS(MediaStore.Audio.Albums.NUMBER_OF_SONGS + " DESC"),
/* Album sort order year */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ enum class SongSortOrder(val rawValue: String) {
/* Song sort order A-Z */
SONG_A_Z(MediaStore.Audio.Media.DEFAULT_SORT_ORDER),
/* Song sort order Z-A */
SONG_Z_A("$SONG_A_Z DESC"),
SONG_Z_A(MediaStore.Audio.Media.DEFAULT_SORT_ORDER + " DESC"),
/* Song sort order year */
SONG_YEAR("${MediaStore.Audio.Media.YEAR} DESC"),
SONG_YEAR(MediaStore.Audio.Media.YEAR + " DESC"),
/* Song sort order duration */
SONG_DURATION("${MediaStore.Audio.Media.DURATION} DESC");
SONG_DURATION(MediaStore.Audio.Media.DURATION + " DESC");

companion object {
fun fromString(raw: String): SongSortOrder {
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/com/naman14/timberx/constants/StartPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ enum class StartPage(val index: Int) {
PLAYLISTS(2),
ARTISTS(3),
FOLDERS(4),
GENRES(5),
LAST_OPENED(-1);
GENRES(5);

companion object {
fun fromString(raw: String): StartPage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
import com.afollestad.rxkprefs.Pref
import com.naman14.timberx.PREF_APP_THEME
import com.naman14.timberx.PREF_START_PAGE
import com.naman14.timberx.R
import com.naman14.timberx.constants.AppThemes
import com.naman14.timberx.constants.StartPage
import com.naman14.timberx.extensions.attachLifecycle
import com.naman14.timberx.extensions.ioToMain
import com.naman14.timberx.extensions.replaceFragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ class MainFragment : Fragment() {
}
viewPager.adapter = adapter
viewpager.offscreenPageLimit = 1
if (startPagePref.get().index != StartPage.LAST_OPENED.index)
viewPager.setCurrentItem(startPagePref.get().index, false)
viewPager.setCurrentItem(startPagePref.get().index, false)
}

internal class Adapter(fm: FragmentManager) : FragmentPagerAdapter(fm) {
Expand All @@ -159,10 +158,4 @@ class MainFragment : Fragment() {

override fun getPageTitle(position: Int) = titles[position]
}

override fun onDestroyView() {
if (startPagePref.get().index == StartPage.LAST_OPENED.index)
startPagePref.set(StartPage.fromIndex(viewpager.currentItem))
super.onDestroyView()
}
}
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_now_playing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_height="50dp"
android:layout_alignParentTop="true">

<TextView
Expand Down Expand Up @@ -176,7 +176,7 @@
android:layout_marginLeft="40dp"
android:layout_marginTop="35dp"
android:layout_marginRight="40dp"
android:layout_marginBottom="20dp">
android:layout_marginBottom="12dp">

<ImageView
android:id="@+id/btnShuffle"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_albums_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="5dp"
android:paddingLeft="8dp"
android:paddingTop="3dp"
android:paddingRight="5dp"
android:singleLine="true"
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
<item>black</item>
</string-array>

<!--
TODO: Last opened option - probably requires a separate setting that stores what the last page was, rather than
overwriting this preference which is not supposed to be the last page.
-->
<string-array name="pref_startpage_entries">
<item>@string/songs</item>
<item>@string/albums</item>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
app:iconSpaceReserved="false" />

<ListPreference
android:defaultValue="last_opened"
android:defaultValue="songs"
android:entries="@array/pref_startpage_entries"
android:entryValues="@array/pref_startpage_values"
android:key="start_page_preference"
Expand Down
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext.versions = [
// App
minSdk : 21,
targetSdk : 28,
versionCode : 4,
versionName : "1.3",
versionCode : 5,
versionName : "1.5",

// Plugins
kotlin : "1.3.20",
Expand Down

0 comments on commit 1fc64eb

Please sign in to comment.