Dark theme

This commit is contained in:
h4h13 2019-12-01 21:15:12 +05:30
parent 9f1e6cb98e
commit efa21c8c91
9 changed files with 110 additions and 125 deletions

View file

@ -246,7 +246,8 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
R.id.action_tag_editor -> { R.id.action_tag_editor -> {
val intent = Intent(this, AlbumTagEditorActivity::class.java) val intent = Intent(this, AlbumTagEditorActivity::class.java)
intent.putExtra(AbsTagEditorActivity.EXTRA_ID, album.id) intent.putExtra(AbsTagEditorActivity.EXTRA_ID, album.id)
startActivityForResult(intent, TAG_EDITOR_REQUEST) val options = ActivityOptions.makeSceneTransitionAnimation(this, image, getString(R.string.transition_album_art))
startActivityForResult(intent, TAG_EDITOR_REQUEST, options.toBundle())
return true return true
} }
/*Sort*/ /*Sort*/

View file

@ -2,20 +2,28 @@ package code.name.monkey.retromusic.activities.tageditor
import android.app.Activity import android.app.Activity
import android.content.res.ColorStateList import android.content.res.ColorStateList
import android.graphics.* import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.Color
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.text.* import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.widget.Toast import android.widget.Toast
import code.name.monkey.appthemehelper.util.* import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.appHandleColor import code.name.monkey.retromusic.extensions.appHandleColor
import code.name.monkey.retromusic.glide.palette.* import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.glide.palette.BitmapPaletteTranscoder
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
import code.name.monkey.retromusic.loaders.AlbumLoader import code.name.monkey.retromusic.loaders.AlbumLoader
import code.name.monkey.retromusic.rest.LastFMRestClient import code.name.monkey.retromusic.rest.LastFMRestClient
import code.name.monkey.retromusic.rest.model.LastFmAlbum import code.name.monkey.retromusic.rest.model.LastFmAlbum
import code.name.monkey.retromusic.util.* import code.name.monkey.retromusic.util.ImageUtil
import code.name.monkey.retromusic.util.LastFMUtil
import code.name.monkey.retromusic.util.RetroColorUtil.generatePalette import code.name.monkey.retromusic.util.RetroColorUtil.generatePalette
import code.name.monkey.retromusic.util.RetroColorUtil.getColor import code.name.monkey.retromusic.util.RetroColorUtil.getColor
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
@ -43,16 +51,7 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
) { ) {
getColor(resource?.palette, Color.TRANSPARENT) getColor(resource?.palette, Color.TRANSPARENT)
albumArtBitmap = resource?.bitmap?.let { ImageUtil.resizeBitmap(it, 2048) } albumArtBitmap = resource?.bitmap?.let { ImageUtil.resizeBitmap(it, 2048) }
setImageBitmap( setImageBitmap(albumArtBitmap, getColor(resource?.palette, ATHUtil.resolveColor(this@AlbumTagEditorActivity, R.attr.defaultFooterColor)))
albumArtBitmap,
getColor(
resource?.palette,
ATHUtil.resolveColor(
this@AlbumTagEditorActivity,
R.attr.defaultFooterColor
)
)
)
deleteAlbumArt = false deleteAlbumArt = false
dataChanged() dataChanged()
setResult(Activity.RESULT_OK) setResult(Activity.RESULT_OK)
@ -72,8 +71,7 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
private val disposable = CompositeDisposable() private val disposable = CompositeDisposable()
private fun setupToolbar() { private fun setupToolbar() {
toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorPrimary)) applyToolbar(toolbar)
setSupportActionBar(toolbar)
supportActionBar?.setDisplayShowHomeEnabled(true) supportActionBar?.setDisplayShowHomeEnabled(true)
} }

View file

@ -2,12 +2,12 @@ package code.name.monkey.retromusic.activities.tageditor
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.text.* import android.text.Editable
import androidx.core.content.ContextCompat import android.text.TextWatcher
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.appHandleColor import code.name.monkey.retromusic.extensions.appHandleColor
import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.loaders.SongLoader import code.name.monkey.retromusic.loaders.SongLoader
import kotlinx.android.synthetic.main.activity_song_tag_editor.* import kotlinx.android.synthetic.main.activity_song_tag_editor.*
import org.jaudiotagger.tag.FieldKey import org.jaudiotagger.tag.FieldKey
@ -15,125 +15,105 @@ import java.util.*
class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher { class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
override val contentViewLayout: Int override val contentViewLayout: Int
get() = R.layout.activity_song_tag_editor get() = R.layout.activity_song_tag_editor
private fun setupToolbar() {
appBarLayout.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorPrimary))
toolbar.apply {
setBackgroundColor(
ATHUtil.resolveColor(
this@SongTagEditorActivity,
R.attr.colorPrimary
)
)
navigationIcon = TintHelper.createTintedDrawable(
ContextCompat.getDrawable(
context,
R.drawable.ic_keyboard_backspace_black_24dp
), ThemeStore.textColorPrimary(context)
)
setNavigationOnClickListener { onBackPressed() }
setSupportActionBar(toolbar)
}
title = null
}
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setNoImageMode() setNoImageMode()
setUpViews() setUpViews()
setupToolbar() applyToolbar(toolbar)
setStatusbarColorAuto() setStatusbarColorAuto()
} }
private fun setUpViews() { private fun setUpViews() {
fillViewsWithFileTags() fillViewsWithFileTags()
MaterialUtil.setTint(songTextContainer, false) MaterialUtil.setTint(songTextContainer, false)
MaterialUtil.setTint(composerContainer, false) MaterialUtil.setTint(composerContainer, false)
MaterialUtil.setTint(albumTextContainer, false) MaterialUtil.setTint(albumTextContainer, false)
MaterialUtil.setTint(artistContainer, false) MaterialUtil.setTint(artistContainer, false)
MaterialUtil.setTint(albumArtistContainer, false) MaterialUtil.setTint(albumArtistContainer, false)
MaterialUtil.setTint(yearContainer, false) MaterialUtil.setTint(yearContainer, false)
MaterialUtil.setTint(genreContainer, false) MaterialUtil.setTint(genreContainer, false)
MaterialUtil.setTint(trackNumberContainer, false) MaterialUtil.setTint(trackNumberContainer, false)
MaterialUtil.setTint(lyricsContainer, false) MaterialUtil.setTint(lyricsContainer, false)
songText.appHandleColor().addTextChangedListener(this) songText.appHandleColor().addTextChangedListener(this)
albumText.appHandleColor().addTextChangedListener(this) albumText.appHandleColor().addTextChangedListener(this)
albumArtistText.appHandleColor().addTextChangedListener(this) albumArtistText.appHandleColor().addTextChangedListener(this)
artistText.appHandleColor().addTextChangedListener(this) artistText.appHandleColor().addTextChangedListener(this)
genreText.appHandleColor().addTextChangedListener(this) genreText.appHandleColor().addTextChangedListener(this)
yearText.appHandleColor().addTextChangedListener(this) yearText.appHandleColor().addTextChangedListener(this)
trackNumberText.appHandleColor().addTextChangedListener(this) trackNumberText.appHandleColor().addTextChangedListener(this)
lyricsText.appHandleColor().addTextChangedListener(this) lyricsText.appHandleColor().addTextChangedListener(this)
songComposerText.appHandleColor().addTextChangedListener(this) songComposerText.appHandleColor().addTextChangedListener(this)
} }
private fun fillViewsWithFileTags() { private fun fillViewsWithFileTags() {
songText.setText(songTitle) songText.setText(songTitle)
albumArtistText.setText(albumArtist) albumArtistText.setText(albumArtist)
albumText.setText(albumTitle) albumText.setText(albumTitle)
artistText.setText(artistName) artistText.setText(artistName)
genreText.setText(genreName) genreText.setText(genreName)
yearText.setText(songYear) yearText.setText(songYear)
trackNumberText.setText(trackNumber) trackNumberText.setText(trackNumber)
lyricsText.setText(lyrics) lyricsText.setText(lyrics)
songComposerText.setText(composer) songComposerText.setText(composer)
} }
override fun loadCurrentImage() { override fun loadCurrentImage() {
} }
override fun searchImageOnWeb() { override fun searchImageOnWeb() {
} }
override fun deleteImage() { override fun deleteImage() {
} }
override fun save() { override fun save() {
val fieldKeyValueMap = EnumMap<FieldKey, String>(FieldKey::class.java) val fieldKeyValueMap = EnumMap<FieldKey, String>(FieldKey::class.java)
fieldKeyValueMap[FieldKey.TITLE] = songText.text.toString() fieldKeyValueMap[FieldKey.TITLE] = songText.text.toString()
fieldKeyValueMap[FieldKey.ALBUM] = albumText.text.toString() fieldKeyValueMap[FieldKey.ALBUM] = albumText.text.toString()
fieldKeyValueMap[FieldKey.ARTIST] = artistText.text.toString() fieldKeyValueMap[FieldKey.ARTIST] = artistText.text.toString()
fieldKeyValueMap[FieldKey.GENRE] = genreText.text.toString() fieldKeyValueMap[FieldKey.GENRE] = genreText.text.toString()
fieldKeyValueMap[FieldKey.YEAR] = yearText.text.toString() fieldKeyValueMap[FieldKey.YEAR] = yearText.text.toString()
fieldKeyValueMap[FieldKey.TRACK] = trackNumberText.text.toString() fieldKeyValueMap[FieldKey.TRACK] = trackNumberText.text.toString()
fieldKeyValueMap[FieldKey.LYRICS] = lyricsText.text.toString() fieldKeyValueMap[FieldKey.LYRICS] = lyricsText.text.toString()
fieldKeyValueMap[FieldKey.ALBUM_ARTIST] = albumArtistText.text.toString() fieldKeyValueMap[FieldKey.ALBUM_ARTIST] = albumArtistText.text.toString()
fieldKeyValueMap[FieldKey.COMPOSER] = songComposerText.text.toString() fieldKeyValueMap[FieldKey.COMPOSER] = songComposerText.text.toString()
writeValuesToFiles(fieldKeyValueMap, null) writeValuesToFiles(fieldKeyValueMap, null)
} }
override fun getSongPaths(): List<String> { override fun getSongPaths(): List<String> {
val paths = ArrayList<String>(1) val paths = ArrayList<String>(1)
paths.add(SongLoader.getSong(this, id).data) paths.add(SongLoader.getSong(this, id).data)
return paths return paths
} }
override fun loadImageFromFile(selectedFile: Uri?) { override fun loadImageFromFile(selectedFile: Uri?) {
} }
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) { override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {
} }
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
} }
override fun afterTextChanged(s: Editable) { override fun afterTextChanged(s: Editable) {
dataChanged() dataChanged()
} }
companion object { companion object {
val TAG: String = SongTagEditorActivity::class.java.simpleName val TAG: String = SongTagEditorActivity::class.java.simpleName
} }
} }

View file

@ -63,7 +63,7 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
aboutSettings.setOnClickListener(this) aboutSettings.setOnClickListener(this)
buyProContainer.apply { buyProContainer.apply {
if (App.isProVersion()) show() else hide() if (!App.isProVersion()) show() else hide()
setOnClickListener { setOnClickListener {
NavigationUtil.goToProVersion(requireContext()) NavigationUtil.goToProVersion(requireContext())
} }

View file

@ -2,6 +2,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/gradient_background" android:id="@+id/gradient_background"
android:background="?attr/colorSurface"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">

View file

@ -57,8 +57,7 @@
android:id="@+id/albumCoverContainer" android:id="@+id/albumCoverContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_margin="16dp"
android:layout_marginEnd="16dp"
android:transitionName="@string/transition_album_art" android:transitionName="@string/transition_album_art"
app:cardCornerRadius="24dp" app:cardCornerRadius="24dp"
app:cardElevation="8dp" app:cardElevation="8dp"

View file

@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:orientation="vertical" android:orientation="vertical"
tools:ignore="UnusedAttribute"> tools:ignore="UnusedAttribute">
@ -18,6 +19,9 @@
android:id="@+id/appBarLayout" android:id="@+id/appBarLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:elevation="0dp"
app:elevation="0dp"
app:liftOnScroll="true"> app:liftOnScroll="true">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
@ -44,10 +48,10 @@
android:id="@+id/imageContainer" android:id="@+id/imageContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="16dp"
android:transitionName="@string/transition_album_art" android:transitionName="@string/transition_album_art"
app:cardCornerRadius="24dp" app:cardCornerRadius="24dp"
app:cardElevation="8dp" app:cardElevation="8dp"
app:cardUseCompatPadding="true"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">

View file

@ -56,8 +56,7 @@
android:id="@+id/albumCoverContainer" android:id="@+id/albumCoverContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_margin="16dp"
android:layout_marginEnd="16dp"
android:transitionName="@string/transition_artist_image" android:transitionName="@string/transition_artist_image"
app:cardCornerRadius="24dp" app:cardCornerRadius="24dp"
app:cardElevation="8dp" app:cardElevation="8dp"

View file

@ -10,6 +10,9 @@
android:id="@+id/appBarLayout" android:id="@+id/appBarLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:elevation="0dp"
app:elevation="0dp"
app:liftOnScroll="true"> app:liftOnScroll="true">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar