Fix font, text appearance, keyboard

This commit is contained in:
h4h13 2019-04-05 16:15:09 +05:30
parent af7404f4a4
commit 614d687827
46 changed files with 347 additions and 126 deletions

View file

@ -79,7 +79,7 @@ class OptionsSheetDialogFragment : RoundedBottomSheetDialogFragment(), View.OnCl
loadImageFromStorage()
actionSettings.setOnClickListener(this)
actionAbout.setOnClickListener(this)
actionSleepTimer.setOnClickListener(this)
userInfoContainer.setOnClickListener(this)
actionEqualizer.setOnClickListener(this)
@ -102,7 +102,7 @@ class OptionsSheetDialogFragment : RoundedBottomSheetDialogFragment(), View.OnCl
when (view.id) {
R.id.actionFolders -> mainActivity.setCurrentFragment(FoldersFragment.newInstance(context), true)
R.id.actionSettings -> NavigationUtil.goToSettings(mainActivity)
R.id.actionAbout -> NavigationUtil.goToAbout(mainActivity)
R.id.actionSleepTimer -> if (fragmentManager != null) {
SleepTimerDialog().show(fragmentManager!!, TAG)
}

View file

@ -73,6 +73,7 @@ class AboutActivity : AbsBaseActivity(), View.OnClickListener {
appVersion.text = getAppVersion()
setUpView()
}

View file

@ -2,6 +2,7 @@ package code.name.monkey.retromusic.ui.activities
import android.app.Activity
import android.app.SearchManager
import android.app.Service
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
@ -11,6 +12,7 @@ import android.speech.RecognizerIntent
import android.text.Editable
import android.text.TextWatcher
import android.view.View
import android.view.inputmethod.InputMethodManager
import android.widget.TextView.BufferType
import android.widget.Toast
import androidx.appcompat.widget.SearchView.OnQueryTextListener
@ -18,6 +20,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.mvp.contract.SearchContract
import code.name.monkey.retromusic.mvp.presenter.SearchPresenter
@ -57,6 +60,16 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, SearchCon
searchContainer.setCardBackgroundColor(ColorStateList.valueOf(ColorUtil.darkenColor(ThemeStore.primaryColor(this))))
keyboardPopup.setOnClickListener {
val inputManager = getSystemService(Service.INPUT_METHOD_SERVICE) as InputMethodManager
inputManager.showSoftInput(searchView,0)
}
keyboardPopup.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.accentColor(this)))).apply {
keyboardPopup.setTextColor(this)
keyboardPopup.iconTint = this
}
}
private fun setupRecyclerView() {
@ -71,6 +84,16 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, SearchCon
layoutManager = LinearLayoutManager(this@SearchActivity)
adapter = searchAdapter
}
recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy > 0) {
keyboardPopup.shrink(true)
} else if (dy < 0) {
keyboardPopup.extend(true)
}
}
})
}
private fun setupSearchView() {
@ -101,6 +124,7 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, SearchCon
private fun setUpToolBar() {
title = null
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this))
}

View file

@ -2,6 +2,7 @@ package code.name.monkey.retromusic.ui.activities
import android.app.Activity
import android.content.*
import android.content.res.ColorStateList
import android.graphics.Bitmap
import android.net.Uri
import android.os.Bundle
@ -13,9 +14,7 @@ import android.view.MenuItem
import android.widget.Toast
import androidx.core.content.FileProvider
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.Constants.USER_BANNER
import code.name.monkey.retromusic.Constants.USER_PROFILE
@ -92,7 +91,11 @@ class UserInfoActivity : AbsBaseActivity() {
setResult(Activity.RESULT_OK)
finish()
}
TintHelper.setTintAuto(next, ThemeStore.accentColor(this), true)
next.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.accentColor(this)))).apply {
next.setTextColor(this)
next.iconTint = this
}
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {

View file

@ -5,7 +5,6 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.annotation.StringRes
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
@ -34,6 +33,7 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
R.id.imageSettings -> inflateFragment(ImageSettingFragment(), R.string.pref_header_images)
R.id.notificationSettings -> inflateFragment(NotificationSettingsFragment(), R.string.notification)
R.id.otherSettings -> inflateFragment(OtherSettingsFragment(), R.string.others)
R.id.aboutSettings -> NavigationUtil.goToAbout(activity!!)
}
}
@ -54,6 +54,36 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
imageSettings.setOnClickListener(this)
notificationSettings.setOnClickListener(this)
otherSettings.setOnClickListener(this)
aboutSettings.setOnClickListener(this)
text.setTextColor(ThemeStore.textColorSecondary(context!!))
text.text = PreferenceUtil.getInstance().userBio
titleWelcome.setTextColor(ThemeStore.textColorPrimary(context!!))
titleWelcome.text = String.format("%s %s!", getTimeOfTheDay(), PreferenceUtil.getInstance().userName)
loadImageFromStorage()
userInfoContainer.setOnClickListener { NavigationUtil.goToUserInfo(activity!!) }
}
override fun onDestroyView() {
super.onDestroyView()
disposable.clear()
}
private val disposable = CompositeDisposable()
private fun loadImageFromStorage() {
disposable.add(Compressor(context!!)
.setMaxHeight(300)
.setMaxWidth(300)
.setQuality(75)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(
File(PreferenceUtil.getInstance().profileImage, USER_PROFILE))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ userImage.setImageBitmap(it) }, {
userImage.setImageDrawable(ContextCompat.getDrawable(context!!, R.drawable.ic_person_flat))
}))
}
private fun inflateFragment(fragment: Fragment, @StringRes title: Int) {