From 2bb42432c0c9edb516c6ff80a4c67630ea497f83 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Dec 2016 14:58:06 +0100 Subject: [PATCH] update more widget colors automatically --- .idea/misc.xml | 2 +- bintray-upload.gradle | 1 - .../commons/activities/BaseSimpleActivity.kt | 15 +++++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 5d1998103..fbb68289f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -37,7 +37,7 @@ - + diff --git a/bintray-upload.gradle b/bintray-upload.gradle index 2df9567ad..efb546a4c 100644 --- a/bintray-upload.gradle +++ b/bintray-upload.gradle @@ -31,7 +31,6 @@ install { connection gitUrl developerConnection gitUrl url siteUrl - } } } diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt index e8d32ae0a..d8ba91863 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt @@ -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) }