From db06fcd683f46921f469ec7ed012776a3a75783e Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 24 Oct 2016 20:31:43 +0200 Subject: [PATCH] use the extensio function beVisibleIf in some new cases --- .../simplemobiletools/calendar/activities/EventActivity.kt | 5 +++-- .../simplemobiletools/calendar/fragments/MonthFragment.kt | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) 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 0e6bdf3a1..780f696b7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt @@ -14,6 +14,7 @@ import android.view.inputmethod.InputMethodManager import android.widget.AdapterView import android.widget.EditText import com.simplemobiletools.calendar.* +import com.simplemobiletools.calendar.extensions.beVisibleIf import com.simplemobiletools.calendar.extensions.updateWidget import com.simplemobiletools.calendar.fragments.DayFragment import com.simplemobiletools.calendar.models.Event @@ -134,8 +135,8 @@ class EventActivity : SimpleActivity(), DBHelper.EventsListener { } fun endCheckboxChecked(isChecked: Boolean) { - event_end_date.visibility = if (isChecked) View.VISIBLE else View.GONE - event_end_time.visibility = if (isChecked) View.VISIBLE else View.GONE + event_end_date.beVisibleIf(isChecked) + event_end_time.beVisibleIf(isChecked) } fun reminderItemSelected() { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragment.kt index 067daf93c..28a56d8da 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragment.kt @@ -13,6 +13,7 @@ import android.view.ViewGroup import android.widget.* import com.simplemobiletools.calendar.* import com.simplemobiletools.calendar.activities.DayActivity +import com.simplemobiletools.calendar.extensions.beVisibleIf import com.simplemobiletools.calendar.models.Day import kotlinx.android.synthetic.main.first_row.* import kotlinx.android.synthetic.main.month_fragment.view.* @@ -167,13 +168,13 @@ class MonthFragment : Fragment(), MonthlyCalendar { return week_num.setTextColor(mWeakTextColor) - week_num.visibility = if (displayWeekNumbers) View.VISIBLE else View.GONE + week_num.beVisibleIf(displayWeekNumbers) for (i in 0..5) { val weekIdTV = mHolder.findViewById(mRes.getIdentifier("week_num_" + i, "id", mPackageName)) as TextView weekIdTV.text = "${days[i * 7].weekOfYear}:" weekIdTV.setTextColor(mWeakTextColor) - weekIdTV.visibility = if (displayWeekNumbers) View.VISIBLE else View.GONE + weekIdTV.beVisibleIf(displayWeekNumbers) } for (i in 0..len - 1) {