update commons to 3.18.18
This commit is contained in:
parent
adebfb60f6
commit
ce92fa8f63
|
@ -46,7 +46,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:3.17.14'
|
||||
implementation 'com.simplemobiletools:commons:3.18.18'
|
||||
implementation 'joda-time:joda-time:2.9.9'
|
||||
implementation 'com.facebook.stetho:stetho:1.5.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
|
|
|
@ -63,7 +63,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
private var mStoredDayCode = ""
|
||||
private var mStoredIsSundayFirst = false
|
||||
private var mStoredUse24HourFormat = false
|
||||
private var mStoredUseEnglish = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -123,11 +122,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (mStoredUseEnglish != config.useEnglish) {
|
||||
restartActivity()
|
||||
return
|
||||
}
|
||||
|
||||
if (mStoredTextColor != config.textColor || mStoredBackgroundColor != config.backgroundColor || mStoredPrimaryColor != config.primaryColor
|
||||
|| mStoredDayCode != Formatter.getTodayCode(applicationContext)) {
|
||||
updateViewPager()
|
||||
|
@ -213,7 +207,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
|
||||
private fun storeStateVariables() {
|
||||
config.apply {
|
||||
mStoredUseEnglish = useEnglish
|
||||
mStoredIsSundayFirst = isSundayFirst
|
||||
mStoredTextColor = textColor
|
||||
mStoredPrimaryColor = primaryColor
|
||||
|
|
|
@ -35,7 +35,6 @@ class ManageEventTypesActivity : SimpleActivity(), DeleteEventTypesListener {
|
|||
val adapter = ManageEventTypesAdapter(this, it, this, manage_event_types_list) {
|
||||
showEventTypeDialog(it as EventType)
|
||||
}
|
||||
adapter.setupDragListener(true)
|
||||
manage_event_types_list.adapter = adapter
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
settings_use_english_holder.setOnClickListener {
|
||||
settings_use_english.toggle()
|
||||
config.useEnglish = settings_use_english.isChecked
|
||||
useEnglishToggled()
|
||||
System.exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,15 +106,15 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun pickBackgroundColor() {
|
||||
ColorPickerDialog(this, mBgColorWithoutTransparency) {
|
||||
mBgColorWithoutTransparency = it
|
||||
ColorPickerDialog(this, mBgColorWithoutTransparency) { wasPositivePressed, color ->
|
||||
mBgColorWithoutTransparency = color
|
||||
updateBgColor()
|
||||
}
|
||||
}
|
||||
|
||||
private fun pickTextColor() {
|
||||
ColorPickerDialog(this, mTextColor) {
|
||||
mTextColorWithoutTransparency = it
|
||||
ColorPickerDialog(this, mTextColor) { wasPositivePressed, color ->
|
||||
mTextColorWithoutTransparency = color
|
||||
updateColors()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,15 +110,15 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
}
|
||||
|
||||
private fun pickBackgroundColor() {
|
||||
ColorPickerDialog(this, mBgColorWithoutTransparency) {
|
||||
mBgColorWithoutTransparency = it
|
||||
ColorPickerDialog(this, mBgColorWithoutTransparency) { wasPositivePressed, color ->
|
||||
mBgColorWithoutTransparency = color
|
||||
updateBgColor()
|
||||
}
|
||||
}
|
||||
|
||||
private fun pickTextColor() {
|
||||
ColorPickerDialog(this, mTextColor) {
|
||||
mTextColorWithoutTransparency = it
|
||||
ColorPickerDialog(this, mTextColor) { wasPositivePressed, color ->
|
||||
mTextColorWithoutTransparency = color
|
||||
updateColors()
|
||||
updateDays()
|
||||
}
|
||||
|
|
|
@ -24,6 +24,10 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList<Event>, r
|
|||
private var allDayString = resources.getString(R.string.all_day)
|
||||
private var replaceDescriptionWithLocation = activity.config.replaceDescription
|
||||
|
||||
init {
|
||||
setupDragListener(true)
|
||||
}
|
||||
|
||||
override fun getActionMenuId() = R.menu.cab_day
|
||||
|
||||
override fun prepareActionMode(menu: Menu) {}
|
||||
|
|
|
@ -23,6 +23,10 @@ import java.util.*
|
|||
class ManageEventTypesAdapter(activity: SimpleActivity, val eventTypes: ArrayList<EventType>, val listener: DeleteEventTypesListener?, recyclerView: MyRecyclerView,
|
||||
itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) {
|
||||
|
||||
init {
|
||||
setupDragListener(true)
|
||||
}
|
||||
|
||||
override fun getActionMenuId() = R.menu.cab_event_type
|
||||
|
||||
override fun prepareActionMode(menu: Menu) {}
|
||||
|
|
|
@ -29,8 +29,8 @@ class DeleteEventDialog(val activity: Activity, eventIds: List<Int>, val callbac
|
|||
.setPositiveButton(R.string.yes, { dialog, which -> dialogConfirmed(view as ViewGroup, hasRepeatableEvent) })
|
||||
.setNegativeButton(R.string.no, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun dialogConfirmed(view: ViewGroup, hasRepeatableEvent: Boolean) {
|
||||
|
|
|
@ -39,26 +39,26 @@ class ExportEventsDialog(val activity: SimpleActivity, val path: String, val cal
|
|||
.setPositiveButton(R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this, R.string.export_events) {
|
||||
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
val filename = view.export_events_filename.value
|
||||
when {
|
||||
filename.isEmpty() -> activity.toast(R.string.empty_name)
|
||||
filename.isAValidFilename() -> {
|
||||
val file = File(path, "$filename.ics")
|
||||
if (file.exists()) {
|
||||
activity.toast(R.string.name_taken)
|
||||
return@setOnClickListener
|
||||
}
|
||||
activity.setupDialogStuff(view, this, R.string.export_events) {
|
||||
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
val filename = view.export_events_filename.value
|
||||
when {
|
||||
filename.isEmpty() -> activity.toast(R.string.empty_name)
|
||||
filename.isAValidFilename() -> {
|
||||
val file = File(path, "$filename.ics")
|
||||
if (file.exists()) {
|
||||
activity.toast(R.string.name_taken)
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
val eventTypes = (view.export_events_types_list.adapter as FilterEventTypeAdapter).getSelectedItemsSet()
|
||||
callback(view.export_events_checkbox.isChecked, file, eventTypes)
|
||||
dismiss()
|
||||
val eventTypes = (view.export_events_types_list.adapter as FilterEventTypeAdapter).getSelectedItemsSet()
|
||||
callback(view.export_events_checkbox.isChecked, file, eventTypes)
|
||||
dismiss()
|
||||
}
|
||||
else -> activity.toast(R.string.invalid_name)
|
||||
}
|
||||
}
|
||||
else -> activity.toast(R.string.invalid_name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ class FilterEventTypesDialog(val activity: SimpleActivity, val callback: () -> U
|
|||
.setPositiveButton(R.string.ok, { dialogInterface, i -> confirmEventTypes() })
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this, R.string.filter_events_by_type)
|
||||
}
|
||||
activity.setupDialogStuff(view, this, R.string.filter_events_by_type)
|
||||
}
|
||||
}
|
||||
|
||||
private fun confirmEventTypes() {
|
||||
|
|
|
@ -34,17 +34,17 @@ class ImportEventsDialog(val activity: SimpleActivity, val path: String, val cal
|
|||
.setPositiveButton(R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this, R.string.import_events) {
|
||||
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
activity.toast(R.string.importing)
|
||||
Thread {
|
||||
val result = IcsImporter(activity).importEvents(path, currEventTypeId, currEventTypeCalDAVCalendarId)
|
||||
handleParseResult(result)
|
||||
dismiss()
|
||||
}.start()
|
||||
activity.setupDialogStuff(view, this, R.string.import_events) {
|
||||
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
activity.toast(R.string.importing)
|
||||
Thread {
|
||||
val result = IcsImporter(activity).importEvents(path, currEventTypeId, currEventTypeCalDAVCalendarId)
|
||||
handleParseResult(result)
|
||||
dismiss()
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateEventType(view: ViewGroup) {
|
||||
|
|
|
@ -36,8 +36,8 @@ class SelectCalendarsDialog(val activity: SimpleActivity, val callback: () -> Un
|
|||
.setPositiveButton(R.string.ok, { dialogInterface, i -> confirmSelection() })
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this, R.string.select_caldav_calendars)
|
||||
}
|
||||
activity.setupDialogStuff(view, this, R.string.select_caldav_calendars)
|
||||
}
|
||||
}
|
||||
|
||||
private fun addCalendarItem(isEvent: Boolean, text: String, tag: Int = 0, shouldCheck: Boolean = false) {
|
||||
|
|
|
@ -39,8 +39,8 @@ class SelectEventCalendarDialog(val activity: Activity, val calendars: List<CalD
|
|||
|
||||
dialog = AlertDialog.Builder(activity)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun addRadioButton(title: String, typeId: Int, color: Int) {
|
||||
|
|
|
@ -32,8 +32,8 @@ class SelectEventTypeColorDialog(val activity: Activity, val eventType: EventTyp
|
|||
wasInit = true
|
||||
dialog = AlertDialog.Builder(activity)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun addRadioButton(colorKey: Int, color: Int) {
|
||||
|
|
|
@ -23,8 +23,8 @@ class UpdateEventTypeDialog(val activity: Activity, var eventType: EventType? =
|
|||
type_title.setText(eventType!!.title)
|
||||
type_color.setOnClickListener {
|
||||
if (eventType?.caldavCalendarId == 0) {
|
||||
ColorPickerDialog(activity, eventType!!.color) {
|
||||
eventType!!.color = it
|
||||
ColorPickerDialog(activity, eventType!!.color) { wasPositivePressed, color ->
|
||||
eventType!!.color = color
|
||||
setupColor(type_color)
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -32,6 +32,7 @@ import com.simplemobiletools.calendar.receivers.CalDAVSyncReceiver
|
|||
import com.simplemobiletools.calendar.receivers.NotificationReceiver
|
||||
import com.simplemobiletools.calendar.services.SnoozeService
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.SILENT
|
||||
import com.simplemobiletools.commons.helpers.isOreoPlus
|
||||
import org.joda.time.DateTime
|
||||
import org.joda.time.DateTimeZone
|
||||
|
@ -178,8 +179,12 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
|
|||
}
|
||||
}
|
||||
|
||||
val soundUri = Uri.parse(config.reminderSoundUri)
|
||||
grantReadUriPermission(config.reminderSoundUri)
|
||||
var soundUri = config.reminderSoundUri
|
||||
if (soundUri == SILENT) {
|
||||
soundUri = ""
|
||||
} else {
|
||||
grantReadUriPermission(soundUri)
|
||||
}
|
||||
|
||||
val contentTitle = if (publicVersion) resources.getString(R.string.app_name) else event.title
|
||||
val contentText = if (publicVersion) resources.getString(R.string.public_event_notification_text) else content
|
||||
|
@ -192,7 +197,7 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
|
|||
.setPriority(Notification.PRIORITY_HIGH)
|
||||
.setDefaults(Notification.DEFAULT_LIGHTS)
|
||||
.setAutoCancel(true)
|
||||
.setSound(soundUri, AudioManager.STREAM_NOTIFICATION)
|
||||
.setSound(Uri.parse(soundUri), AudioManager.STREAM_NOTIFICATION)
|
||||
.setChannelId(channelId)
|
||||
.addAction(R.drawable.ic_snooze, getString(R.string.snooze), getSnoozePendingIntent(this, event))
|
||||
|
||||
|
|
|
@ -139,7 +139,6 @@ class DayFragment : Fragment() {
|
|||
DayEventsAdapter(activity as SimpleActivity, events, mHolder.day_events) {
|
||||
editEvent(it as Event)
|
||||
}.apply {
|
||||
setupDragListener(true)
|
||||
addVerticalDividers(true)
|
||||
mHolder.day_events.adapter = this
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue