Fix banner, shortcut colors

This commit is contained in:
h4h13 2019-06-03 22:48:19 +05:30
parent a271a180b5
commit 192ceb4438
10 changed files with 32 additions and 37 deletions

View file

@ -28,8 +28,4 @@ object Injection {
fun provideSchedulerProvider(): BaseSchedulerProvider { fun provideSchedulerProvider(): BaseSchedulerProvider {
return SchedulerProvider.getInstance() return SchedulerProvider.getInstance()
} }
fun provideKuGouApiService(): KuGouApiService {
return KogouClient().apiService
}
} }

View file

@ -9,7 +9,6 @@ import android.os.Bundle
import android.provider.DocumentsContract import android.provider.DocumentsContract
import android.provider.MediaStore import android.provider.MediaStore
import android.provider.MediaStore.Images.Media.getBitmap import android.provider.MediaStore.Images.Media.getBitmap
import android.text.TextUtils
import android.view.MenuItem import android.view.MenuItem
import android.widget.Toast import android.widget.Toast
import androidx.core.content.FileProvider import androidx.core.content.FileProvider
@ -77,7 +76,7 @@ class UserInfoActivity : AbsBaseActivity() {
showBannerOptions() showBannerOptions()
} }
next.setOnClickListener { next.setOnClickListener {
val nameString = name.text.toString().trim { it <= ' ' } /*val nameString = name.text.toString().trim { it <= ' ' }
if (TextUtils.isEmpty(nameString)) { if (TextUtils.isEmpty(nameString)) {
Toast.makeText(this, "Umm name is empty", Toast.LENGTH_SHORT).show() Toast.makeText(this, "Umm name is empty", Toast.LENGTH_SHORT).show()
return@setOnClickListener return@setOnClickListener
@ -89,7 +88,7 @@ class UserInfoActivity : AbsBaseActivity() {
} }
PreferenceUtil.getInstance().userName = nameString PreferenceUtil.getInstance().userName = nameString
PreferenceUtil.getInstance().userBio = bioString PreferenceUtil.getInstance().userBio = bioString*/
setResult(Activity.RESULT_OK) setResult(Activity.RESULT_OK)
finish() finish()
} }
@ -193,11 +192,12 @@ class UserInfoActivity : AbsBaseActivity() {
} }
} }
CROP_BANNER_REQUEST -> { CROP_BANNER_REQUEST -> {
val extras: Bundle = data.extras!! val selectedBitmap: Bitmap? = data.extras?.getParcelable("date")
val selectedBitmap: Bitmap = extras.getParcelable("data") val profileImagePath = selectedBitmap?.let { saveToInternalStorage(it, USER_BANNER) }
val profileImagePath = saveToInternalStorage(selectedBitmap, USER_BANNER) profileImagePath?.let {
PreferenceUtil.getInstance().saveProfileImage(profileImagePath) PreferenceUtil.getInstance().saveProfileImage(it)
loadImageFromStorage(profileImagePath) loadImageFromStorage(it)
}
} }
} }
} }

View file

@ -72,7 +72,9 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
toolbar = view.findViewById(R.id.toolbar) toolbar = view.findViewById(R.id.toolbar)
bannerImage?.setOnClickListener {
NavigationUtil.goToUserInfo(activity!!)
}
if (!PreferenceUtil.getInstance().isHomeBanner) if (!PreferenceUtil.getInstance().isHomeBanner)
setStatusbarColorAuto(view) setStatusbarColorAuto(view)

View file

@ -78,7 +78,7 @@ class MaterialListPreferenceDialog : PreferenceDialogFragmentCompat() {
val entries = arguments?.getStringArrayList(EXTRA_ENTRIES) val entries = arguments?.getStringArrayList(EXTRA_ENTRIES)
val entriesValues = arguments?.getStringArrayList(EXTRA_ENTRIES_VALUES) val entriesValues = arguments?.getStringArrayList(EXTRA_ENTRIES_VALUES)
return MaterialDialog(activity!!, BottomSheet()) materialDialog = MaterialDialog(activity!!, BottomSheet())
.show { .show {
title(text = materialListPreference.title.toString()) title(text = materialListPreference.title.toString())
positiveButton(R.string.set) positiveButton(R.string.set)
@ -89,11 +89,14 @@ class MaterialListPreferenceDialog : PreferenceDialogFragmentCompat() {
dismiss() dismiss()
} }
} }
return materialDialog
} }
private lateinit var materialDialog: MaterialDialog
override fun onDialogClosed(positiveResult: Boolean) { override fun onDialogClosed(positiveResult: Boolean) {
if (positiveResult) { if (positiveResult) {
dismiss() materialDialog.dismiss()
} }
} }

View file

@ -19,8 +19,6 @@ import android.content.res.ColorStateList
import android.graphics.Color import android.graphics.Color
import android.util.AttributeSet import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatImageView import androidx.appcompat.widget.AppCompatImageView
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
@ -47,20 +45,8 @@ class ColorIconsImageView : AppCompatImageView {
private fun setIconBackgroundColor(color: Int) { private fun setIconBackgroundColor(color: Int) {
setBackgroundResource(R.drawable.color_circle_gradient) setBackgroundResource(R.drawable.color_circle_gradient)
backgroundTintList = ColorStateList.valueOf(ColorUtil.adjustAlpha(color, 0.22f))
val alpha = if (ATHUtil.isWindowBackgroundDark(context)) { imageTintList = ColorStateList.valueOf(ColorUtil.withAlpha(color, 0.75f))
1.0f
} else {
0.12f
}
val filterColor = if (ATHUtil.isWindowBackgroundDark(context)) {
ThemeStore.primaryColor(context)
} else {
color
}
backgroundTintList = ColorStateList.valueOf(ColorUtil.adjustAlpha(color, alpha))
imageTintList = ColorStateList.valueOf(filterColor)
requestLayout() requestLayout()
invalidate() invalidate()
} }

View file

@ -61,6 +61,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:cardCornerRadius="8dp" app:cardCornerRadius="8dp"
app:cardElevation="6dp" app:cardElevation="6dp"
android:layout_marginEnd="58dp"
android:layout_marginStart="58dp"
app:cardUseCompatPadding="true" app:cardUseCompatPadding="true"
app:layout_scrollFlags="scroll|enterAlways"> app:layout_scrollFlags="scroll|enterAlways">

View file

@ -52,7 +52,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:padding="16dp" android:padding="16dp"
app:iconBackgroundColor="@color/md_blue_A700" app:iconBackgroundColor="@color/md_blue_500"
app:srcCompat="@drawable/ic_access_time_white_24dp" /> app:srcCompat="@drawable/ic_access_time_white_24dp" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
@ -77,7 +77,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:padding="16dp" android:padding="16dp"
app:iconBackgroundColor="@color/md_red_A700" app:iconBackgroundColor="@color/md_red_500"
app:srcCompat="@drawable/ic_library_add_white_24dp" /> app:srcCompat="@drawable/ic_library_add_white_24dp" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
@ -101,7 +101,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:padding="16dp" android:padding="16dp"
app:iconBackgroundColor="@color/md_deep_purple_A700" app:iconBackgroundColor="@color/md_deep_purple_500"
app:srcCompat="@drawable/ic_trending_up_white_24dp" /> app:srcCompat="@drawable/ic_trending_up_white_24dp" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
@ -125,7 +125,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:padding="16dp" android:padding="16dp"
app:iconBackgroundColor="@color/md_green_A700" app:iconBackgroundColor="@color/md_green_500"
app:srcCompat="@drawable/ic_shuffle_white_24dp" /> app:srcCompat="@drawable/ic_shuffle_white_24dp" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView

View file

@ -69,7 +69,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_margin="8dp"> android:layout_margin="8dp"
android:visibility="gone">
<code.name.monkey.retromusic.views.CircularImageView <code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/userImage" android:id="@+id/userImage"
@ -102,6 +103,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:visibility="gone"
app:hintAnimationEnabled="true"> app:hintAnimationEnabled="true">
@ -123,6 +125,7 @@
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:visibility="gone"
app:hintAnimationEnabled="true"> app:hintAnimationEnabled="true">

View file

@ -89,7 +89,8 @@
android:descendantFocusability="blocksDescendants" android:descendantFocusability="blocksDescendants"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:orientation="vertical"> android:orientation="vertical"
android:paddingTop="8dp">
<include layout="@layout/abs_playlists" /> <include layout="@layout/abs_playlists" />

View file

@ -21,6 +21,7 @@
<!-- Deep Purple --> <!-- Deep Purple -->
<color name="md_deep_purple_A400">#651FFF</color> <color name="md_deep_purple_A400">#651FFF</color>
<color name="md_deep_purple_500A12">#30673AB7</color> <color name="md_deep_purple_500A12">#30673AB7</color>
<color name="md_deep_purple_500">#673AB7</color>
<color name="md_deep_purple_A700">#6200EA</color> <color name="md_deep_purple_A700">#6200EA</color>
<!-- Indigo --> <!-- Indigo -->
@ -36,6 +37,7 @@
<color name="md_green_A200">#69F0AE</color> <color name="md_green_A200">#69F0AE</color>
<color name="md_green_A700">#00C853</color> <color name="md_green_A700">#00C853</color>
<color name="md_green_500">#4CAF50</color>
<color name="md_green_500A12">#304CAF50</color> <color name="md_green_500A12">#304CAF50</color>