From fa83e809aaced18d15dd6864030a0fb4c485658f Mon Sep 17 00:00:00 2001 From: h4h13 Date: Thu, 26 Dec 2019 20:05:21 +0530 Subject: [PATCH] Fix tag editor colors --- app/build.gradle | 39 +++--- .../adapter/album/AlbumFullWidthAdapter.kt | 114 ++++++++---------- .../views/MetalRecyclerViewPager.kt | 2 +- .../res/layout/activity_song_tag_editor.xml | 7 +- 4 files changed, 78 insertions(+), 84 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2032121e..b4243744 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -108,30 +108,36 @@ dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation project(':appthemehelper') implementation 'androidx.multidex:multidex:2.0.1' - implementation 'androidx.fragment:fragment:1.2.0-rc02' - implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'androidx.recyclerview:recyclerview:1.1.0-rc01' + implementation "androidx.gridlayout:gridlayout:1.0.0" implementation "androidx.cardview:cardview:1.0.0" implementation "androidx.palette:palette:1.0.0" + implementation 'androidx.palette:palette-ktx:1.0.0' + + implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.annotation:annotation:1.1.0' implementation 'androidx.preference:preference:1.1.0' - implementation 'androidx.palette:palette-ktx:1.0.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.core:core-ktx:1.1.0' + implementation 'androidx.fragment:fragment:1.2.0-rc02' + implementation 'androidx.recyclerview:recyclerview:1.1.0-rc01' implementation 'com.google.android.material:material:1.2.0-alpha01' implementation 'com.google.android.play:core:1.6.4' - implementation 'com.squareup.retrofit2:retrofit:2.6.2' - implementation 'com.squareup.retrofit2:converter-gson:2.6.2' - implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.2' + def retrofit_version = "2.6.2" + implementation "com.squareup.retrofit2:retrofit:$retrofit_version" + implementation "com.squareup.retrofit2:converter-gson:$retrofit_version" + implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version" + implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2' - implementation 'com.afollestad.material-dialogs:core:3.1.1' - implementation 'com.afollestad.material-dialogs:input:3.1.1' - implementation 'com.afollestad.material-dialogs:color:3.1.1' - implementation 'com.afollestad.material-dialogs:bottomsheets:3.1.1' + def material_dialog_version = "3.1.1" + implementation "com.afollestad.material-dialogs:core:$material_dialog_version" + implementation "com.afollestad.material-dialogs:input:$material_dialog_version" + implementation "com.afollestad.material-dialogs:color:$material_dialog_version" + implementation "com.afollestad.material-dialogs:bottomsheets:$material_dialog_version" implementation 'com.afollestad:material-cab:0.1.12' @@ -150,9 +156,9 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1" - + def kotlin_coroutines_version = "1.3.0" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version" implementation 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:3.4.0.201406110918-r' @@ -165,8 +171,9 @@ dependencies { implementation 'com.r0adkll:slidableactivity:2.1.0' implementation 'com.heinrichreimersoftware:material-intro:1.6' - implementation 'com.google.dagger:dagger:2.23.1' - kapt 'com.google.dagger:dagger-compiler:2.23.1' + def dagger_version = "2.23.1" + implementation "com.google.dagger:dagger:$dagger_version" + kapt "com.google.dagger:dagger-compiler:$dagger_version" } \ No newline at end of file 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 index a3cc654f..9a945216 100644 --- 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 @@ -15,11 +15,15 @@ */ package code.name.monkey.retromusic.adapter.album -import android.app.* +import android.app.Activity +import android.app.ActivityOptions import android.util.DisplayMetrics -import android.view.* +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup import code.name.monkey.retromusic.R -import code.name.monkey.retromusic.glide.* +import code.name.monkey.retromusic.glide.RetroMusicColoredTarget +import code.name.monkey.retromusic.glide.SongGlideRequest import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.model.Album import code.name.monkey.retromusic.util.NavigationUtil @@ -27,75 +31,57 @@ import code.name.monkey.retromusic.views.MetalRecyclerViewPager import com.bumptech.glide.Glide class AlbumFullWidthAdapter( - private val activity: Activity, - private val dataSet: ArrayList, - metrics: DisplayMetrics + private val activity: Activity, + private val dataSet: ArrayList, + 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 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) - } + 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 getAlbumTitle(album: Album): String? { + return album.title + } - private fun getAlbumText(album: Album): String? { - return album.artistName - } + private fun getAlbumText(album: Album): String? { + return album.artistName + } - private fun loadAlbumCover(album: Album, holder: FullMetalViewHolder) { - if (holder.image == null) { - return - } - SongGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong()) - .checkIgnoreMediaStore(activity).generatePalette(activity).build() - .into(object : RetroMusicColoredTarget(holder.image!!) { - override fun onColorReady(color: Int) { + private fun loadAlbumCover(album: Album, holder: FullMetalViewHolder) { + if (holder.image == null) { + return + } + SongGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong()) + .checkIgnoreMediaStore(activity) + .generatePalette(activity) + .build() + .into(object : RetroMusicColoredTarget(holder.image!!) { + override fun onColorReady(color: Int) { - } - }) - } + } + }) + } - override fun getItemCount(): Int { - return dataSet.size - } + override fun getItemCount(): Int { + return dataSet.size + } - inner class FullMetalViewHolder(itemView: View) : MetalRecyclerViewPager.MetalViewHolder( - itemView - ) { + inner class FullMetalViewHolder(itemView: View) : MetalRecyclerViewPager.MetalViewHolder(itemView) { - override fun onClick(v: View?) { - val activityOptions = ActivityOptions.makeSceneTransitionAnimation( - activity, - image, - activity.getString(R.string.transition_album_art) - ) - NavigationUtil.goToAlbumOptions(activity, dataSet[adapterPosition].id, activityOptions) - } - } + override fun onClick(v: View?) { + val activityOptions = ActivityOptions.makeSceneTransitionAnimation(activity, image, activity.getString(R.string.transition_album_art)) + NavigationUtil.goToAlbumOptions(activity, dataSet[adapterPosition].id, activityOptions) + } + } } \ No newline at end of file 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 index 39f233f2..c044bd26 100644 --- a/app/src/main/java/code/name/monkey/retromusic/views/MetalRecyclerViewPager.kt +++ b/app/src/main/java/code/name/monkey/retromusic/views/MetalRecyclerViewPager.kt @@ -74,7 +74,7 @@ class MetalRecyclerViewPager : RecyclerView { itemWidth = if (RetroUtil.isTablet()) { displayMetrics.widthPixels / 2 - itemMargin * 3 } else if (RetroUtil.isLandscape()) { - ((displayMetrics.widthPixels / 1.5f) - itemMargin).toInt() + ((displayMetrics.widthPixels / 2.5f) - itemMargin).toInt() } else { displayMetrics.widthPixels - itemMargin } diff --git a/app/src/main/res/layout/activity_song_tag_editor.xml b/app/src/main/res/layout/activity_song_tag_editor.xml index c8d6a7e1..0e737fd7 100755 --- a/app/src/main/res/layout/activity_song_tag_editor.xml +++ b/app/src/main/res/layout/activity_song_tag_editor.xml @@ -3,6 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="?attr/colorSurface" android:focusable="true" android:focusableInTouchMode="true"> @@ -40,7 +41,8 @@ android:id="@+id/songTextContainer" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + app:hintEnabled="true"> + android:maxLines="1" />