Combine home section in single Recycler View

This commit is contained in:
hemanths@live.com 2019-01-19 11:48:26 +05:30
parent 9ea7735261
commit 36a58d5869
39 changed files with 686 additions and 76 deletions

View file

@ -117,7 +117,7 @@ static def getDate() {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation "androidx.fragment:fragment:$supportLibVersion"
implementation "androidx.appcompat:appcompat:1.0.2"
implementation "androidx.recyclerview:recyclerview:$supportLibVersion"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View file

@ -3,6 +3,7 @@ package code.name.monkey.retromusic.helper
import android.annotation.TargetApi
import android.app.Activity
import android.content.*
import android.database.Cursor
import android.net.Uri
import android.os.Build
import android.os.Environment
@ -116,15 +117,19 @@ object MusicPlayerRemote {
val column = "_data"
val projection = arrayOf(column)
var cursor: Cursor? = null
try {
context.contentResolver.query(uri, projection, null, null, null)!!.use { cursor ->
if (cursor.moveToFirst()) {
val column_index = cursor.getColumnIndexOrThrow(column)
return cursor.getString(column_index)
cursor = context.contentResolver.query(uri, projection, null, null, null)
cursor.use { it ->
if (it.moveToFirst()) {
val columnIndex = it.getColumnIndexOrThrow(column)
return it.getString(columnIndex)
}
}
} catch (e: Exception) {
Log.e(TAG, e.message)
} finally {
cursor!!.close()
}
return null
@ -398,13 +403,6 @@ object MusicPlayerRemote {
return DocumentsContract.getDocumentId(uri).split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[1]
}
internal annotation class PlaybackLocation {
companion object {
val REMOTE = 0
val LOCAL = 1
}
}
class ServiceBinder internal constructor(private val mCallback: ServiceConnection?) : ServiceConnection {
override fun onServiceConnected(className: ComponentName, service: IBinder) {

View file

@ -0,0 +1,44 @@
package code.name.monkey.retromusic.model;
import androidx.annotation.StringRes;
import java.util.ArrayList;
import code.name.monkey.retromusic.ui.adapter.HomeAdapter.Companion.HomeSection;
public class Home {
@StringRes
int title;
@StringRes
int subtitle;
@HomeSection
int homeSection;
ArrayList arrayList;
public Home(int title, int subtitle, ArrayList arrayList, @HomeSection int homeSection) {
this.title = title;
this.subtitle = subtitle;
this.arrayList = arrayList;
this.homeSection = homeSection;
}
@HomeSection
public int getHomeSection() {
return homeSection;
}
@StringRes
public int getTitle() {
return title;
}
@StringRes
public int getSubtitle() {
return subtitle;
}
public ArrayList getArrayList() {
return arrayList;
}
}

View file

@ -1,8 +1,6 @@
package code.name.monkey.retromusic.mvp.contract
import code.name.monkey.retromusic.model.*
import java.util.ArrayList
import code.name.monkey.retromusic.mvp.BasePresenter
import code.name.monkey.retromusic.mvp.BaseView
@ -10,7 +8,7 @@ interface HomeContract {
interface HomeView : BaseView<ArrayList<Any>> {
fun recentArtist(artists: ArrayList<Artist>)
/*fun recentArtist(artists: ArrayList<Artist>)
fun recentAlbum(albums: ArrayList<Album>)
@ -22,12 +20,14 @@ interface HomeContract {
fun playlists(playlists: ArrayList<Playlist>)
fun geners(songs: ArrayList<Genre>)
fun geners(songs: ArrayList<Genre>)*/
fun loadHomes(homes: ArrayList<Home>)
}
interface HomePresenter : BasePresenter<HomeView> {
fun loadRecentAlbums()
/*fun loadRecentAlbums()
fun loadTopAlbums()
@ -37,6 +37,7 @@ interface HomeContract {
fun loadSuggestions()
fun loadGenres()
fun loadGenres()*/
fun loadAll();
}
}

View file

@ -1,36 +1,71 @@
package code.name.monkey.retromusic.mvp.presenter
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.model.*
import code.name.monkey.retromusic.mvp.Presenter
import code.name.monkey.retromusic.mvp.contract.HomeContract
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.ui.adapter.HomeAdapter.Companion.GENRES
import code.name.monkey.retromusic.ui.adapter.HomeAdapter.Companion.PLAYLISTS
import code.name.monkey.retromusic.ui.adapter.HomeAdapter.Companion.RECENT_ALBUMS
import code.name.monkey.retromusic.ui.adapter.HomeAdapter.Companion.RECENT_ARTISTS
import code.name.monkey.retromusic.ui.adapter.HomeAdapter.Companion.SUGGESTIONS
import code.name.monkey.retromusic.ui.adapter.HomeAdapter.Companion.TOP_ALBUMS
import code.name.monkey.retromusic.ui.adapter.HomeAdapter.Companion.TOP_ARTISTS
import io.reactivex.Observable
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable
import io.reactivex.functions.Function7
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
add(disposable)
}
class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), HomeContract.HomePresenter {
override fun loadAll() {
disposable += Observable.combineLatest(repository.suggestionSongs, repository.recentAlbums,
repository.topAlbums, repository.recentArtists, repository.topArtists,
repository.allGenres, repository.allPlaylists,
Function7<ArrayList<Song>, ArrayList<Album>, ArrayList<Album>, ArrayList<Artist>,
ArrayList<Artist>, ArrayList<Genre>, ArrayList<Playlist>, List<Home>>
{ suggestions: ArrayList<Song>, recentAlbums: ArrayList<Album>,
topAlbums: ArrayList<Album>, recentArtists: ArrayList<Artist>,
topArtists: ArrayList<Artist>, genres: ArrayList<Genre>,
playlists: ArrayList<Playlist> ->
val homes: ArrayList<Home> = ArrayList()
if (suggestions.isNotEmpty()) homes.add(Home(R.string.suggestion_songs, 0, suggestions, SUGGESTIONS))
if (recentArtists.isNotEmpty()) homes.add(Home(R.string.recent_artists, 0, recentArtists, RECENT_ARTISTS))
if (recentAlbums.isNotEmpty()) homes.add(Home(R.string.recent_albums, 0, recentAlbums, RECENT_ALBUMS))
if (topArtists.isNotEmpty()) homes.add(Home(R.string.top_artists, 0, topArtists, TOP_ARTISTS))
if (topAlbums.isNotEmpty()) homes.add(Home(R.string.top_albums, 0, topAlbums, TOP_ALBUMS))
if (genres.isNotEmpty()) homes.add(Home(R.string.genres, 0, genres, GENRES))
if (playlists.isNotEmpty()) homes.add(Home(R.string.playlists, 0, playlists, PLAYLISTS))
homes
}).subscribe { homes ->
if (homes.isNotEmpty()) {
view.loadHomes(homes as ArrayList<Home>)
}
}
}
override fun subscribe() {
loadRecentAlbums()
loadAll()
/*loadRecentAlbums()
loadRecentArtists()
loadTopAlbums()
loadTopArtists()
loadSuggestions()
loadSuggestions()*/
if (PreferenceUtil.getInstance().isGenreShown) loadGenres()
/*if (PreferenceUtil.getInstance().isGenreShown) loadGenres()*/
}
override fun unsubscribe() {
if (!disposable.isDisposed) {
if (true) {
disposable.dispose()
}
}
fun loadPlaylists() {
/*fun loadPlaylists() {
disposable += repository.allPlaylists
.observeOn(schedulerProvider.ui())
.subscribeOn(schedulerProvider.io())
@ -109,5 +144,5 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
view.geners(genres)
}
}, { view.showEmptyView() }, { view.completed() })
}
}*/
}

View file

@ -8,15 +8,27 @@ import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Environment;
import androidx.annotation.NonNull;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.NonNull;
import code.name.monkey.retromusic.Constants;
import code.name.monkey.retromusic.App;
import code.name.monkey.retromusic.model.Album;
import code.name.monkey.retromusic.model.Artist;
import code.name.monkey.retromusic.model.Genre;
import code.name.monkey.retromusic.model.Home;
import code.name.monkey.retromusic.model.Playlist;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.util.FileUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
import io.reactivex.Observable;
import io.reactivex.functions.Function7;
import static code.name.monkey.retromusic.Constants.MEDIA_STORE_CHANGED;
import static code.name.monkey.retromusic.ui.adapter.HomeAdapter.RECENT_ALBUMS;
import static code.name.monkey.retromusic.ui.adapter.HomeAdapter.SUGGESTIONS;
public class BlacklistStore extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "blacklist.db";
@ -148,6 +160,45 @@ public class BlacklistStore extends SQLiteOpenHelper {
return paths;
}
private void hmm() {
RepositoryImpl repository = new RepositoryImpl(App.Companion.getContext());
Observable.combineLatest(repository.getSuggestionSongs(), repository.getRecentAlbums(),
repository.getTopAlbums(), repository.getRecentArtists(), repository.getTopArtists(),
repository.getAllGenres(), repository.getAllPlaylists(), new Function7<ArrayList<Song>, ArrayList<Album>, ArrayList<Album>, ArrayList<Artist>, ArrayList<Artist>, ArrayList<Genre>, ArrayList<Playlist>, List<Home>>() {
@Override
public List<Home> apply(ArrayList<Song> songs, ArrayList<Album> albums, ArrayList<Album> albums2, ArrayList<Artist> artists, ArrayList<Artist> artists2, ArrayList<Genre> genres, ArrayList<Playlist> playlists) throws Exception {
List<Home> homes = new ArrayList<>();
homes.add(new Home(0, 0, songs, SUGGESTIONS));
homes.add(new Home(0, 0, albums, RECENT_ALBUMS));
return homes;
}
}).subscribe(homes -> {
if (homes.isEmpty()) {
}
});
Observable.combineLatest(
repository.getSuggestionSongs(),
repository.getRecentAlbums(),
repository.getTopAlbums(),
repository.getRecentArtists(),
repository.getTopArtists(),
repository.getAllGenres(),
repository.getAllPlaylists(),
(ArrayList<Song> suggestions, ArrayList<Album> recentAlbums, ArrayList<Album> topAlbums,
ArrayList<Artist> recentArtists, ArrayList<Artist> topArtists,
ArrayList<Genre> genres, ArrayList<Playlist> playlists) -> {
List<Home> homes = new ArrayList<>();
return homes;
}).subscribe();
}
public interface BlacklistStoreColumns {
String NAME = "blacklist";

View file

@ -250,13 +250,13 @@ class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener, ViewPage
override fun onPostExecute(l: Lyrics?) {
lyrics = l
offlineLyrics.visibility = View.VISIBLE
offlineLyrics?.visibility = View.VISIBLE
if (l == null) {
offlineLyrics.setText(R.string.no_lyrics_found)
offlineLyrics?.setText(R.string.no_lyrics_found)
return
}
(activity as LyricsActivity).lyricsString = l.data
offlineLyrics.text = l.data
offlineLyrics?.text = l.data
}
override fun onCancelled(s: Lyrics?) {

View file

@ -0,0 +1,177 @@
package code.name.monkey.retromusic.ui.adapter
import android.util.DisplayMetrics
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.annotation.IntDef
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.GridLayoutManager
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.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.glide.GlideApp
import code.name.monkey.retromusic.glide.RetroGlideExtension
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.*
import code.name.monkey.retromusic.ui.adapter.album.AlbumFullWidthAdapter
import code.name.monkey.retromusic.ui.adapter.artist.ArtistAdapter
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.views.MetalRecyclerViewPager
import com.google.android.material.floatingactionbutton.FloatingActionButton
class HomeAdapter(private val activity: AppCompatActivity, private val homes: ArrayList<Home>, private val displayMetrics: DisplayMetrics) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun getItemViewType(position: Int): Int {
return homes[position].homeSection
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val layout = LayoutInflater.from(activity).inflate(R.layout.section_recycler_view, parent, false)
return when (viewType) {
SUGGESTIONS -> SuggestionViewHolder(LayoutInflater.from(activity).inflate(R.layout.section_item_collage, parent, false))
RECENT_ARTISTS, TOP_ARTISTS -> ArtistViewHolder(layout)
GENRES -> GenreViewHolder(layout)
else -> {
AlbumViewHolder(LayoutInflater.from(activity).inflate(R.layout.metal_section_recycler_view, parent, false))
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
val home = homes[position]
when (getItemViewType(position)) {
SUGGESTIONS -> {
val viewHolder = holder as SuggestionViewHolder
viewHolder.bindView(home)
}
RECENT_ALBUMS, TOP_ALBUMS -> {
val viewHolder = holder as AlbumViewHolder
viewHolder.bindView(home)
}
RECENT_ARTISTS, TOP_ARTISTS -> {
val viewHolder = holder as ArtistViewHolder
viewHolder.bindView(home)
}
GENRES -> {
val viewHolder = holder as GenreViewHolder
viewHolder.bindView(home)
}
}
}
override fun getItemCount(): Int {
return homes.size
}
companion object {
@IntDef(SUGGESTIONS, RECENT_ALBUMS, TOP_ALBUMS, RECENT_ARTISTS, TOP_ARTISTS, GENRES, PLAYLISTS)
@Retention(AnnotationRetention.SOURCE)
annotation class HomeSection
const val SUGGESTIONS = 0
const val RECENT_ALBUMS = 1
const val TOP_ALBUMS = 2
const val RECENT_ARTISTS = 3
const val TOP_ARTISTS = 4
const val GENRES = 5
const val PLAYLISTS = 6
}
private inner class SuggestionViewHolder(view: View) : RecyclerView.ViewHolder(view) {
private val ids: ArrayList<Int> = arrayListOf(R.id.image_1, R.id.image_2, R.id.image_3, R.id.image_4, R.id.image_5, R.id.image_6, R.id.image_7)
private var textView: TextView = itemView.findViewById(R.id.text)
private var playSuggestion: FloatingActionButton = itemView.findViewById(R.id.playSuggestions)
private var title: TextView = itemView.findViewById(R.id.sectionTitle)
fun bindView(home: Home) {
val dataSet = home.arrayList as ArrayList<Song>
for (id in 0 until ids.size) {
val imageView = itemView.findViewById<ImageView>(ids[id])
imageView.setOnClickListener {
MusicPlayerRemote.enqueue(dataSet[id])
}
GlideApp.with(activity)
.asBitmapPalette()
.load(RetroGlideExtension.getSongModel(dataSet[id]))
.transition(RetroGlideExtension.getDefaultTransition())
.songOptions(dataSet[id])
.into(object : RetroMusicColoredTarget(imageView) {
override fun onColorReady(color: Int) {
}
})
}
val color = ThemeStore.accentColor(activity)
textView.apply {
setBackgroundColor(color);
setTextColor(MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(color)))
}
title.text = activity.getString(home.title)
playSuggestion.apply {
TintHelper.setTintAuto(this, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(color)), false)
TintHelper.setTintAuto(this, color, true)
setOnClickListener { MusicPlayerRemote.openQueue(home.arrayList as ArrayList<Song>, 0, true) }
}
}
}
private inner class AlbumViewHolder(view: View) : RecyclerView.ViewHolder(view) {
fun bindView(home: Home) {
recyclerView.apply {
adapter = AlbumFullWidthAdapter(activity, home.arrayList as ArrayList<Album>, displayMetrics)
}
title.text = activity.getString(home.title)
}
val recyclerView: MetalRecyclerViewPager = view.findViewById(R.id.recyclerView)
val title: TextView = view.findViewById(R.id.sectionTitle)
}
private inner class ArtistViewHolder(view: View) : RecyclerView.ViewHolder(view) {
fun bindView(home: Home) {
recyclerView.apply {
layoutManager = GridLayoutManager(activity, 1, GridLayoutManager.HORIZONTAL, false)
val artistAdapter = ArtistAdapter(activity, home.arrayList as ArrayList<Artist>, PreferenceUtil.getInstance().getHomeGridStyle(context!!), false, null)
adapter = artistAdapter
}
title.text = activity.getString(home.title)
}
val recyclerView: RecyclerView = view.findViewById(R.id.recyclerView)
val title: TextView = view.findViewById(R.id.sectionTitle)
}
private inner class GenreViewHolder(view: View) : RecyclerView.ViewHolder(view) {
fun bindView(home: Home) {
recyclerView.apply {
val genreAdapter = GenreAdapter(activity, home.arrayList as ArrayList<Genre>, R.layout.item_list)
layoutManager = LinearLayoutManager(context)
adapter = genreAdapter
}
title.text = activity.getString(home.title)
}
val recyclerView: RecyclerView = view.findViewById(R.id.recyclerView)
val title: TextView = view.findViewById(R.id.sectionTitle)
}
}

View file

@ -0,0 +1,20 @@
package code.name.monkey.retromusic.ui.adapter
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import code.name.monkey.retromusic.interfaces.CabHolder
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.ui.adapter.song.SongAdapter
import java.util.*
class SpanSongsAdapter(activity: AppCompatActivity, dataSet: ArrayList<Song>, itemLayoutRes: Int, usePalette: Boolean, cabHolder: CabHolder?) : SongAdapter(activity, dataSet, itemLayoutRes, usePalette, cabHolder) {
override fun onBindViewHolder(holder: SongAdapter.ViewHolder, position: Int) {
super.onBindViewHolder(holder, position)
if (position == 0) {
val params = StaggeredGridLayoutManager.LayoutParams(StaggeredGridLayoutManager.LayoutParams.WRAP_CONTENT, StaggeredGridLayoutManager.LayoutParams.MATCH_PARENT)
params.isFullSpan = true
holder.itemView.layoutParams = params
}
}
}

View file

@ -20,7 +20,6 @@ import android.util.DisplayMetrics
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.core.util.Pair
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.glide.GlideApp
@ -30,21 +29,12 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Album
import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.views.MetalRecyclerViewPager
import java.util.*
class AlbumFullWithAdapter(private val activity: Activity,
metrics: DisplayMetrics) : MetalRecyclerViewPager.MetalAdapter<AlbumFullWithAdapter.FullMetalViewHolder>(metrics) {
private var dataSet: List<Album> = ArrayList()
fun swapData(list: ArrayList<Album>) {
dataSet = list
notifyDataSetChanged()
}
class AlbumFullWidthAdapter(private val activity: Activity, private val dataSet: ArrayList<Album>, metrics: DisplayMetrics) :
MetalRecyclerViewPager.MetalAdapter<AlbumFullWidthAdapter.FullMetalViewHolder>(metrics) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FullMetalViewHolder {
val viewItem = LayoutInflater.from(parent.context)
.inflate(R.layout.pager_item, parent, false)
return FullMetalViewHolder(viewItem)
return FullMetalViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.pager_item, parent, false))
}
override fun onBindViewHolder(holder: FullMetalViewHolder, position: Int) {
@ -97,7 +87,7 @@ class AlbumFullWithAdapter(private val activity: Activity,
inner class FullMetalViewHolder(itemView: View) : MetalRecyclerViewPager.MetalViewHolder(itemView) {
override fun onClick(v: View?) {
val albumPairs = arrayOf<Pair<*, *>>(Pair.create<ImageView, String>(image, activity.resources.getString(R.string.transition_album_art)))
val albumPairs = arrayOf<Pair<*, *>>(Pair.create(image, activity.resources.getString(R.string.transition_album_art)))
NavigationUtil.goToAlbum(activity, dataSet[adapterPosition].id, *albumPairs)
}
}

View file

@ -11,6 +11,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.SeekBar
import androidx.fragment.app.Fragment
import androidx.transition.TransitionManager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote
@ -57,6 +58,7 @@ class VolumeFragment : Fragment(), SeekBar.OnSeekBarChangeListener, OnAudioVolum
if (volumeSeekBar == null) {
return
}
volumeSeekBar.max = maxVolume
volumeSeekBar.progress = currentVolume
volumeDown.setImageResource(if (currentVolume == 0) R.drawable.ic_volume_off_white_24dp else R.drawable.ic_volume_down_white_24dp)

View file

@ -10,7 +10,6 @@ import android.view.ViewGroup
import android.widget.ImageView
import androidx.appcompat.widget.Toolbar
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.TintHelper
@ -21,31 +20,33 @@ import code.name.monkey.retromusic.glide.GlideApp
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks
import code.name.monkey.retromusic.loaders.SongLoader
import code.name.monkey.retromusic.model.*
import code.name.monkey.retromusic.model.Home
import code.name.monkey.retromusic.model.smartplaylist.HistoryPlaylist
import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist
import code.name.monkey.retromusic.model.smartplaylist.MyTopTracksPlaylist
import code.name.monkey.retromusic.mvp.contract.HomeContract
import code.name.monkey.retromusic.mvp.presenter.HomePresenter
import code.name.monkey.retromusic.ui.adapter.CollageSongAdapter
import code.name.monkey.retromusic.ui.adapter.GenreAdapter
import code.name.monkey.retromusic.ui.adapter.album.AlbumFullWithAdapter
import code.name.monkey.retromusic.ui.adapter.artist.ArtistAdapter
import code.name.monkey.retromusic.ui.adapter.HomeAdapter
import code.name.monkey.retromusic.ui.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.util.Compressor
import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroUtil
import com.bumptech.glide.load.engine.DiskCacheStrategy
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.fragment_banner_home.*
import kotlinx.android.synthetic.main.home_section_content.*
import java.io.File
import java.util.*
class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallbacks, HomeContract.HomeView {
override fun loadHomes(homes: ArrayList<Home>) {
recyclerView.apply {
val homeAdapter = HomeAdapter(mainActivity, homes, displayMetrics)
layoutManager = LinearLayoutManager(mainActivity)
adapter = homeAdapter
}
}
val disposable: CompositeDisposable = CompositeDisposable()
private lateinit var homePresenter: HomePresenter
@ -208,19 +209,18 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
//homeAdapter.swapDataSet(homes);
}
override fun recentArtist(artists: ArrayList<Artist>) {
recentArtistContainer.visibility = View.VISIBLE
/*override fun recentArtist(artists: ArrayList<Artist>) {
*//* recentArtistContainer.visibility = View.VISIBLE
recentArtist.apply {
val artistAdapter = ArtistAdapter(mainActivity, artists, PreferenceUtil.getInstance().getHomeGridStyle(context!!), false, null)
layoutManager = GridLayoutManager(mainActivity, 1, GridLayoutManager.HORIZONTAL, false)
adapter = artistAdapter
}
}*//*
}
override fun recentAlbum(albums: ArrayList<Album>) {
recentAlbumsContainer.visibility = View.VISIBLE
val artistAdapter = AlbumFullWithAdapter(mainActivity, displayMetrics)
artistAdapter.swapData(albums)
val artistAdapter = AlbumFullWidthAdapter(mainActivity, albums, displayMetrics)
recentAlbum.adapter = artistAdapter
}
@ -236,17 +236,27 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
override fun topAlbums(albums: ArrayList<Album>) {
topAlbumsContainer.visibility = View.VISIBLE
val artistAdapter = AlbumFullWithAdapter(mainActivity, displayMetrics)
artistAdapter.swapData(albums)
val artistAdapter = AlbumFullWidthAdapter(mainActivity, albums, displayMetrics)
topAlbum.adapter = artistAdapter
}
override fun suggestions(songs: ArrayList<Song>) {
if (!songs.isEmpty()) {
suggestionContainer.visibility = View.VISIBLE
val artistAdapter = CollageSongAdapter(mainActivity, songs)
val artistAdapter = SpanSongsAdapter(mainActivity, songs, R.layout.image, false, null)
val manager = GridLayoutManager(mainActivity, 2, GridLayoutManager.HORIZONTAL, false)
manager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
override fun getSpanSize(position: Int): Int {
return when (position) {
0 -> 2
else -> {
1
}
}
}
}
suggestionSongs.apply {
layoutManager = if (RetroUtil.isTablet()) GridLayoutManager(mainActivity, 2) else LinearLayoutManager(mainActivity)
layoutManager = if (RetroUtil.isTablet()) GridLayoutManager(mainActivity, 2) else manager
adapter = artistAdapter
}
}
@ -264,7 +274,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
adapter = genreAdapter
}
}
*/
companion object {

View file

@ -208,7 +208,7 @@ class ColorFragment : AbsPlayerFragment() {
private fun setColors(backgroundColor: Int, textColor: Int) {
playbackControlsFragment!!.setDark(textColor, backgroundColor)
colorGradientBackground.setBackgroundColor(backgroundColor)
colorGradientBackground?.setBackgroundColor(backgroundColor)
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, textColor, activity)
@ -230,7 +230,7 @@ class ColorFragment : AbsPlayerFragment() {
valueAnimator = ValueAnimator.ofObject(ArgbEvaluator(), paletteColor, i)
valueAnimator!!.addUpdateListener { animation ->
colorGradientBackground.setBackgroundColor(animation.animatedValue as Int)
colorGradientBackground?.setBackgroundColor(animation.animatedValue as Int)
}
valueAnimator!!.setDuration(ViewUtil.RETRO_MUSIC_ANIM_TIME.toLong()).start()
}

View file

@ -56,7 +56,7 @@ class FlatPlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbac
valueAnimator!!.addUpdateListener { animation ->
val drawable = DrawableGradient(GradientDrawable.Orientation.TOP_BOTTOM,
intArrayOf(animation.animatedValue as Int, android.R.color.transparent), 0)
colorGradientBackground!!.background = drawable
colorGradientBackground?.background = drawable
}
valueAnimator!!.setDuration(ViewUtil.RETRO_MUSIC_ANIM_TIME.toLong()).start()

View file

@ -38,7 +38,7 @@ class PlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks {
valueAnimator = ValueAnimator.ofObject(ArgbEvaluator(), android.R.color.transparent, i)
valueAnimator!!.addUpdateListener { animation ->
val drawable = DrawableGradient(GradientDrawable.Orientation.TOP_BOTTOM, intArrayOf(animation.animatedValue as Int, android.R.color.transparent), 0)
colorGradientBackground!!.background = drawable
colorGradientBackground?.background = drawable
}
valueAnimator!!.setDuration(ViewUtil.RETRO_MUSIC_ANIM_TIME.toLong()).start()
}

View file

@ -100,7 +100,11 @@
<include layout="@layout/abs_playlists" />
<include layout="@layout/home_section_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.core.widget.NestedScrollView>

View file

@ -67,7 +67,11 @@
<include layout="@layout/abs_playlists" />
<include layout="@layout/home_section_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -4,6 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">
<LinearLayout
@ -11,6 +12,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:visibility="visible"
android:visibility="gone">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
@ -19,7 +21,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recentArtist"
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false" />

View file

@ -2,7 +2,7 @@
<code.name.monkey.retromusic.views.WidthFitSquareLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/image_container"
android:layout_width="match_parent"
android:layout_width="196dp"
android:layout_height="match_parent"
android:orientation="vertical">

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:id="@+id/sectionTitle"
style="@style/SubTitleTextAppearance"
android:textStyle="bold" />
<code.name.monkey.retromusic.views.MetalRecyclerViewPager
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
app:itemMargin="28dp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="8dp"
android:background="?attr/dividerColor" />
</LinearLayout>

View file

@ -0,0 +1,220 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:id="@+id/sectionTitle"
style="@style/SubTitleTextAppearance"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/md_red_400"
android:padding="8dp"
android:text="New music mix"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline4"
app:autoSizeMaxTextSize="128sp"
app:autoSizeMinTextSize="24sp"
app:autoSizeStepGranularity="1sp"
app:autoSizeTextType="uniform" />
</com.google.android.material.card.MaterialCardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2.68"
android:gravity="center"
android:orientation="vertical">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</com.google.android.material.card.MaterialCardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</com.google.android.material.card.MaterialCardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:minHeight="100dp">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</com.google.android.material.card.MaterialCardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</com.google.android.material.card.MaterialCardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</com.google.android.material.card.MaterialCardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_6"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</com.google.android.material.card.MaterialCardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<Space
android:layout_width="1dp"
android:layout_height="match_parent" />
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_7"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</com.google.android.material.card.MaterialCardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/playSuggestions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_play_arrow_white_24dp" />
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/recentArtistContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:id="@+id/sectionTitle"
android:textStyle="bold"
style="@style/SubTitleTextAppearance" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="8dp"
android:background="?attr/dividerColor" />
</LinearLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 515 B

After

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 902 B

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -1,4 +1,4 @@
#Thu Dec 13 05:28:53 IST 2018
#Fri Jan 18 19:55:16 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME