From 76331eae7d7d8e9814c33a18d295b1688b9222a8 Mon Sep 17 00:00:00 2001 From: Hemanth S Date: Sat, 18 Jul 2020 02:55:04 +0530 Subject: [PATCH] Code refactor 1. Chaning Home Album sections from MetalAdapter to Normal 2. Adding animation icons 3. Removed cardElevation 0dp --- app/build.gradle | 6 +- app/release/output.json | 20 ++ .../retromusic/PeekingLinearLayoutManager.kt | 46 ++++ .../monkey/retromusic/adapter/HomeAdapter.kt | 50 ++-- .../adapter/album/AlbumFullWidthAdapter.kt | 108 --------- .../fragments/MiniPlayerFragment.kt | 3 +- .../monkey/retromusic/model/CategoryInfo.java | 6 +- .../retromusic/providers/RepositoryImpl.kt | 4 +- .../monkey/retromusic/util/DensityUtil.java | 39 ---- .../monkey/retromusic/util/DensityUtil.kt | 49 ++++ .../name/monkey/retromusic/util/ViewUtil.kt | 3 +- .../views/MetalRecyclerViewPager.kt | 108 --------- .../name/monkey/retromusic/views/SeekArc.java | 2 +- .../drawable-v21/notification_selector.xml | 3 - .../main/res/drawable-v21/widget_selector.xml | 3 - .../drawable-v21/widget_selector_light.xml | 3 - app/src/main/res/drawable/asld_album.xml | 15 ++ app/src/main/res/drawable/asld_home.xml | 15 ++ app/src/main/res/drawable/asld_music_note.xml | 15 ++ app/src/main/res/drawable/avd_album.xml | 39 ++++ app/src/main/res/drawable/avd_home.xml | 96 ++++++++ app/src/main/res/drawable/avd_music_note.xml | 115 ++++++++++ .../res/drawable/notification_selector.xml | 10 +- .../saf_guide_1.webp | Bin .../saf_guide_2.webp | Bin .../saf_guide_3.webp | Bin app/src/main/res/drawable/widget_selector.xml | 10 +- .../res/drawable/widget_selector_light.xml | 10 +- .../main/res/layout-land/activity_album.xml | 2 +- .../layout-land/activity_artist_details.xml | 2 +- app/src/main/res/layout-land/pager_item.xml | 2 +- .../layout-xlarge-land/fragment_player.xml | 65 ------ .../fragment_player_playback_controls.xml | 216 ------------------ .../res/layout-xlarge-land/pager_item.xml | 2 +- .../main/res/layout-xlarge/fragment_blur.xml | 86 ------- .../res/layout-xlarge/fragment_player.xml | 75 ------ app/src/main/res/layout/activity_album.xml | 1 - .../res/layout/activity_artist_details.xml | 1 - .../main/res/layout/fragment_mini_player.xml | 1 + .../fragment_player_playback_controls.xml | 18 +- app/src/main/res/layout/item_album_card.xml | 1 - app/src/main/res/layout/item_artist_card.xml | 3 +- .../main/res/layout/item_artist_square.xml | 3 +- .../main/res/layout/item_donation_option.xml | 2 +- app/src/main/res/layout/item_grid.xml | 1 - app/src/main/res/layout/item_image.xml | 1 - .../main/res/layout/item_image_gradient.xml | 1 - app/src/main/res/layout/item_list.xml | 3 +- app/src/main/res/layout/item_suggestions.xml | 3 +- .../main/res/layout/list_item_color_view.xml | 18 +- .../layout/metal_section_recycler_view.xml | 7 +- app/src/main/res/layout/pager_item.xml | 1 - .../main/res/layout/section_recycler_view.xml | 2 +- .../res/values/metal_recycler_view_attrs.xml | 6 - app/src/main/res/values/seekarc_attrs.xml | 4 +- 55 files changed, 490 insertions(+), 815 deletions(-) create mode 100644 app/release/output.json create mode 100644 app/src/main/java/code/name/monkey/retromusic/PeekingLinearLayoutManager.kt delete mode 100644 app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumFullWidthAdapter.kt delete mode 100644 app/src/main/java/code/name/monkey/retromusic/util/DensityUtil.java create mode 100644 app/src/main/java/code/name/monkey/retromusic/util/DensityUtil.kt delete mode 100644 app/src/main/java/code/name/monkey/retromusic/views/MetalRecyclerViewPager.kt delete mode 100644 app/src/main/res/drawable-v21/notification_selector.xml delete mode 100644 app/src/main/res/drawable-v21/widget_selector.xml delete mode 100644 app/src/main/res/drawable-v21/widget_selector_light.xml create mode 100644 app/src/main/res/drawable/asld_album.xml create mode 100644 app/src/main/res/drawable/asld_home.xml create mode 100644 app/src/main/res/drawable/asld_music_note.xml create mode 100644 app/src/main/res/drawable/avd_album.xml create mode 100644 app/src/main/res/drawable/avd_home.xml create mode 100644 app/src/main/res/drawable/avd_music_note.xml rename app/src/main/res/{drawable-v21 => drawable}/saf_guide_1.webp (100%) rename app/src/main/res/{drawable-v21 => drawable}/saf_guide_2.webp (100%) rename app/src/main/res/{drawable-v21 => drawable}/saf_guide_3.webp (100%) mode change 100755 => 100644 app/src/main/res/drawable/widget_selector.xml delete mode 100644 app/src/main/res/layout-xlarge-land/fragment_player.xml delete mode 100755 app/src/main/res/layout-xlarge-land/fragment_player_playback_controls.xml delete mode 100644 app/src/main/res/layout-xlarge/fragment_blur.xml delete mode 100644 app/src/main/res/layout-xlarge/fragment_player.xml delete mode 100644 app/src/main/res/values/metal_recycler_view_attrs.xml diff --git a/app/build.gradle b/app/build.gradle index f63a4e9a..c199db20 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -107,17 +107,15 @@ dependencies { implementation "androidx.gridlayout:gridlayout:1.0.0" implementation "androidx.cardview:cardview:1.0.0" - implementation "androidx.palette:palette:1.0.0" implementation "androidx.viewpager2:viewpager2:1.1.0-alpha01" implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.annotation:annotation:1.1.0' - implementation 'androidx.preference:preference:1.1.1' - + implementation 'androidx.preference:preference-ktx:1.1.1' implementation 'androidx.core:core-ktx:1.3.0' implementation 'androidx.fragment:fragment-ktx:1.2.5' implementation 'androidx.palette:palette-ktx:1.0.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta8' implementation 'androidx.recyclerview:recyclerview:1.1.0' implementation 'com.google.android.material:material:1.3.0-alpha01' diff --git a/app/release/output.json b/app/release/output.json new file mode 100644 index 00000000..758f3ea4 --- /dev/null +++ b/app/release/output.json @@ -0,0 +1,20 @@ +{ + "version": 1, + "artifactType": { + "type": "APK", + "kind": "Directory" + }, + "applicationId": "code.name.monkey.retromusic", + "variantName": "release", + "elements": [ + { + "type": "SINGLE", + "filters": [], + "properties": [], + "versionCode": 10438, + "versionName": "10438", + "enabled": true, + "outputFile": "app-release.apk" + } + ] +} \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/PeekingLinearLayoutManager.kt b/app/src/main/java/code/name/monkey/retromusic/PeekingLinearLayoutManager.kt new file mode 100644 index 00000000..a7961ffd --- /dev/null +++ b/app/src/main/java/code/name/monkey/retromusic/PeekingLinearLayoutManager.kt @@ -0,0 +1,46 @@ +package code.name.monkey.retromusic + +import android.content.Context +import android.util.AttributeSet +import android.view.ViewGroup +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView + +class PeekingLinearLayoutManager : LinearLayoutManager { + @JvmOverloads + constructor( + context: Context?, + @RecyclerView.Orientation orientation: Int = RecyclerView.VERTICAL, + reverseLayout: Boolean = false + ) : super(context, orientation, reverseLayout) + + constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super( + context, + attrs, + defStyleAttr, + defStyleRes + ) + + override fun generateDefaultLayoutParams() = + scaledLayoutParams(super.generateDefaultLayoutParams()) + + override fun generateLayoutParams(lp: ViewGroup.LayoutParams?) = + scaledLayoutParams(super.generateLayoutParams(lp)) + + override fun generateLayoutParams(c: Context?, attrs: AttributeSet?) = + scaledLayoutParams(super.generateLayoutParams(c, attrs)) + + private fun scaledLayoutParams(layoutParams: RecyclerView.LayoutParams) = + layoutParams.apply { + when (orientation) { + HORIZONTAL -> width = (horizontalSpace * ratio).toInt() + VERTICAL -> height = (verticalSpace * ratio).toInt() + } + } + + private val horizontalSpace get() = width - paddingStart - paddingEnd + + private val verticalSpace get() = height - paddingTop - paddingBottom + + private val ratio = 0.8f // change to 0.7f for 70% +} \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/HomeAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/HomeAdapter.kt index e7a36f29..681dadec 100644 --- a/app/src/main/java/code/name/monkey/retromusic/adapter/HomeAdapter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/adapter/HomeAdapter.kt @@ -11,9 +11,12 @@ import androidx.appcompat.widget.AppCompatTextView import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView +import androidx.recyclerview.widget.RecyclerView.HORIZONTAL import code.name.monkey.appthemehelper.ThemeStore +import code.name.monkey.appthemehelper.util.ColorUtil +import code.name.monkey.retromusic.PeekingLinearLayoutManager import code.name.monkey.retromusic.R -import code.name.monkey.retromusic.adapter.album.AlbumFullWidthAdapter +import code.name.monkey.retromusic.adapter.album.AlbumAdapter import code.name.monkey.retromusic.adapter.artist.ArtistAdapter import code.name.monkey.retromusic.adapter.song.SongAdapter import code.name.monkey.retromusic.extensions.show @@ -23,6 +26,7 @@ import code.name.monkey.retromusic.loaders.PlaylistSongsLoader import code.name.monkey.retromusic.model.* import code.name.monkey.retromusic.util.PreferenceUtil import com.bumptech.glide.Glide +import com.google.android.material.card.MaterialCardView class HomeAdapter( private val activity: AppCompatActivity, @@ -40,8 +44,14 @@ class HomeAdapter( .inflate(R.layout.section_recycler_view, parent, false) return when (viewType) { RECENT_ARTISTS, TOP_ARTISTS -> ArtistViewHolder(layout) + TOP_ALBUMS, RECENT_ALBUMS -> { + AlbumViewHolder( + LayoutInflater.from(activity) + .inflate(R.layout.metal_section_recycler_view, parent, false) + ) + } FAVOURITES -> PlaylistViewHolder(layout) - SUGGESTIONS -> { + else -> { SuggestionsViewHolder( LayoutInflater.from(activity).inflate( R.layout.item_suggestions, @@ -50,15 +60,6 @@ class HomeAdapter( ) ) } - else -> { - AlbumViewHolder( - LayoutInflater.from(activity).inflate( - R.layout.metal_section_recycler_view, - parent, - false - ) - ) - } } } @@ -133,7 +134,9 @@ class HomeAdapter( if (list.isNotEmpty()) { recyclerView.apply { show() - adapter = AlbumFullWidthAdapter(activity, list, displayMetrics) + adapter = AlbumAdapter(activity, list, R.layout.pager_item, null) + layoutManager = + PeekingLinearLayoutManager(activity, HORIZONTAL, false) } title.text = activity.getString(titleRes) } @@ -175,17 +178,20 @@ class HomeAdapter( fun bindView(arrayList: List) { val color = ThemeStore.accentColor(activity) itemView.findViewById(R.id.text).setTextColor(color) - - images.forEachIndexed { index, i -> - itemView.findViewById(i).setOnClickListener { - MusicPlayerRemote.playNext(arrayList[index]) - } - SongGlideRequest.Builder.from(Glide.with(activity), arrayList[index]) - .asBitmap() - .build() - .into(itemView.findViewById(i)) - + itemView.findViewById(R.id.card6).apply { + setCardBackgroundColor(ColorUtil.withAlpha(color, 0.2f)) } + if (arrayList.size > 9) + images.forEachIndexed { index, i -> + itemView.findViewById(i).setOnClickListener { + MusicPlayerRemote.playNext(arrayList[index]) + } + SongGlideRequest.Builder.from(Glide.with(activity), arrayList[index]) + .asBitmap() + .build() + .into(itemView.findViewById(i)) + + } } } diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumFullWidthAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumFullWidthAdapter.kt deleted file mode 100644 index 5a774b20..00000000 --- a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumFullWidthAdapter.kt +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2017. Alexander Bilchuk - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package code.name.monkey.retromusic.adapter.album - -import android.app.Activity -import android.app.ActivityOptions -import android.util.DisplayMetrics -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import code.name.monkey.retromusic.R -import code.name.monkey.retromusic.glide.AlbumGlideRequest -import code.name.monkey.retromusic.glide.RetroMusicColoredTarget -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.util.color.MediaNotificationProcessor -import code.name.monkey.retromusic.views.MetalRecyclerViewPager -import com.bumptech.glide.Glide - -class AlbumFullWidthAdapter( - private val activity: Activity, - private val dataSet: List, - metrics: DisplayMetrics -) : MetalRecyclerViewPager.MetalAdapter(metrics) { - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FullMetalViewHolder { - return FullMetalViewHolder( - LayoutInflater.from(parent.context).inflate( - R.layout.pager_item, - parent, - false - ) - ) - } - - override fun onBindViewHolder(holder: FullMetalViewHolder, position: Int) { - // don't forget about calling supper.onBindViewHolder! - super.onBindViewHolder(holder, position) - val album = dataSet[position] - holder.title?.text = getAlbumTitle(album) - holder.text?.text = getAlbumText(album) - holder.playSongs?.setOnClickListener { - album.songs?.let { songs -> - MusicPlayerRemote.openQueue( - songs, - 0, - true - ) - } - } - loadAlbumCover(album, holder) - } - - private fun getAlbumTitle(album: Album): String? { - return album.title - } - - private fun getAlbumText(album: Album): String? { - return album.artistName - } - - private fun loadAlbumCover(album: Album, holder: FullMetalViewHolder) { - if (holder.image == null) { - return - } - - AlbumGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong()) - .checkIgnoreMediaStore(activity) - .generatePalette(activity) - .build() - .into(object : RetroMusicColoredTarget(holder.image!!) { - override fun onColorReady(colors: MediaNotificationProcessor) { - - } - }) - } - - override fun getItemCount(): Int { - return dataSet.size - } - - inner class FullMetalViewHolder(itemView: View) : - MetalRecyclerViewPager.MetalViewHolder(itemView) { - - override fun onClick(v: View?) { - val activityOptions = ActivityOptions.makeSceneTransitionAnimation( - activity, - imageContainerCard ?: image, - activity.getString(R.string.transition_album_art) - ) - NavigationUtil.goToAlbumOptions(activity, dataSet[layoutPosition].id, activityOptions) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt index 8d5cdb1a..34253648 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt @@ -61,8 +61,7 @@ open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpda actionPrevious?.show() } else { - actionNext.visibility = - if (PreferenceUtil.isExtraControls) View.VISIBLE else View.GONE + actionNext.visibility = if (PreferenceUtil.isExtraControls) View.VISIBLE else View.GONE actionPrevious.visibility = if (PreferenceUtil.isExtraControls) View.VISIBLE else View.GONE } diff --git a/app/src/main/java/code/name/monkey/retromusic/model/CategoryInfo.java b/app/src/main/java/code/name/monkey/retromusic/model/CategoryInfo.java index 6fdb6f85..867bc409 100644 --- a/app/src/main/java/code/name/monkey/retromusic/model/CategoryInfo.java +++ b/app/src/main/java/code/name/monkey/retromusic/model/CategoryInfo.java @@ -59,9 +59,9 @@ public class CategoryInfo implements Parcelable { } public enum Category { - Home(R.id.action_home, R.string.home, R.drawable.ic_home_white_24dp), - Songs(R.id.action_song, R.string.songs, R.drawable.ic_audiotrack_white_24dp), - Albums(R.id.action_album, R.string.albums, R.drawable.ic_album_white_24dp), + Home(R.id.action_home, R.string.home, R.drawable.asld_home), + Songs(R.id.action_song, R.string.songs, R.drawable.asld_music_note), + Albums(R.id.action_album, R.string.albums, R.drawable.asld_album), Artists(R.id.action_artist, R.string.artists, R.drawable.ic_artist_white_24dp), Playlists(R.id.action_playlist, R.string.playlists, R.drawable.ic_playlist_play_white_24dp), Genres(R.id.action_genre, R.string.genres, R.drawable.ic_guitar_white_24dp), 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 eb6b2e15..87d1dc6b 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 @@ -43,7 +43,9 @@ class RepositoryImpl constructor(private val context: Context) : Repository { ArtistLoader.getArtist(context, artistId) override suspend fun suggestions(): Home? { - val songs = NotRecentlyPlayedPlaylist(context).getSongs(context).shuffled().subList(0, 9) + val songs = NotRecentlyPlayedPlaylist(context).getSongs(context).shuffled().apply { + if (size > 9) subList(0, 9) + } if (songs.isNotEmpty()) { return Home( songs, diff --git a/app/src/main/java/code/name/monkey/retromusic/util/DensityUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/DensityUtil.java deleted file mode 100644 index 6c5c650c..00000000 --- a/app/src/main/java/code/name/monkey/retromusic/util/DensityUtil.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2019 Hemanth Savarala. - * - * Licensed under the GNU General Public License v3 - * - * This is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by - * the Free Software Foundation either version 3 of the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - */ - -package code.name.monkey.retromusic.util; - -import android.app.Activity; -import android.content.Context; -import android.util.DisplayMetrics; - -import androidx.annotation.NonNull; - -/** - * Created by hefuyi on 16/7/30. - */ -public class DensityUtil { - - public static int getScreenHeight(@NonNull Context context) { - DisplayMetrics displayMetrics = new DisplayMetrics(); - ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); - return displayMetrics.heightPixels; - } - - public static int dip2px(@NonNull Context context, float dpVale) { - final float scale = context.getResources().getDisplayMetrics().density; - return (int) (dpVale * scale + 0.5f); - } - -} \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/util/DensityUtil.kt b/app/src/main/java/code/name/monkey/retromusic/util/DensityUtil.kt new file mode 100644 index 00000000..2e36de9a --- /dev/null +++ b/app/src/main/java/code/name/monkey/retromusic/util/DensityUtil.kt @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2019 Hemanth Savarala. + * + * Licensed under the GNU General Public License v3 + * + * This is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by + * the Free Software Foundation either version 3 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + */ +package code.name.monkey.retromusic.util + +import android.app.Activity +import android.content.Context +import android.util.DisplayMetrics +import android.util.TypedValue + +/** + * Created by hefuyi on 16/7/30. + */ +object DensityUtil { + fun getScreenHeight(context: Context): Int { + val displayMetrics = DisplayMetrics() + (context as Activity).windowManager.defaultDisplay.getMetrics(displayMetrics) + return displayMetrics.heightPixels + } + + fun getScreenWidth(context: Context): Int { + val displayMetrics = DisplayMetrics() + (context as Activity).windowManager.defaultDisplay.getMetrics(displayMetrics) + return displayMetrics.widthPixels + } + + private fun toDP(context: Context, value: Int): Int { + return TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, + value.toFloat(), context.resources.displayMetrics + ).toInt() + } + + @JvmStatic + fun dip2px(context: Context, dpVale: Float): Int { + val scale = context.resources.displayMetrics.density + return (dpVale * scale + 0.5f).toInt() + } +} \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt b/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt index fbd4cef3..591c67d9 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt +++ b/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt @@ -78,7 +78,8 @@ object ViewUtil { } fun setProgressDrawable(progressIndicator: ProgressIndicator, newColor: Int) { - progressIndicator.progressTintList = ColorStateList.valueOf(newColor) + progressIndicator.indicatorColors = intArrayOf(newColor) + progressIndicator.trackColor = ColorUtil.withAlpha(newColor, 0.2f) } fun hitTest(v: View, x: Int, y: Int): Boolean { diff --git a/app/src/main/java/code/name/monkey/retromusic/views/MetalRecyclerViewPager.kt b/app/src/main/java/code/name/monkey/retromusic/views/MetalRecyclerViewPager.kt deleted file mode 100644 index 29bab7ba..00000000 --- a/app/src/main/java/code/name/monkey/retromusic/views/MetalRecyclerViewPager.kt +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2019 Hemanth Savarala. - * - * Licensed under the GNU General Public License v3 - * - * This is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by - * the Free Software Foundation either version 3 of the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - */ - -package code.name.monkey.retromusic.views - -import android.content.Context -import android.util.AttributeSet -import android.util.DisplayMetrics -import android.view.View -import android.view.ViewGroup -import androidx.annotation.NonNull -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.PagerSnapHelper -import androidx.recyclerview.widget.RecyclerView -import code.name.monkey.retromusic.R -import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder -import code.name.monkey.retromusic.util.RetroUtil - -class MetalRecyclerViewPager : RecyclerView { - constructor(context: Context) : super(context) { - init(context, null) - } - - constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { - init(context, attrs) - } - - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( - context, - attrs, - defStyleAttr - ) { - init(context, attrs) - } - - private var itemMargin: Int = 0 - - fun init(context: Context, attrs: AttributeSet?) { - val typedArray = - context.obtainStyledAttributes(attrs, R.styleable.MetalRecyclerViewPager, 0, 0) - itemMargin = - typedArray.getDimension(R.styleable.MetalRecyclerViewPager_itemMargin, 0f).toInt() - typedArray.recycle() - - layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false) - val snapHelper = PagerSnapHelper() - snapHelper.attachToRecyclerView(this) - } - - override fun setAdapter(adapter: Adapter<*>?) { - if (adapter is MetalAdapter) { - adapter.setItemMargin(itemMargin) - adapter.updateDisplayMetrics() - } else { - throw IllegalArgumentException("Only MetalAdapter is allowed here") - } - super.setAdapter(adapter) - } - - abstract class MetalAdapter(@NonNull val displayMetrics: DisplayMetrics) : - RecyclerView.Adapter() { - private var itemMargin: Int = 0 - private var itemWidth: Int = 0 - - fun setItemMargin(itemMargin: Int) { - this.itemMargin = itemMargin - } - - fun updateDisplayMetrics() { - itemWidth = if (RetroUtil.isTablet()) { - displayMetrics.widthPixels / 2 - itemMargin * 3 - } else if (RetroUtil.isLandscape()) { - ((displayMetrics.widthPixels / 2.5f) - itemMargin).toInt() - } else { - displayMetrics.widthPixels - itemMargin - } - } - - override fun onBindViewHolder(holder: VH, position: Int) { - val currentItemWidth = itemWidth - if (position == 0) { - //currentItemWidth += itemMargin; - holder.rootLayout.setPadding(0, 0, 0, 0); - } else if (position == itemCount - 1) { - //currentItemWidth += itemMargin; - holder.rootLayout.setPadding(0, 0, 0, 0); - } - - val height = holder.rootLayout.layoutParams.height - holder.rootLayout.layoutParams = ViewGroup.LayoutParams(currentItemWidth, height) - } - } - - abstract class MetalViewHolder(itemView: View) : MediaEntryViewHolder(itemView) { - var rootLayout: ViewGroup = itemView.findViewById(R.id.root_layout) - } -} diff --git a/app/src/main/java/code/name/monkey/retromusic/views/SeekArc.java b/app/src/main/java/code/name/monkey/retromusic/views/SeekArc.java index 726a5f73..684410fc 100644 --- a/app/src/main/java/code/name/monkey/retromusic/views/SeekArc.java +++ b/app/src/main/java/code/name/monkey/retromusic/views/SeekArc.java @@ -405,7 +405,7 @@ public class SeekArc extends View { thumbHalfheight); mMax = a.getInteger(R.styleable.SeekArc_max, mMax); - mProgress = a.getInteger(R.styleable.SeekArc_progress, mProgress); + mProgress = a.getInteger(R.styleable.SeekArc_seekProgress, mProgress); mProgressWidth = (int) a.getDimension( R.styleable.SeekArc_progressWidth, mProgressWidth); mArcWidth = (int) a.getDimension(R.styleable.SeekArc_arcWidth, diff --git a/app/src/main/res/drawable-v21/notification_selector.xml b/app/src/main/res/drawable-v21/notification_selector.xml deleted file mode 100644 index 83aed83c..00000000 --- a/app/src/main/res/drawable-v21/notification_selector.xml +++ /dev/null @@ -1,3 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/widget_selector.xml b/app/src/main/res/drawable-v21/widget_selector.xml deleted file mode 100644 index f0360419..00000000 --- a/app/src/main/res/drawable-v21/widget_selector.xml +++ /dev/null @@ -1,3 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/widget_selector_light.xml b/app/src/main/res/drawable-v21/widget_selector_light.xml deleted file mode 100644 index 83aed83c..00000000 --- a/app/src/main/res/drawable-v21/widget_selector_light.xml +++ /dev/null @@ -1,3 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/drawable/asld_album.xml b/app/src/main/res/drawable/asld_album.xml new file mode 100644 index 00000000..0b8fd84e --- /dev/null +++ b/app/src/main/res/drawable/asld_album.xml @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/asld_home.xml b/app/src/main/res/drawable/asld_home.xml new file mode 100644 index 00000000..1b4da255 --- /dev/null +++ b/app/src/main/res/drawable/asld_home.xml @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/asld_music_note.xml b/app/src/main/res/drawable/asld_music_note.xml new file mode 100644 index 00000000..b6086e4f --- /dev/null +++ b/app/src/main/res/drawable/asld_music_note.xml @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/avd_album.xml b/app/src/main/res/drawable/avd_album.xml new file mode 100644 index 00000000..696cae4b --- /dev/null +++ b/app/src/main/res/drawable/avd_album.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/avd_home.xml b/app/src/main/res/drawable/avd_home.xml new file mode 100644 index 00000000..ec405646 --- /dev/null +++ b/app/src/main/res/drawable/avd_home.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/avd_music_note.xml b/app/src/main/res/drawable/avd_music_note.xml new file mode 100644 index 00000000..1db16c7e --- /dev/null +++ b/app/src/main/res/drawable/avd_music_note.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/notification_selector.xml b/app/src/main/res/drawable/notification_selector.xml index d7867f86..83aed83c 100644 --- a/app/src/main/res/drawable/notification_selector.xml +++ b/app/src/main/res/drawable/notification_selector.xml @@ -1,9 +1,3 @@ - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/saf_guide_1.webp b/app/src/main/res/drawable/saf_guide_1.webp similarity index 100% rename from app/src/main/res/drawable-v21/saf_guide_1.webp rename to app/src/main/res/drawable/saf_guide_1.webp diff --git a/app/src/main/res/drawable-v21/saf_guide_2.webp b/app/src/main/res/drawable/saf_guide_2.webp similarity index 100% rename from app/src/main/res/drawable-v21/saf_guide_2.webp rename to app/src/main/res/drawable/saf_guide_2.webp diff --git a/app/src/main/res/drawable-v21/saf_guide_3.webp b/app/src/main/res/drawable/saf_guide_3.webp similarity index 100% rename from app/src/main/res/drawable-v21/saf_guide_3.webp rename to app/src/main/res/drawable/saf_guide_3.webp diff --git a/app/src/main/res/drawable/widget_selector.xml b/app/src/main/res/drawable/widget_selector.xml old mode 100755 new mode 100644 index d7867f86..f0360419 --- a/app/src/main/res/drawable/widget_selector.xml +++ b/app/src/main/res/drawable/widget_selector.xml @@ -1,9 +1,3 @@ - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/drawable/widget_selector_light.xml b/app/src/main/res/drawable/widget_selector_light.xml index 75e988c0..83aed83c 100644 --- a/app/src/main/res/drawable/widget_selector_light.xml +++ b/app/src/main/res/drawable/widget_selector_light.xml @@ -1,9 +1,3 @@ - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout-land/activity_album.xml b/app/src/main/res/layout-land/activity_album.xml index 7402e452..47d9002f 100644 --- a/app/src/main/res/layout-land/activity_album.xml +++ b/app/src/main/res/layout-land/activity_album.xml @@ -48,7 +48,7 @@ android:layout_marginEnd="16dp" android:transitionName="@string/transition_album_art" app:cardCornerRadius="24dp" - app:cardElevation="0dp" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/container" app:layout_constraintHorizontal_bias="0.5" 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 3f62c2ee..85e50dda 100644 --- a/app/src/main/res/layout-land/activity_artist_details.xml +++ b/app/src/main/res/layout-land/activity_artist_details.xml @@ -48,7 +48,7 @@ android:layout_marginEnd="16dp" android:transitionName="@string/transition_artist_image" app:cardCornerRadius="24dp" - app:cardElevation="0dp" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/container" app:layout_constraintHorizontal_bias="0.5" diff --git a/app/src/main/res/layout-land/pager_item.xml b/app/src/main/res/layout-land/pager_item.xml index 9dac9266..d4c26e0e 100644 --- a/app/src/main/res/layout-land/pager_item.xml +++ b/app/src/main/res/layout-land/pager_item.xml @@ -14,7 +14,7 @@ android:layout_height="156dp" android:layout_margin="8dp" app:cardCornerRadius="16dp" - app:cardElevation="0dp"> + > - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge-land/fragment_player_playback_controls.xml b/app/src/main/res/layout-xlarge-land/fragment_player_playback_controls.xml deleted file mode 100755 index 0d859ef2..00000000 --- a/app/src/main/res/layout-xlarge-land/fragment_player_playback_controls.xml +++ /dev/null @@ -1,216 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge-land/pager_item.xml b/app/src/main/res/layout-xlarge-land/pager_item.xml index 9e3d13f7..627037df 100644 --- a/app/src/main/res/layout-xlarge-land/pager_item.xml +++ b/app/src/main/res/layout-xlarge-land/pager_item.xml @@ -14,7 +14,7 @@ android:layout_height="256dp" android:layout_margin="8dp" app:cardCornerRadius="16dp" - app:cardElevation="0dp"> + > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/fragment_player.xml b/app/src/main/res/layout-xlarge/fragment_player.xml deleted file mode 100644 index 720ab992..00000000 --- a/app/src/main/res/layout-xlarge/fragment_player.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_album.xml b/app/src/main/res/layout/activity_album.xml index cacb7067..71302b6b 100755 --- a/app/src/main/res/layout/activity_album.xml +++ b/app/src/main/res/layout/activity_album.xml @@ -64,7 +64,6 @@ android:layout_marginEnd="16dp" android:transitionName="@string/transition_album_art" app:cardCornerRadius="24dp" - app:cardElevation="0dp" app:layout_constraintDimensionRatio="1:1" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/activity_artist_details.xml b/app/src/main/res/layout/activity_artist_details.xml index fdbad70c..b65a3bfe 100755 --- a/app/src/main/res/layout/activity_artist_details.xml +++ b/app/src/main/res/layout/activity_artist_details.xml @@ -63,7 +63,6 @@ android:layout_marginEnd="16dp" android:transitionName="@string/transition_artist_image" app:cardCornerRadius="24dp" - app:cardElevation="0dp" app:layout_constraintDimensionRatio="1:1" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/fragment_mini_player.xml b/app/src/main/res/layout/fragment_mini_player.xml index 0f56c37b..3f5161b6 100644 --- a/app/src/main/res/layout/fragment_mini_player.xml +++ b/app/src/main/res/layout/fragment_mini_player.xml @@ -67,6 +67,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:circularRadius="16dp" + app:indicatorColor="@android:color/black" app:indicatorType="circular" app:indicatorWidth="2dp" app:linearSeamless="true" diff --git a/app/src/main/res/layout/fragment_player_playback_controls.xml b/app/src/main/res/layout/fragment_player_playback_controls.xml index 5ba61f14..c181fbaa 100755 --- a/app/src/main/res/layout/fragment_player_playback_controls.xml +++ b/app/src/main/res/layout/fragment_player_playback_controls.xml @@ -27,9 +27,9 @@ + tools:text="@tools:sample/full_names" /> + tools:text="@tools:sample/full_names" /> diff --git a/app/src/main/res/layout/item_artist_card.xml b/app/src/main/res/layout/item_artist_card.xml index 69d61f44..f0558b04 100644 --- a/app/src/main/res/layout/item_artist_card.xml +++ b/app/src/main/res/layout/item_artist_card.xml @@ -17,8 +17,7 @@ android:layout_width="128dp" android:layout_height="128dp" android:layout_margin="4dp" - app:cardCornerRadius="16dp" - app:cardElevation="0dp"> + app:cardCornerRadius="16dp"> + app:cardCornerRadius="8dp"> + app:cardCornerRadius="6dp"> @@ -69,13 +69,11 @@ android:orientation="vertical" app:layout_constraintGuide_begin="@dimen/list_pref_guideline_begin" /> - diff --git a/app/src/main/res/layout/metal_section_recycler_view.xml b/app/src/main/res/layout/metal_section_recycler_view.xml index 19d67030..06d45eb9 100644 --- a/app/src/main/res/layout/metal_section_recycler_view.xml +++ b/app/src/main/res/layout/metal_section_recycler_view.xml @@ -12,7 +12,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:paddingHorizontal="16dp" - android:paddingVertical="12dp" + android:paddingVertical="14dp" android:textAppearance="@style/TextViewHeadline6" android:textStyle="bold" app:layout_constrainedWidth="true" @@ -21,14 +21,13 @@ app:layout_constraintTop_toTopOf="parent" tools:text="@tools:sample/full_names" /> - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/seekarc_attrs.xml b/app/src/main/res/values/seekarc_attrs.xml index d8e6e351..22e021ac 100644 --- a/app/src/main/res/values/seekarc_attrs.xml +++ b/app/src/main/res/values/seekarc_attrs.xml @@ -29,7 +29,7 @@ - + @@ -42,7 +42,7 @@ - + \ No newline at end of file