Skip to content

Commit

Permalink
Fix accent not being updated and bump to 1.3.1
Browse files Browse the repository at this point in the history
Signed-off-by: enricocid <[email protected]>
  • Loading branch information
enricocid committed Aug 10, 2019
1 parent 8d3adf5 commit 63e143e
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 39 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@



###### Current version: [(13) 1.3.0.2](https://github.com/enricocid/VectorifyDaHome/releases/tag/v1.3.0.2)
###### Current version: [(14) 1.3.1](https://github.com/enricocid/VectorifyDaHome/releases/tag/v1.3.1)
###### Based on the project [Potate da home](https://github.com/enricocid/PotateDaHome)

![Screenshots](https://raw.githubusercontent.com/enricocid/VectorifyDaHome/master/vdh3.gif)
Expand Down
4 changes: 2 additions & 2 deletions project/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "com.iven.iconify"
minSdkVersion 21
targetSdkVersion 29
versionCode 13
versionName "1.3.0.2"
versionCode 14
versionName "1.3.1"
}

// Configure only for each module that uses Java 8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,26 +102,43 @@ class SetWallpaperActivity : AppCompatActivity() {
if (systemAccentColor != mVectorifyPreferences.backgroundColor || systemAccentColor != mVectorifyPreferences.vectorColor) {

//update cards colors
if (isBackgroundAccented) mVectorView.updateBackgroundColor(systemAccentColor)
if (isBackgroundAccented) {
mBackgroundColor = systemAccentColor
mVectorView.updateBackgroundColor(systemAccentColor)
setToolbarAndSeekbarColors()
}
if (isVectorAccented) mVectorView.updateVectorColor(systemAccentColor)
}
return true
}
}

private fun setToolbarAndSeekbarColors() {

if (Utils.isColorDark(mBackgroundColor)) toolbar.context.setTheme(R.style.ToolbarStyle_Dark)
else toolbar.context.setTheme(R.style.ToolbarStyle)

//determine if background color is dark or light and select
//the appropriate color for UI widgets
val widgetColors = Utils.getSecondaryColor(mBackgroundColor)

toolbar.setBackgroundColor(mBackgroundColor)
toolbar.setTitleTextColor(widgetColors)
toolbar.setNavigationIcon(R.drawable.ic_back)

//set seekbar colors
seekbar_card.setCardBackgroundColor(mBackgroundColor)
seek_size.progressTintList = ColorStateList.valueOf(widgetColors)
seek_size.thumbTintList = ColorStateList.valueOf(widgetColors)
seek_size.progressBackgroundTintList = ColorStateList.valueOf(widgetColors)

seekbar_title.setTextColor(widgetColors)
scale_text.setTextColor(widgetColors)
}

private fun handleWallpaperChanges(which: Int) {
//do all the save shit here

if (mTempPreferences.isBackgroundColorChanged) {
mVectorifyPreferences.isBackgroundAccented = false
mVectorifyPreferences.backgroundColor = mTempPreferences.tempBackgroundColor
mTempPreferences.isBackgroundColorChanged = false
}
if (mTempPreferences.isVectorColorChanged) {
mVectorifyPreferences.isVectorAccented = false
mVectorifyPreferences.vectorColor = mTempPreferences.tempVectorColor
mTempPreferences.isVectorColorChanged = false
}
if (mTempPreferences.isBackgroundAccentSet) {
mVectorifyPreferences.isBackgroundAccented = true
mVectorifyPreferences.backgroundColor = mTempPreferences.tempBackgroundColor
Expand All @@ -133,6 +150,17 @@ class SetWallpaperActivity : AppCompatActivity() {
mTempPreferences.isVectorAccentSet = false
}

if (mTempPreferences.isBackgroundColorChanged) {
mVectorifyPreferences.isBackgroundAccented = false
mVectorifyPreferences.backgroundColor = mTempPreferences.tempBackgroundColor
mTempPreferences.isBackgroundColorChanged = false
}
if (mTempPreferences.isVectorColorChanged) {
mVectorifyPreferences.isVectorAccented = false
mVectorifyPreferences.vectorColor = mTempPreferences.tempVectorColor
mTempPreferences.isVectorColorChanged = false
}

if (mTempPreferences.isVectorChanged) {
mVectorifyPreferences.vector = mTempPreferences.tempVector
mTempPreferences.isVectorChanged = false
Expand Down Expand Up @@ -169,19 +197,9 @@ class SetWallpaperActivity : AppCompatActivity() {
//get all the views
mVectorView = vector_view

//determine if background color is dark or light and select
//the appropriate color for UI widgets
val widgetColors = Utils.getSecondaryColor(mBackgroundColor)


//set toolbar shit
//match theme with background luminance
if (Utils.isColorDark(mBackgroundColor)) toolbar.context.setTheme(R.style.ToolbarStyle_Dark)
else toolbar.context.setTheme(R.style.ToolbarStyle)

toolbar.setBackgroundColor(mBackgroundColor)
toolbar.setTitleTextColor(widgetColors)
toolbar.setNavigationIcon(R.drawable.ic_back)
setToolbarAndSeekbarColors()

setSupportActionBar(toolbar)

Expand All @@ -190,11 +208,6 @@ class SetWallpaperActivity : AppCompatActivity() {
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
}

//set seekbar and seekbar card shit
seek_size.progressTintList = ColorStateList.valueOf(widgetColors)
seek_size.thumbTintList = ColorStateList.valueOf(widgetColors)
seek_size.progressBackgroundTintList = ColorStateList.valueOf(widgetColors)

//observe seekbar changes
seek_size.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {

Expand All @@ -219,14 +232,10 @@ class SetWallpaperActivity : AppCompatActivity() {
}
})

seekbar_title.setTextColor(widgetColors)
seekbar_card.setCardBackgroundColor(mBackgroundColor)

//restore saved scale value
seek_size.progress = (mScaleFactor * 100).toInt()

//set scale text
scale_text.setTextColor(widgetColors)
scale_text.text = Utils.getDecimalFormattedString(mScaleFactor)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class VectorifyActivity : AppCompatActivity() {

//set system accent as background color
fun setSystemAccentForBackground(view: View) {
mTempPreferences.tempIsBackgroundAccented = true
mTempPreferences.isBackgroundAccentSet = true
val systemAccent = Utils.getSystemAccentColor(this)
setBackgroundColorForUI(systemAccent, false)
}
Expand Down Expand Up @@ -241,15 +241,15 @@ class VectorifyActivity : AppCompatActivity() {
getString(R.string.background_color_key) -> {
//update the color only if it really changed
if (mBackgroundColor != color) {
mTempPreferences.tempIsBackgroundAccented = false
mVectorifyPreferences.isBackgroundAccented = false
mTempPreferences.isBackgroundColorChanged = true
setBackgroundColorForUI(color, false)
}
}
else -> {
//update the color only if it really changed
if (mVectorColor != color) {
mTempPreferences.tempIsVectorAccented = false
mVectorifyPreferences.isVectorAccented = false
mTempPreferences.isVectorColorChanged = true
setVectorColorForUI(color, false)
}
Expand All @@ -261,8 +261,8 @@ class VectorifyActivity : AppCompatActivity() {
}

private fun setBackgroundAndVectorColorsChanged() {
mTempPreferences.isBackgroundAccentSet = false
mTempPreferences.isVectorAccentSet = false
mVectorifyPreferences.isBackgroundAccented = false
mVectorifyPreferences.isVectorAccented = false
mTempPreferences.isBackgroundColorChanged = true
mTempPreferences.isVectorColorChanged = true
}
Expand Down

0 comments on commit 63e143e

Please sign in to comment.