update more widget colors automatically

This commit is contained in:
tibbi 2016-12-18 14:58:06 +01:00
parent 4db5fe40c6
commit 2bb42432c0
3 changed files with 14 additions and 4 deletions

View file

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View file

@ -31,7 +31,6 @@ install {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}

View file

@ -4,18 +4,22 @@ import android.annotation.TargetApi
import android.app.Activity
import android.content.Intent
import android.graphics.Color
import android.graphics.PorterDuff
import android.graphics.drawable.ColorDrawable
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.AppCompatEditText
import android.support.v7.widget.AppCompatTextView
import android.view.MenuItem
import android.view.ViewGroup
import android.widget.TextView
import com.simplemobiletools.commons.helpers.APP_LICENSES
import com.simplemobiletools.commons.helpers.APP_NAME
import com.simplemobiletools.commons.helpers.BaseConfig
import com.simplemobiletools.commons.helpers.OPEN_DOCUMENT_TREE
import com.simplemobiletools.commons.views.MyAppCompatSpinner
import com.simplemobiletools.commons.views.MySwitchCompat
import com.simplemobiletools.filepicker.extensions.isShowingWritePermissions
import java.io.File
@ -65,8 +69,15 @@ open class BaseSimpleActivity : AppCompatActivity() {
val cnt = viewGroup.childCount
(0..cnt - 1).map { viewGroup.getChildAt(it) }
.forEach {
if (it is TextView) {
if (it is AppCompatEditText) {
it.background.mutate().setColorFilter(color, PorterDuff.Mode.SRC_ATOP)
it.setTextColor(color)
} else if (it is AppCompatTextView) {
it.setTextColor(color)
} else if (it is MyAppCompatSpinner) {
it.setColor(color)
} else if (it is MySwitchCompat) {
it.setColor(color)
} else if (it is ViewGroup) {
updateTextColors(it, color)
}