Fix Gener details not showing buttons, list text bold

This commit is contained in:
h4h13 2019-06-06 17:34:28 +05:30
parent 8f1672b38e
commit 17f3f1dac1
10 changed files with 27 additions and 34 deletions

View file

@ -31,7 +31,7 @@ android {
vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic"
versionCode 331
versionCode 333
versionName '3.1.900'
multiDexEnabled true

File diff suppressed because one or more lines are too long

View file

@ -12,6 +12,7 @@ import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
import code.name.monkey.retromusic.adapter.song.ShuffleButtonSongAdapter
import code.name.monkey.retromusic.adapter.song.SongAdapter
import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.helper.menu.GenreMenuHelper
@ -34,18 +35,17 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), GenreDetailsContrac
private var genre: Genre? = null
private var presenter: GenreDetailsPresenter? = null
private var songAdapter: SongAdapter? = null
private lateinit var songAdapter: ShuffleButtonSongAdapter
private var cab: MaterialCab? = null
private fun checkIsEmpty() {
empty!!.visibility = if (songAdapter!!.itemCount == 0) View.VISIBLE else View.GONE
empty?.visibility = if (songAdapter.itemCount == 0) View.VISIBLE else View.GONE
}
override fun onCreate(savedInstanceState: Bundle?) {
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
setStatusbarColor(Color.TRANSPARENT)
setNavigationbarColorAuto()
setTaskDescriptionColorAuto()
@ -53,8 +53,8 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), GenreDetailsContrac
setLightStatusbar(ColorUtil.isColorLight(ThemeStore.primaryColor(this)))
toggleBottomNavigationView(true)
genre = intent.extras!!.getParcelable(EXTRA_GENRE_ID)
presenter = GenreDetailsPresenter(this, genre!!.id)
genre = intent?.extras?.getParcelable(EXTRA_GENRE_ID)
presenter = genre?.id?.let { GenreDetailsPresenter(this, it) }
setUpToolBar()
setupRecyclerView()
@ -66,17 +66,17 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), GenreDetailsContrac
appBarLayout.setBackgroundColor(primaryColor)
applyToolbar(toolbar)
title = genre!!.name
title = genre?.name
}
override fun onResume() {
super.onResume()
presenter!!.subscribe()
presenter?.subscribe()
}
override fun onPause() {
super.onPause()
presenter!!.unsubscribe()
presenter?.unsubscribe()
}
override fun createContentView(): View {
@ -110,13 +110,13 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), GenreDetailsContrac
private fun setupRecyclerView() {
ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView, ThemeStore.accentColor(this))
songAdapter = SongAdapter(this, ArrayList(), R.layout.item_list, false, this)
songAdapter = ShuffleButtonSongAdapter(this, ArrayList(), R.layout.item_list, false, this)
recyclerView.apply {
itemAnimator = DefaultItemAnimator()
layoutManager = LinearLayoutManager(this@GenreDetailsActivity)
adapter = songAdapter
}
songAdapter!!.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
songAdapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
override fun onChanged() {
super.onChanged()
checkIsEmpty()
@ -125,7 +125,7 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), GenreDetailsContrac
}
override fun showData(list: ArrayList<Song>) {
songAdapter!!.swapDataSet(list)
songAdapter.swapDataSet(list)
}
override fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab {
@ -149,7 +149,7 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), GenreDetailsContrac
override fun onMediaStoreChanged() {
super.onMediaStoreChanged()
presenter!!.subscribe()
presenter?.subscribe()
}
companion object {

View file

@ -1,5 +1,6 @@
package code.name.monkey.retromusic.activities
import android.graphics.Color
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
@ -7,6 +8,7 @@ import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
import code.name.monkey.retromusic.adapter.song.OrderablePlaylistSongAdapter
@ -20,6 +22,7 @@ import code.name.monkey.retromusic.model.AbsCustomPlaylist
import code.name.monkey.retromusic.model.Playlist
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.mvp.contract.PlaylistSongsContract
import code.name.monkey.retromusic.mvp.contract.PlaylistSongsContract.*
import code.name.monkey.retromusic.mvp.presenter.PlaylistSongsPresenter
import code.name.monkey.retromusic.util.PlaylistsUtil
import code.name.monkey.retromusic.util.RetroColorUtil
@ -31,7 +34,7 @@ import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
import kotlinx.android.synthetic.main.activity_playlist_detail.*
import java.util.*
class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, PlaylistSongsContract.PlaylistSongsView {
class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, PlaylistSongsView {
private var playlist: Playlist? = null
private var cab: MaterialCab? = null
@ -44,10 +47,11 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
setStatusbarColorAuto()
setStatusbarColor(Color.TRANSPARENT)
setNavigationbarColorAuto()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
setLightStatusbar(ColorUtil.isColorLight(ThemeStore.primaryColor(this)))
toggleBottomNavigationView(true)

View file

@ -128,7 +128,7 @@ class UserInfoActivity : AbsBaseActivity() {
private fun selectBannerImage() {
if (PreferenceUtil.getInstance().bannerImage.isEmpty()) {
if (TextUtils.isEmpty(PreferenceUtil.getInstance().bannerImage)) {
val pickImageIntent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
pickImageIntent.type = "image/*"
//pickImageIntent.putExtra("crop", "true")
@ -138,8 +138,7 @@ class UserInfoActivity : AbsBaseActivity() {
pickImageIntent.putExtra("aspectY", 9)
pickImageIntent.putExtra("scale", true)
//intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(pickImageIntent,
"Select Picture"), PICK_BANNER_REQUEST)
startActivityForResult(Intent.createChooser(pickImageIntent, "Select Picture"), PICK_BANNER_REQUEST)
} else {
PreferenceUtil.getInstance().setBannerImagePath("")
bannerImage.setImageResource(android.R.color.transparent)

View file

@ -25,11 +25,11 @@ class GenreAdapter(private val mActivity: Activity, dataSet: ArrayList<Genre>, p
this.dataSet = dataSet
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GenreAdapter.ViewHolder {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(LayoutInflater.from(mActivity).inflate(mItemLayoutRes, parent, false))
}
override fun onBindViewHolder(holder: GenreAdapter.ViewHolder, position: Int) {
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val genre = dataSet[position]
if (holder.title != null) {
holder.title!!.text = genre.name

View file

@ -61,17 +61,7 @@ class PlaylistAdapter(protected val activity: AppCompatActivity, dataSet: ArrayL
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
/* if (getItemViewType(position) == SMART_PLAYLIST) {
if (holder.viewList != null) {
holder.viewList.get(0).setOnClickListener(
v -> NavigationUtil.goToPlaylistNew(activity, new HistoryPlaylist(activity)));
holder.viewList.get(1).setOnClickListener(
v -> NavigationUtil.goToPlaylistNew(activity, new LastAddedPlaylist(activity)));
holder.viewList.get(2).setOnClickListener(
v -> NavigationUtil.goToPlaylistNew(activity, new MyTopTracksPlaylist(activity)));
}
return;
}*/
val playlist = dataSet[position]
val songs = getSongs(playlist)
holder.itemView.isActivated = isChecked(playlist)

View file

@ -81,7 +81,6 @@
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
app:fontFamily="@font/circular_std_medium"
android:textSize="16sp" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView

View file

@ -29,7 +29,7 @@
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:padding="10dp"
android:text="@string/action_play"
android:text="@string/action_play_all"
android:textAllCaps="false"
app:cornerRadius="6dp"
app:icon="@drawable/ic_play_arrow_white_24dp"

View file

@ -625,4 +625,5 @@
<string name="welcome">Welcome,</string>
<string name="premium">Get Premium</string>
<string name="pro_summary">Now playing themes, Carousel effect, Color theme and more..</string>
<string name="action_play_all">Play all</string>
</resources>