Fix not showing empty state

This commit is contained in:
h4h13 2020-05-01 02:18:14 +05:30
parent 911e18bf89
commit 69c76556a2
13 changed files with 234 additions and 205 deletions

View file

@ -24,7 +24,7 @@ android {
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic" applicationId "code.name.monkey.retromusic"
versionCode 420 versionCode 422
versionName '3.5.110' versionName '3.5.110'
multiDexEnabled true multiDexEnabled true

View file

@ -57,7 +57,7 @@
</head> </head>
<body> <body>
<h5>April 28, 2020</h5> <h5>April 30, 2020</h5>
<h2>v3.5.110</h2> <h2>v3.5.110</h2>
<span class="tag"><i>Beta version</i></span> <span class="tag"><i>Beta version</i></span>
<h3><span class="colorHeader">What's New</span></h3> <h3><span class="colorHeader">What's New</span></h3>

View file

@ -27,9 +27,7 @@ import code.name.monkey.retromusic.adapter.ContributorAdapter
import code.name.monkey.retromusic.model.Contributor import code.name.monkey.retromusic.model.Contributor
import code.name.monkey.retromusic.util.NavigationUtil import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.list.listItems import com.afollestad.materialdialogs.list.listItems
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
@ -121,7 +119,7 @@ class AboutActivity : AbsBaseActivity(), View.OnClickListener {
R.id.donateLink -> NavigationUtil.goToSupportDevelopment(this) R.id.donateLink -> NavigationUtil.goToSupportDevelopment(this)
R.id.instagramLink -> openUrl(APP_INSTAGRAM_LINK) R.id.instagramLink -> openUrl(APP_INSTAGRAM_LINK)
R.id.twitterLink -> openUrl(APP_TWITTER_LINK) R.id.twitterLink -> openUrl(APP_TWITTER_LINK)
R.id.changelog -> showChangeLogOptions() R.id.changelog -> openUrl(TELEGRAM_CHANGE_LOG)
R.id.openSource -> NavigationUtil.goToOpenSource(this) R.id.openSource -> NavigationUtil.goToOpenSource(this)
R.id.bugReportLink -> NavigationUtil.bugReport(this) R.id.bugReportLink -> NavigationUtil.bugReport(this)
} }

View file

@ -183,7 +183,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
mToolbar = findViewById(R.id.toolbar); mToolbar = findViewById(R.id.toolbar);
mAppBarLayout = findViewById(R.id.appBarLayout); mAppBarLayout = findViewById(R.id.appBarLayout);
checkShowChangelog(); //checkShowChangelog();
AppRater.appLaunched(this); AppRater.appLaunched(this);
setupToolbar(); setupToolbar();
checkUpdate(); checkUpdate();

View file

@ -1,12 +1,14 @@
package code.name.monkey.retromusic.activities package code.name.monkey.retromusic.activities
import android.content.Intent import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.AsyncTask import android.os.AsyncTask
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
import android.view.MenuItem import android.view.MenuItem
import android.widget.Toast import android.widget.Toast
import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.MaterialUtil import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.App import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.BuildConfig import code.name.monkey.retromusic.BuildConfig
@ -26,18 +28,18 @@ class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
setDrawUnderStatusBar() setDrawUnderStatusBar()
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_pro_version) setContentView(R.layout.activity_pro_version)
setStatusbarColorAuto() setStatusbarColor(Color.TRANSPARENT)
setNavigationbarColorAuto() setLightStatusbar(false)
setLightNavigationBar(true) setNavigationbarColor(Color.BLACK)
toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface)) setLightNavigationBar(false)
setSupportActionBar(toolbar) toolbar.navigationIcon?.setTint(Color.WHITE)
toolbar.setNavigationOnClickListener { onBackPressed() }
restoreButton.isEnabled = false restoreButton.isEnabled = false
purchaseButton.isEnabled = false purchaseButton.isEnabled = false
billingProcessor = BillingProcessor(this, BuildConfig.GOOGLE_PLAY_LICENSING_KEY, this) billingProcessor = BillingProcessor(this, BuildConfig.GOOGLE_PLAY_LICENSING_KEY, this)
MaterialUtil.setTint(restoreButton, false)
MaterialUtil.setTint(purchaseButton, true) MaterialUtil.setTint(purchaseButton, true)
restoreButton.setOnClickListener { restoreButton.setOnClickListener {
@ -49,6 +51,8 @@ class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
purchaseButton.setOnClickListener { purchaseButton.setOnClickListener {
billingProcessor.purchase(this@PurchaseActivity, App.PRO_VERSION_PRODUCT_ID) billingProcessor.purchase(this@PurchaseActivity, App.PRO_VERSION_PRODUCT_ID)
} }
bannerContainer.backgroundTintList =
ColorStateList.valueOf(ThemeStore.accentColor(this))
} }
private fun restorePurchase() { private fun restorePurchase() {

View file

@ -20,6 +20,8 @@ class AlbumViewModel(application: Application) : AndroidViewModel(application) {
val result = RepositoryImpl(getApplication()).allAlbums() val result = RepositoryImpl(getApplication()).allAlbums()
if (result is Result.Success) { if (result is Result.Success) {
albums.value = result.data albums.value = result.data
}else {
albums.value = listOf()
} }
} }
} }

View file

@ -20,6 +20,8 @@ class ArtistViewModel(application: Application) : AndroidViewModel(application)
val result = RepositoryImpl(getApplication()).allArtists() val result = RepositoryImpl(getApplication()).allArtists()
if (result is Result.Success) { if (result is Result.Success) {
artists.value = result.data artists.value = result.data
} else {
artists.value = listOf()
} }
} }
} }

View file

@ -20,6 +20,8 @@ class GenreViewModel(application: Application) : AndroidViewModel(application) {
val result = RepositoryImpl(getApplication()).allGenres() val result = RepositoryImpl(getApplication()).allGenres()
if (result is Success) { if (result is Success) {
genres.value = result.data genres.value = result.data
}else {
genres.value = listOf()
} }
} }
} }

View file

@ -10,7 +10,7 @@ import code.name.monkey.retromusic.providers.RepositoryImpl
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
class PlaylistViewModel(application: Application) : AndroidViewModel(application) { class PlaylistViewModel(application: Application) : AndroidViewModel(application) {
lateinit var playlists: MutableLiveData<List<Playlist>> var playlists = MutableLiveData<List<Playlist>>()
init { init {
loadPlaylist() loadPlaylist()
@ -19,7 +19,9 @@ class PlaylistViewModel(application: Application) : AndroidViewModel(application
fun loadPlaylist() = viewModelScope.launch { fun loadPlaylist() = viewModelScope.launch {
val result = RepositoryImpl(getApplication()).allPlaylists() val result = RepositoryImpl(getApplication()).allPlaylists()
if (result is Result.Success) { if (result is Result.Success) {
playlists = MutableLiveData(result.data) playlists.value = result.data
} else {
playlists.value = listOf()
} }
} }
} }

View file

@ -20,6 +20,8 @@ class SongsViewModel(application: Application) : AndroidViewModel(application) {
val result = RepositoryImpl(getApplication()).allSongs() val result = RepositoryImpl(getApplication()).allSongs()
if (result is Success) { if (result is Success) {
songs.value = result.data songs.value = result.data
} else {
songs.value = listOf()
} }
} }
} }

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="315"
android:centerColor="@android:color/transparent"
android:endColor="@android:color/transparent"
android:startColor="@color/md_deep_purple_500" />
</shape>

View file

@ -1,217 +1,225 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:background="@color/md_black_1000"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<View
android:id="@+id/bannerContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shadow_pro"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<code.name.monkey.retromusic.views.StatusBarView <code.name.monkey.retromusic.views.StatusBarView
android:id="@+id/status_bar" android:id="@+id/status_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:background="?attr/colorSurface" android:background="?attr/colorSurface"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UnusedAttribute" /> tools:ignore="UnusedAttribute" />
<com.google.android.material.appbar.AppBarLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout android:id="@+id/appBarLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:background="?attr/colorSurface"> android:background="@android:color/transparent"
android:elevation="0dp"
<com.google.android.material.appbar.AppBarLayout app:elevation="0dp"
android:id="@+id/appBarLayout" app:layout_constraintEnd_toEndOf="parent"
android:layout_width="match_parent" app:layout_constraintStart_toStartOf="parent"
android:layout_height="wrap_content" app:layout_constraintTop_toBottomOf="@id/status_bar">
android:background="@android:color/transparent"
android:elevation="0dp"
app:elevation="0dp">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
app:titleEnabled="false">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
style="@style/Toolbar" style="@style/Toolbar"
app:layout_collapseMode="pin" app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp" app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/retro_music_pro" app:title="@string/retro_music_pro"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
tools:ignore="UnusedAttribute" /> app:titleTextColor="@color/md_white_1000"
tools:ignore="UnusedAttribute" />
</com.google.android.material.appbar.CollapsingToolbarLayout> </com.google.android.material.appbar.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:id="@+id/cardContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@id/actions"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/appBarLayout">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:gravity="center_vertical"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> android:orientation="horizontal">
<com.google.android.material.card.MaterialCardView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/content" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
app:srcCompat="@drawable/ic_invert_colors_white_24dp"
app:tint="@color/md_white_1000" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="4dp" android:padding="16dp"
app:cardCornerRadius="8dp" android:text="@string/black_theme_name"
app:cardUseCompatPadding="true"> android:textAppearance="@style/TextViewSubtitle1"
android:textColor="@color/md_white_1000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
app:srcCompat="@drawable/ic_invert_colors_white_24dp"
app:tint="?colorOnSurface" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="@string/black_theme_name"
android:textAppearance="@style/TextViewSubtitle1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
app:srcCompat="@drawable/ic_theme_palette_white_24dp"
app:tint="?colorOnSurface" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="@string/now_playing_themes"
android:textAppearance="@style/TextViewSubtitle1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
app:srcCompat="@drawable/ic_view_carousel_black_24dp"
app:tint="?colorOnSurface" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="@string/carousal_effect_on_now_playing_screen"
android:textAppearance="@style/TextViewSubtitle1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
app:srcCompat="@drawable/ic_rounded_corner"
app:tint="?colorOnSurface" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="@string/window_corner_edges"
android:textAppearance="@style/TextViewSubtitle1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
app:srcCompat="@drawable/ic_favorite_white_24dp"
app:tint="?colorOnSurface" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="@string/support_development"
android:textAppearance="@style/TextViewSubtitle1" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<LinearLayout
android:id="@+id/actions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/restoreButton"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_weight="1"
android:paddingTop="14dp"
android:paddingBottom="14dp"
android:text="@string/restore"
android:textAllCaps="false"
android:textColor="?colorOnBackground"
app:strokeWidth="2dp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/purchaseButton"
style="@style/Widget.MaterialComponents.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_weight="1"
android:paddingTop="14dp"
android:paddingBottom="14dp"
android:text="@string/purchase"
android:textAllCaps="false" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
app:srcCompat="@drawable/ic_theme_palette_white_24dp"
app:tint="@color/md_white_1000" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="@string/now_playing_themes"
android:textAppearance="@style/TextViewSubtitle1"
android:textColor="@color/md_white_1000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
app:srcCompat="@drawable/ic_view_carousel_black_24dp"
app:tint="@color/md_white_1000" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="@string/carousal_effect_on_now_playing_screen"
android:textAppearance="@style/TextViewSubtitle1"
android:textColor="@color/md_white_1000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
app:srcCompat="@drawable/ic_rounded_corner"
app:tint="@color/md_white_1000" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="@string/window_corner_edges"
android:textAppearance="@style/TextViewSubtitle1"
android:textColor="@color/md_white_1000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
app:srcCompat="@drawable/ic_favorite_white_24dp"
app:tint="@color/md_white_1000" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="@string/support_development"
android:textAppearance="@style/TextViewSubtitle1"
android:textColor="@color/md_white_1000" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/actions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="24dp"
android:text="@string/try_retro_music_premium"
android:textAppearance="@style/TextViewHeadline5"
android:textColor="@color/md_white_1000" />
<com.google.android.material.button.MaterialButton
android:id="@+id/restoreButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:paddingVertical="16dp"
android:text="@string/restore"
android:textAppearance="@style/TextViewHeadline6"
android:textColor="@color/md_black_1000"
app:backgroundTint="@color/md_white_1000"
app:cornerRadius="28dp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/purchaseButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:paddingVertical="16dp"
android:text="@string/purchase"
android:textAppearance="@style/TextViewHeadline6"
app:cornerRadius="28dp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -850,6 +850,7 @@
<string name="pref_language_name">Select language</string> <string name="pref_language_name">Select language</string>
<string name="translators">Translators</string> <string name="translators">Translators</string>
<string name="translators_summary">The people who helped translate this app</string> <string name="translators_summary">The people who helped translate this app</string>
<string name="try_retro_music_premium">Try Retro Music Premium</string>
<plurals name="albumSongs"> <plurals name="albumSongs">
<item quantity="one">Song</item> <item quantity="one">Song</item>