From 1982af9a52daec2d185c87712e4ec11fd284e973 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 2 Jan 2017 20:53:33 +0100 Subject: [PATCH] couple text color changes --- .../calendar/activities/DayActivity.kt | 4 +-- .../calendar/activities/EventActivity.kt | 6 ++--- .../calendar/activities/MainActivity.kt | 4 +-- .../WidgetMonthlyConfigureActivity.kt | 25 +++++++++++-------- app/src/main/res/layout/activity_day.xml | 2 +- app/src/main/res/layout/activity_main.xml | 2 +- 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/DayActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/DayActivity.kt index ecb4f5df1..987ede2d5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/DayActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/DayActivity.kt @@ -1,7 +1,6 @@ package com.simplemobiletools.calendar.activities import android.content.Intent -import android.content.res.ColorStateList import android.graphics.Color import android.os.Bundle import android.support.design.widget.Snackbar @@ -12,6 +11,7 @@ import com.simplemobiletools.calendar.adapters.MyDayPagerAdapter import com.simplemobiletools.calendar.fragments.DayFragment import com.simplemobiletools.calendar.helpers.DAY_CODE import com.simplemobiletools.calendar.helpers.Formatter +import com.simplemobiletools.commons.extensions.updateTextColors import kotlinx.android.synthetic.main.activity_day.* import org.joda.time.DateTime import java.util.* @@ -34,8 +34,8 @@ class DayActivity : SimpleActivity(), DayFragment.DeleteListener, ViewPager.OnPa fillViewPager(mDayCode) - day_fab.backgroundTintList = ColorStateList.valueOf(baseConfig.primaryColor) day_fab.setOnClickListener { addNewEvent() } + updateTextColors(day_coordinator) } override fun onPause() { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt index 993cff923..946bd2075 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt @@ -14,10 +14,7 @@ import com.simplemobiletools.calendar.extensions.scheduleNotification import com.simplemobiletools.calendar.helpers.* import com.simplemobiletools.calendar.models.Event import com.simplemobiletools.commons.dialogs.ConfirmationDialog -import com.simplemobiletools.commons.extensions.hideKeyboard -import com.simplemobiletools.commons.extensions.showKeyboard -import com.simplemobiletools.commons.extensions.toast -import com.simplemobiletools.commons.extensions.value +import com.simplemobiletools.commons.extensions.* import kotlinx.android.synthetic.main.activity_event.* import org.joda.time.DateTime import org.joda.time.DateTimeZone @@ -79,6 +76,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener { reminderItemSelected() } } + updateTextColors(event_scrollview) } private fun setupEditEvent() { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt index 1f89a6ff0..00a01bd9a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt @@ -1,7 +1,6 @@ package com.simplemobiletools.calendar.activities import android.content.Intent -import android.content.res.ColorStateList import android.graphics.Color import android.os.Bundle import android.support.design.widget.Snackbar @@ -18,6 +17,7 @@ import com.simplemobiletools.calendar.extensions.updateWidgets import com.simplemobiletools.calendar.fragments.EventListFragment import com.simplemobiletools.calendar.helpers.* import com.simplemobiletools.calendar.helpers.Formatter +import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.commons.helpers.LICENSE_AMBILWARNA import com.simplemobiletools.commons.helpers.LICENSE_JODA import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN @@ -46,7 +46,7 @@ class MainActivity : SimpleActivity(), EventListFragment.DeleteListener { override fun onResume() { super.onResume() updateWidgets() - calendar_fab.backgroundTintList = ColorStateList.valueOf(baseConfig.primaryColor) + updateTextColors(calendar_coordinator) } override fun onPause() { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt index 80ad0c061..4e27c9f3f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt @@ -169,16 +169,16 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar { week_num.visibility = View.VISIBLE for (i in 0..5) { - val weekIdTV = findViewById(mRes.getIdentifier("week_num_" + i, "id", mPackageName)) as TextView? - weekIdTV!!.text = mDays!![i * 7].weekOfYear.toString() + ":" - weekIdTV.setTextColor(mWeakTextColor) - weekIdTV.visibility = View.VISIBLE + (findViewById(mRes.getIdentifier("week_num_$i", "id", mPackageName)) as TextView).apply { + text = "${mDays!![i * 7].weekOfYear}:" + setTextColor(mWeakTextColor) + visibility = View.VISIBLE + } } } for (i in 0..len - 1) { val day = mDays!![i] - val dayTV = findViewById(mRes.getIdentifier("day_" + i, "id", mPackageName)) as TextView? var curTextColor = mWeakTextColor var curTextSize = mDayTextSize @@ -190,9 +190,11 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar { curTextSize = mTodayTextSize } - dayTV!!.text = day.value.toString() - dayTV.setTextColor(curTextColor) - dayTV.textSize = curTextSize + (findViewById(mRes.getIdentifier("day_$i", "id", mPackageName)) as TextView).apply { + text = day.value.toString() + setTextColor(curTextColor) + textSize = curTextSize + } } } @@ -225,9 +227,10 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar { private fun updateLabels() { for (i in 0..6) { - val dayTV = findViewById(mRes.getIdentifier("label_" + i, "id", mPackageName)) as TextView? - dayTV!!.textSize = mDayTextSize - dayTV.setTextColor(mTextColor) + (findViewById(mRes.getIdentifier("label_$i", "id", mPackageName)) as TextView).apply { + textSize = mDayTextSize + setTextColor(mTextColor) + } } } } diff --git a/app/src/main/res/layout/activity_day.xml b/app/src/main/res/layout/activity_day.xml index b0b99c230..dd8f96553 100644 --- a/app/src/main/res/layout/activity_day.xml +++ b/app/src/main/res/layout/activity_day.xml @@ -12,7 +12,7 @@ android:layout_height="match_parent" android:layout_marginTop="@dimen/activity_margin"/> - -