diff --git a/app/build.gradle b/app/build.gradle index f013a40c5..945851f8b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,7 +42,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.4.11' + implementation 'com.simplemobiletools:commons:3.4.12' implementation 'joda-time:joda-time:2.9.9' implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'com.android.support:multidex:1.0.2' 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 4cc5140af..edefe1e9b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt @@ -45,7 +45,7 @@ class EventActivity : SimpleActivity() { supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_cross) val intent = intent ?: return - mDialogTheme = getAppropriateTheme() + mDialogTheme = getDialogTheme() val eventId = intent.getIntExtra(EVENT_ID, 0) val event = dbHelper.getEventWithId(eventId) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/dialogs/RepeatLimitTypePickerDialog.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/dialogs/RepeatLimitTypePickerDialog.kt index 55cfc26fd..1057c38f6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/dialogs/RepeatLimitTypePickerDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/dialogs/RepeatLimitTypePickerDialog.kt @@ -7,9 +7,9 @@ import android.support.v7.app.AlertDialog import android.view.View import com.simplemobiletools.calendar.R import com.simplemobiletools.calendar.extensions.config -import com.simplemobiletools.calendar.extensions.getAppropriateTheme import com.simplemobiletools.calendar.extensions.seconds import com.simplemobiletools.calendar.helpers.Formatter +import com.simplemobiletools.commons.extensions.getDialogTheme import com.simplemobiletools.commons.extensions.isLollipopPlus import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.value @@ -82,7 +82,7 @@ class RepeatLimitTypePickerDialog(val activity: Activity, var repeatLimit: Int, private fun showRepetitionLimitDialog() { val now = (System.currentTimeMillis() / 1000).toInt() val repeatLimitDateTime = Formatter.getDateTimeFromTS(if (repeatLimit != 0) repeatLimit else now) - val datepicker = DatePickerDialog(activity, activity.getAppropriateTheme(), repetitionLimitDateSetListener, repeatLimitDateTime.year, + val datepicker = DatePickerDialog(activity, activity.getDialogTheme(), repetitionLimitDateSetListener, repeatLimitDateTime.year, repeatLimitDateTime.monthOfYear - 1, repeatLimitDateTime.dayOfMonth) if (activity.isLollipopPlus()) { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt index e4e7cd866..9bac6aefe 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt @@ -7,7 +7,6 @@ import android.content.ComponentName import android.content.Context import android.content.Intent import android.content.res.Resources -import android.graphics.Color import android.net.Uri import android.support.v4.app.NotificationCompat import android.view.Gravity @@ -113,8 +112,6 @@ private fun getNotificationIntent(context: Context, event: Event): PendingIntent return PendingIntent.getBroadcast(context, event.id, intent, PendingIntent.FLAG_UPDATE_CURRENT) } -fun Context.getAppropriateTheme() = if (config.backgroundColor.getContrastColor() == Color.WHITE) R.style.MyDialogTheme_Dark else R.style.MyDialogTheme - fun Context.getFormattedMinutes(minutes: Int, showBefore: Boolean = true) = when (minutes) { -1 -> getString(R.string.no_reminder) 0 -> getString(R.string.at_start) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragment.kt index ab2776a99..d00456c18 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragment.kt @@ -17,7 +17,6 @@ import com.simplemobiletools.calendar.activities.SimpleActivity import com.simplemobiletools.calendar.adapters.DayEventsAdapter import com.simplemobiletools.calendar.extensions.config import com.simplemobiletools.calendar.extensions.dbHelper -import com.simplemobiletools.calendar.extensions.getAppropriateTheme import com.simplemobiletools.calendar.extensions.getFilteredEvents import com.simplemobiletools.calendar.helpers.DAY_CODE import com.simplemobiletools.calendar.helpers.EVENT_ID @@ -27,6 +26,7 @@ import com.simplemobiletools.calendar.interfaces.DeleteEventsListener import com.simplemobiletools.calendar.interfaces.NavigationListener import com.simplemobiletools.calendar.models.Event import com.simplemobiletools.commons.extensions.applyColorFilter +import com.simplemobiletools.commons.extensions.getDialogTheme import com.simplemobiletools.commons.extensions.setupDialogStuff import kotlinx.android.synthetic.main.fragment_day.view.* import kotlinx.android.synthetic.main.top_navigation.view.* @@ -86,7 +86,7 @@ class DayFragment : Fragment(), DeleteEventsListener { fun getDayEventsAdapter() = mHolder.day_events?.adapter as? DayEventsAdapter private fun pickDay() { - activity!!.setTheme(context!!.getAppropriateTheme()) + activity!!.setTheme(context!!.getDialogTheme()) val view = layoutInflater.inflate(R.layout.date_picker, null) val datePicker = view.findViewById(R.id.date_picker) 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 c7d39cd48..17cdaf443 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragment.kt @@ -18,15 +18,11 @@ import com.simplemobiletools.calendar.activities.DayActivity import com.simplemobiletools.calendar.extensions.addDayEvents import com.simplemobiletools.calendar.extensions.addDayNumber import com.simplemobiletools.calendar.extensions.config -import com.simplemobiletools.calendar.extensions.getAppropriateTheme import com.simplemobiletools.calendar.helpers.* import com.simplemobiletools.calendar.interfaces.MonthlyCalendar import com.simplemobiletools.calendar.interfaces.NavigationListener import com.simplemobiletools.calendar.models.DayMonthly -import com.simplemobiletools.commons.extensions.applyColorFilter -import com.simplemobiletools.commons.extensions.beGone -import com.simplemobiletools.commons.extensions.beVisibleIf -import com.simplemobiletools.commons.extensions.setupDialogStuff +import com.simplemobiletools.commons.extensions.* import kotlinx.android.synthetic.main.first_row.* import kotlinx.android.synthetic.main.fragment_month.view.* import kotlinx.android.synthetic.main.top_navigation.view.* @@ -125,7 +121,7 @@ class MonthFragment : Fragment(), MonthlyCalendar { } private fun showMonthDialog() { - activity!!.setTheme(context!!.getAppropriateTheme()) + activity!!.setTheme(context!!.getDialogTheme()) val view = layoutInflater.inflate(R.layout.date_picker, null) val datePicker = view.findViewById(R.id.date_picker) datePicker.findViewById(Resources.getSystem().getIdentifier("day", "id", "android")).beGone()