mirror of
				https://github.com/SimpleMobileTools/Simple-Calendar.git
				synced 2025-06-05 21:59:17 +02:00 
			
		
		
		
	some code style updating
This commit is contained in:
		| @@ -207,16 +207,11 @@ class MainActivity : SimpleActivity(), NavigationListener { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun shouldGoToTodayBeVisible(): Boolean { |     private fun shouldGoToTodayBeVisible() = when { | ||||||
|         return if (config.storedView == WEEKLY_VIEW) { |         config.storedView == WEEKLY_VIEW -> week_view_view_pager.currentItem != mDefaultWeeklyPage | ||||||
|             week_view_view_pager.currentItem != mDefaultWeeklyPage |         config.storedView == MONTHLY_VIEW -> main_view_pager.currentItem != mDefaultMonthlyPage | ||||||
|         } else if (config.storedView == MONTHLY_VIEW) { |         config.storedView == YEARLY_VIEW -> main_view_pager.currentItem != mDefaultYearlyPage | ||||||
|             main_view_pager.currentItem != mDefaultMonthlyPage |         else -> false | ||||||
|         } else if (config.storedView == YEARLY_VIEW) { |  | ||||||
|             main_view_pager.currentItem != mDefaultYearlyPage |  | ||||||
|         } else { |  | ||||||
|             false |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun showFilterDialog() { |     private fun showFilterDialog() { | ||||||
| @@ -281,14 +276,11 @@ class MainActivity : SimpleActivity(), NavigationListener { | |||||||
|  |  | ||||||
|     private fun updateViewPager() { |     private fun updateViewPager() { | ||||||
|         resetTitle() |         resetTitle() | ||||||
|         if (config.storedView == YEARLY_VIEW) { |         when { | ||||||
|             fillYearlyViewPager() |             config.storedView == YEARLY_VIEW -> fillYearlyViewPager() | ||||||
|         } else if (config.storedView == EVENTS_LIST_VIEW) { |             config.storedView == EVENTS_LIST_VIEW -> fillEventsList() | ||||||
|             fillEventsList() |             config.storedView == WEEKLY_VIEW -> fillWeeklyViewPager() | ||||||
|         } else if (config.storedView == WEEKLY_VIEW) { |             else -> openMonthlyToday() | ||||||
|             fillWeeklyViewPager() |  | ||||||
|         } else { |  | ||||||
|             openMonthlyToday() |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         mWeekScrollY = 0 |         mWeekScrollY = 0 | ||||||
| @@ -300,14 +292,11 @@ class MainActivity : SimpleActivity(), NavigationListener { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun refreshViewPager() { |     private fun refreshViewPager() { | ||||||
|         if (config.storedView == YEARLY_VIEW) { |         when { | ||||||
|             (main_view_pager.adapter as MyYearPagerAdapter).refreshEvents(main_view_pager.currentItem) |             config.storedView == YEARLY_VIEW -> (main_view_pager.adapter as MyYearPagerAdapter).refreshEvents(main_view_pager.currentItem) | ||||||
|         } else if (config.storedView == EVENTS_LIST_VIEW) { |             config.storedView == EVENTS_LIST_VIEW -> fillEventsList() | ||||||
|             fillEventsList() |             config.storedView == WEEKLY_VIEW -> (week_view_view_pager.adapter as MyWeekPagerAdapter).refreshEvents(week_view_view_pager.currentItem) | ||||||
|         } else if (config.storedView == WEEKLY_VIEW) { |             else -> (main_view_pager.adapter as MyMonthPagerAdapter).refreshEvents(main_view_pager.currentItem) | ||||||
|             (week_view_view_pager.adapter as MyWeekPagerAdapter).refreshEvents(week_view_view_pager.currentItem) |  | ||||||
|         } else { |  | ||||||
|             (main_view_pager.adapter as MyMonthPagerAdapter).refreshEvents(main_view_pager.currentItem) |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -326,9 +315,9 @@ class MainActivity : SimpleActivity(), NavigationListener { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun tryImportEventsFromFile(uri: Uri) { |     private fun tryImportEventsFromFile(uri: Uri) { | ||||||
|         if (uri.scheme == "file") { |         when { | ||||||
|             importEventsDialog(uri.path) |             uri.scheme == "file" -> importEventsDialog(uri.path) | ||||||
|         } else if (uri.scheme == "content") { |             uri.scheme == "content" -> { | ||||||
|                 val tempFile = getTempFile() |                 val tempFile = getTempFile() | ||||||
|                 if (tempFile == null) { |                 if (tempFile == null) { | ||||||
|                     toast(R.string.unknown_error_occurred) |                     toast(R.string.unknown_error_occurred) | ||||||
| @@ -339,8 +328,8 @@ class MainActivity : SimpleActivity(), NavigationListener { | |||||||
|                 val out = FileOutputStream(tempFile) |                 val out = FileOutputStream(tempFile) | ||||||
|                 inputStream.copyTo(out) |                 inputStream.copyTo(out) | ||||||
|                 importEventsDialog(tempFile.absolutePath) |                 importEventsDialog(tempFile.absolutePath) | ||||||
|         } else { |             } | ||||||
|             toast(R.string.invalid_file_format) |             else -> toast(R.string.invalid_file_format) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -64,7 +64,7 @@ class CalDAVEventsHandler(val context: Context) { | |||||||
|         return calendars |         return calendars | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     fun fetchCalDAVCalendarEvents(calendarId: Int, eventTypeId: Int) { |     private fun fetchCalDAVCalendarEvents(calendarId: Int, eventTypeId: Int) { | ||||||
|         val importIdsMap = HashMap<String, Event>() |         val importIdsMap = HashMap<String, Event>() | ||||||
|         val fetchedEventIds = ArrayList<String>() |         val fetchedEventIds = ArrayList<String>() | ||||||
|         val existingEvents = context.dbHelper.getEventsFromCalDAVCalendar(calendarId) |         val existingEvents = context.dbHelper.getEventsFromCalDAVCalendar(calendarId) | ||||||
| @@ -208,7 +208,7 @@ class CalDAVEventsHandler(val context: Context) { | |||||||
|         context.contentResolver.delete(contentUri, null, null) |         context.contentResolver.delete(contentUri, null, null) | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     fun getCalDAVEventReminders(eventId: Long): List<Int> { |     private fun getCalDAVEventReminders(eventId: Long): List<Int> { | ||||||
|         val reminders = ArrayList<Int>() |         val reminders = ArrayList<Int>() | ||||||
|         val uri = CalendarContract.Reminders.CONTENT_URI |         val uri = CalendarContract.Reminders.CONTENT_URI | ||||||
|         val projection = arrayOf( |         val projection = arrayOf( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user