From fdb2ab300e25bee9fec1aa54f3a23b452f298d36 Mon Sep 17 00:00:00 2001 From: h4h13 Date: Tue, 28 Jan 2020 22:30:28 +0530 Subject: [PATCH] Layoit fixes --- app/build.gradle | 2 +- .../activities/AlbumDetailsActivity.kt | 51 +++++- .../activities/ArtistDetailActivity.kt | 55 +++--- .../activities/WhatsNewActivity.java | 2 - .../adapter/album/HorizontalAlbumAdapter.kt | 8 +- .../mainactivity/home/BannerHomeFragment.kt | 4 - .../mvp/presenter/AlbumDetailsPresenter.kt | 20 ++- .../mvp/presenter/ArtistDetailsPresenter.kt | 8 +- .../retromusic/providers/RepositoryImpl.kt | 11 ++ .../providers/interfaces/Repository.kt | 10 +- .../retromusic/rest/LastFMRestClient.java | 34 ++-- .../retromusic/rest/model/LastFmAlbum.java | 142 +++++++++++----- .../retromusic/rest/model/LastFmArtist.java | 119 ++++++++----- .../retromusic/rest/service/LastFMService.kt | 15 +- .../monkey/retromusic/util/RetroUtil.java | 12 ++ .../main/res/layout-land/activity_album.xml | 3 +- .../layout-land/activity_artist_details.xml | 3 +- .../res/layout-land/fragment_banner_home.xml | 2 +- .../main/res/layout-land/fragment_home.xml | 6 +- .../res/layout-xlarge-land/activity_album.xml | 148 ---------------- .../activity_artist_details.xml | 116 ------------- .../fragment_banner_home.xml | 136 --------------- .../res/layout-xlarge-land/fragment_home.xml | 133 --------------- .../main/res/layout-xlarge/activity_album.xml | 159 ------------------ .../layout-xlarge/activity_artist_details.xml | 116 ------------- .../fragment_album_card_cover.xml | 31 ---- .../layout-xlarge/fragment_banner_home.xml | 133 --------------- .../main/res/layout-xlarge/fragment_home.xml | 134 --------------- .../layout-xlarge/fragment_mini_player.xml | 10 +- .../main/res/layout-xlarge/item_artist.xml | 1 + app/src/main/res/layout-xlarge/item_image.xml | 2 +- app/src/main/res/layout/activity_album.xml | 4 +- .../res/layout/activity_album_content.xml | 115 ++++++++++++- .../res/layout/activity_artist_content.xml | 153 +++++++++++++---- .../res/layout/activity_artist_details.xml | 3 +- app/src/main/res/layout/activity_search.xml | 4 - .../main/res/layout/fragment_banner_home.xml | 4 +- app/src/main/res/layout/fragment_home.xml | 6 +- app/src/main/res/layout/fragment_library.xml | 4 - app/src/main/res/layout/item_album_card.xml | 4 +- app/src/main/res/layout/item_image.xml | 4 +- app/src/main/res/layout/item_song.xml | 4 +- app/src/main/res/values-xlarge/dimens.xml | 1 - app/src/main/res/values/strings.xml | 2 + app/src/main/res/values/styles.xml | 4 + settings.gradle | 2 +- 46 files changed, 594 insertions(+), 1346 deletions(-) delete mode 100644 app/src/main/res/layout-xlarge-land/activity_album.xml delete mode 100644 app/src/main/res/layout-xlarge-land/activity_artist_details.xml delete mode 100644 app/src/main/res/layout-xlarge-land/fragment_banner_home.xml delete mode 100644 app/src/main/res/layout-xlarge-land/fragment_home.xml delete mode 100644 app/src/main/res/layout-xlarge/activity_album.xml delete mode 100644 app/src/main/res/layout-xlarge/activity_artist_details.xml delete mode 100644 app/src/main/res/layout-xlarge/fragment_album_card_cover.xml delete mode 100644 app/src/main/res/layout-xlarge/fragment_banner_home.xml delete mode 100644 app/src/main/res/layout-xlarge/fragment_home.xml diff --git a/app/build.gradle b/app/build.gradle index f8c719dc..1597466e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -116,7 +116,6 @@ static def getDate() { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation project(':appthemehelper') - implementation project(':liboverscroll') implementation 'androidx.multidex:multidex:2.0.1' implementation "androidx.gridlayout:gridlayout:1.0.0" @@ -152,6 +151,7 @@ dependencies { implementation 'com.github.bumptech.glide:glide:3.8.0' implementation 'com.github.bumptech.glide:okhttp3-integration:1.5.0' + debugImplementation 'com.squareup.okhttp3:logging-interceptor:3.6.0' implementation('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar') { transitive = true diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt index d4987eb8..83204b6c 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt @@ -13,7 +13,6 @@ import androidx.core.app.ActivityCompat import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.LinearLayoutManager -import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.MaterialUtil import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper @@ -38,25 +37,31 @@ import code.name.monkey.retromusic.model.Album import code.name.monkey.retromusic.model.Artist import code.name.monkey.retromusic.mvp.presenter.AlbumDetailsPresenter import code.name.monkey.retromusic.mvp.presenter.AlbumDetailsView +import code.name.monkey.retromusic.rest.model.LastFmAlbum import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.NavigationUtil import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.RetroColorUtil +import code.name.monkey.retromusic.util.RetroUtil import com.afollestad.materialcab.MaterialCab import com.bumptech.glide.Glide import kotlinx.android.synthetic.main.activity_album.albumCoverContainer import kotlinx.android.synthetic.main.activity_album.albumText import kotlinx.android.synthetic.main.activity_album.albumTitle -import kotlinx.android.synthetic.main.activity_album.container import kotlinx.android.synthetic.main.activity_album.image import kotlinx.android.synthetic.main.activity_album.toolbar +import kotlinx.android.synthetic.main.activity_album_content.aboutAlbumText +import kotlinx.android.synthetic.main.activity_album_content.aboutAlbumTitle +import kotlinx.android.synthetic.main.activity_album_content.listeners +import kotlinx.android.synthetic.main.activity_album_content.listenersLabel import kotlinx.android.synthetic.main.activity_album_content.moreRecyclerView import kotlinx.android.synthetic.main.activity_album_content.moreTitle import kotlinx.android.synthetic.main.activity_album_content.playAction import kotlinx.android.synthetic.main.activity_album_content.recyclerView +import kotlinx.android.synthetic.main.activity_album_content.scrobbles +import kotlinx.android.synthetic.main.activity_album_content.scrobblesLabel import kotlinx.android.synthetic.main.activity_album_content.shuffleAction import kotlinx.android.synthetic.main.activity_album_content.songTitle -import me.everything.android.ui.overscroll.OverScrollDecoratorHelper import java.util.ArrayList import javax.inject.Inject import android.util.Pair as UtilPair @@ -151,6 +156,14 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C shuffleAction.apply { setOnClickListener { MusicPlayerRemote.openAndShuffleQueue(album.songs!!, true) } } + + aboutAlbumText.setOnClickListener { + if (aboutAlbumText.maxLines == 4) { + aboutAlbumText.maxLines = Integer.MAX_VALUE + } else { + aboutAlbumText.maxLines = 4 + } + } } private fun setupRecyclerView() { @@ -161,8 +174,6 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C isNestedScrollingEnabled = false adapter = simpleSongAdapter } - - OverScrollDecoratorHelper.setUpOverScroll(container) } override fun onDestroy() { @@ -200,6 +211,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C loadAlbumCover() simpleSongAdapter.swapDataSet(album.songs) albumDetailsPresenter.loadMore(album.artistId) + albumDetailsPresenter.aboutAlbum(album.artistName!!, album.title!!) } override fun moreAlbums(albums: ArrayList) { @@ -217,6 +229,24 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C moreRecyclerView.adapter = albumAdapter } + override fun aboutAlbum(lastFmAlbum: LastFmAlbum) { + if (lastFmAlbum.album.wiki != null) { + aboutAlbumText.show() + aboutAlbumTitle.show() + aboutAlbumTitle.text = String.format("About %s", lastFmAlbum.album.name) + aboutAlbumText.text = lastFmAlbum.album.wiki.content + } + if (lastFmAlbum.album.listeners.isNotEmpty()) { + listeners.show() + listenersLabel.show() + scrobbles.show() + scrobblesLabel.show() + + listeners.text = RetroUtil.formatValue(lastFmAlbum.album.listeners.toFloat()) + scrobbles.text = RetroUtil.formatValue(lastFmAlbum.album.playcount.toFloat()) + } + } + override fun loadArtistImage(artist: Artist) { ArtistGlideRequest.Builder.from(Glide.with(this), artist).generatePalette(this).build() .dontAnimate().dontTransform().into(object : RetroMusicColoredTarget(artistImage) { @@ -239,11 +269,14 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C } private fun setColors(color: Int) { - val themeColor = if (PreferenceUtil.getInstance(this).adaptiveColor) color.ripAlpha() - else ThemeStore.accentColor(this) + val textColor = if (PreferenceUtil.getInstance(this).adaptiveColor) + color.ripAlpha() + else + ATHUtil.resolveColor(this, android.R.attr.textColorPrimary) - songTitle.setTextColor(themeColor) - moreTitle.setTextColor(themeColor) + songTitle.setTextColor(textColor) + moreTitle.setTextColor(textColor) + aboutAlbumTitle.setTextColor(textColor) val buttonColor = if (PreferenceUtil.getInstance(this).adaptiveColor) color.ripAlpha() diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt index 5414af1b..359bfde6 100755 --- a/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt @@ -15,17 +15,16 @@ import androidx.core.app.ActivityCompat import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.LinearLayoutManager -import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.MaterialUtil import code.name.monkey.retromusic.App import code.name.monkey.retromusic.R import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity -import code.name.monkey.retromusic.adapter.album.AlbumAdapter import code.name.monkey.retromusic.adapter.album.HorizontalAlbumAdapter import code.name.monkey.retromusic.adapter.song.SimpleSongAdapter import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog import code.name.monkey.retromusic.extensions.ripAlpha +import code.name.monkey.retromusic.extensions.show import code.name.monkey.retromusic.glide.ArtistGlideRequest import code.name.monkey.retromusic.glide.RetroMusicColoredTarget import code.name.monkey.retromusic.helper.MusicPlayerRemote @@ -35,29 +34,30 @@ import code.name.monkey.retromusic.mvp.presenter.ArtistDetailsPresenter import code.name.monkey.retromusic.mvp.presenter.ArtistDetailsView import code.name.monkey.retromusic.rest.model.LastFmArtist import code.name.monkey.retromusic.util.CustomArtistImageUtil -import code.name.monkey.retromusic.util.DensityUtil import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.RetroColorUtil import code.name.monkey.retromusic.util.RetroUtil import com.afollestad.materialcab.MaterialCab import com.bumptech.glide.Glide -import kotlinx.android.synthetic.main.activity_album.container import kotlinx.android.synthetic.main.activity_artist_content.albumRecyclerView import kotlinx.android.synthetic.main.activity_artist_content.albumTitle import kotlinx.android.synthetic.main.activity_artist_content.biographyText import kotlinx.android.synthetic.main.activity_artist_content.biographyTitle +import kotlinx.android.synthetic.main.activity_artist_content.listeners +import kotlinx.android.synthetic.main.activity_artist_content.listenersLabel import kotlinx.android.synthetic.main.activity_artist_content.playAction import kotlinx.android.synthetic.main.activity_artist_content.recyclerView +import kotlinx.android.synthetic.main.activity_artist_content.scrobbles +import kotlinx.android.synthetic.main.activity_artist_content.scrobblesLabel import kotlinx.android.synthetic.main.activity_artist_content.shuffleAction import kotlinx.android.synthetic.main.activity_artist_content.songTitle import kotlinx.android.synthetic.main.activity_artist_details.artistCoverContainer import kotlinx.android.synthetic.main.activity_artist_details.artistTitle import kotlinx.android.synthetic.main.activity_artist_details.image -import kotlinx.android.synthetic.main.activity_artist_details.imageContainer import kotlinx.android.synthetic.main.activity_artist_details.text import kotlinx.android.synthetic.main.activity_artist_details.toolbar -import me.everything.android.ui.overscroll.OverScrollDecoratorHelper +import java.text.DecimalFormat import java.util.Locale import javax.inject.Inject @@ -85,7 +85,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView, private var biography: Spanned? = null private lateinit var artist: Artist private lateinit var songAdapter: SimpleSongAdapter - private lateinit var albumAdapter: AlbumAdapter + private lateinit var albumAdapter: HorizontalAlbumAdapter private var forceDownload: Boolean = false override fun createContentView(): View { @@ -101,7 +101,6 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView, slide.excludeTarget(R.id.status_bar, true) slide.excludeTarget(android.R.id.statusBarBackground, true) slide.excludeTarget(android.R.id.navigationBarBackground, true) - window.enterTransition = slide } @@ -131,7 +130,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView, windowEnterTransition() ActivityCompat.postponeEnterTransition(this) - setUpViews() + setupRecyclerView() playAction.apply { setOnClickListener { MusicPlayerRemote.openQueue(artist.songs, 0, true) } @@ -154,19 +153,6 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView, artistDetailsPresenter.detachView() } - private fun setUpViews() { - setupRecyclerView() - setupContainerHeight() - } - - private fun setupContainerHeight() { - imageContainer?.let { - val params = it.layoutParams - params.width = DensityUtil.getScreenHeight(this) / 2 - it.layoutParams = params - } - } - private fun setupRecyclerView() { albumAdapter = HorizontalAlbumAdapter(this, ArrayList(), false, null) albumRecyclerView.apply { @@ -180,7 +166,6 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView, layoutManager = LinearLayoutManager(this.context) adapter = songAdapter } - OverScrollDecoratorHelper.setUpOverScroll(container) } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { @@ -247,6 +232,16 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView, Html.fromHtml(bioContent) } biographyText.text = biography + + if (lastFmArtist.artist.stats.listeners.isNotEmpty()) { + listeners.show() + listenersLabel.show() + scrobbles.show() + scrobblesLabel.show() + + listeners.text = RetroUtil.formatValue(lastFmArtist.artist.stats.listeners.toFloat()) + scrobbles.text = RetroUtil.formatValue(lastFmArtist.artist.stats.playcount.toFloat()) + } } } @@ -271,7 +266,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView, val textColor = if (PreferenceUtil.getInstance(this).adaptiveColor) color.ripAlpha() else - ThemeStore.accentColor(this) + ATHUtil.resolveColor(this, android.R.attr.textColorPrimary) albumTitle.setTextColor(textColor) songTitle.setTextColor(textColor) @@ -292,6 +287,18 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView, supportActionBar?.title = null } + private fun numberFormat(count: Float): String { + val prefixes = arrayOf("", "K", "M", "B", "T", "P", "E") + var index = 0 + var finalCount = count + while (finalCount / 1000 >= 1) { + finalCount /= 1000 + index++ + } + val decimal = DecimalFormat("#.##") + return String.format("%s %s", decimal.format(finalCount), prefixes[index]) + } + override fun onOptionsItemSelected(item: MenuItem): Boolean { return handleSortOrderMenuItem(item) } diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/WhatsNewActivity.java b/app/src/main/java/code/name/monkey/retromusic/activities/WhatsNewActivity.java index b08e4c0c..7b787fcf 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/WhatsNewActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/activities/WhatsNewActivity.java @@ -23,7 +23,6 @@ import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; -import me.everything.android.ui.overscroll.OverScrollDecoratorHelper; public class WhatsNewActivity extends AbsBaseActivity { @@ -52,7 +51,6 @@ public class WhatsNewActivity extends AbsBaseActivity { toolbar.setNavigationOnClickListener(v -> onBackPressed()); ToolbarContentTintHelper.colorBackButton(toolbar); NestedScrollView nestedScrollView = findViewById(R.id.container); - OverScrollDecoratorHelper.setUpOverScroll(nestedScrollView); try { StringBuilder buf = new StringBuilder(); diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/album/HorizontalAlbumAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/album/HorizontalAlbumAdapter.kt index 644666ac..5fb268b1 100644 --- a/app/src/main/java/code/name/monkey/retromusic/adapter/album/HorizontalAlbumAdapter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/adapter/album/HorizontalAlbumAdapter.kt @@ -4,8 +4,7 @@ import android.graphics.drawable.Drawable import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity -import code.name.monkey.appthemehelper.util.ColorUtil -import code.name.monkey.appthemehelper.util.MaterialValueHelper +import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.retromusic.glide.RetroMusicColoredTarget import code.name.monkey.retromusic.glide.SongGlideRequest import code.name.monkey.retromusic.helper.HorizontalAdapterHelper @@ -31,13 +30,12 @@ class HorizontalAlbumAdapter( } override fun setColors(color: Int, holder: ViewHolder) { - holder.title?.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color))) - holder.text?.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color))) + holder.title?.setTextColor(ATHUtil.resolveColor(activity, android.R.attr.textColorPrimary)) + holder.text?.setTextColor(ATHUtil.resolveColor(activity, android.R.attr.textColorSecondary)) } override fun loadAlbumCover(album: Album, holder: ViewHolder) { if (holder.image == null) return - SongGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong()) .checkIgnoreMediaStore(activity).generatePalette(activity).build() .into(object : RetroMusicColoredTarget(holder.image!!) { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/home/BannerHomeFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/home/BannerHomeFragment.kt index 64af7cee..e8714864 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/home/BannerHomeFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/home/BannerHomeFragment.kt @@ -44,10 +44,8 @@ import kotlinx.android.synthetic.main.fragment_banner_home.bannerImage import kotlinx.android.synthetic.main.fragment_banner_home.titleWelcome import kotlinx.android.synthetic.main.fragment_banner_home.toolbarContainer import kotlinx.android.synthetic.main.fragment_banner_home.userImage -import kotlinx.android.synthetic.main.fragment_home.container import kotlinx.android.synthetic.main.home_content.emptyContainer import kotlinx.android.synthetic.main.home_content.recyclerView -import me.everything.android.ui.overscroll.OverScrollDecoratorHelper import java.io.File import java.util.ArrayList import java.util.Calendar @@ -144,8 +142,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba } homePresenter.attachView(this) homePresenter.loadSections() - - OverScrollDecoratorHelper.setUpOverScroll(container) } private fun setupToolbar() { diff --git a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/AlbumDetailsPresenter.kt b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/AlbumDetailsPresenter.kt index e9158c3e..3fcfefd6 100644 --- a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/AlbumDetailsPresenter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/AlbumDetailsPresenter.kt @@ -14,13 +14,13 @@ package code.name.monkey.retromusic.mvp.presenter -import code.name.monkey.retromusic.Result import code.name.monkey.retromusic.Result.Success import code.name.monkey.retromusic.model.Album import code.name.monkey.retromusic.model.Artist import code.name.monkey.retromusic.mvp.Presenter import code.name.monkey.retromusic.mvp.PresenterImpl import code.name.monkey.retromusic.providers.interfaces.Repository +import code.name.monkey.retromusic.rest.model.LastFmAlbum import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job @@ -40,13 +40,18 @@ interface AlbumDetailsView { fun loadArtistImage(artist: Artist) - fun moreAlbums(albums: ArrayList) + fun moreAlbums( + albums: ArrayList + ) + + fun aboutAlbum(lastFmAlbum: LastFmAlbum) } interface AlbumDetailsPresenter : Presenter { fun loadAlbum(albumId: Int) fun loadMore(artistId: Int) + fun aboutAlbum(artist: String, album: String) class AlbumDetailsPresenterImpl @Inject constructor( private val repository: Repository @@ -59,7 +64,16 @@ interface AlbumDetailsPresenter : Presenter { launch { when (val result = repository.artistById(artistId)) { is Success -> withContext(Dispatchers.Main) { showArtistImage(result.data) } - is Result.Error -> withContext(Dispatchers.Main) {} + is Error -> withContext(Dispatchers.Main) {} + } + } + } + + override fun aboutAlbum(artist: String, album: String) { + launch { + when (val result = repository.albumInfo(artist, album)) { + is Success -> withContext(Dispatchers.Main) { view.aboutAlbum(result.data) } + is Error -> withContext(Dispatchers.Main) {} } } } diff --git a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/ArtistDetailsPresenter.kt b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/ArtistDetailsPresenter.kt index aaf790ae..80f1eafc 100644 --- a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/ArtistDetailsPresenter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/ArtistDetailsPresenter.kt @@ -34,6 +34,7 @@ import kotlin.coroutines.CoroutineContext * Created by hemanths on 20/08/17. */ interface ArtistDetailsView : BaseView { + fun artist(artist: Artist) fun artistInfo(lastFmArtist: LastFmArtist?) fun complete() @@ -44,12 +45,15 @@ interface ArtistDetailsPresenter : Presenter { fun loadArtist(artistId: Int) fun loadBiography( - name: String, lang: String? = Locale.getDefault().language, cache: String? + name: String, + lang: String? = Locale.getDefault().language, + cache: String? ) class ArtistDetailsPresenterImpl @Inject constructor( - private val repository: Repository + private val repository: Repository ) : PresenterImpl(), ArtistDetailsPresenter, CoroutineScope { + override val coroutineContext: CoroutineContext get() = Dispatchers.IO + job diff --git a/app/src/main/java/code/name/monkey/retromusic/providers/RepositoryImpl.kt b/app/src/main/java/code/name/monkey/retromusic/providers/RepositoryImpl.kt index 47874e0b..20a1b3b3 100644 --- a/app/src/main/java/code/name/monkey/retromusic/providers/RepositoryImpl.kt +++ b/app/src/main/java/code/name/monkey/retromusic/providers/RepositoryImpl.kt @@ -38,6 +38,7 @@ import code.name.monkey.retromusic.model.Playlist import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.providers.interfaces.Repository import code.name.monkey.retromusic.rest.LastFMRestClient +import code.name.monkey.retromusic.rest.model.LastFmAlbum import code.name.monkey.retromusic.rest.model.LastFmArtist import java.io.IOException import javax.inject.Inject @@ -278,6 +279,16 @@ class RepositoryImpl @Inject constructor(private val context: Context) : Reposit ) + override suspend fun albumInfo( + artist: String, + album: String + ): Result = safeApiCall( + call = { + Success(LastFMRestClient(context).apiService.albumInfo(artist, album)) + }, + errorMessage = "Error" + ) + override suspend fun artistById(artistId: Int): Result { return try { val artist = ArtistLoader.getArtist(context, artistId) diff --git a/app/src/main/java/code/name/monkey/retromusic/providers/interfaces/Repository.kt b/app/src/main/java/code/name/monkey/retromusic/providers/interfaces/Repository.kt index 106fe24a..aec8eaea 100644 --- a/app/src/main/java/code/name/monkey/retromusic/providers/interfaces/Repository.kt +++ b/app/src/main/java/code/name/monkey/retromusic/providers/interfaces/Repository.kt @@ -15,7 +15,13 @@ package code.name.monkey.retromusic.providers.interfaces import code.name.monkey.retromusic.Result -import code.name.monkey.retromusic.model.* +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.rest.model.LastFmAlbum import code.name.monkey.retromusic.rest.model.LastFmArtist /** @@ -54,5 +60,7 @@ interface Repository { suspend fun artistInfo(name: String, lang: String?, cache: String?): Result + suspend fun albumInfo(artist: String, album: String): Result + suspend fun artistById(artistId: Int): Result } \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/rest/LastFMRestClient.java b/app/src/main/java/code/name/monkey/retromusic/rest/LastFMRestClient.java index 84b786ff..d5c67f09 100644 --- a/app/src/main/java/code/name/monkey/retromusic/rest/LastFMRestClient.java +++ b/app/src/main/java/code/name/monkey/retromusic/rest/LastFMRestClient.java @@ -15,20 +15,18 @@ package code.name.monkey.retromusic.rest; import android.content.Context; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; - +import code.name.monkey.retromusic.rest.service.LastFMService; import java.io.File; import java.util.concurrent.TimeUnit; - -import code.name.monkey.retromusic.rest.service.LastFMService; import okhttp3.Cache; import okhttp3.Call; import okhttp3.ConnectionPool; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; +import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; @@ -53,13 +51,9 @@ public class LastFMRestClient { apiService = restAdapter.create(LastFMService.class); } - @Nullable - private static Cache createDefaultCache(Context context) { - File cacheDir = new File(context.getCacheDir().getAbsolutePath(), "/okhttp-lastfm/"); - if (cacheDir.mkdirs() || cacheDir.isDirectory()) { - return new Cache(cacheDir, 1024 * 1024 * 10); - } - return null; + @NonNull + public LastFMService getApiService() { + return apiService; } private static Interceptor createCacheControlInterceptor() { @@ -71,6 +65,15 @@ public class LastFMRestClient { }; } + @Nullable + private static Cache createDefaultCache(Context context) { + File cacheDir = new File(context.getCacheDir().getAbsolutePath(), "/okhttp-lastfm/"); + if (cacheDir.mkdirs() || cacheDir.isDirectory()) { + return new Cache(cacheDir, 1024 * 1024 * 10); + } + return null; + } + @NonNull private static OkHttpClient.Builder createDefaultOkHttpClientBuilder(@NonNull Context context) { return new OkHttpClient.Builder() @@ -80,11 +83,14 @@ public class LastFMRestClient { .writeTimeout(1, TimeUnit.MINUTES) // write timeout .readTimeout(1, TimeUnit.MINUTES) // read timeout .cache(createDefaultCache(context)) - .addInterceptor(createCacheControlInterceptor()); + .addInterceptor(createCacheControlInterceptor()) + .addInterceptor(createLogInterceptor()); } @NonNull - public LastFMService getApiService() { - return apiService; + private static Interceptor createLogInterceptor() { + HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); + interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); + return interceptor; } } diff --git a/app/src/main/java/code/name/monkey/retromusic/rest/model/LastFmAlbum.java b/app/src/main/java/code/name/monkey/retromusic/rest/model/LastFmAlbum.java index 1bad869b..ae4da518 100644 --- a/app/src/main/java/code/name/monkey/retromusic/rest/model/LastFmAlbum.java +++ b/app/src/main/java/code/name/monkey/retromusic/rest/model/LastFmAlbum.java @@ -16,65 +16,22 @@ package code.name.monkey.retromusic.rest.model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; - import java.util.ArrayList; import java.util.List; public class LastFmAlbum { - @Expose - private Album album; - - public Album getAlbum() { - return album; - } - - public void setAlbum(Album album) { - this.album = album; - } public static class Album { - @Expose - private Tags tags; - @Expose - private List image = new ArrayList<>(); - @Expose - private Wiki wiki; - - public List getImage() { - return image; - } - - public void setImage(List image) { - this.image = image; - } - - public Wiki getWiki() { - return wiki; - } - - public void setWiki(Wiki wiki) { - this.wiki = wiki; - } - - public Tags getTags() { - return tags; - } public static class Image { + @SerializedName("#text") @Expose private String Text; + @Expose private String size; - public String getText() { - return Text; - } - - public void setText(String Text) { - this.Text = Text; - } - public String getSize() { return size; } @@ -82,9 +39,18 @@ public class LastFmAlbum { public void setSize(String size) { this.size = size; } + + public String getText() { + return Text; + } + + public void setText(String Text) { + this.Text = Text; + } } public class Tags { + @Expose private List tag = null; @@ -94,6 +60,7 @@ public class LastFmAlbum { } public class Tag { + @Expose private String name; @@ -110,9 +77,13 @@ public class LastFmAlbum { } public class Wiki { + @Expose private String content; + @Expose + private String published; + public String getContent() { return content; } @@ -120,6 +91,87 @@ public class LastFmAlbum { public void setContent(String content) { this.content = content; } + + public String getPublished() { + return published; + } + + public void setPublished(final String published) { + this.published = published; + } + } + + @Expose + public String listeners; + + @Expose + public String playcount; + + @Expose + private List image = new ArrayList<>(); + + @Expose + private String name; + + @Expose + private Tags tags; + + @Expose + private Wiki wiki; + + public List getImage() { + return image; + } + + public void setImage(List image) { + this.image = image; + } + + public String getListeners() { + return listeners; + } + + public void setListeners(final String listeners) { + this.listeners = listeners; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public String getPlaycount() { + return playcount; + } + + public void setPlaycount(final String playcount) { + this.playcount = playcount; + } + + public Tags getTags() { + return tags; + } + + public Wiki getWiki() { + return wiki; + } + + public void setWiki(Wiki wiki) { + this.wiki = wiki; } } + + @Expose + private Album album; + + public Album getAlbum() { + return album; + } + + public void setAlbum(Album album) { + this.album = album; + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/rest/model/LastFmArtist.java b/app/src/main/java/code/name/monkey/retromusic/rest/model/LastFmArtist.java index 6a72aa5a..4afc19cd 100644 --- a/app/src/main/java/code/name/monkey/retromusic/rest/model/LastFmArtist.java +++ b/app/src/main/java/code/name/monkey/retromusic/rest/model/LastFmArtist.java @@ -16,45 +16,66 @@ package code.name.monkey.retromusic.rest.model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; - import java.util.ArrayList; import java.util.List; public class LastFmArtist { - @Expose - private Artist artist; - - public Artist getArtist() { - return artist; - } - - public void setArtist(Artist artist) { - this.artist = artist; - } public static class Artist { - @Expose - private List image = new ArrayList<>(); - @Expose - private Bio bio; - public List getImage() { - return image; + public static class Image { + + @SerializedName("#text") + @Expose + private String Text; + + @Expose + private String size; + + public String getSize() { + return size; + } + + public void setSize(String size) { + this.size = size; + } + + public String getText() { + return Text; + } + + public void setText(String Text) { + this.Text = Text; + } } - public void setImage(List image) { - this.image = image; - } + public static class Stats { - public Bio getBio() { - return bio; - } + @Expose + public String listeners; - public void setBio(Bio bio) { - this.bio = bio; + @Expose + public String playcount; + + public String getListeners() { + return listeners; + } + + public void setListeners(final String listeners) { + this.listeners = listeners; + } + + public String getPlaycount() { + return playcount; + } + + public void setPlaycount(final String playcount) { + this.playcount = playcount; + } } public class Bio { + @Expose private String content; @@ -67,28 +88,40 @@ public class LastFmArtist { } } - public static class Image { - @SerializedName("#text") - @Expose - private String Text; - @Expose - private String size; + @Expose + public Stats stats; - public String getText() { - return Text; - } + @Expose + private Bio bio; - public void setText(String Text) { - this.Text = Text; - } + @Expose + private List image = new ArrayList<>(); - public String getSize() { - return size; - } + public Bio getBio() { + return bio; + } - public void setSize(String size) { - this.size = size; - } + public void setBio(Bio bio) { + this.bio = bio; + } + + public List getImage() { + return image; + } + + public void setImage(List image) { + this.image = image; } } + + @Expose + private Artist artist; + + public Artist getArtist() { + return artist; + } + + public void setArtist(Artist artist) { + this.artist = artist; + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/rest/service/LastFMService.kt b/app/src/main/java/code/name/monkey/retromusic/rest/service/LastFMService.kt index 6dcd5c76..02175e1c 100644 --- a/app/src/main/java/code/name/monkey/retromusic/rest/service/LastFMService.kt +++ b/app/src/main/java/code/name/monkey/retromusic/rest/service/LastFMService.kt @@ -14,6 +14,7 @@ package code.name.monkey.retromusic.rest.service +import code.name.monkey.retromusic.rest.model.LastFmAlbum import code.name.monkey.retromusic.rest.model.LastFmArtist import retrofit2.http.GET import retrofit2.http.Header @@ -24,14 +25,22 @@ import retrofit2.http.Query */ interface LastFMService { + companion object { const val API_KEY = "c679c8d3efa84613dc7dcb2e8d42da4c" const val BASE_QUERY_PARAMETERS = "?format=json&autocorrect=1&api_key=$API_KEY" } @GET("$BASE_QUERY_PARAMETERS&method=artist.getinfo") - suspend fun artistInfo(@Query("artist") artistName: String, - @Query("lang") language: String?, - @Header("Cache-Control") cacheControl: String? + suspend fun artistInfo( + @Query("artist") artistName: String, + @Query("lang") language: String?, + @Header("Cache-Control") cacheControl: String? ): LastFmArtist + + @GET("$BASE_QUERY_PARAMETERS&method=album.getinfo") + suspend fun albumInfo( + @Query("artist") artistName: String, + @Query("album") albumName: String + ): LastFmAlbum } \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/util/RetroUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/RetroUtil.java index 9fdcb4fb..80a0bc49 100755 --- a/app/src/main/java/code/name/monkey/retromusic/util/RetroUtil.java +++ b/app/src/main/java/code/name/monkey/retromusic/util/RetroUtil.java @@ -42,6 +42,7 @@ import androidx.annotation.Nullable; import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat; import code.name.monkey.appthemehelper.util.TintHelper; import code.name.monkey.retromusic.App; +import java.text.DecimalFormat; public class RetroUtil { @@ -65,6 +66,17 @@ public class RetroUtil { return bitmap; } + public static String formatValue(float value) { + String arr[] = {"", "K", "M", "B", "T", "P", "E"}; + int index = 0; + while ((value / 1000) >= 1) { + value = value / 1000; + index++; + } + DecimalFormat decimalFormat = new DecimalFormat("#.##"); + return String.format("%s %s", decimalFormat.format(value), arr[index]); + } + public static float frequencyCount(int frequency) { return (float) (frequency / 1000.0); } diff --git a/app/src/main/res/layout-land/activity_album.xml b/app/src/main/res/layout-land/activity_album.xml index e753cb33..0ac1bb11 100644 --- a/app/src/main/res/layout-land/activity_album.xml +++ b/app/src/main/res/layout-land/activity_album.xml @@ -103,7 +103,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:maxLines="2" - android:textAppearance="@style/TextViewHeadline6" + android:textAppearance="@style/TextViewHeadline4" android:textStyle="bold" tools:ignore="MissingPrefix" tools:text="Album name" /> @@ -126,7 +126,6 @@ - diff --git a/app/src/main/res/layout-land/activity_artist_details.xml b/app/src/main/res/layout-land/activity_artist_details.xml index 1dadac14..9b5f4916 100644 --- a/app/src/main/res/layout-land/activity_artist_details.xml +++ b/app/src/main/res/layout-land/activity_artist_details.xml @@ -89,7 +89,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:maxLines="2" - android:textAppearance="@style/TextViewHeadline6" + android:textColor="?android:attr/textColorPrimary" + android:textAppearance="@style/TextViewHeadline4" android:textStyle="bold" tools:ignore="MissingPrefix" tools:text="Title" /> diff --git a/app/src/main/res/layout-land/fragment_banner_home.xml b/app/src/main/res/layout-land/fragment_banner_home.xml index 2c156295..9725e8e0 100644 --- a/app/src/main/res/layout-land/fragment_banner_home.xml +++ b/app/src/main/res/layout-land/fragment_banner_home.xml @@ -86,7 +86,7 @@ app:contentInsetStart="0dp" app:contentInsetStartWithNavigation="0dp" app:popupTheme="?toolbarPopupTheme" - app:title="@string/search_hint" + app:title="@string/action_search" app:titleMarginStart="0dp" app:titleTextAppearance="@style/ToolbarTextAppearanceSearch" tools:ignore="UnusedAttribute" /> diff --git a/app/src/main/res/layout-land/fragment_home.xml b/app/src/main/res/layout-land/fragment_home.xml index a93a1f55..702e8fc8 100644 --- a/app/src/main/res/layout-land/fragment_home.xml +++ b/app/src/main/res/layout-land/fragment_home.xml @@ -45,10 +45,6 @@ android:id="@+id/toolbarContainer" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/toolbar_margin_horizontal" - android:layout_marginTop="@dimen/toolbar_margin_vertical" - android:layout_marginEnd="@dimen/toolbar_margin_horizontal" - android:layout_marginBottom="@dimen/toolbar_margin_vertical" app:cardCornerRadius="8dp" app:cardUseCompatPadding="true" app:layout_collapseMode="pin" @@ -62,7 +58,7 @@ app:contentInsetStart="0dp" app:contentInsetStartWithNavigation="0dp" app:popupTheme="?toolbarPopupTheme" - app:title="@string/search_hint" + app:title="@string/action_search" app:titleMarginStart="0dp" app:titleTextAppearance="@style/ToolbarTextAppearanceSearch" tools:ignore="UnusedAttribute" /> diff --git a/app/src/main/res/layout-xlarge-land/activity_album.xml b/app/src/main/res/layout-xlarge-land/activity_album.xml deleted file mode 100644 index 37a62a8d..00000000 --- a/app/src/main/res/layout-xlarge-land/activity_album.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge-land/activity_artist_details.xml b/app/src/main/res/layout-xlarge-land/activity_artist_details.xml deleted file mode 100644 index 80c75114..00000000 --- a/app/src/main/res/layout-xlarge-land/activity_artist_details.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout-xlarge-land/fragment_banner_home.xml b/app/src/main/res/layout-xlarge-land/fragment_banner_home.xml deleted file mode 100644 index 1fbf85f4..00000000 --- a/app/src/main/res/layout-xlarge-land/fragment_banner_home.xml +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge-land/fragment_home.xml b/app/src/main/res/layout-xlarge-land/fragment_home.xml deleted file mode 100644 index 91d38600..00000000 --- a/app/src/main/res/layout-xlarge-land/fragment_home.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/activity_album.xml b/app/src/main/res/layout-xlarge/activity_album.xml deleted file mode 100644 index fb8a4cfb..00000000 --- a/app/src/main/res/layout-xlarge/activity_album.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/activity_artist_details.xml b/app/src/main/res/layout-xlarge/activity_artist_details.xml deleted file mode 100644 index 59dc5fdb..00000000 --- a/app/src/main/res/layout-xlarge/activity_artist_details.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout-xlarge/fragment_album_card_cover.xml b/app/src/main/res/layout-xlarge/fragment_album_card_cover.xml deleted file mode 100644 index a75d2aed..00000000 --- a/app/src/main/res/layout-xlarge/fragment_album_card_cover.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/fragment_banner_home.xml b/app/src/main/res/layout-xlarge/fragment_banner_home.xml deleted file mode 100644 index 3cb1bd69..00000000 --- a/app/src/main/res/layout-xlarge/fragment_banner_home.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/fragment_home.xml b/app/src/main/res/layout-xlarge/fragment_home.xml deleted file mode 100644 index 58adfd97..00000000 --- a/app/src/main/res/layout-xlarge/fragment_home.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/fragment_mini_player.xml b/app/src/main/res/layout-xlarge/fragment_mini_player.xml index 681247ad..28388f4a 100644 --- a/app/src/main/res/layout-xlarge/fragment_mini_player.xml +++ b/app/src/main/res/layout-xlarge/fragment_mini_player.xml @@ -24,7 +24,7 @@ android:layout_margin="16dp" android:scaleType="centerCrop" app:srcCompat="@drawable/ic_keyboard_arrow_up_24dp" - app:tint="?colorOnSurface" + app:tint="?attr/colorControlNormal" tools:ignore="ContentDescription" tools:tint="?colorOnSurface" /> @@ -43,7 +43,7 @@ android:scrollHorizontally="true" android:singleLine="true" android:textAppearance="@style/TextViewNormal" - android:textColor="?colorOnSurface" + android:textColor="?android:attr/textColorPrimary" tools:text="Song name and details" /> @@ -66,7 +66,7 @@ android:background="?roundSelector" android:scaleType="center" app:srcCompat="@drawable/ic_pause_white_24dp" - app:tint="?colorOnSurface" + app:tint="?attr/colorControlNormal" tools:ignore="ContentDescription" tools:tint="?colorOnSurface" /> @@ -80,7 +80,7 @@ android:background="?roundSelector" android:padding="8dp" app:srcCompat="@drawable/ic_skip_next_white_24dp" - app:tint="?colorOnSurface" + app:tint="?attr/colorControlNormal" tools:tint="?colorOnSurface" /> diff --git a/app/src/main/res/layout-xlarge/item_artist.xml b/app/src/main/res/layout-xlarge/item_artist.xml index 5c01ab3b..ae7ec053 100644 --- a/app/src/main/res/layout-xlarge/item_artist.xml +++ b/app/src/main/res/layout-xlarge/item_artist.xml @@ -30,5 +30,6 @@ android:maxLines="2" android:paddingTop="12dp" android:textAppearance="@style/TextViewNormal" + android:textColor="?android:attr/textColorPrimary" tools:text="@tools:sample/full_names" /> \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/item_image.xml b/app/src/main/res/layout-xlarge/item_image.xml index 4b7a6f52..0252ce12 100644 --- a/app/src/main/res/layout-xlarge/item_image.xml +++ b/app/src/main/res/layout-xlarge/item_image.xml @@ -8,7 +8,7 @@ android:orientation="vertical"> - @@ -66,11 +68,16 @@ android:id="@+id/moreTitle" style="@style/SubTitleTextAppearance" android:layout_width="0dp" + android:layout_height="wrap_content" + android:padding="16dp" + android:text="@string/songs" + android:textAppearance="@style/TextViewHeadline5" + android:textStyle="bold" android:visibility="gone" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/recyclerView" - tools:text="More by Hemanth" + tools:text="More by Artist" tools:visibility="visible" /> + + + + + + + + + + + + + app:layout_constraintTop_toBottomOf="@id/listeners" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_artist_content.xml b/app/src/main/res/layout/activity_artist_content.xml index 12b0edff..034bc4a9 100644 --- a/app/src/main/res/layout/activity_artist_content.xml +++ b/app/src/main/res/layout/activity_artist_content.xml @@ -38,14 +38,70 @@ + + + + + + + + + - - + app:layout_constraintTop_toBottomOf="@id/biographyText" + tools:visibility="visible" /> - - + android:layout_marginStart="16dp" + android:layout_marginTop="8dp" + android:layout_marginEnd="12dp" + android:text="@string/scrobbles_label" + android:textAppearance="@style/TextViewSubtitle1" + android:textColor="?android:attr/textColorSecondary" + android:textStyle="bold" + android:visibility="gone" + app:layout_constrainedWidth="true" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/listenersLabel" + app:layout_constraintTop_toBottomOf="@id/biographyText" + tools:visibility="visible" /> + + + + + + app:layout_constraintTop_toBottomOf="@id/listeners" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_artist_details.xml b/app/src/main/res/layout/activity_artist_details.xml index 8b6da03c..a9ce0c24 100755 --- a/app/src/main/res/layout/activity_artist_details.xml +++ b/app/src/main/res/layout/activity_artist_details.xml @@ -84,7 +84,8 @@ android:layout_marginTop="16dp" android:layout_marginEnd="16dp" android:maxLines="2" - android:textAppearance="@style/TextViewHeadline6" + android:textColor="?android:attr/textColorPrimary" + android:textAppearance="@style/TextViewHeadline4" android:textStyle="bold" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml index 090b4d69..5e685cb2 100755 --- a/app/src/main/res/layout/activity_search.xml +++ b/app/src/main/res/layout/activity_search.xml @@ -32,10 +32,6 @@ android:id="@+id/searchContainer" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/toolbar_margin_horizontal" - android:layout_marginTop="@dimen/toolbar_margin_vertical" - android:layout_marginEnd="@dimen/toolbar_margin_horizontal" - android:layout_marginBottom="@dimen/toolbar_margin_vertical" app:cardBackgroundColor="?colorSurface" app:cardCornerRadius="8dp" app:cardUseCompatPadding="true" diff --git a/app/src/main/res/layout/fragment_banner_home.xml b/app/src/main/res/layout/fragment_banner_home.xml index e44e6386..1f033fee 100644 --- a/app/src/main/res/layout/fragment_banner_home.xml +++ b/app/src/main/res/layout/fragment_banner_home.xml @@ -42,8 +42,6 @@ android:id="@+id/toolbarContainer" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/toolbar_margin_horizontal" - android:layout_marginEnd="@dimen/toolbar_margin_horizontal" app:cardCornerRadius="8dp" app:cardUseCompatPadding="true" app:layout_constraintEnd_toEndOf="parent" @@ -60,7 +58,7 @@ app:contentInsetStart="0dp" app:contentInsetStartWithNavigation="0dp" app:popupTheme="?toolbarPopupTheme" - app:title="@string/search_hint" + app:title="@string/action_search" app:titleMarginStart="0dp" app:titleTextAppearance="@style/ToolbarTextAppearanceSearch" tools:ignore="UnusedAttribute" /> diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index e3138288..93515e8a 100755 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -44,10 +44,6 @@ android:id="@+id/toolbarContainer" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/toolbar_margin_horizontal" - android:layout_marginTop="@dimen/toolbar_margin_vertical" - android:layout_marginEnd="@dimen/toolbar_margin_horizontal" - android:layout_marginBottom="@dimen/toolbar_margin_vertical" app:cardBackgroundColor="?colorSurface" app:cardCornerRadius="8dp" app:cardUseCompatPadding="true" @@ -62,7 +58,7 @@ app:contentInsetStart="0dp" app:contentInsetStartWithNavigation="0dp" app:popupTheme="?toolbarPopupTheme" - app:title="@string/search_hint" + app:title="@string/action_search" app:titleMarginStart="0dp" app:titleTextAppearance="@style/ToolbarTextAppearanceSearch" tools:ignore="UnusedAttribute" /> diff --git a/app/src/main/res/layout/fragment_library.xml b/app/src/main/res/layout/fragment_library.xml index e360c91a..88e3adb8 100644 --- a/app/src/main/res/layout/fragment_library.xml +++ b/app/src/main/res/layout/fragment_library.xml @@ -47,10 +47,6 @@ android:id="@+id/toolbarContainer" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/toolbar_margin_horizontal" - android:layout_marginTop="@dimen/toolbar_margin_vertical" - android:layout_marginEnd="@dimen/toolbar_margin_horizontal" - android:layout_marginBottom="@dimen/toolbar_margin_vertical" app:cardCornerRadius="8dp" app:cardUseCompatPadding="true" app:layout_scrollFlags="scroll|enterAlways"> diff --git a/app/src/main/res/layout/item_album_card.xml b/app/src/main/res/layout/item_album_card.xml index bebd226d..5129afda 100644 --- a/app/src/main/res/layout/item_album_card.xml +++ b/app/src/main/res/layout/item_album_card.xml @@ -10,9 +10,9 @@ + app:cardElevation="4dp"> - \ No newline at end of file diff --git a/app/src/main/res/layout/item_song.xml b/app/src/main/res/layout/item_song.xml index ff9e065f..dbf9e841 100755 --- a/app/src/main/res/layout/item_song.xml +++ b/app/src/main/res/layout/item_song.xml @@ -4,6 +4,8 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="@dimen/item_song_height" + android:layout_marginStart="2dp" + android:layout_marginEnd="2dp" android:background="?rectSelector" android:clickable="true" android:focusable="true" @@ -24,8 +26,6 @@ android:id="@+id/imageText" android:layout_width="40dp" android:layout_height="match_parent" - - android:gravity="center" android:maxLines="1" android:minHeight="40dp" diff --git a/app/src/main/res/values-xlarge/dimens.xml b/app/src/main/res/values-xlarge/dimens.xml index 0e0dab15..afff4d73 100644 --- a/app/src/main/res/values-xlarge/dimens.xml +++ b/app/src/main/res/values-xlarge/dimens.xml @@ -4,5 +4,4 @@ 16dp 64dp 16dp - 72dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 26bba5b1..7e9ecaf7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -819,4 +819,6 @@ Your account data is only used for authentication. Circle Volume + Listeners + Scrobbles diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 4deecbd4..ed8fb9cd 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -128,6 +128,10 @@ @font/circular + + diff --git a/settings.gradle b/settings.gradle index 052922a7..91441848 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':app', ':appthemehelper', ':liboverscroll' \ No newline at end of file +include ':app', ':appthemehelper' \ No newline at end of file