Merge pull request #1 from SimpleMobileTools/master

getting the latest version
This commit is contained in:
Aravinth
2020-08-08 14:11:24 +00:00
committed by GitHub
187 changed files with 3775 additions and 2045 deletions

View File

@@ -15,3 +15,9 @@ root = true
end_of_line = lf end_of_line = lf
insert_final_newline = true insert_final_newline = true
charset = utf-8 charset = utf-8
indent_style = space
indent_size = 4
continuation_indent_size = 8
[*.xml]
continuation_indent_size = 4

View File

@@ -1,6 +1,65 @@
Changelog Changelog
========== ==========
Version 6.9.7 *(2020-07-06)*
----------------------------
* Fixed some weekly view related glitches
* Added some stability and translation improvements
Version 6.9.6 *(2020-06-12)*
----------------------------
* Fixing a glitch with zoomed out weekly view
Version 6.9.5 *(2020-06-10)*
----------------------------
* Allow changing the amount of days shown at the weekly view
* Show a Save / Discard prompt at leaving an edited event (by fnrngg)
* Some translation and stability improvements
Version 6.9.4 *(2020-05-25)*
----------------------------
* Allow landscape orientation on any device
* Use the nicer new app icon on lower Android versions
* Some UI, stability and translation improvements
Version 6.9.3 *(2020-05-05)*
----------------------------
* Added a 1x1 widget showing the current date
* Made all widget corners round to make them nicer
* Added some translation and other smaller improvements here and there
Version 6.9.2 *(2020-04-17)*
----------------------------
* Fixed some .ics file importing related glitches
* Corrected and added some UK holidays
* Added many UI and translation improvements
Version 6.9.1 *(2020-03-25)*
----------------------------
* Allow zooming the weekly view with vertical gestures
* Allow scrolling through the whole weeky view, use Start time only as the default time
* Updating the app icon
* Other stability, translation and UX improvements
Version 6.9.0 *(2020-03-18)*
----------------------------
* Remember the last used folder at ics exporting
* Do not request the Storage permission on Android 10+, use Scoped Storage
Version 6.8.5 *(2020-03-08)*
----------------------------
* Added a Go To Today menu button at the event list view too
* Some translation and stability improvements
Version 6.8.4 *(2020-02-07)* Version 6.8.4 *(2020-02-07)*
---------------------------- ----------------------------

View File

@@ -1,5 +1,5 @@
# Simple Calendar # Simple Calendar
<img alt="Logo" src="app/src/main/res/mipmap-xxxhdpi/ic_launcher.png" width="80" /> <img alt="Logo" src="fastlane/metadata/android/en-US/images/icon.png" width="120" />
A simple calendar with events and a customizable widget. A simple calendar with events and a customizable widget.

View File

@@ -18,8 +18,8 @@ android {
applicationId "com.simplemobiletools.calendar.pro" applicationId "com.simplemobiletools.calendar.pro"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode 171 versionCode 180
versionName "6.8.4" versionName "6.9.7"
multiDexEnabled true multiDexEnabled true
setProperty("archivesBaseName", "calendar") setProperty("archivesBaseName", "calendar")
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
@@ -64,12 +64,12 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:5.22.7' implementation 'com.simplemobiletools:commons:5.29.7'
implementation 'joda-time:joda-time:2.10.1' implementation 'joda-time:joda-time:2.10.1'
implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta6'
kapt 'androidx.room:room-compiler:2.2.2' kapt 'androidx.room:room-compiler:2.2.5'
implementation 'androidx.room:room-runtime:2.2.2' implementation 'androidx.room:room-runtime:2.2.5'
annotationProcessor 'androidx.room:room-compiler:2.2.2' annotationProcessor 'androidx.room:room-compiler:2.2.5'
} }

View File

@@ -1,31 +1,33 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.simplemobiletools.calendar.pro" package="com.simplemobiletools.calendar.pro"
android:installLocation="auto"> android:installLocation="auto">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_CONTACTS"/> <uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.READ_CALENDAR"/> <uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR"/> <uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name='android.permission.WAKE_LOCK'/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />
<uses-permission <uses-permission
android:name="android.permission.USE_FINGERPRINT" android:name="android.permission.USE_FINGERPRINT"
tools:node="remove"/> tools:node="remove" />
<uses-feature <uses-feature
android:name="android.hardware.faketouch" android:name="android.hardware.faketouch"
android:required="false"/> android:required="false" />
<application <application
android:name=".App" android:name=".App"
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_launcher_name" android:label="@string/app_launcher_name"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
@@ -33,43 +35,43 @@
<activity <activity
android:name=".activities.SplashActivity" android:name=".activities.SplashActivity"
android:launchMode="singleTask" android:launchMode="singleTask"
android:theme="@style/SplashTheme"/> android:theme="@style/SplashTheme" />
<activity <activity
android:name=".activities.MainActivity" android:name=".activities.MainActivity"
android:launchMode="singleTask"> android:launchMode="singleTask">
<meta-data <meta-data
android:name="android.app.default_searchable" android:name="android.app.default_searchable"
android:resource="@xml/searchable"/> android:resource="@xml/searchable" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH"/> <action android:name="android.intent.action.SEARCH" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content"/> <data android:scheme="content" />
<data android:scheme="file"/> <data android:scheme="file" />
<data android:mimeType="text/x-vcalendar"/> <data android:mimeType="text/x-vcalendar" />
<data android:mimeType="text/calendar"/> <data android:mimeType="text/calendar" />
<data android:mimeType="application/ics"/> <data android:mimeType="application/ics" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="time/epoch"/> <data android:mimeType="time/epoch" />
<data android:host="com.android.calendar"/> <data android:host="com.android.calendar" />
<data android:scheme="content"/> <data android:scheme="content" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/event"/> <data android:mimeType="vnd.android.cursor.item/event" />
</intent-filter> </intent-filter>
</activity> </activity>
@@ -78,7 +80,7 @@
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/MyWidgetConfigTheme"> android:theme="@style/MyWidgetConfigTheme">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/> <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter> </intent-filter>
</activity> </activity>
@@ -87,29 +89,38 @@
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/MyWidgetConfigTheme"> android:theme="@style/MyWidgetConfigTheme">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/> <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<activity
android:name=".activities.WidgetDateConfigureActivity"
android:screenOrientation="portrait"
android:theme="@style/MyWidgetConfigTheme">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name="com.simplemobiletools.commons.activities.AboutActivity" android:name="com.simplemobiletools.commons.activities.AboutActivity"
android:label="@string/about" android:label="@string/about"
android:parentActivityName=".activities.MainActivity"/> android:parentActivityName=".activities.MainActivity" />
<activity <activity
android:name="com.simplemobiletools.commons.activities.CustomizationActivity" android:name="com.simplemobiletools.commons.activities.CustomizationActivity"
android:label="@string/customize_colors" android:label="@string/customize_colors"
android:parentActivityName=".activities.SettingsActivity"/> android:parentActivityName=".activities.SettingsActivity" />
<activity <activity
android:name="com.simplemobiletools.commons.activities.LicenseActivity" android:name="com.simplemobiletools.commons.activities.LicenseActivity"
android:label="@string/third_party_licences" android:label="@string/third_party_licences"
android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity"/> android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity" />
<activity <activity
android:name="com.simplemobiletools.commons.activities.FAQActivity" android:name="com.simplemobiletools.commons.activities.FAQActivity"
android:label="@string/frequently_asked_questions" android:label="@string/frequently_asked_questions"
android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity"/> android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity" />
<activity <activity
android:name=".activities.EventActivity" android:name=".activities.EventActivity"
@@ -117,19 +128,19 @@
android:parentActivityName=".activities.MainActivity"> android:parentActivityName=".activities.MainActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.EDIT"/> <action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.INSERT"/> <action android:name="android.intent.action.INSERT" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/event"/> <data android:mimeType="vnd.android.cursor.item/event" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.EDIT"/> <action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.INSERT"/> <action android:name="android.intent.action.INSERT" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.dir/event"/> <data android:mimeType="vnd.android.cursor.dir/event" />
</intent-filter> </intent-filter>
</activity> </activity>
@@ -148,28 +159,28 @@
<activity <activity
android:name=".activities.SettingsActivity" android:name=".activities.SettingsActivity"
android:label="@string/settings" android:label="@string/settings"
android:parentActivityName=".activities.MainActivity"/> android:parentActivityName=".activities.MainActivity" />
<activity <activity
android:name=".activities.ManageEventTypesActivity" android:name=".activities.ManageEventTypesActivity"
android:label="@string/event_types" android:label="@string/event_types"
android:parentActivityName=".activities.SettingsActivity"/> android:parentActivityName=".activities.SettingsActivity" />
<activity <activity
android:name=".activities.SnoozeReminderActivity" android:name=".activities.SnoozeReminderActivity"
android:theme="@style/Theme.Transparent"/> android:theme="@style/Theme.Transparent" />
<receiver <receiver
android:name=".helpers.MyWidgetMonthlyProvider" android:name=".helpers.MyWidgetMonthlyProvider"
android:icon="@drawable/img_widget_monthly_preview" android:icon="@drawable/img_widget_monthly_preview"
android:label="@string/widget_monthly"> android:label="@string/widget_monthly">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter> </intent-filter>
<meta-data <meta-data
android:name="android.appwidget.provider" android:name="android.appwidget.provider"
android:resource="@xml/widget_monthly_info"/> android:resource="@xml/widget_monthly_info" />
</receiver> </receiver>
<receiver <receiver
@@ -177,38 +188,51 @@
android:icon="@drawable/img_widget_list_preview" android:icon="@drawable/img_widget_list_preview"
android:label="@string/widget_list"> android:label="@string/widget_list">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter> </intent-filter>
<meta-data <meta-data
android:name="android.appwidget.provider" android:name="android.appwidget.provider"
android:resource="@xml/widget_list_info"/> android:resource="@xml/widget_list_info" />
</receiver>
<receiver
android:name=".helpers.MyWidgetDateProvider"
android:icon="@drawable/img_widget_date_preview"
android:label="@string/widget_todays_date">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_date_info" />
</receiver> </receiver>
<service <service
android:name=".services.WidgetService" android:name=".services.WidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS"/> android:permission="android.permission.BIND_REMOTEVIEWS" />
<service <service
android:name=".services.WidgetServiceEmpty" android:name=".services.WidgetServiceEmpty"
android:permission="android.permission.BIND_REMOTEVIEWS"/> android:permission="android.permission.BIND_REMOTEVIEWS" />
<service android:name=".services.SnoozeService"/> <service android:name=".services.SnoozeService" />
<service <service
android:name=".jobs.CalDAVUpdateListener" android:name=".jobs.CalDAVUpdateListener"
android:exported="true" android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE"/> android:permission="android.permission.BIND_JOB_SERVICE" />
<receiver android:name=".receivers.NotificationReceiver"/> <receiver android:name=".receivers.NotificationReceiver" />
<receiver android:name=".receivers.CalDAVSyncReceiver"/> <receiver android:name=".receivers.CalDAVSyncReceiver" />
<receiver android:name=".receivers.BootCompletedReceiver"> <receiver android:name=".receivers.BootCompletedReceiver">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/> <action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON"/> <action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/> <action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
</intent-filter> </intent-filter>
</receiver> </receiver>
@@ -219,7 +243,7 @@
android:grantUriPermissions="true"> android:grantUriPermissions="true">
<meta-data <meta-data
android:name="android.support.FILE_PROVIDER_PATHS" android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/> android:resource="@xml/provider_paths" />
</provider> </provider>
<activity-alias <activity-alias
@@ -230,8 +254,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -243,8 +267,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -256,8 +280,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -269,8 +293,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -282,8 +306,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -295,8 +319,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -308,8 +332,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -321,8 +345,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -334,8 +358,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -347,8 +371,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -360,8 +384,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -373,8 +397,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -386,8 +410,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -399,8 +423,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -411,8 +435,8 @@
android:roundIcon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -424,8 +448,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -437,8 +461,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -450,8 +474,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@@ -463,8 +487,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
</application> </application>

View File

@@ -10,12 +10,19 @@ END:VEVENT
BEGIN:VEVENT BEGIN:VEVENT
SUMMARY:Early May Bank Holiday SUMMARY:Early May Bank Holiday
UID:21626542-636f-43d7-8fa9-bad05bb82dca UID:21626542-636f-43d7-8fa9-bad05bb82dca
DTSTART;VALUE=DATE:20100503 DTSTART;VALUE=DATE:20210503
DTEND;VALUE=DATE:20100504 DTEND;VALUE=DATE:20210504
RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYDAY=1MO RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYDAY=1MO
STATUS:CONFIRMED STATUS:CONFIRMED
END:VEVENT END:VEVENT
BEGIN:VEVENT BEGIN:VEVENT
SUMMARY:Early May Bank Holiday
UID:21626542-636f-43d7-8fa9-bad05bbsds
DTSTART;VALUE=DATE:20200508
DTEND;VALUE=DATE:20200509
STATUS:CONFIRMED
END:VEVENT
BEGIN:VEVENT
SUMMARY:Summer Bank Holiday SUMMARY:Summer Bank Holiday
UID:5dac6a63-e519-4ad1-a687-2fd5fccb4656 UID:5dac6a63-e519-4ad1-a687-2fd5fccb4656
DTSTART;VALUE=DATE:20130826 DTSTART;VALUE=DATE:20130826
@@ -47,13 +54,40 @@ UID:ca6af7456b0088abad9a69f9f620f5ac-59@gov.uk
STATUS:CONFIRMED STATUS:CONFIRMED
END:VEVENT END:VEVENT
BEGIN:VEVENT BEGIN:VEVENT
DTEND;VALUE=DATE:20190420
DTSTART;VALUE=DATE:20190419 DTSTART;VALUE=DATE:20190419
DTEND;VALUE=DATE:20190420
SUMMARY:Good Friday SUMMARY:Good Friday
UID:ca6af7456b0088abad9a69f9f620f5ac-58@gov.uk UID:ca6af7456b0088abad9a69f9f620f5ac-58@gov.uk
STATUS:CONFIRMED STATUS:CONFIRMED
END:VEVENT END:VEVENT
BEGIN:VEVENT BEGIN:VEVENT
DTSTART;VALUE=DATE:20200410
DTEND;VALUE=DATE:20200411
SUMMARY:Good Friday
UID:ca6af7456b0088abad9a69f9f620f5ac-2020-04-10-GoodFriday@gov.uk
STATUS:CONFIRMED
END:VEVENT
BEGIN:VEVENT
DTSTART;VALUE=DATE:20200413
DTEND;VALUE=DATE:20200414
SUMMARY:Easter Monday
UID:ca6af7456b0088abad9a69f9f620f5ac-2020-04-13-EasterMonday@gov.uk
STATUS:CONFIRMED
END:VEVENT
BEGIN:VEVENT
DTSTART;VALUE=DATE:20210402
DTEND;VALUE=DATE:20210403
SUMMARY:Good Friday
STATUS:CONFIRMED
END:VEVENT
BEGIN:VEVENT
DTSTART;VALUE=DATE:20210405
DTEND;VALUE=DATE:20210406
SUMMARY:Easter Monday
UID:ca6af7456b0088abad9a69f9f620f5ac-2021-04-05-EasterMonday@gov.uk
STATUS:CONFIRMED
END:VEVENT
BEGIN:VEVENT
SUMMARY:Spring Bank Holiday SUMMARY:Spring Bank Holiday
UID:5dac6a63-e519-4ad1-a687-2fd5fccb4 UID:5dac6a63-e519-4ad1-a687-2fd5fccb4
DTSTART;VALUE=DATE:20130527 DTSTART;VALUE=DATE:20130527

View File

@@ -4,13 +4,15 @@ import android.app.Activity
import android.app.DatePickerDialog import android.app.DatePickerDialog
import android.app.TimePickerDialog import android.app.TimePickerDialog
import android.content.Intent import android.content.Intent
import android.database.Cursor import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.graphics.drawable.LayerDrawable import android.graphics.drawable.LayerDrawable
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.provider.CalendarContract import android.provider.CalendarContract.Attendees
import android.provider.ContactsContract import android.provider.ContactsContract.CommonDataKinds
import android.provider.ContactsContract.CommonDataKinds.StructuredName
import android.provider.ContactsContract.Data
import android.text.TextUtils import android.text.TextUtils
import android.text.method.LinkMovementMethod import android.text.method.LinkMovementMethod
import android.view.Menu import android.view.Menu
@@ -30,6 +32,7 @@ import com.simplemobiletools.calendar.pro.extensions.*
import com.simplemobiletools.calendar.pro.helpers.* import com.simplemobiletools.calendar.pro.helpers.*
import com.simplemobiletools.calendar.pro.helpers.Formatter import com.simplemobiletools.calendar.pro.helpers.Formatter
import com.simplemobiletools.calendar.pro.models.* import com.simplemobiletools.calendar.pro.models.*
import com.simplemobiletools.commons.dialogs.ConfirmationAdvancedDialog
import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
@@ -86,7 +89,6 @@ class EventActivity : SimpleActivity() {
private var mStoredEventTypes = ArrayList<EventType>() private var mStoredEventTypes = ArrayList<EventType>()
private var mOriginalTimeZone = DateTimeZone.getDefault().id private var mOriginalTimeZone = DateTimeZone.getDefault().id
private lateinit var mAttendeePlaceholder: Drawable
private lateinit var mEventStartDateTime: DateTime private lateinit var mEventStartDateTime: DateTime
private lateinit var mEventEndDateTime: DateTime private lateinit var mEventEndDateTime: DateTime
private lateinit var mEvent: Event private lateinit var mEvent: Event
@@ -103,8 +105,6 @@ class EventActivity : SimpleActivity() {
val intent = intent ?: return val intent = intent ?: return
mDialogTheme = getDialogTheme() mDialogTheme = getDialogTheme()
mWasContactsPermissionChecked = hasPermission(PERMISSION_READ_CONTACTS) mWasContactsPermissionChecked = hasPermission(PERMISSION_READ_CONTACTS)
mAttendeePlaceholder = resources.getDrawable(R.drawable.attendee_circular_background)
(mAttendeePlaceholder as LayerDrawable).findDrawableByLayerId(R.id.attendee_circular_background).applyColorFilter(config.primaryColor)
val eventId = intent.getLongExtra(EVENT_ID, 0L) val eventId = intent.getLongExtra(EVENT_ID, 0L)
ensureBackgroundThread { ensureBackgroundThread {
@@ -231,6 +231,7 @@ class EventActivity : SimpleActivity() {
menu.findItem(R.id.share).isVisible = mEvent.id != null menu.findItem(R.id.share).isVisible = mEvent.id != null
menu.findItem(R.id.duplicate).isVisible = mEvent.id != null menu.findItem(R.id.duplicate).isVisible = mEvent.id != null
} }
updateMenuItemColors(menu) updateMenuItemColors(menu)
return true return true
} }
@@ -246,6 +247,68 @@ class EventActivity : SimpleActivity() {
return true return true
} }
private fun getStartEndTimes(): Pair<Long, Long> {
val offset = if (!config.allowChangingTimeZones || mEvent.getTimeZoneString().equals(mOriginalTimeZone, true)) {
0
} else {
val original = if (mOriginalTimeZone.isEmpty()) DateTimeZone.getDefault().id else mOriginalTimeZone
(DateTimeZone.forID(mEvent.getTimeZoneString()).getOffset(System.currentTimeMillis()) - DateTimeZone.forID(original).getOffset(System.currentTimeMillis())) / 1000L
}
val newStartTS = mEventStartDateTime.withSecondOfMinute(0).withMillisOfSecond(0).seconds() - offset
val newEndTS = mEventEndDateTime.withSecondOfMinute(0).withMillisOfSecond(0).seconds() - offset
return Pair(newStartTS, newEndTS)
}
private fun getReminders(): ArrayList<Reminder> {
var reminders = arrayListOf(
Reminder(mReminder1Minutes, mReminder1Type),
Reminder(mReminder2Minutes, mReminder2Type),
Reminder(mReminder3Minutes, mReminder3Type)
)
reminders = reminders.filter { it.minutes != REMINDER_OFF }.sortedBy { it.minutes }.toMutableList() as ArrayList<Reminder>
return reminders
}
private fun isEventChanged(): Boolean {
var newStartTS: Long
var newEndTS: Long
getStartEndTimes().apply {
newStartTS = first
newEndTS = second
}
val reminders = getReminders()
if (event_title.value != mEvent.title ||
event_location.value != mEvent.location ||
event_description.value != mEvent.description ||
newStartTS != mEvent.startTS ||
newEndTS != mEvent.endTS ||
event_time_zone.text != mEvent.getTimeZoneString() ||
reminders != mEvent.getReminders() ||
mRepeatInterval != mEvent.repeatInterval ||
mRepeatRule != mEvent.repeatRule ||
mEventTypeId != mEvent.eventType) {
return true
}
return false
}
override fun onBackPressed() {
if (isEventChanged()) {
ConfirmationAdvancedDialog(this, "", R.string.save_before_closing, R.string.save, R.string.discard) {
if (it) {
saveCurrentEvent()
} else {
super.onBackPressed()
}
}
} else {
super.onBackPressed()
}
}
override fun onSaveInstanceState(outState: Bundle) { override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState) super.onSaveInstanceState(outState)
if (!mWasActivityInitialized) { if (!mWasActivityInitialized) {
@@ -302,8 +365,8 @@ class EventActivity : SimpleActivity() {
mRepeatRule = getInt(REPEAT_RULE) mRepeatRule = getInt(REPEAT_RULE)
mRepeatLimit = getLong(REPEAT_LIMIT) mRepeatLimit = getLong(REPEAT_LIMIT)
mAttendees = Gson().fromJson<ArrayList<Attendee>>(getString(ATTENDEES), object : TypeToken<List<Attendee>>() {}.type) val token = object : TypeToken<List<Attendee>>() {}.type
?: ArrayList() mAttendees = Gson().fromJson<ArrayList<Attendee>>(getString(ATTENDEES), token) ?: ArrayList()
mEventTypeId = getLong(EVENT_TYPE_ID) mEventTypeId = getLong(EVENT_TYPE_ID)
mEventCalendarId = getInt(EVENT_CALENDAR_ID) mEventCalendarId = getInt(EVENT_CALENDAR_ID)
@@ -370,11 +433,35 @@ class EventActivity : SimpleActivity() {
mRepeatRule = mEvent.repeatRule mRepeatRule = mEvent.repeatRule
mEventTypeId = mEvent.eventType mEventTypeId = mEvent.eventType
mEventCalendarId = mEvent.getCalDAVCalendarId() mEventCalendarId = mEvent.getCalDAVCalendarId()
mAttendees = Gson().fromJson<ArrayList<Attendee>>(mEvent.attendees, object : TypeToken<List<Attendee>>() {}.type) ?: ArrayList()
val token = object : TypeToken<List<Attendee>>() {}.type
mAttendees = Gson().fromJson<ArrayList<Attendee>>(mEvent.attendees, token) ?: ArrayList()
checkRepeatTexts(mRepeatInterval) checkRepeatTexts(mRepeatInterval)
checkAttendees() checkAttendees()
} }
private fun addDefValuesToNewEvent() {
var newStartTS: Long
var newEndTS: Long
getStartEndTimes().apply {
newStartTS = first
newEndTS = second
}
mEvent.apply {
startTS = newStartTS
endTS = newEndTS
reminder1Minutes = mReminder1Minutes
reminder1Type = mReminder1Type
reminder2Minutes = mReminder2Minutes
reminder2Type = mReminder2Type
reminder3Minutes = mReminder3Minutes
reminder3Type = mReminder3Type
eventType = mEventTypeId
}
}
private fun setupNewEvent() { private fun setupNewEvent() {
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
event_title.requestFocus() event_title.requestFocus()
@@ -411,13 +498,18 @@ class EventActivity : SimpleActivity() {
mEventStartDateTime = dateTime mEventStartDateTime = dateTime
val addMinutes = if (intent.getBooleanExtra(NEW_EVENT_SET_HOUR_DURATION, false)) { val addMinutes = if (intent.getBooleanExtra(NEW_EVENT_SET_HOUR_DURATION, false)) {
// if an event is created at 23:00 on the weekly view, make it end on 23:59 by default to avoid spanning across multiple days
if (mEventStartDateTime.hourOfDay == 23) {
59
} else {
60 60
}
} else { } else {
config.defaultDuration config.defaultDuration
} }
mEventEndDateTime = mEventStartDateTime.plusMinutes(addMinutes) mEventEndDateTime = mEventStartDateTime.plusMinutes(addMinutes)
} }
addDefValuesToNewEvent()
checkAttendees() checkAttendees()
} }
@@ -804,8 +896,7 @@ class EventActivity : SimpleActivity() {
private fun getCalendarId() = if (mEvent.source == SOURCE_SIMPLE_CALENDAR) config.lastUsedCaldavCalendarId else mEvent.getCalDAVCalendarId() private fun getCalendarId() = if (mEvent.source == SOURCE_SIMPLE_CALENDAR) config.lastUsedCaldavCalendarId else mEvent.getCalDAVCalendarId()
private fun getCalendarWithId(calendars: List<CalDAVCalendar>, calendarId: Int): CalDAVCalendar? = private fun getCalendarWithId(calendars: List<CalDAVCalendar>, calendarId: Int) = calendars.firstOrNull { it.id == calendarId }
calendars.firstOrNull { it.id == calendarId }
private fun updateCurrentCalendarInfo(currentCalendar: CalDAVCalendar?) { private fun updateCurrentCalendarInfo(currentCalendar: CalDAVCalendar?) {
event_type_image.beVisibleIf(currentCalendar == null) event_type_image.beVisibleIf(currentCalendar == null)
@@ -914,16 +1005,13 @@ class EventActivity : SimpleActivity() {
return return
} }
val offset = if (!config.allowChangingTimeZones || mEvent.getTimeZoneString().equals(mOriginalTimeZone, true)) { var newStartTS: Long
0 var newEndTS: Long
} else { getStartEndTimes().apply {
val original = if (mOriginalTimeZone.isEmpty()) DateTimeZone.getDefault().id else mOriginalTimeZone newStartTS = first
(DateTimeZone.forID(mEvent.getTimeZoneString()).getOffset(System.currentTimeMillis()) - DateTimeZone.forID(original).getOffset(System.currentTimeMillis())) / 1000L newEndTS = second
} }
val newStartTS = mEventStartDateTime.withSecondOfMinute(0).withMillisOfSecond(0).seconds() - offset
val newEndTS = mEventEndDateTime.withSecondOfMinute(0).withMillisOfSecond(0).seconds() - offset
if (newStartTS > newEndTS) { if (newStartTS > newEndTS) {
toast(R.string.end_before_start) toast(R.string.end_before_start)
return return
@@ -931,7 +1019,11 @@ class EventActivity : SimpleActivity() {
val wasRepeatable = mEvent.repeatInterval > 0 val wasRepeatable = mEvent.repeatInterval > 0
val oldSource = mEvent.source val oldSource = mEvent.source
val newImportId = if (mEvent.id != null) mEvent.importId else UUID.randomUUID().toString().replace("-", "") + System.currentTimeMillis().toString() val newImportId = if (mEvent.id != null) {
mEvent.importId
} else {
UUID.randomUUID().toString().replace("-", "") + System.currentTimeMillis().toString()
}
val newEventType = if (!config.caldavSync || config.lastUsedCaldavCalendarId == 0 || mEventCalendarId == STORED_LOCALLY_ONLY) { val newEventType = if (!config.caldavSync || config.lastUsedCaldavCalendarId == 0 || mEventCalendarId == STORED_LOCALLY_ONLY) {
mEventTypeId mEventTypeId
@@ -955,13 +1047,7 @@ class EventActivity : SimpleActivity() {
"$CALDAV-$mEventCalendarId" "$CALDAV-$mEventCalendarId"
} }
var reminders = arrayListOf( val reminders = getReminders()
Reminder(mReminder1Minutes, mReminder1Type),
Reminder(mReminder2Minutes, mReminder2Type),
Reminder(mReminder3Minutes, mReminder3Type)
)
reminders = reminders.filter { it.minutes != REMINDER_OFF }.sortedBy { it.minutes }.toMutableList() as ArrayList<Reminder>
val reminder1 = reminders.getOrNull(0) ?: Reminder(REMINDER_OFF, REMINDER_NOTIFICATION) val reminder1 = reminders.getOrNull(0) ?: Reminder(REMINDER_OFF, REMINDER_NOTIFICATION)
val reminder2 = reminders.getOrNull(1) ?: Reminder(REMINDER_OFF, REMINDER_NOTIFICATION) val reminder2 = reminders.getOrNull(1) ?: Reminder(REMINDER_OFF, REMINDER_NOTIFICATION)
val reminder3 = reminders.getOrNull(2) ?: Reminder(REMINDER_OFF, REMINDER_NOTIFICATION) val reminder3 = reminders.getOrNull(2) ?: Reminder(REMINDER_OFF, REMINDER_NOTIFICATION)
@@ -1007,7 +1093,6 @@ class EventActivity : SimpleActivity() {
eventsHelper.deleteEvent(mEvent.id!!, true) eventsHelper.deleteEvent(mEvent.id!!, true)
mEvent.id = null mEvent.id = null
} }
storeEvent(wasRepeatable) storeEvent(wasRepeatable)
} }
@@ -1254,9 +1339,9 @@ class EventActivity : SimpleActivity() {
mAttendees.sortWith(compareBy<Attendee> mAttendees.sortWith(compareBy<Attendee>
{ it.isMe }.thenBy { it.isMe }.thenBy
{ it.status == CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED }.thenBy { it.status == Attendees.ATTENDEE_STATUS_ACCEPTED }.thenBy
{ it.status == CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED }.thenBy { it.status == Attendees.ATTENDEE_STATUS_DECLINED }.thenBy
{ it.status == CalendarContract.Attendees.ATTENDEE_STATUS_TENTATIVE }.thenBy { it.status == Attendees.ATTENDEE_STATUS_TENTATIVE }.thenBy
{ it.status }) { it.status })
mAttendees.reverse() mAttendees.reverse()
@@ -1342,8 +1427,14 @@ class EventActivity : SimpleActivity() {
beVisibleIf(attendee.showStatusImage()) beVisibleIf(attendee.showStatusImage())
} }
event_contact_name.text = if (attendee.isMe) getString(R.string.my_status) else attendee.getPublicName()
if (attendee.isMe) {
(event_contact_name.layoutParams as RelativeLayout.LayoutParams).addRule(RelativeLayout.START_OF, event_contact_me_status.id)
}
val placeholder = BitmapDrawable(resources, SimpleContactsHelper(context).getContactLetterIcon(event_contact_name.value))
event_contact_image.apply { event_contact_image.apply {
attendee.updateImage(applicationContext, this, mAttendeePlaceholder) attendee.updateImage(applicationContext, this, placeholder)
beVisible() beVisible()
} }
@@ -1352,11 +1443,6 @@ class EventActivity : SimpleActivity() {
beGoneIf(attendee.isMe) beGoneIf(attendee.isMe)
} }
event_contact_name.text = if (attendee.isMe) getString(R.string.my_status) else attendee.getPublicName()
if (attendee.isMe) {
(event_contact_name.layoutParams as RelativeLayout.LayoutParams).addRule(RelativeLayout.START_OF, event_contact_me_status.id)
}
if (attendee.isMe) { if (attendee.isMe) {
updateAttendeeMe(this, attendee) updateAttendeeMe(this, attendee)
} }
@@ -1368,9 +1454,9 @@ class EventActivity : SimpleActivity() {
if (attendee.isMe) { if (attendee.isMe) {
event_contact_attendee.setOnClickListener { event_contact_attendee.setOnClickListener {
val items = arrayListOf( val items = arrayListOf(
RadioItem(CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED, getString(R.string.going)), RadioItem(Attendees.ATTENDEE_STATUS_ACCEPTED, getString(R.string.going)),
RadioItem(CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED, getString(R.string.not_going)), RadioItem(Attendees.ATTENDEE_STATUS_DECLINED, getString(R.string.not_going)),
RadioItem(CalendarContract.Attendees.ATTENDEE_STATUS_TENTATIVE, getString(R.string.maybe_going)) RadioItem(Attendees.ATTENDEE_STATUS_TENTATIVE, getString(R.string.maybe_going))
) )
RadioGroupDialog(this@EventActivity, items, attendee.status) { RadioGroupDialog(this@EventActivity, items, attendee.status) {
@@ -1384,8 +1470,8 @@ class EventActivity : SimpleActivity() {
private fun getAttendeeStatusImage(attendee: Attendee): Drawable { private fun getAttendeeStatusImage(attendee: Attendee): Drawable {
return resources.getDrawable(when (attendee.status) { return resources.getDrawable(when (attendee.status) {
CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED -> R.drawable.ic_check_green Attendees.ATTENDEE_STATUS_ACCEPTED -> R.drawable.ic_check_green
CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED -> R.drawable.ic_cross_red Attendees.ATTENDEE_STATUS_DECLINED -> R.drawable.ic_cross_red
else -> R.drawable.ic_question_yellow else -> R.drawable.ic_question_yellow
}) })
} }
@@ -1393,9 +1479,9 @@ class EventActivity : SimpleActivity() {
private fun updateAttendeeMe(holder: RelativeLayout, attendee: Attendee) { private fun updateAttendeeMe(holder: RelativeLayout, attendee: Attendee) {
holder.apply { holder.apply {
event_contact_me_status.text = getString(when (attendee.status) { event_contact_me_status.text = getString(when (attendee.status) {
CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED -> R.string.going Attendees.ATTENDEE_STATUS_ACCEPTED -> R.string.going
CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED -> R.string.not_going Attendees.ATTENDEE_STATUS_DECLINED -> R.string.not_going
CalendarContract.Attendees.ATTENDEE_STATUS_TENTATIVE -> R.string.maybe_going Attendees.ATTENDEE_STATUS_TENTATIVE -> R.string.maybe_going
else -> R.string.invited else -> R.string.invited
}) })
@@ -1422,7 +1508,7 @@ class EventActivity : SimpleActivity() {
val customEmails = mAttendeeAutoCompleteViews.filter { it.isVisible() }.map { it.value }.filter { it.isNotEmpty() }.toMutableList() as ArrayList<String> val customEmails = mAttendeeAutoCompleteViews.filter { it.isVisible() }.map { it.value }.filter { it.isNotEmpty() }.toMutableList() as ArrayList<String>
customEmails.mapTo(attendees) { customEmails.mapTo(attendees) {
Attendee(0, "", it, CalendarContract.Attendees.ATTENDEE_STATUS_INVITED, "", false, CalendarContract.Attendees.RELATIONSHIP_NONE) Attendee(0, "", it, Attendees.ATTENDEE_STATUS_INVITED, "", false, Attendees.RELATIONSHIP_NONE)
} }
attendees = attendees.distinctBy { it.email }.toMutableList() as ArrayList<Attendee> attendees = attendees.distinctBy { it.email }.toMutableList() as ArrayList<Attendee>
@@ -1430,8 +1516,8 @@ class EventActivity : SimpleActivity() {
val currentCalendar = calDAVHelper.getCalDAVCalendars("", true).firstOrNull { it.id == mEventCalendarId } val currentCalendar = calDAVHelper.getCalDAVCalendars("", true).firstOrNull { it.id == mEventCalendarId }
mAvailableContacts.firstOrNull { it.email == currentCalendar?.accountName }?.apply { mAvailableContacts.firstOrNull { it.email == currentCalendar?.accountName }?.apply {
attendees = attendees.filter { it.email != currentCalendar?.accountName }.toMutableList() as ArrayList<Attendee> attendees = attendees.filter { it.email != currentCalendar?.accountName }.toMutableList() as ArrayList<Attendee>
status = CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED status = Attendees.ATTENDEE_STATUS_ACCEPTED
relationship = CalendarContract.Attendees.RELATIONSHIP_ORGANIZER relationship = Attendees.RELATIONSHIP_ORGANIZER
attendees.add(this) attendees.add(this)
} }
} }
@@ -1441,85 +1527,62 @@ class EventActivity : SimpleActivity() {
private fun getNames(): List<Attendee> { private fun getNames(): List<Attendee> {
val contacts = ArrayList<Attendee>() val contacts = ArrayList<Attendee>()
val uri = ContactsContract.Data.CONTENT_URI val uri = Data.CONTENT_URI
val projection = arrayOf( val projection = arrayOf(
ContactsContract.Data.CONTACT_ID, Data.CONTACT_ID,
ContactsContract.CommonDataKinds.StructuredName.PREFIX, StructuredName.PREFIX,
ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME, StructuredName.GIVEN_NAME,
ContactsContract.CommonDataKinds.StructuredName.MIDDLE_NAME, StructuredName.MIDDLE_NAME,
ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME, StructuredName.FAMILY_NAME,
ContactsContract.CommonDataKinds.StructuredName.SUFFIX, StructuredName.SUFFIX,
ContactsContract.CommonDataKinds.StructuredName.PHOTO_THUMBNAIL_URI) StructuredName.PHOTO_THUMBNAIL_URI)
val selection = "${ContactsContract.Data.MIMETYPE} = ?" val selection = "${Data.MIMETYPE} = ?"
val selectionArgs = arrayOf(ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE) val selectionArgs = arrayOf(StructuredName.CONTENT_ITEM_TYPE)
var cursor: Cursor? = null queryCursor(uri, projection, selection, selectionArgs) { cursor ->
try { val id = cursor.getIntValue(Data.CONTACT_ID)
cursor = contentResolver.query(uri, projection, selection, selectionArgs, null) val prefix = cursor.getStringValue(StructuredName.PREFIX) ?: ""
if (cursor?.moveToFirst() == true) { val firstName = cursor.getStringValue(StructuredName.GIVEN_NAME) ?: ""
do { val middleName = cursor.getStringValue(StructuredName.MIDDLE_NAME) ?: ""
val id = cursor.getIntValue(ContactsContract.Data.CONTACT_ID) val surname = cursor.getStringValue(StructuredName.FAMILY_NAME) ?: ""
val prefix = cursor.getStringValue(ContactsContract.CommonDataKinds.StructuredName.PREFIX) ?: "" val suffix = cursor.getStringValue(StructuredName.SUFFIX) ?: ""
val firstName = cursor.getStringValue(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME) ?: "" val photoUri = cursor.getStringValue(StructuredName.PHOTO_THUMBNAIL_URI) ?: ""
val middleName = cursor.getStringValue(ContactsContract.CommonDataKinds.StructuredName.MIDDLE_NAME) ?: ""
val surname = cursor.getStringValue(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME) ?: ""
val suffix = cursor.getStringValue(ContactsContract.CommonDataKinds.StructuredName.SUFFIX) ?: ""
val photoUri = cursor.getStringValue(ContactsContract.CommonDataKinds.StructuredName.PHOTO_THUMBNAIL_URI) ?: ""
val names = arrayListOf(prefix, firstName, middleName, surname, suffix).filter { it.trim().isNotEmpty() } val names = arrayListOf(prefix, firstName, middleName, surname, suffix).filter { it.trim().isNotEmpty() }
val fullName = TextUtils.join("", names) val fullName = TextUtils.join(" ", names).trim()
if (fullName.isNotEmpty() || photoUri.isNotEmpty()) { if (fullName.isNotEmpty() || photoUri.isNotEmpty()) {
val contact = Attendee(id, fullName, "", CalendarContract.Attendees.ATTENDEE_STATUS_NONE, photoUri, false, CalendarContract.Attendees.RELATIONSHIP_NONE) val contact = Attendee(id, fullName, "", Attendees.ATTENDEE_STATUS_NONE, photoUri, false, Attendees.RELATIONSHIP_NONE)
contacts.add(contact) contacts.add(contact)
} }
} while (cursor.moveToNext())
}
} catch (ignored: Exception) {
} finally {
cursor?.close()
} }
return contacts return contacts
} }
private fun getEmails(): ArrayList<Attendee> { private fun getEmails(): ArrayList<Attendee> {
val contacts = ArrayList<Attendee>() val contacts = ArrayList<Attendee>()
val uri = ContactsContract.CommonDataKinds.Email.CONTENT_URI val uri = CommonDataKinds.Email.CONTENT_URI
val projection = arrayOf( val projection = arrayOf(
ContactsContract.Data.CONTACT_ID, Data.CONTACT_ID,
ContactsContract.CommonDataKinds.Email.DATA CommonDataKinds.Email.DATA
) )
var cursor: Cursor? = null queryCursor(uri, projection) { cursor ->
try { val id = cursor.getIntValue(Data.CONTACT_ID)
cursor = contentResolver.query(uri, projection, null, null, null) val email = cursor.getStringValue(CommonDataKinds.Email.DATA) ?: return@queryCursor
if (cursor?.moveToFirst() == true) { val contact = Attendee(id, "", email, Attendees.ATTENDEE_STATUS_NONE, "", false, Attendees.RELATIONSHIP_NONE)
do {
val id = cursor.getIntValue(ContactsContract.Data.CONTACT_ID)
val email = cursor.getStringValue(ContactsContract.CommonDataKinds.Email.DATA) ?: continue
val contact = Attendee(id, "", email, CalendarContract.Attendees.ATTENDEE_STATUS_NONE, "", false, CalendarContract.Attendees.RELATIONSHIP_NONE)
contacts.add(contact) contacts.add(contact)
} while (cursor.moveToNext())
}
} catch (ignored: Exception) {
} finally {
cursor?.close()
} }
return contacts return contacts
} }
private fun updateIconColors() { private fun updateIconColors() {
val textColor = config.textColor
event_time_image.applyColorFilter(textColor)
event_time_zone_image.applyColorFilter(textColor)
event_repetition_image.applyColorFilter(textColor)
event_reminder_image.applyColorFilter(textColor)
event_type_image.applyColorFilter(textColor)
event_caldav_calendar_image.applyColorFilter(textColor)
event_show_on_map.applyColorFilter(getAdjustedPrimaryColor()) event_show_on_map.applyColorFilter(getAdjustedPrimaryColor())
event_reminder_1_type.applyColorFilter(textColor) val textColor = config.textColor
event_reminder_2_type.applyColorFilter(textColor) arrayOf(event_time_image, event_time_zone_image, event_repetition_image, event_reminder_image, event_type_image, event_caldav_calendar_image,
event_reminder_3_type.applyColorFilter(textColor) event_reminder_1_type, event_reminder_2_type, event_reminder_3_type, event_attendees_image).forEach {
event_attendees_image.applyColorFilter(textColor) it.applyColorFilter(textColor)
}
} }
} }

View File

@@ -1,19 +1,18 @@
package com.simplemobiletools.calendar.pro.activities package com.simplemobiletools.calendar.pro.activities
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Activity
import android.app.SearchManager import android.app.SearchManager
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.ActivityInfo
import android.content.pm.ShortcutInfo import android.content.pm.ShortcutInfo
import android.content.pm.ShortcutManager import android.content.pm.ShortcutManager
import android.database.Cursor
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Icon import android.graphics.drawable.Icon
import android.graphics.drawable.LayerDrawable import android.graphics.drawable.LayerDrawable
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.provider.ContactsContract import android.provider.ContactsContract.*
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.widget.Toast import android.widget.Toast
@@ -31,6 +30,8 @@ import com.simplemobiletools.calendar.pro.extensions.*
import com.simplemobiletools.calendar.pro.fragments.* import com.simplemobiletools.calendar.pro.fragments.*
import com.simplemobiletools.calendar.pro.helpers.* import com.simplemobiletools.calendar.pro.helpers.*
import com.simplemobiletools.calendar.pro.helpers.Formatter import com.simplemobiletools.calendar.pro.helpers.Formatter
import com.simplemobiletools.calendar.pro.helpers.IcsExporter.ExportResult
import com.simplemobiletools.calendar.pro.helpers.IcsImporter.ImportResult
import com.simplemobiletools.calendar.pro.jobs.CalDAVUpdateListener import com.simplemobiletools.calendar.pro.jobs.CalDAVUpdateListener
import com.simplemobiletools.calendar.pro.models.Event import com.simplemobiletools.calendar.pro.models.Event
import com.simplemobiletools.calendar.pro.models.EventType import com.simplemobiletools.calendar.pro.models.EventType
@@ -48,11 +49,15 @@ import kotlinx.android.synthetic.main.activity_main.*
import org.joda.time.DateTime import org.joda.time.DateTime
import org.joda.time.DateTimeZone import org.joda.time.DateTimeZone
import java.io.FileOutputStream import java.io.FileOutputStream
import java.io.OutputStream
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
private val PICK_IMPORT_SOURCE_INTENT = 1
private val PICK_EXPORT_FILE_INTENT = 2
private var showCalDAVRefreshToast = false private var showCalDAVRefreshToast = false
private var mShouldFilterBeVisible = false private var mShouldFilterBeVisible = false
private var mIsSearchOpen = false private var mIsSearchOpen = false
@@ -61,6 +66,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
private var shouldGoToTodayBeVisible = false private var shouldGoToTodayBeVisible = false
private var goToTodayButton: MenuItem? = null private var goToTodayButton: MenuItem? = null
private var currentFragments = ArrayList<MyFragmentHolder>() private var currentFragments = ArrayList<MyFragmentHolder>()
private var eventTypesToExport = ArrayList<Long>()
private var mStoredTextColor = 0 private var mStoredTextColor = 0
private var mStoredBackgroundColor = 0 private var mStoredBackgroundColor = 0
@@ -76,15 +82,12 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
appLaunched(BuildConfig.APPLICATION_ID) appLaunched(BuildConfig.APPLICATION_ID)
checkWhatsNewDialog() checkWhatsNewDialog()
calendar_fab.beVisibleIf(config.storedView != YEARLY_VIEW) calendar_fab.beVisibleIf(config.storedView != YEARLY_VIEW && config.storedView != WEEKLY_VIEW)
calendar_fab.setOnClickListener { calendar_fab.setOnClickListener {
launchNewEventIntent(currentFragments.last().getNewEventDayCode()) launchNewEventIntent(currentFragments.last().getNewEventDayCode())
} }
storeStateVariables() storeStateVariables()
if (resources.getBoolean(R.bool.portrait_only)) {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}
if (!hasPermission(PERMISSION_WRITE_CALENDAR) || !hasPermission(PERMISSION_READ_CALENDAR)) { if (!hasPermission(PERMISSION_WRITE_CALENDAR) || !hasPermission(PERMISSION_READ_CALENDAR)) {
config.caldavSync = false config.caldavSync = false
@@ -138,12 +141,8 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
storeStateVariables() storeStateVariables()
updateWidgets() updateWidgets()
if (config.storedView != EVENTS_LIST_VIEW) {
updateTextColors(calendar_coordinator) updateTextColors(calendar_coordinator)
}
search_placeholder.setTextColor(config.textColor)
search_placeholder_2.setTextColor(config.textColor)
calendar_fab.setColors(config.textColor, getAdjustedPrimaryColor(), config.backgroundColor)
search_holder.background = ColorDrawable(config.backgroundColor) search_holder.background = ColorDrawable(config.backgroundColor)
checkSwipeRefreshAvailability() checkSwipeRefreshAvailability()
checkShortcuts() checkShortcuts()
@@ -173,7 +172,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
menu.apply { menu.apply {
goToTodayButton = findItem(R.id.go_to_today) goToTodayButton = findItem(R.id.go_to_today)
findItem(R.id.filter).isVisible = mShouldFilterBeVisible findItem(R.id.filter).isVisible = mShouldFilterBeVisible
findItem(R.id.go_to_today).isVisible = shouldGoToTodayBeVisible && config.storedView != EVENTS_LIST_VIEW findItem(R.id.go_to_today).isVisible = (shouldGoToTodayBeVisible || config.storedView == EVENTS_LIST_VIEW) && !mIsSearchOpen
findItem(R.id.go_to_date).isVisible = config.storedView != EVENTS_LIST_VIEW findItem(R.id.go_to_date).isVisible = config.storedView != EVENTS_LIST_VIEW
} }
@@ -182,8 +181,8 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
return true return true
} }
override fun onPrepareOptionsMenu(menu: Menu?): Boolean { override fun onPrepareOptionsMenu(menu: Menu): Boolean {
menu!!.apply { menu.apply {
findItem(R.id.refresh_caldav_calendars).isVisible = config.caldavSync findItem(R.id.refresh_caldav_calendars).isVisible = config.caldavSync
} }
@@ -227,6 +226,16 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
checkIsViewIntent() checkIsViewIntent()
} }
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
super.onActivityResult(requestCode, resultCode, resultData)
if (requestCode == PICK_IMPORT_SOURCE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {
tryImportEventsFromFile(resultData.data!!)
} else if (requestCode == PICK_EXPORT_FILE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {
val outputStream = contentResolver.openOutputStream(resultData.data!!)
exportEventsTo(eventTypesToExport, outputStream)
}
}
private fun storeStateVariables() { private fun storeStateVariables() {
config.apply { config.apply {
mStoredIsSundayFirst = isSundayFirst mStoredIsSundayFirst = isSundayFirst
@@ -263,13 +272,15 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
search_holder.beVisible() search_holder.beVisible()
calendar_fab.beGone() calendar_fab.beGone()
searchQueryChanged("") searchQueryChanged("")
invalidateOptionsMenu()
return true return true
} }
override fun onMenuItemActionCollapse(item: MenuItem?): Boolean { override fun onMenuItemActionCollapse(item: MenuItem?): Boolean {
mIsSearchOpen = false mIsSearchOpen = false
search_holder.beGone() search_holder.beGone()
calendar_fab.beVisibleIf(currentFragments.last() !is YearFragmentsHolder) calendar_fab.beVisibleIf(currentFragments.last() !is YearFragmentsHolder && currentFragments.last() !is WeekFragmentsHolder)
invalidateOptionsMenu()
return true return true
} }
}) })
@@ -360,7 +371,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
private fun checkIsViewIntent() { private fun checkIsViewIntent() {
if (intent?.action == Intent.ACTION_VIEW && intent.data != null) { if (intent?.action == Intent.ACTION_VIEW && intent.data != null) {
val uri = intent.data val uri = intent.data
if (uri?.authority?.equals("com.android.calendar") == true) { if (uri?.authority?.equals("com.android.calendar") == true || uri?.authority?.substringAfter("@") == "com.android.calendar") {
if (uri.path!!.startsWith("/events")) { if (uri.path!!.startsWith("/events")) {
ensureBackgroundThread { ensureBackgroundThread {
// intents like content://com.android.calendar/events/1756 // intents like content://com.android.calendar/events/1756
@@ -375,8 +386,9 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
toast(R.string.caldav_event_not_found, Toast.LENGTH_LONG) toast(R.string.caldav_event_not_found, Toast.LENGTH_LONG)
} }
} }
} else if (intent?.extras?.getBoolean("DETAIL_VIEW", false) == true) { } else if (uri.path!!.startsWith("/time") || intent?.extras?.getBoolean("DETAIL_VIEW", false) == true) {
// clicking date on a third party widget: content://com.android.calendar/time/1507309245683 // clicking date on a third party widget: content://com.android.calendar/time/1507309245683
// or content://0@com.android.calendar/time/1584958526435
val timestamp = uri.pathSegments.last() val timestamp = uri.pathSegments.last()
if (timestamp.areDigitsOnly()) { if (timestamp.areDigitsOnly()) {
openDayAt(timestamp.toLong()) openDayAt(timestamp.toLong())
@@ -398,10 +410,9 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
RadioItem(EVENTS_LIST_VIEW, getString(R.string.simple_event_list))) RadioItem(EVENTS_LIST_VIEW, getString(R.string.simple_event_list)))
RadioGroupDialog(this, items, config.storedView) { RadioGroupDialog(this, items, config.storedView) {
calendar_fab.beVisibleIf(it as Int != YEARLY_VIEW)
resetActionBarTitle() resetActionBarTitle()
closeSearch() closeSearch()
updateView(it) updateView(it as Int)
shouldGoToTodayBeVisible = false shouldGoToTodayBeVisible = false
invalidateOptionsMenu() invalidateOptionsMenu()
} }
@@ -471,7 +482,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
val result = IcsImporter(this).importEvents(it as String, eventTypeId, 0, false) val result = IcsImporter(this).importEvents(it as String, eventTypeId, 0, false)
handleParseResult(result) handleParseResult(result)
if (result != IcsImporter.ImportResult.IMPORT_FAIL) { if (result != ImportResult.IMPORT_FAIL) {
runOnUiThread { runOnUiThread {
updateViewPager() updateViewPager()
} }
@@ -528,11 +539,11 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
} }
} }
private fun handleParseResult(result: IcsImporter.ImportResult) { private fun handleParseResult(result: ImportResult) {
toast(when (result) { toast(when (result) {
IcsImporter.ImportResult.IMPORT_NOTHING_NEW -> R.string.no_new_items ImportResult.IMPORT_NOTHING_NEW -> R.string.no_new_items
IcsImporter.ImportResult.IMPORT_OK -> R.string.holidays_imported_successfully ImportResult.IMPORT_OK -> R.string.holidays_imported_successfully
IcsImporter.ImportResult.IMPORT_PARTIAL -> R.string.importing_some_holidays_failed ImportResult.IMPORT_PARTIAL -> R.string.importing_some_holidays_failed
else -> R.string.importing_holidays_failed else -> R.string.importing_holidays_failed
}, Toast.LENGTH_LONG) }, Toast.LENGTH_LONG)
} }
@@ -540,19 +551,16 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
private fun addContactEvents(birthdays: Boolean, reminders: ArrayList<Int>, callback: (Int) -> Unit) { private fun addContactEvents(birthdays: Boolean, reminders: ArrayList<Int>, callback: (Int) -> Unit) {
var eventsAdded = 0 var eventsAdded = 0
var eventsFound = 0 var eventsFound = 0
val uri = ContactsContract.Data.CONTENT_URI val uri = Data.CONTENT_URI
val projection = arrayOf(ContactsContract.Contacts.DISPLAY_NAME, val projection = arrayOf(Contacts.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Event.CONTACT_ID, CommonDataKinds.Event.CONTACT_ID,
ContactsContract.CommonDataKinds.Event.CONTACT_LAST_UPDATED_TIMESTAMP, CommonDataKinds.Event.CONTACT_LAST_UPDATED_TIMESTAMP,
ContactsContract.CommonDataKinds.Event.START_DATE) CommonDataKinds.Event.START_DATE)
val selection = "${Data.MIMETYPE} = ? AND ${CommonDataKinds.Event.TYPE} = ?"
val type = if (birthdays) CommonDataKinds.Event.TYPE_BIRTHDAY else CommonDataKinds.Event.TYPE_ANNIVERSARY
val selectionArgs = arrayOf(CommonDataKinds.Event.CONTENT_ITEM_TYPE, type.toString())
val selection = "${ContactsContract.Data.MIMETYPE} = ? AND ${ContactsContract.CommonDataKinds.Event.TYPE} = ?"
val type = if (birthdays) ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY else ContactsContract.CommonDataKinds.Event.TYPE_ANNIVERSARY
val selectionArgs = arrayOf(ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE, type.toString())
var cursor: Cursor? = null
try {
cursor = contentResolver.query(uri, projection, selection, selectionArgs, null)
if (cursor?.moveToFirst() == true) {
val dateFormats = getDateFormats() val dateFormats = getDateFormats()
val existingEvents = if (birthdays) eventsDB.getBirthdays() else eventsDB.getAnniversaries() val existingEvents = if (birthdays) eventsDB.getBirthdays() else eventsDB.getAnniversaries()
val importIDs = HashMap<String, Long>() val importIDs = HashMap<String, Long>()
@@ -562,10 +570,10 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
val eventTypeId = if (birthdays) getBirthdaysEventTypeId() else getAnniversariesEventTypeId() val eventTypeId = if (birthdays) getBirthdaysEventTypeId() else getAnniversariesEventTypeId()
do { queryCursor(uri, projection, selection, selectionArgs, showErrors = true) { cursor ->
val contactId = cursor.getIntValue(ContactsContract.CommonDataKinds.Event.CONTACT_ID).toString() val contactId = cursor.getIntValue(CommonDataKinds.Event.CONTACT_ID).toString()
val name = cursor.getStringValue(ContactsContract.Contacts.DISPLAY_NAME) val name = cursor.getStringValue(Contacts.DISPLAY_NAME)
val startDate = cursor.getStringValue(ContactsContract.CommonDataKinds.Event.START_DATE) val startDate = cursor.getStringValue(CommonDataKinds.Event.START_DATE)
for (format in dateFormats) { for (format in dateFormats) {
try { try {
@@ -577,7 +585,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
val timestamp = date.time / 1000L val timestamp = date.time / 1000L
val source = if (birthdays) SOURCE_CONTACT_BIRTHDAY else SOURCE_CONTACT_ANNIVERSARY val source = if (birthdays) SOURCE_CONTACT_BIRTHDAY else SOURCE_CONTACT_ANNIVERSARY
val lastUpdated = cursor.getLongValue(ContactsContract.CommonDataKinds.Event.CONTACT_LAST_UPDATED_TIMESTAMP) val lastUpdated = cursor.getLongValue(CommonDataKinds.Event.CONTACT_LAST_UPDATED_TIMESTAMP)
val event = Event(null, timestamp, timestamp, name, reminder1Minutes = reminders[0], reminder2Minutes = reminders[1], val event = Event(null, timestamp, timestamp, name, reminder1Minutes = reminders[0], reminder2Minutes = reminders[1],
reminder3Minutes = reminders[2], importId = contactId, timeZone = DateTimeZone.getDefault().id, flags = FLAG_ALL_DAY, reminder3Minutes = reminders[2], importId = contactId, timeZone = DateTimeZone.getDefault().id, flags = FLAG_ALL_DAY,
repeatInterval = YEAR, repeatRule = REPEAT_SAME_DAY, eventType = eventTypeId, source = source, lastUpdated = lastUpdated) repeatInterval = YEAR, repeatRule = REPEAT_SAME_DAY, eventType = eventTypeId, source = source, lastUpdated = lastUpdated)
@@ -606,12 +614,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
} catch (e: Exception) { } catch (e: Exception) {
} }
} }
} while (cursor.moveToNext())
}
} catch (e: Exception) {
showErrorToast(e)
} finally {
cursor?.close()
} }
runOnUiThread { runOnUiThread {
@@ -640,7 +642,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
} }
private fun updateView(view: Int) { private fun updateView(view: Int) {
calendar_fab.beVisibleIf(view != YEARLY_VIEW) calendar_fab.beVisibleIf(view != YEARLY_VIEW && view != WEEKLY_VIEW)
config.storedView = view config.storedView = view
checkSwipeRefreshAvailability() checkSwipeRefreshAvailability()
updateViewPager() updateViewPager()
@@ -738,12 +740,20 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
} }
private fun tryImportEvents() { private fun tryImportEvents() {
if (isQPlus()) {
Intent(Intent.ACTION_GET_CONTENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = "text/calendar"
startActivityForResult(this, PICK_IMPORT_SOURCE_INTENT)
}
} else {
handlePermission(PERMISSION_READ_STORAGE) { handlePermission(PERMISSION_READ_STORAGE) {
if (it) { if (it) {
importEvents() importEvents()
} }
} }
} }
}
private fun importEvents() { private fun importEvents() {
FilePickerDialog(this) { FilePickerDialog(this) {
@@ -781,33 +791,47 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
} }
private fun tryExportEvents() { private fun tryExportEvents() {
if (isQPlus()) {
ExportEventsDialog(this, config.lastExportPath, true) { file, eventTypes ->
eventTypesToExport = eventTypes
Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
type = "text/calendar"
putExtra(Intent.EXTRA_TITLE, file.name)
addCategory(Intent.CATEGORY_OPENABLE)
startActivityForResult(this, PICK_EXPORT_FILE_INTENT)
}
}
} else {
handlePermission(PERMISSION_WRITE_STORAGE) { handlePermission(PERMISSION_WRITE_STORAGE) {
if (it) { if (it) {
exportEvents() ExportEventsDialog(this, config.lastExportPath, false) { file, eventTypes ->
getFileOutputStream(file.toFileDirItem(this), true) {
exportEventsTo(eventTypes, it)
}
}
}
} }
} }
} }
private fun exportEvents() { private fun exportEventsTo(eventTypes: ArrayList<Long>, outputStream: OutputStream?) {
FilePickerDialog(this, pickFile = false, showFAB = true) {
ExportEventsDialog(this, it) { exportPastEvents, file, eventTypes ->
ensureBackgroundThread { ensureBackgroundThread {
val events = eventsHelper.getEventsToExport(exportPastEvents, eventTypes) val events = eventsHelper.getEventsToExport(eventTypes)
if (events.isEmpty()) { if (events.isEmpty()) {
toast(R.string.no_entries_for_exporting) toast(R.string.no_entries_for_exporting)
} else { } else {
IcsExporter().exportEvents(this, file, events, true) { IcsExporter().exportEvents(this, outputStream, events, true) {
toast(when (it) { toast(when (it) {
IcsExporter.ExportResult.EXPORT_OK -> R.string.exporting_successful ExportResult.EXPORT_OK -> R.string.exporting_successful
IcsExporter.ExportResult.EXPORT_PARTIAL -> R.string.exporting_some_entries_failed ExportResult.EXPORT_PARTIAL -> R.string.exporting_some_entries_failed
else -> R.string.exporting_failed else -> R.string.exporting_failed
}) })
} }
} }
} }
} }
}
}
private fun launchSettings() { private fun launchSettings() {
startActivity(Intent(applicationContext, SettingsActivity::class.java)) startActivity(Intent(applicationContext, SettingsActivity::class.java))

View File

@@ -1,8 +1,8 @@
package com.simplemobiletools.calendar.pro.activities package com.simplemobiletools.calendar.pro.activities
import android.app.Activity
import android.app.TimePickerDialog import android.app.TimePickerDialog
import android.content.Intent import android.content.Intent
import android.content.res.Resources
import android.media.AudioManager import android.media.AudioManager
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
@@ -20,18 +20,18 @@ import com.simplemobiletools.commons.models.RadioItem
import kotlinx.android.synthetic.main.activity_settings.* import kotlinx.android.synthetic.main.activity_settings.*
import org.joda.time.DateTime import org.joda.time.DateTime
import java.io.File import java.io.File
import java.io.InputStream
import java.util.* import java.util.*
class SettingsActivity : SimpleActivity() { class SettingsActivity : SimpleActivity() {
private val GET_RINGTONE_URI = 1 private val GET_RINGTONE_URI = 1
private val PICK_IMPORT_SOURCE_INTENT = 2
lateinit var res: Resources
private var mStoredPrimaryColor = 0 private var mStoredPrimaryColor = 0
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings) setContentView(R.layout.activity_settings)
res = resources
mStoredPrimaryColor = config.primaryColor mStoredPrimaryColor = config.primaryColor
} }
@@ -51,7 +51,6 @@ class SettingsActivity : SimpleActivity() {
setupWeekNumbers() setupWeekNumbers()
setupShowGrid() setupShowGrid()
setupWeeklyStart() setupWeeklyStart()
setupWeeklyEnd()
setupVibrate() setupVibrate()
setupReminderSound() setupReminderSound()
setupReminderAudioStream() setupReminderAudioStream()
@@ -105,6 +104,9 @@ class SettingsActivity : SimpleActivity() {
if (requestCode == GET_RINGTONE_URI && resultCode == RESULT_OK && resultData != null) { if (requestCode == GET_RINGTONE_URI && resultCode == RESULT_OK && resultData != null) {
val newAlarmSound = storeNewYourAlarmSound(resultData) val newAlarmSound = storeNewYourAlarmSound(resultData)
updateReminderSound(newAlarmSound) updateReminderSound(newAlarmSound)
} else if (requestCode == PICK_IMPORT_SOURCE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {
val inputStream = contentResolver.openInputStream(resultData.data!!)
parseFile(inputStream)
} }
} }
@@ -293,35 +295,14 @@ class SettingsActivity : SimpleActivity() {
settings_start_weekly_at.text = getHoursString(config.startWeeklyAt) settings_start_weekly_at.text = getHoursString(config.startWeeklyAt)
settings_start_weekly_at_holder.setOnClickListener { settings_start_weekly_at_holder.setOnClickListener {
val items = ArrayList<RadioItem>() val items = ArrayList<RadioItem>()
(0..24).mapTo(items) { RadioItem(it, getHoursString(it)) } (0..16).mapTo(items) { RadioItem(it, getHoursString(it)) }
RadioGroupDialog(this@SettingsActivity, items, config.startWeeklyAt) { RadioGroupDialog(this@SettingsActivity, items, config.startWeeklyAt) {
if (it as Int >= config.endWeeklyAt) { config.startWeeklyAt = it as Int
toast(R.string.day_end_before_start)
} else {
config.startWeeklyAt = it
settings_start_weekly_at.text = getHoursString(it) settings_start_weekly_at.text = getHoursString(it)
} }
} }
} }
}
private fun setupWeeklyEnd() {
settings_end_weekly_at.text = getHoursString(config.endWeeklyAt)
settings_end_weekly_at_holder.setOnClickListener {
val items = ArrayList<RadioItem>()
(0..24).mapTo(items) { RadioItem(it, getHoursString(it)) }
RadioGroupDialog(this@SettingsActivity, items, config.endWeeklyAt) {
if (it as Int <= config.startWeeklyAt) {
toast(R.string.day_end_before_start)
} else {
config.endWeeklyAt = it
settings_end_weekly_at.text = getHoursString(it)
}
}
}
}
private fun setupWeekNumbers() { private fun setupWeekNumbers() {
settings_week_numbers.isChecked = config.showWeekNumbers settings_week_numbers.isChecked = config.showWeekNumbers
@@ -367,10 +348,10 @@ class SettingsActivity : SimpleActivity() {
settings_reminder_audio_stream.text = getAudioStreamText() settings_reminder_audio_stream.text = getAudioStreamText()
settings_reminder_audio_stream_holder.setOnClickListener { settings_reminder_audio_stream_holder.setOnClickListener {
val items = arrayListOf( val items = arrayListOf(
RadioItem(AudioManager.STREAM_ALARM, res.getString(R.string.alarm_stream)), RadioItem(AudioManager.STREAM_ALARM, getString(R.string.alarm_stream)),
RadioItem(AudioManager.STREAM_SYSTEM, res.getString(R.string.system_stream)), RadioItem(AudioManager.STREAM_SYSTEM, getString(R.string.system_stream)),
RadioItem(AudioManager.STREAM_NOTIFICATION, res.getString(R.string.notification_stream)), RadioItem(AudioManager.STREAM_NOTIFICATION, getString(R.string.notification_stream)),
RadioItem(AudioManager.STREAM_RING, res.getString(R.string.ring_stream))) RadioItem(AudioManager.STREAM_RING, getString(R.string.ring_stream)))
RadioGroupDialog(this@SettingsActivity, items, config.reminderAudioStream) { RadioGroupDialog(this@SettingsActivity, items, config.reminderAudioStream) {
config.reminderAudioStream = it as Int config.reminderAudioStream = it as Int
@@ -503,10 +484,10 @@ class SettingsActivity : SimpleActivity() {
settings_font_size.text = getFontSizeText() settings_font_size.text = getFontSizeText()
settings_font_size_holder.setOnClickListener { settings_font_size_holder.setOnClickListener {
val items = arrayListOf( val items = arrayListOf(
RadioItem(FONT_SIZE_SMALL, res.getString(R.string.small)), RadioItem(FONT_SIZE_SMALL, getString(R.string.small)),
RadioItem(FONT_SIZE_MEDIUM, res.getString(R.string.medium)), RadioItem(FONT_SIZE_MEDIUM, getString(R.string.medium)),
RadioItem(FONT_SIZE_LARGE, res.getString(R.string.large)), RadioItem(FONT_SIZE_LARGE, getString(R.string.large)),
RadioItem(FONT_SIZE_EXTRA_LARGE, res.getString(R.string.extra_large))) RadioItem(FONT_SIZE_EXTRA_LARGE, getString(R.string.extra_large)))
RadioGroupDialog(this@SettingsActivity, items, config.fontSize) { RadioGroupDialog(this@SettingsActivity, items, config.fontSize) {
config.fontSize = it as Int config.fontSize = it as Int
@@ -529,12 +510,12 @@ class SettingsActivity : SimpleActivity() {
settings_list_widget_view_to_open.text = getDefaultViewText() settings_list_widget_view_to_open.text = getDefaultViewText()
settings_list_widget_view_to_open_holder.setOnClickListener { settings_list_widget_view_to_open_holder.setOnClickListener {
val items = arrayListOf( val items = arrayListOf(
RadioItem(DAILY_VIEW, res.getString(R.string.daily_view)), RadioItem(DAILY_VIEW, getString(R.string.daily_view)),
RadioItem(WEEKLY_VIEW, res.getString(R.string.weekly_view)), RadioItem(WEEKLY_VIEW, getString(R.string.weekly_view)),
RadioItem(MONTHLY_VIEW, res.getString(R.string.monthly_view)), RadioItem(MONTHLY_VIEW, getString(R.string.monthly_view)),
RadioItem(YEARLY_VIEW, res.getString(R.string.yearly_view)), RadioItem(YEARLY_VIEW, getString(R.string.yearly_view)),
RadioItem(EVENTS_LIST_VIEW, res.getString(R.string.simple_event_list)), RadioItem(EVENTS_LIST_VIEW, getString(R.string.simple_event_list)),
RadioItem(LAST_VIEW, res.getString(R.string.last_view))) RadioItem(LAST_VIEW, getString(R.string.last_view)))
RadioGroupDialog(this@SettingsActivity, items, config.listWidgetViewToOpen) { RadioGroupDialog(this@SettingsActivity, items, config.listWidgetViewToOpen) {
config.listWidgetViewToOpen = it as Int config.listWidgetViewToOpen = it as Int
@@ -670,7 +651,6 @@ class SettingsActivity : SimpleActivity() {
put(WIDGET_TEXT_COLOR, config.widgetTextColor) put(WIDGET_TEXT_COLOR, config.widgetTextColor)
put(WEEK_NUMBERS, config.showWeekNumbers) put(WEEK_NUMBERS, config.showWeekNumbers)
put(START_WEEKLY_AT, config.startWeeklyAt) put(START_WEEKLY_AT, config.startWeeklyAt)
put(END_WEEKLY_AT, config.endWeeklyAt)
put(VIBRATE, config.vibrateOnReminder) put(VIBRATE, config.vibrateOnReminder)
put(LAST_EVENT_REMINDER_MINUTES, config.lastEventReminderMinutes1) put(LAST_EVENT_REMINDER_MINUTES, config.lastEventReminderMinutes1)
put(LAST_EVENT_REMINDER_MINUTES_2, config.lastEventReminderMinutes2) put(LAST_EVENT_REMINDER_MINUTES_2, config.lastEventReminderMinutes2)
@@ -703,14 +683,18 @@ class SettingsActivity : SimpleActivity() {
private fun setupImportSettings() { private fun setupImportSettings() {
settings_import_holder.setOnClickListener { settings_import_holder.setOnClickListener {
if (isQPlus()) {
Intent(Intent.ACTION_GET_CONTENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = "text/plain"
startActivityForResult(this, PICK_IMPORT_SOURCE_INTENT)
}
} else {
handlePermission(PERMISSION_READ_STORAGE) { handlePermission(PERMISSION_READ_STORAGE) {
if (it) { if (it) {
FilePickerDialog(this) { FilePickerDialog(this) {
ensureBackgroundThread { ensureBackgroundThread {
try { parseFile(File(it).inputStream())
parseFile(it)
} catch (e: Exception) {
showErrorToast(e)
} }
} }
} }
@@ -719,8 +703,12 @@ class SettingsActivity : SimpleActivity() {
} }
} }
private fun parseFile(path: String) { private fun parseFile(inputStream: InputStream?) {
val inputStream = File(path).inputStream() if (inputStream == null) {
toast(R.string.unknown_error_occurred)
return
}
var importedItems = 0 var importedItems = 0
val configValues = LinkedHashMap<String, Any>() val configValues = LinkedHashMap<String, Any>()
inputStream.bufferedReader().use { inputStream.bufferedReader().use {
@@ -756,7 +744,6 @@ class SettingsActivity : SimpleActivity() {
WIDGET_TEXT_COLOR -> config.widgetTextColor = value.toInt() WIDGET_TEXT_COLOR -> config.widgetTextColor = value.toInt()
WEEK_NUMBERS -> config.showWeekNumbers = value.toBoolean() WEEK_NUMBERS -> config.showWeekNumbers = value.toBoolean()
START_WEEKLY_AT -> config.startWeeklyAt = value.toInt() START_WEEKLY_AT -> config.startWeeklyAt = value.toInt()
END_WEEKLY_AT -> config.endWeeklyAt = value.toInt()
VIBRATE -> config.vibrateOnReminder = value.toBoolean() VIBRATE -> config.vibrateOnReminder = value.toBoolean()
LAST_EVENT_REMINDER_MINUTES -> config.lastEventReminderMinutes1 = value.toInt() LAST_EVENT_REMINDER_MINUTES -> config.lastEventReminderMinutes1 = value.toInt()
LAST_EVENT_REMINDER_MINUTES_2 -> config.lastEventReminderMinutes2 = value.toInt() LAST_EVENT_REMINDER_MINUTES_2 -> config.lastEventReminderMinutes2 = value.toInt()
@@ -784,8 +771,10 @@ class SettingsActivity : SimpleActivity() {
} }
} }
toast(if (configValues.size > 0) R.string.settings_imported_successfully else R.string.no_entries_for_importing)
runOnUiThread { runOnUiThread {
val msg = if (configValues.size > 0) R.string.settings_imported_successfully else R.string.no_entries_for_importing
toast(msg)
setupSettingItems() setupSettingItems()
updateWidgets() updateWidgets()
} }

View File

@@ -0,0 +1,141 @@
package com.simplemobiletools.calendar.pro.activities
import android.app.Activity
import android.appwidget.AppWidgetManager
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.widget.SeekBar
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.helpers.Formatter
import com.simplemobiletools.calendar.pro.helpers.LOW_ALPHA
import com.simplemobiletools.calendar.pro.helpers.MyWidgetDateProvider
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
import com.simplemobiletools.commons.extensions.adjustAlpha
import com.simplemobiletools.commons.extensions.applyColorFilter
import com.simplemobiletools.commons.extensions.setFillWithStroke
import kotlinx.android.synthetic.main.widget_config_date.*
class WidgetDateConfigureActivity : SimpleActivity() {
private var mBgAlpha = 0f
private var mWidgetId = 0
private var mBgColorWithoutTransparency = 0
private var mBgColor = 0
private var mTextColorWithoutTransparency = 0
private var mTextColor = 0
private var mWeakTextColor = 0
private var mPrimaryColor = 0
public override fun onCreate(savedInstanceState: Bundle?) {
useDynamicTheme = false
super.onCreate(savedInstanceState)
setResult(Activity.RESULT_CANCELED)
setContentView(R.layout.widget_config_date)
initVariables()
val extras = intent.extras
if (extras != null)
mWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID)
if (mWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID)
finish()
config_save.setOnClickListener { saveConfig() }
config_bg_color.setOnClickListener { pickBackgroundColor() }
config_text_color.setOnClickListener { pickTextColor() }
config_bg_seekbar.setColors(mTextColor, mPrimaryColor, mPrimaryColor)
widget_date_label.text = Formatter.getTodayDayNumber()
widget_month_label.text = Formatter.getCurrentMonthShort()
}
override fun onResume() {
super.onResume()
window.decorView.setBackgroundColor(0)
}
private fun initVariables() {
mTextColorWithoutTransparency = config.widgetTextColor
updateColors()
mBgColor = config.widgetBgColor
mBgAlpha = Color.alpha(mBgColor) / 255.toFloat()
mBgColorWithoutTransparency = Color.rgb(Color.red(mBgColor), Color.green(mBgColor), Color.blue(mBgColor))
config_bg_seekbar.setOnSeekBarChangeListener(bgSeekbarChangeListener)
config_bg_seekbar.progress = (mBgAlpha * 100).toInt()
updateBgColor()
}
private fun saveConfig() {
storeWidgetColors()
requestWidgetUpdate()
Intent().apply {
putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mWidgetId)
setResult(Activity.RESULT_OK, this)
}
finish()
}
private fun storeWidgetColors() {
config.apply {
widgetBgColor = mBgColor
widgetTextColor = mTextColorWithoutTransparency
}
}
private fun pickBackgroundColor() {
ColorPickerDialog(this, mBgColorWithoutTransparency) { wasPositivePressed, color ->
if (wasPositivePressed) {
mBgColorWithoutTransparency = color
updateBgColor()
}
}
}
private fun pickTextColor() {
ColorPickerDialog(this, mTextColor) { wasPositivePressed, color ->
if (wasPositivePressed) {
mTextColorWithoutTransparency = color
updateColors()
}
}
}
private fun requestWidgetUpdate() {
Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null, this, MyWidgetDateProvider::class.java).apply {
putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, intArrayOf(mWidgetId))
sendBroadcast(this)
}
}
private fun updateColors() {
mTextColor = mTextColorWithoutTransparency
mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOW_ALPHA)
mPrimaryColor = config.primaryColor
config_text_color.setFillWithStroke(mTextColor, Color.BLACK)
config_save.setTextColor(mTextColor)
widget_date_label.setTextColor(mTextColor)
widget_month_label.setTextColor(mTextColor)
}
private fun updateBgColor() {
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
config_date_time_wrapper.background.applyColorFilter(mBgColor)
config_bg_color.setFillWithStroke(mBgColor, Color.BLACK)
config_save.setBackgroundColor(mBgColor)
}
private val bgSeekbarChangeListener = object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
mBgAlpha = progress.toFloat() / 100.toFloat()
updateBgColor()
}
override fun onStartTrackingTouch(seekBar: SeekBar) {}
override fun onStopTrackingTouch(seekBar: SeekBar) {}
}
}

View File

@@ -17,6 +17,7 @@ import com.simplemobiletools.calendar.pro.models.ListItem
import com.simplemobiletools.calendar.pro.models.ListSection import com.simplemobiletools.calendar.pro.models.ListSection
import com.simplemobiletools.commons.dialogs.ColorPickerDialog import com.simplemobiletools.commons.dialogs.ColorPickerDialog
import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.adjustAlpha
import com.simplemobiletools.commons.extensions.applyColorFilter
import com.simplemobiletools.commons.extensions.setFillWithStroke import com.simplemobiletools.commons.extensions.setFillWithStroke
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
import kotlinx.android.synthetic.main.widget_config_list.* import kotlinx.android.synthetic.main.widget_config_list.*
@@ -128,7 +129,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
private fun updateBgColor() { private fun updateBgColor() {
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha) mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
config_events_list.setBackgroundColor(mBgColor) config_events_list.background.applyColorFilter(mBgColor)
config_bg_color.setFillWithStroke(mBgColor, Color.BLACK) config_bg_color.setFillWithStroke(mBgColor, Color.BLACK)
config_save.setBackgroundColor(mBgColor) config_save.setBackgroundColor(mBgColor)
} }

View File

@@ -4,7 +4,6 @@ import android.app.Activity
import android.appwidget.AppWidgetManager import android.appwidget.AppWidgetManager
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.res.Resources
import android.graphics.Color import android.graphics.Color
import android.os.Bundle import android.os.Bundle
import android.widget.LinearLayout import android.widget.LinearLayout
@@ -30,9 +29,7 @@ import kotlinx.android.synthetic.main.widget_config_monthly.*
import org.joda.time.DateTime import org.joda.time.DateTime
class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar { class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
lateinit var mRes: Resources
private var mDays: List<DayMonthly>? = null private var mDays: List<DayMonthly>? = null
private var mPackageName = ""
private var dayLabelHeight = 0 private var dayLabelHeight = 0
private var mBgAlpha = 0f private var mBgAlpha = 0f
@@ -70,9 +67,6 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
} }
private fun initVariables() { private fun initVariables() {
mPackageName = packageName
mRes = resources
mTextColorWithoutTransparency = config.widgetTextColor mTextColorWithoutTransparency = config.widgetTextColor
updateColors() updateColors()
@@ -146,7 +140,7 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
private fun updateBgColor() { private fun updateBgColor() {
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha) mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
config_calendar.setBackgroundColor(mBgColor) config_calendar.background.applyColorFilter(mBgColor)
config_bg_color.setFillWithStroke(mBgColor, Color.BLACK) config_bg_color.setFillWithStroke(mBgColor, Color.BLACK)
config_save.setBackgroundColor(mBgColor) config_save.setBackgroundColor(mBgColor)
} }
@@ -159,7 +153,7 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
week_num.beVisible() week_num.beVisible()
for (i in 0..5) { for (i in 0..5) {
findViewById<TextView>(mRes.getIdentifier("week_num_$i", "id", mPackageName)).apply { findViewById<TextView>(resources.getIdentifier("week_num_$i", "id", packageName)).apply {
text = "${mDays!![i * 7 + 3].weekOfYear}:" text = "${mDays!![i * 7 + 3].weekOfYear}:"
setTextColor(mTextColor) setTextColor(mTextColor)
beVisible() beVisible()
@@ -167,14 +161,14 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
} }
} }
val dividerMargin = mRes.displayMetrics.density.toInt() val dividerMargin = resources.displayMetrics.density.toInt()
for (i in 0 until len) { for (i in 0 until len) {
findViewById<LinearLayout>(mRes.getIdentifier("day_$i", "id", mPackageName)).apply { findViewById<LinearLayout>(resources.getIdentifier("day_$i", "id", packageName)).apply {
val day = mDays!![i] val day = mDays!![i]
removeAllViews() removeAllViews()
context.addDayNumber(mTextColor, day, this, dayLabelHeight) { dayLabelHeight = it } context.addDayNumber(mTextColor, day, this, dayLabelHeight) { dayLabelHeight = it }
context.addDayEvents(day, this, mRes, dividerMargin) context.addDayEvents(day, this, resources, dividerMargin)
} }
} }
} }
@@ -185,13 +179,9 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
updateBgColor() updateBgColor()
} }
override fun onStartTrackingTouch(seekBar: SeekBar) { override fun onStartTrackingTouch(seekBar: SeekBar) {}
} override fun onStopTrackingTouch(seekBar: SeekBar) {}
override fun onStopTrackingTouch(seekBar: SeekBar) {
}
} }
override fun updateMonthlyCalendar(context: Context, month: String, days: ArrayList<DayMonthly>, checkedEvents: Boolean, currTargetDate: DateTime) { override fun updateMonthlyCalendar(context: Context, month: String, days: ArrayList<DayMonthly>, checkedEvents: Boolean, currTargetDate: DateTime) {
@@ -204,7 +194,7 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
private fun updateLabels() { private fun updateLabels() {
for (i in 0..6) { for (i in 0..6) {
findViewById<TextView>(mRes.getIdentifier("label_$i", "id", mPackageName)).apply { findViewById<TextView>(resources.getIdentifier("label_$i", "id", packageName)).apply {
setTextColor(mTextColor) setTextColor(mTextColor)
} }
} }

View File

@@ -1,6 +1,6 @@
package com.simplemobiletools.calendar.pro.adapters package com.simplemobiletools.calendar.pro.adapters
import android.graphics.drawable.LayerDrawable import android.graphics.drawable.BitmapDrawable
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@@ -8,19 +8,13 @@ import android.widget.ArrayAdapter
import android.widget.Filter import android.widget.Filter
import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.SimpleActivity import com.simplemobiletools.calendar.pro.activities.SimpleActivity
import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.models.Attendee import com.simplemobiletools.calendar.pro.models.Attendee
import com.simplemobiletools.commons.extensions.applyColorFilter
import com.simplemobiletools.commons.extensions.normalizeString import com.simplemobiletools.commons.extensions.normalizeString
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
import kotlinx.android.synthetic.main.item_autocomplete_email_name.view.* import kotlinx.android.synthetic.main.item_autocomplete_email_name.view.*
class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: ArrayList<Attendee>) : ArrayAdapter<Attendee>(activity, 0, contacts) { class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: ArrayList<Attendee>) : ArrayAdapter<Attendee>(activity, 0, contacts) {
var resultList = ArrayList<Attendee>() var resultList = ArrayList<Attendee>()
private var placeholder = activity.resources.getDrawable(R.drawable.attendee_circular_background)
init {
(placeholder as LayerDrawable).findDrawableByLayerId(R.id.attendee_circular_background).applyColorFilter(activity.config.primaryColor)
}
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View { override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
val contact = resultList[position] val contact = resultList[position]
@@ -30,6 +24,13 @@ class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: Ar
listItem = LayoutInflater.from(activity).inflate(layout, parent, false) listItem = LayoutInflater.from(activity).inflate(layout, parent, false)
} }
val nameToUse = when {
contact.name.isNotEmpty() -> contact.name
contact.email.isNotEmpty() -> contact.email
else -> "A"
}
val placeholder = BitmapDrawable(activity.resources, SimpleContactsHelper(context).getContactLetterIcon(nameToUse))
listItem!!.apply { listItem!!.apply {
tag = contact.name.isNotEmpty() tag = contact.name.isNotEmpty()
item_autocomplete_name?.text = contact.name item_autocomplete_name?.text = contact.name

View File

@@ -40,15 +40,7 @@ class EventListAdapter(activity: SimpleActivity, var listItems: ArrayList<ListIt
init { init {
setupDragListener(true) setupDragListener(true)
var firstNonPastSectionIndex = -1 val firstNonPastSectionIndex = listItems.indexOfFirst { it is ListSection && !it.isPastSection }
listItems.forEachIndexed { index, listItem ->
if (firstNonPastSectionIndex == -1 && listItem is ListSection) {
if (!listItem.isPastSection) {
firstNonPastSectionIndex = index
}
}
}
if (firstNonPastSectionIndex != -1) { if (firstNonPastSectionIndex != -1) {
activity.runOnUiThread { activity.runOnUiThread {
recyclerView.scrollToPosition(firstNonPastSectionIndex) recyclerView.scrollToPosition(firstNonPastSectionIndex)

View File

@@ -48,7 +48,10 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
setupListEvent(remoteView, event) setupListEvent(remoteView, event)
} else { } else {
remoteView = RemoteViews(context.packageName, R.layout.event_list_section_widget) remoteView = RemoteViews(context.packageName, R.layout.event_list_section_widget)
setupListSection(remoteView, events[position] as ListSection) val section = events.getOrNull(position) as? ListSection
if (section != null) {
setupListSection(remoteView, section)
}
} }
return remoteView return remoteView
@@ -142,7 +145,7 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
} }
} }
private fun getItemViewType(position: Int) = if (events[position] is ListEvent) ITEM_EVENT else ITEM_HEADER private fun getItemViewType(position: Int) = if (events.getOrNull(position) is ListEvent) ITEM_EVENT else ITEM_HEADER
override fun getLoadingView() = null override fun getLoadingView() = null

View File

@@ -8,6 +8,7 @@ import androidx.fragment.app.FragmentStatePagerAdapter
import com.simplemobiletools.calendar.pro.fragments.WeekFragment import com.simplemobiletools.calendar.pro.fragments.WeekFragment
import com.simplemobiletools.calendar.pro.helpers.WEEK_START_TIMESTAMP import com.simplemobiletools.calendar.pro.helpers.WEEK_START_TIMESTAMP
import com.simplemobiletools.calendar.pro.interfaces.WeekFragmentListener import com.simplemobiletools.calendar.pro.interfaces.WeekFragmentListener
import com.simplemobiletools.commons.helpers.DAY_SECONDS
class MyWeekPagerAdapter(fm: FragmentManager, private val mWeekTimestamps: List<Long>, private val mListener: WeekFragmentListener) : FragmentStatePagerAdapter(fm) { class MyWeekPagerAdapter(fm: FragmentManager, private val mWeekTimestamps: List<Long>, private val mListener: WeekFragmentListener) : FragmentStatePagerAdapter(fm) {
private val mFragments = SparseArray<WeekFragment>() private val mFragments = SparseArray<WeekFragment>()
@@ -21,7 +22,7 @@ class MyWeekPagerAdapter(fm: FragmentManager, private val mWeekTimestamps: List<
val fragment = WeekFragment() val fragment = WeekFragment()
fragment.arguments = bundle fragment.arguments = bundle
fragment.mListener = mListener fragment.listener = mListener
mFragments.put(position, fragment) mFragments.put(position, fragment)
return fragment return fragment
@@ -37,4 +38,18 @@ class MyWeekPagerAdapter(fm: FragmentManager, private val mWeekTimestamps: List<
mFragments[pos + i]?.updateCalendar() mFragments[pos + i]?.updateCalendar()
} }
} }
fun updateNotVisibleScaleLevel(pos: Int) {
mFragments[pos - 1]?.updateNotVisibleViewScaleLevel()
mFragments[pos + 1]?.updateNotVisibleViewScaleLevel()
}
fun updateVisibleDaysCount(pos: Int, count: Int, currentWeekTimestamp: Long) {
mFragments[pos - 1]?.updateWeekStartTimestamp(currentWeekTimestamp - count * DAY_SECONDS)
mFragments[pos + 1]?.updateWeekStartTimestamp(currentWeekTimestamp + count * DAY_SECONDS)
for (i in -1..1) {
mFragments[pos + i]?.updateVisibleDaysCount(count)
}
}
} }

View File

@@ -6,18 +6,38 @@ import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.SimpleActivity import com.simplemobiletools.calendar.pro.activities.SimpleActivity
import com.simplemobiletools.calendar.pro.adapters.FilterEventTypeAdapter import com.simplemobiletools.calendar.pro.adapters.FilterEventTypeAdapter
import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.extensions.eventsHelper import com.simplemobiletools.calendar.pro.extensions.eventsHelper
import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import kotlinx.android.synthetic.main.dialog_export_events.view.* import kotlinx.android.synthetic.main.dialog_export_events.view.*
import java.io.File import java.io.File
import java.util.* import java.util.*
class ExportEventsDialog(val activity: SimpleActivity, val path: String, val callback: (exportPastEvents: Boolean, file: File, eventTypes: ArrayList<Long>) -> Unit) { class ExportEventsDialog(val activity: SimpleActivity, val path: String, val hidePath: Boolean,
val callback: (file: File, eventTypes: ArrayList<Long>) -> Unit) {
private var realPath = if (path.isEmpty()) activity.internalStoragePath else path
val config = activity.config
init { init {
val view = (activity.layoutInflater.inflate(R.layout.dialog_export_events, null) as ViewGroup).apply { val view = (activity.layoutInflater.inflate(R.layout.dialog_export_events, null) as ViewGroup).apply {
export_events_folder.text = activity.humanizePath(path) export_events_folder.text = activity.humanizePath(realPath)
export_events_filename.setText("${activity.getString(R.string.events)}_${activity.getCurrentFormattedDateTime()}") export_events_filename.setText("${activity.getString(R.string.events)}_${activity.getCurrentFormattedDateTime()}")
export_events_checkbox.isChecked = config.exportPastEvents
if (hidePath) {
export_events_folder_label.beGone()
export_events_folder.beGone()
} else {
export_events_folder.setOnClickListener {
activity.hideKeyboard(export_events_filename)
FilePickerDialog(activity, realPath, false, showFAB = true) {
export_events_folder.text = activity.humanizePath(it)
realPath = it
}
}
}
activity.eventsHelper.getEventTypes(activity, false) { activity.eventsHelper.getEventTypes(activity, false) {
val eventTypes = HashSet<String>() val eventTypes = HashSet<String>()
@@ -43,16 +63,21 @@ class ExportEventsDialog(val activity: SimpleActivity, val path: String, val cal
when { when {
filename.isEmpty() -> activity.toast(R.string.empty_name) filename.isEmpty() -> activity.toast(R.string.empty_name)
filename.isAValidFilename() -> { filename.isAValidFilename() -> {
val file = File(path, "$filename.ics") val file = File(realPath, "$filename.ics")
if (file.exists()) { if (!hidePath && file.exists()) {
activity.toast(R.string.name_taken) activity.toast(R.string.name_taken)
return@setOnClickListener return@setOnClickListener
} }
ensureBackgroundThread {
config.lastExportPath = file.absolutePath.getParentPath()
config.exportPastEvents = view.export_events_checkbox.isChecked
val eventTypes = (view.export_events_types_list.adapter as FilterEventTypeAdapter).getSelectedItemsList() val eventTypes = (view.export_events_types_list.adapter as FilterEventTypeAdapter).getSelectedItemsList()
callback(view.export_events_checkbox.isChecked, file, eventTypes) callback(file, eventTypes)
dismiss() dismiss()
} }
}
else -> activity.toast(R.string.invalid_name) else -> activity.toast(R.string.invalid_name)
} }
} }

View File

@@ -9,19 +9,25 @@ import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.SimpleActivity import com.simplemobiletools.calendar.pro.activities.SimpleActivity
import com.simplemobiletools.calendar.pro.extensions.calDAVHelper import com.simplemobiletools.calendar.pro.extensions.calDAVHelper
import com.simplemobiletools.calendar.pro.extensions.config import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
import kotlinx.android.synthetic.main.calendar_item_account.view.* import kotlinx.android.synthetic.main.calendar_item_account.view.*
import kotlinx.android.synthetic.main.calendar_item_calendar.view.* import kotlinx.android.synthetic.main.calendar_item_calendar.view.*
import kotlinx.android.synthetic.main.dialog_select_calendars.view.* import kotlinx.android.synthetic.main.dialog_select_calendars.view.*
class SelectCalendarsDialog(val activity: SimpleActivity, val callback: () -> Unit) { class SelectCalendarsDialog(val activity: SimpleActivity, val callback: () -> Unit) {
var prevAccount = "" private var prevAccount = ""
var dialog: AlertDialog private var dialog: AlertDialog
var view = (activity.layoutInflater.inflate(R.layout.dialog_select_calendars, null) as ViewGroup) private var view = (activity.layoutInflater.inflate(R.layout.dialog_select_calendars, null) as ViewGroup)
init { init {
val ids = activity.config.getSyncedCalendarIdsAsList() val ids = activity.config.getSyncedCalendarIdsAsList()
val calendars = activity.calDAVHelper.getCalDAVCalendars("", true) val calendars = activity.calDAVHelper.getCalDAVCalendars("", true)
view.apply {
dialog_select_calendars_placeholder.beVisibleIf(calendars.isEmpty())
dialog_select_calendars_holder.beVisibleIf(calendars.isNotEmpty())
}
val sorted = calendars.sortedWith(compareBy({ it.accountName }, { it.displayName })) val sorted = calendars.sortedWith(compareBy({ it.accountName }, { it.displayName }))
sorted.forEach { sorted.forEach {
if (prevAccount != it.accountName) { if (prevAccount != it.accountName) {
@@ -41,8 +47,8 @@ class SelectCalendarsDialog(val activity: SimpleActivity, val callback: () -> Un
} }
private fun addCalendarItem(isEvent: Boolean, text: String, tag: Int = 0, shouldCheck: Boolean = false) { private fun addCalendarItem(isEvent: Boolean, text: String, tag: Int = 0, shouldCheck: Boolean = false) {
val calendarItem = activity.layoutInflater.inflate(if (isEvent) R.layout.calendar_item_calendar else R.layout.calendar_item_account, val layout = if (isEvent) R.layout.calendar_item_calendar else R.layout.calendar_item_account
view.dialog_select_calendars_holder, false) val calendarItem = activity.layoutInflater.inflate(layout, view.dialog_select_calendars_holder, false)
if (isEvent) { if (isEvent) {
calendarItem.calendar_item_calendar_switch.apply { calendarItem.calendar_item_calendar_switch.apply {

View File

@@ -8,9 +8,7 @@ import com.simplemobiletools.calendar.pro.helpers.*
import com.simplemobiletools.calendar.pro.models.Event import com.simplemobiletools.calendar.pro.models.Event
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.hideKeyboard import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.extensions.sharePathIntent
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
import java.io.File import java.io.File
@@ -26,12 +24,14 @@ fun BaseSimpleActivity.shareEvents(ids: List<Long>) {
} }
val events = eventsDB.getEventsWithIds(ids) as ArrayList<Event> val events = eventsDB.getEventsWithIds(ids) as ArrayList<Event>
IcsExporter().exportEvents(this, file, events, false) { getFileOutputStream(file.toFileDirItem(this), true) {
IcsExporter().exportEvents(this, it, events, false) {
if (it == IcsExporter.ExportResult.EXPORT_OK) { if (it == IcsExporter.ExportResult.EXPORT_OK) {
sharePathIntent(file.absolutePath, BuildConfig.APPLICATION_ID) sharePathIntent(file.absolutePath, BuildConfig.APPLICATION_ID)
} }
} }
} }
}
} }
fun BaseSimpleActivity.getTempFile(): File? { fun BaseSimpleActivity.getTempFile(): File? {

View File

@@ -56,6 +56,7 @@ fun Context.updateWidgets() {
} }
updateListWidget() updateListWidget()
updateDateWidget()
} }
fun Context.updateListWidget() { fun Context.updateListWidget() {
@@ -69,6 +70,17 @@ fun Context.updateListWidget() {
} }
} }
fun Context.updateDateWidget() {
val widgetIDs = AppWidgetManager.getInstance(applicationContext).getAppWidgetIds(ComponentName(applicationContext, MyWidgetDateProvider::class.java))
if (widgetIDs.isNotEmpty()) {
Intent(applicationContext, MyWidgetDateProvider::class.java).apply {
action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, widgetIDs)
sendBroadcast(this)
}
}
}
fun Context.scheduleAllEvents() { fun Context.scheduleAllEvents() {
val events = eventsDB.getEventsAtReboot(getNowSeconds()) val events = eventsDB.getEventsAtReboot(getNowSeconds())
events.forEach { events.forEach {
@@ -262,7 +274,7 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
val builder = NotificationCompat.Builder(this, channelId) val builder = NotificationCompat.Builder(this, channelId)
.setContentTitle(contentTitle) .setContentTitle(contentTitle)
.setContentText(contentText) .setContentText(contentText)
.setSmallIcon(R.drawable.ic_calendar) .setSmallIcon(R.drawable.ic_calendar_vector)
.setContentIntent(pendingIntent) .setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_MAX) .setPriority(NotificationCompat.PRIORITY_MAX)
.setDefaults(Notification.DEFAULT_LIGHTS) .setDefaults(Notification.DEFAULT_LIGHTS)
@@ -513,7 +525,6 @@ fun Context.refreshCalDAVCalendars(ids: String, showToasts: Boolean) {
} }
} }
fun Context.getWidgetFontSize() = when (config.fontSize) { fun Context.getWidgetFontSize() = when (config.fontSize) {
FONT_SIZE_SMALL -> getWidgetSmallFontSize() FONT_SIZE_SMALL -> getWidgetSmallFontSize()
FONT_SIZE_MEDIUM -> getWidgetMediumFontSize() FONT_SIZE_MEDIUM -> getWidgetMediumFontSize()
@@ -525,3 +536,9 @@ fun Context.getWidgetSmallFontSize() = getWidgetMediumFontSize() - 3f
fun Context.getWidgetMediumFontSize() = resources.getDimension(R.dimen.day_text_size) / resources.displayMetrics.density fun Context.getWidgetMediumFontSize() = resources.getDimension(R.dimen.day_text_size) / resources.displayMetrics.density
fun Context.getWidgetLargeFontSize() = getWidgetMediumFontSize() + 3f fun Context.getWidgetLargeFontSize() = getWidgetMediumFontSize() + 3f
fun Context.getWidgetExtraLargeFontSize() = getWidgetMediumFontSize() + 6f fun Context.getWidgetExtraLargeFontSize() = getWidgetMediumFontSize() + 6f
fun Context.getWeeklyViewItemHeight(): Float {
val defaultHeight = resources.getDimension(R.dimen.weekly_view_row_height)
val multiplier = config.weeklyViewItemHeightMultiplier
return defaultHeight * multiplier
}

View File

@@ -6,6 +6,7 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.EventActivity import com.simplemobiletools.calendar.pro.activities.EventActivity
import com.simplemobiletools.calendar.pro.activities.MainActivity import com.simplemobiletools.calendar.pro.activities.MainActivity
@@ -18,6 +19,7 @@ import com.simplemobiletools.calendar.pro.helpers.Formatter
import com.simplemobiletools.calendar.pro.models.Event import com.simplemobiletools.calendar.pro.models.Event
import com.simplemobiletools.calendar.pro.models.ListEvent import com.simplemobiletools.calendar.pro.models.ListEvent
import com.simplemobiletools.calendar.pro.models.ListItem import com.simplemobiletools.calendar.pro.models.ListItem
import com.simplemobiletools.calendar.pro.models.ListSection
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.MONTH_SECONDS import com.simplemobiletools.commons.helpers.MONTH_SECONDS
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
@@ -187,7 +189,13 @@ class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener {
checkEvents() checkEvents()
} }
override fun goToToday() {} override fun goToToday() {
val listItems = context!!.getEventListItems(mEvents)
val firstNonPastSectionIndex = listItems.indexOfFirst { it is ListSection && !it.isPastSection }
if (firstNonPastSectionIndex != -1) {
(mView.calendar_events_list.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(firstNonPastSectionIndex, 0)
}
}
override fun showGoToDateDialog() {} override fun showGoToDateDialog() {}

View File

@@ -1,15 +1,13 @@
package com.simplemobiletools.calendar.pro.fragments package com.simplemobiletools.calendar.pro.fragments
import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.content.res.Resources import android.content.res.Resources
import android.graphics.Rect
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.os.Bundle import android.os.Bundle
import android.os.Handler
import android.util.Range import android.util.Range
import android.view.LayoutInflater import android.view.*
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.RelativeLayout import android.widget.RelativeLayout
import android.widget.TextView import android.widget.TextView
@@ -17,10 +15,7 @@ import androidx.collection.LongSparseArray
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.EventActivity import com.simplemobiletools.calendar.pro.activities.EventActivity
import com.simplemobiletools.calendar.pro.extensions.config import com.simplemobiletools.calendar.pro.extensions.*
import com.simplemobiletools.calendar.pro.extensions.eventsHelper
import com.simplemobiletools.calendar.pro.extensions.seconds
import com.simplemobiletools.calendar.pro.extensions.touch
import com.simplemobiletools.calendar.pro.helpers.* import com.simplemobiletools.calendar.pro.helpers.*
import com.simplemobiletools.calendar.pro.helpers.Formatter import com.simplemobiletools.calendar.pro.helpers.Formatter
import com.simplemobiletools.calendar.pro.interfaces.WeekFragmentListener import com.simplemobiletools.calendar.pro.interfaces.WeekFragmentListener
@@ -31,6 +26,7 @@ import com.simplemobiletools.calendar.pro.views.MyScrollView
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.DAY_SECONDS import com.simplemobiletools.commons.helpers.DAY_SECONDS
import com.simplemobiletools.commons.helpers.WEEK_SECONDS import com.simplemobiletools.commons.helpers.WEEK_SECONDS
import com.simplemobiletools.commons.views.MyTextView
import kotlinx.android.synthetic.main.fragment_week.* import kotlinx.android.synthetic.main.fragment_week.*
import kotlinx.android.synthetic.main.fragment_week.view.* import kotlinx.android.synthetic.main.fragment_week.view.*
import org.joda.time.DateTime import org.joda.time.DateTime
@@ -38,64 +34,95 @@ import org.joda.time.Days
import java.util.* import java.util.*
class WeekFragment : Fragment(), WeeklyCalendar { class WeekFragment : Fragment(), WeeklyCalendar {
private val CLICK_DURATION_THRESHOLD = 150
private val PLUS_FADEOUT_DELAY = 5000L private val PLUS_FADEOUT_DELAY = 5000L
private val MIN_SCALE_FACTOR = 0.3f
private val MAX_SCALE_FACTOR = 5f
private val MIN_SCALE_DIFFERENCE = 0.02f
private val SCALE_RANGE = MAX_SCALE_FACTOR - MIN_SCALE_FACTOR
var mListener: WeekFragmentListener? = null var listener: WeekFragmentListener? = null
private var mWeekTimestamp = 0L private var weekTimestamp = 0L
private var mRowHeight = 0f private var rowHeight = 0f
private var minScrollY = -1
private var maxScrollY = -1
private var todayColumnIndex = -1 private var todayColumnIndex = -1
private var clickStartTime = 0L
private var primaryColor = 0 private var primaryColor = 0
private var lastHash = 0 private var lastHash = 0
private var prevScaleSpanY = 0f
private var scaleCenterPercent = 0f
private var defaultRowHeight = 0f
private var screenHeight = 0
private var rowHeightsAtScale = 0f
private var prevScaleFactor = 0f
private var mWasDestroyed = false private var mWasDestroyed = false
private var isFragmentVisible = false private var isFragmentVisible = false
private var wasFragmentInit = false private var wasFragmentInit = false
private var wasExtraHeightAdded = false private var wasExtraHeightAdded = false
private var dimPastEvents = true private var dimPastEvents = true
private var wasScaled = false
private var selectedGrid: View? = null private var selectedGrid: View? = null
private var currentTimeView: ImageView? = null private var currentTimeView: ImageView? = null
private var events = ArrayList<Event>() private var fadeOutHandler = Handler()
private var allDayHolders = ArrayList<RelativeLayout>() private var allDayHolders = ArrayList<RelativeLayout>()
private var allDayRows = ArrayList<HashSet<Int>>() private var allDayRows = ArrayList<HashSet<Int>>()
private var currEvents = ArrayList<Event>()
private var dayColumns = ArrayList<RelativeLayout>()
private var eventTypeColors = LongSparseArray<Int>() private var eventTypeColors = LongSparseArray<Int>()
private var eventTimeRanges = LinkedHashMap<String, ArrayList<EventWeeklyView>>() private var eventTimeRanges = LinkedHashMap<String, ArrayList<EventWeeklyView>>()
private lateinit var inflater: LayoutInflater private lateinit var inflater: LayoutInflater
private lateinit var mView: View private lateinit var mView: View
private lateinit var mScrollView: MyScrollView private lateinit var scrollView: MyScrollView
private lateinit var mCalendar: WeeklyCalendarImpl private lateinit var res: Resources
private lateinit var mRes: Resources private lateinit var config: Config
private lateinit var mConfig: Config
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
mRes = context!!.resources res = context!!.resources
mConfig = context!!.config config = context!!.config
mRowHeight = mRes.getDimension(R.dimen.weekly_view_row_height) rowHeight = context!!.getWeeklyViewItemHeight()
minScrollY = (mRowHeight * mConfig.startWeeklyAt).toInt() defaultRowHeight = res.getDimension(R.dimen.weekly_view_row_height)
mWeekTimestamp = arguments!!.getLong(WEEK_START_TIMESTAMP) weekTimestamp = arguments!!.getLong(WEEK_START_TIMESTAMP)
dimPastEvents = mConfig.dimPastEvents dimPastEvents = config.dimPastEvents
primaryColor = context!!.getAdjustedPrimaryColor() primaryColor = context!!.getAdjustedPrimaryColor()
allDayRows.add(HashSet()) allDayRows.add(HashSet())
mCalendar = WeeklyCalendarImpl(this, context!!)
} }
@SuppressLint("ClickableViewAccessibility")
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
this.inflater = inflater this.inflater = inflater
mView = inflater.inflate(R.layout.fragment_week, container, false) val fullHeight = context!!.getWeeklyViewItemHeight().toInt() * 24
mScrollView = mView.week_events_scrollview mView = inflater.inflate(R.layout.fragment_week, container, false).apply {
mScrollView.setOnScrollviewListener(object : MyScrollView.ScrollViewListener { scrollView = week_events_scrollview
week_horizontal_grid_holder.layoutParams.height = fullHeight
week_events_columns_holder.layoutParams.height = fullHeight
val scaleDetector = getViewScaleDetector()
scrollView.setOnTouchListener { view, motionEvent ->
scaleDetector.onTouchEvent(motionEvent)
if (motionEvent.action == MotionEvent.ACTION_UP && wasScaled) {
scrollView.isScrollable = true
wasScaled = false
true
} else {
false
}
}
}
addDayColumns()
scrollView.setOnScrollviewListener(object : MyScrollView.ScrollViewListener {
override fun onScrollChanged(scrollView: MyScrollView, x: Int, y: Int, oldx: Int, oldy: Int) { override fun onScrollChanged(scrollView: MyScrollView, x: Int, y: Int, oldx: Int, oldy: Int) {
checkScrollLimits(y) checkScrollLimits(y)
} }
}) })
mScrollView.onGlobalLayout { scrollView.onGlobalLayout {
updateScrollY(Math.max(mListener?.getCurrScrollY() ?: 0, minScrollY)) if (fullHeight < scrollView.height) {
scrollView.layoutParams.height = fullHeight - res.getDimension(R.dimen.one_dp).toInt()
}
val initialScrollY = (rowHeight * config.startWeeklyAt).toInt()
updateScrollY(Math.max(listener?.getCurrScrollY() ?: 0, initialScrollY))
} }
wasFragmentInit = true wasFragmentInit = true
@@ -105,28 +132,13 @@ class WeekFragment : Fragment(), WeeklyCalendar {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
context!!.eventsHelper.getEventTypes(activity!!, false) { context!!.eventsHelper.getEventTypes(activity!!, false) {
it.map { eventTypeColors.put(it.id!!, it.color) } it.map {
eventTypeColors.put(it.id!!, it.color)
}
} }
setupDayLabels() setupDayLabels()
updateCalendar() updateCalendar()
mScrollView.onGlobalLayout {
if (context == null) {
return@onGlobalLayout
}
minScrollY = (mRowHeight * mConfig.startWeeklyAt).toInt()
maxScrollY = (mRowHeight * mConfig.endWeeklyAt).toInt()
val bounds = Rect()
week_events_holder.getGlobalVisibleRect(bounds)
maxScrollY -= bounds.bottom - bounds.top
if (minScrollY > maxScrollY)
maxScrollY = -1
checkScrollLimits(mScrollView.scrollY)
}
} }
override fun onPause() { override fun onPause() {
@@ -143,88 +155,182 @@ class WeekFragment : Fragment(), WeeklyCalendar {
super.setMenuVisibility(menuVisible) super.setMenuVisibility(menuVisible)
isFragmentVisible = menuVisible isFragmentVisible = menuVisible
if (isFragmentVisible && wasFragmentInit) { if (isFragmentVisible && wasFragmentInit) {
mListener?.updateHoursTopMargin(mView.week_top_holder.height) listener?.updateHoursTopMargin(mView.week_top_holder.height)
checkScrollLimits(mScrollView.scrollY) checkScrollLimits(scrollView.scrollY)
// fix some glitches like at swiping from a fully scaled out fragment with all-day events to an empty one
val fullFragmentHeight = (listener?.getFullFragmentHeight() ?: 0) - mView.week_top_holder.height
if (scrollView.height < fullFragmentHeight) {
config.weeklyViewItemHeightMultiplier = fullFragmentHeight / 24 / defaultRowHeight
updateViewScale()
listener?.updateRowHeight(rowHeight.toInt())
}
} }
} }
fun updateCalendar() { fun updateCalendar() {
mCalendar.updateWeeklyCalendar(mWeekTimestamp) if (context != null) {
WeeklyCalendarImpl(this, context!!).updateWeeklyCalendar(weekTimestamp)
}
}
fun updateVisibleDaysCount(count: Int) {
dayColumns.clear()
addDayColumns()
mView.week_horizontal_grid_holder.apply {
daysCount = count
invalidate()
}
addEvents(currEvents)
setupDayLabels()
}
fun updateWeekStartTimestamp(newTimestamp: Long) {
weekTimestamp = newTimestamp
updateCalendar()
}
private fun addDayColumns() {
mView.week_events_columns_holder.removeAllViews()
(0 until config.weeklyViewDays).forEach {
val column = inflater.inflate(R.layout.weekly_view_day_column, mView.week_events_columns_holder, false) as RelativeLayout
column.tag = Formatter.getDayCodeFromTS(weekTimestamp + it * DAY_SECONDS)
mView.week_events_columns_holder.addView(column)
dayColumns.add(column)
}
} }
private fun setupDayLabels() { private fun setupDayLabels() {
var curDay = Formatter.getDateTimeFromTS(mWeekTimestamp) var curDay = Formatter.getDateTimeFromTS(weekTimestamp)
val textColor = mConfig.textColor val textColor = config.textColor
val todayCode = Formatter.getDayCodeFromDateTime(DateTime()) val todayCode = Formatter.getDayCodeFromDateTime(DateTime())
for (i in 0..6) { val screenWidth = context?.usableScreenSize?.x ?: return
val dayWidth = screenWidth / config.weeklyViewDays
val useLongerDayLabels = dayWidth > res.getDimension(R.dimen.weekly_view_min_day_label)
mView.week_letters_holder.removeAllViews()
for (i in 0 until config.weeklyViewDays) {
val dayCode = Formatter.getDayCodeFromDateTime(curDay) val dayCode = Formatter.getDayCodeFromDateTime(curDay)
val dayLetters = mRes.getStringArray(R.array.week_day_letters).toMutableList() as ArrayList<String> val labelIDs = if (useLongerDayLabels) {
R.array.week_days_short
} else {
R.array.week_day_letters
}
val dayLetters = res.getStringArray(labelIDs).toMutableList() as ArrayList<String>
val dayLetter = dayLetters[curDay.dayOfWeek - 1] val dayLetter = dayLetters[curDay.dayOfWeek - 1]
mView.findViewById<TextView>(mRes.getIdentifier("week_day_label_$i", "id", context!!.packageName)).apply { val label = inflater.inflate(R.layout.weekly_view_day_letter, mView.week_letters_holder, false) as MyTextView
text = "$dayLetter\n${curDay.dayOfMonth}" label.text = "$dayLetter\n${curDay.dayOfMonth}"
setTextColor(if (todayCode == dayCode) primaryColor else textColor) label.setTextColor(if (todayCode == dayCode) primaryColor else textColor)
if (todayCode == dayCode) { if (todayCode == dayCode) {
todayColumnIndex = i todayColumnIndex = i
} }
}
mView.week_letters_holder.addView(label)
curDay = curDay.plusDays(1) curDay = curDay.plusDays(1)
} }
} }
private fun checkScrollLimits(y: Int) { private fun checkScrollLimits(y: Int) {
if (minScrollY != -1 && y < minScrollY) { if (isFragmentVisible) {
mScrollView.scrollY = minScrollY listener?.scrollTo(y)
} else if (maxScrollY != -1 && y > maxScrollY) {
mScrollView.scrollY = maxScrollY
} else if (isFragmentVisible) {
mListener?.scrollTo(y)
} }
} }
private fun initGrid() { private fun initGrid() {
(0..6).map { getColumnWithId(it) } (0 until config.weeklyViewDays).mapNotNull { dayColumns.getOrNull(it) }
.forEachIndexed { index, layout -> .forEachIndexed { index, layout ->
layout.removeAllViews() layout.removeAllViews()
val gestureDetector = getViewGestureDetector(layout, index)
layout.setOnTouchListener { view, motionEvent -> layout.setOnTouchListener { view, motionEvent ->
checkGridClick(motionEvent, index, layout) gestureDetector.onTouchEvent(motionEvent)
true true
} }
} }
} }
private fun checkGridClick(event: MotionEvent, index: Int, view: ViewGroup) { private fun getViewGestureDetector(view: ViewGroup, index: Int): GestureDetector {
when (event.action) { return GestureDetector(context, object : GestureDetector.SimpleOnGestureListener() {
MotionEvent.ACTION_DOWN -> clickStartTime = System.currentTimeMillis() override fun onSingleTapUp(event: MotionEvent): Boolean {
MotionEvent.ACTION_UP -> {
if (System.currentTimeMillis() - clickStartTime < CLICK_DURATION_THRESHOLD) {
selectedGrid?.animation?.cancel() selectedGrid?.animation?.cancel()
selectedGrid?.beGone() selectedGrid?.beGone()
val hour = (event.y / mRowHeight).toInt() val hour = (event.y / rowHeight).toInt()
selectedGrid = (inflater.inflate(R.layout.week_grid_item, null, false) as ImageView).apply { selectedGrid = (inflater.inflate(R.layout.week_grid_item, null, false) as ImageView).apply {
view.addView(this) view.addView(this)
background = ColorDrawable(primaryColor) background = ColorDrawable(primaryColor)
layoutParams.width = view.width layoutParams.width = view.width
layoutParams.height = mRowHeight.toInt() layoutParams.height = rowHeight.toInt()
y = hour * mRowHeight y = hour * rowHeight
applyColorFilter(primaryColor.getContrastColor()) applyColorFilter(primaryColor.getContrastColor())
setOnClickListener { setOnClickListener {
val timestamp = mWeekTimestamp + index * DAY_SECONDS + hour * 60 * 60 val timestamp = weekTimestamp + index * DAY_SECONDS + hour * 60 * 60
Intent(context, EventActivity::class.java).apply { Intent(context, EventActivity::class.java).apply {
putExtra(NEW_EVENT_START_TS, timestamp) putExtra(NEW_EVENT_START_TS, timestamp)
putExtra(NEW_EVENT_SET_HOUR_DURATION, true) putExtra(NEW_EVENT_SET_HOUR_DURATION, true)
startActivity(this) startActivity(this)
} }
} }
animate().alpha(0f).setStartDelay(PLUS_FADEOUT_DELAY).withEndAction {
// do not use setStartDelay, it will trigger instantly if the device has disabled animations
fadeOutHandler.removeCallbacksAndMessages(null)
fadeOutHandler.postDelayed({
animate().alpha(0f).withEndAction {
beGone() beGone()
} }
}, PLUS_FADEOUT_DELAY)
} }
return super.onSingleTapUp(event)
} }
})
} }
private fun getViewScaleDetector(): ScaleGestureDetector {
return ScaleGestureDetector(context, object : ScaleGestureDetector.SimpleOnScaleGestureListener() {
override fun onScale(detector: ScaleGestureDetector): Boolean {
val percent = (prevScaleSpanY - detector.currentSpanY) / screenHeight
prevScaleSpanY = detector.currentSpanY
val wantedFactor = config.weeklyViewItemHeightMultiplier - (SCALE_RANGE * percent)
var newFactor = Math.max(Math.min(wantedFactor, MAX_SCALE_FACTOR), MIN_SCALE_FACTOR)
if (scrollView.height > defaultRowHeight * newFactor * 24) {
newFactor = scrollView.height / 24f / defaultRowHeight
} }
if (Math.abs(newFactor - prevScaleFactor) > MIN_SCALE_DIFFERENCE) {
prevScaleFactor = newFactor
config.weeklyViewItemHeightMultiplier = newFactor
updateViewScale()
listener?.updateRowHeight(rowHeight.toInt())
val targetY = rowHeightsAtScale * rowHeight - scaleCenterPercent * getVisibleHeight()
scrollView.scrollTo(0, targetY.toInt())
}
return super.onScale(detector)
}
override fun onScaleBegin(detector: ScaleGestureDetector): Boolean {
scaleCenterPercent = detector.focusY / scrollView.height
rowHeightsAtScale = (scrollView.scrollY + scaleCenterPercent * getVisibleHeight()) / rowHeight
scrollView.isScrollable = false
prevScaleSpanY = detector.currentSpanY
prevScaleFactor = config.weeklyViewItemHeightMultiplier
wasScaled = true
screenHeight = context!!.realScreenSize.y
return super.onScaleBegin(detector)
}
})
}
private fun getVisibleHeight(): Float {
val fullContentHeight = rowHeight * 24
val visibleRatio = scrollView.height / fullContentHeight
return fullContentHeight * visibleRatio
} }
override fun updateWeeklyCalendar(events: ArrayList<Event>) { override fun updateWeeklyCalendar(events: ArrayList<Event>) {
@@ -234,34 +340,47 @@ class WeekFragment : Fragment(), WeeklyCalendar {
} }
lastHash = newHash lastHash = newHash
this.events = events
activity!!.runOnUiThread { activity!!.runOnUiThread {
if (context != null && activity != null && isAdded) { if (context != null && activity != null && isAdded) {
addEvents() val replaceDescription = config.replaceDescription
val sorted = events.sortedWith(
compareBy<Event> { it.startTS }.thenBy { it.endTS }.thenBy { it.title }.thenBy { if (replaceDescription) it.location else it.description }
).toMutableList() as ArrayList<Event>
currEvents = sorted
addEvents(sorted)
} }
} }
} }
private fun addEvents() { private fun updateViewScale() {
rowHeight = context?.getWeeklyViewItemHeight() ?: return
val oneDp = res.getDimension(R.dimen.one_dp).toInt()
val fullHeight = Math.max(rowHeight.toInt() * 24, scrollView.height + oneDp)
scrollView.layoutParams.height = fullHeight - oneDp
mView.week_horizontal_grid_holder.layoutParams.height = fullHeight
mView.week_events_columns_holder.layoutParams.height = fullHeight
addEvents(currEvents)
}
private fun addEvents(events: ArrayList<Event>) {
initGrid() initGrid()
allDayHolders.clear() allDayHolders.clear()
allDayRows.clear() allDayRows.clear()
eventTimeRanges.clear() eventTimeRanges.clear()
allDayRows.add(HashSet()) allDayRows.add(HashSet())
week_all_day_holder?.removeAllViews() week_all_day_holder?.removeAllViews()
addNewLine() addNewLine()
val fullHeight = mRes.getDimension(R.dimen.weekly_view_events_height) val minuteHeight = rowHeight / 60
val minuteHeight = fullHeight / (24 * 60) val minimalHeight = res.getDimension(R.dimen.weekly_view_minimal_event_height).toInt()
val minimalHeight = mRes.getDimension(R.dimen.weekly_view_minimal_event_height).toInt() val density = Math.round(res.displayMetrics.density)
val density = Math.round(context!!.resources.displayMetrics.density)
var hadAllDayEvent = false var hadAllDayEvent = false
val replaceDescription = mConfig.replaceDescription
val sorted = events.sortedWith(compareBy<Event> { it.startTS }.thenBy { it.endTS }.thenBy { it.title }.thenBy { if (replaceDescription) it.location else it.description }) for (event in events) {
for (event in sorted) {
val startDateTime = Formatter.getDateTimeFromTS(event.startTS) val startDateTime = Formatter.getDateTimeFromTS(event.startTS)
val endDateTime = Formatter.getDateTimeFromTS(event.endTS) val endDateTime = Formatter.getDateTimeFromTS(event.endTS)
if (!event.getIsAllDay() && Formatter.getDayCodeFromDateTime(startDateTime) == Formatter.getDayCodeFromDateTime(endDateTime)) { if (!event.getIsAllDay() && Formatter.getDayCodeFromDateTime(startDateTime) == Formatter.getDayCodeFromDateTime(endDateTime)) {
@@ -279,21 +398,23 @@ class WeekFragment : Fragment(), WeeklyCalendar {
} }
} }
for (event in sorted) { for (event in events) {
val startDateTime = Formatter.getDateTimeFromTS(event.startTS) val startDateTime = Formatter.getDateTimeFromTS(event.startTS)
val endDateTime = Formatter.getDateTimeFromTS(event.endTS) val endDateTime = Formatter.getDateTimeFromTS(event.endTS)
if (event.getIsAllDay() || Formatter.getDayCodeFromDateTime(startDateTime) != Formatter.getDayCodeFromDateTime(endDateTime)) { if (event.getIsAllDay() || Formatter.getDayCodeFromDateTime(startDateTime) != Formatter.getDayCodeFromDateTime(endDateTime)) {
hadAllDayEvent = true hadAllDayEvent = true
addAllDayEvent(event) addAllDayEvent(event)
} else { } else {
val dayOfWeek = startDateTime.plusDays(if (mConfig.isSundayFirst) 1 else 0).dayOfWeek - 1 val dayCode = Formatter.getDayCodeFromDateTime(startDateTime)
val layout = getColumnWithId(dayOfWeek) val dayOfWeek = dayColumns.indexOfFirst { it.tag == dayCode }
if (dayOfWeek == -1 || dayOfWeek >= config.weeklyViewDays) {
continue
}
val startMinutes = startDateTime.minuteOfDay val startMinutes = startDateTime.minuteOfDay
val duration = endDateTime.minuteOfDay - startMinutes val duration = endDateTime.minuteOfDay - startMinutes
val range = Range(startMinutes, startMinutes + duration) val range = Range(startMinutes, startMinutes + duration)
val dayCode = Formatter.getDayCodeFromDateTime(startDateTime)
var overlappingEvents = 0 var overlappingEvents = 0
var currentEventOverlapIndex = 0 var currentEventOverlapIndex = 0
var foundCurrentEvent = false var foundCurrentEvent = false
@@ -312,6 +433,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
} }
} }
val dayColumn = dayColumns[dayOfWeek]
(inflater.inflate(R.layout.week_event_marker, null, false) as TextView).apply { (inflater.inflate(R.layout.week_event_marker, null, false) as TextView).apply {
var backgroundColor = eventTypeColors.get(event.eventType, primaryColor) var backgroundColor = eventTypeColors.get(event.eventType, primaryColor)
var textColor = backgroundColor.getContrastColor() var textColor = backgroundColor.getContrastColor()
@@ -324,10 +446,10 @@ class WeekFragment : Fragment(), WeeklyCalendar {
setTextColor(textColor) setTextColor(textColor)
text = event.title text = event.title
contentDescription = text contentDescription = text
layout.addView(this) dayColumn.addView(this)
y = startMinutes * minuteHeight y = startMinutes * minuteHeight
(layoutParams as RelativeLayout.LayoutParams).apply { (layoutParams as RelativeLayout.LayoutParams).apply {
width = layout.width - 1 width = dayColumn.width - 1
width /= Math.max(overlappingEvents, 1) width /= Math.max(overlappingEvents, 1)
if (overlappingEvents > 1) { if (overlappingEvents > 1) {
x = width * currentEventOverlapIndex.toFloat() x = width * currentEventOverlapIndex.toFloat()
@@ -343,7 +465,11 @@ class WeekFragment : Fragment(), WeeklyCalendar {
} }
} }
minHeight = if (event.startTS == event.endTS) minimalHeight else (duration * minuteHeight).toInt() - 1 minHeight = if (event.startTS == event.endTS) {
minimalHeight
} else {
(duration * minuteHeight).toInt() - 1
}
} }
setOnClickListener { setOnClickListener {
Intent(context, EventActivity::class.java).apply { Intent(context, EventActivity::class.java).apply {
@@ -365,29 +491,39 @@ class WeekFragment : Fragment(), WeeklyCalendar {
private fun addNewLine() { private fun addNewLine() {
val allDaysLine = inflater.inflate(R.layout.all_day_events_holder_line, null, false) as RelativeLayout val allDaysLine = inflater.inflate(R.layout.all_day_events_holder_line, null, false) as RelativeLayout
week_all_day_holder.addView(allDaysLine) week_all_day_holder?.addView(allDaysLine)
allDayHolders.add(allDaysLine) allDayHolders.add(allDaysLine)
} }
private fun addCurrentTimeIndicator(minuteHeight: Float) { private fun addCurrentTimeIndicator(minuteHeight: Float) {
if (todayColumnIndex != -1) { if (todayColumnIndex != -1) {
val minutes = DateTime().minuteOfDay val minutes = DateTime().minuteOfDay
val todayColumn = getColumnWithId(todayColumnIndex) if (todayColumnIndex >= dayColumns.size) {
currentTimeView?.alpha = 0f
return
}
if (currentTimeView != null) { if (currentTimeView != null) {
mView.week_events_holder.removeView(currentTimeView) mView.week_events_holder.removeView(currentTimeView)
} }
currentTimeView = (inflater.inflate(R.layout.week_now_marker, null, false) as ImageView) val weeklyViewDays = config.weeklyViewDays
currentTimeView!!.apply { currentTimeView = (inflater.inflate(R.layout.week_now_marker, null, false) as ImageView).apply {
applyColorFilter(primaryColor) applyColorFilter(primaryColor)
mView.week_events_holder.addView(this, 0) mView.week_events_holder.addView(this, 0)
val extraWidth = (todayColumn.width * 0.3).toInt() val extraWidth = res.getDimension(R.dimen.activity_margin).toInt()
val markerHeight = mRes.getDimension(R.dimen.weekly_view_now_height).toInt() val markerHeight = res.getDimension(R.dimen.weekly_view_now_height).toInt()
(layoutParams as RelativeLayout.LayoutParams).apply { (layoutParams as RelativeLayout.LayoutParams).apply {
width = todayColumn.width + extraWidth width = (mView.width / weeklyViewDays) + extraWidth
height = markerHeight height = markerHeight
} }
x = todayColumn.x - extraWidth / 2
x = if (weeklyViewDays == 1) {
0f
} else {
(mView.width / weeklyViewDays * todayColumnIndex).toFloat() - extraWidth / 2f
}
y = minutes * minuteHeight - markerHeight / 2 y = minutes * minuteHeight - markerHeight / 2
} }
} }
@@ -396,7 +532,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
private fun checkTopHolderHeight() { private fun checkTopHolderHeight() {
mView.week_top_holder.onGlobalLayout { mView.week_top_holder.onGlobalLayout {
if (isFragmentVisible && activity != null && !mWasDestroyed) { if (isFragmentVisible && activity != null && !mWasDestroyed) {
mListener?.updateHoursTopMargin(mView.week_top_holder.height) listener?.updateHoursTopMargin(mView.week_top_holder.height)
} }
} }
} }
@@ -418,11 +554,11 @@ class WeekFragment : Fragment(), WeeklyCalendar {
val startDateTime = Formatter.getDateTimeFromTS(event.startTS) val startDateTime = Formatter.getDateTimeFromTS(event.startTS)
val endDateTime = Formatter.getDateTimeFromTS(event.endTS) val endDateTime = Formatter.getDateTimeFromTS(event.endTS)
val minTS = Math.max(startDateTime.seconds(), mWeekTimestamp) val minTS = Math.max(startDateTime.seconds(), weekTimestamp)
val maxTS = Math.min(endDateTime.seconds(), mWeekTimestamp + WEEK_SECONDS) val maxTS = Math.min(endDateTime.seconds(), weekTimestamp + 2 * WEEK_SECONDS)
// fix a visual glitch with all-day events or events lasting multiple days starting at midnight on monday, being shown the previous week too // fix a visual glitch with all-day events or events lasting multiple days starting at midnight on monday, being shown the previous week too
if (minTS == maxTS && (minTS - mWeekTimestamp == WEEK_SECONDS.toLong())) { if (minTS == maxTS && (minTS - weekTimestamp == WEEK_SECONDS.toLong())) {
return return
} }
@@ -430,7 +566,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
val numDays = Days.daysBetween(Formatter.getDateTimeFromTS(minTS).toLocalDate(), Formatter.getDateTimeFromTS(maxTS).toLocalDate()).days val numDays = Days.daysBetween(Formatter.getDateTimeFromTS(minTS).toLocalDate(), Formatter.getDateTimeFromTS(maxTS).toLocalDate()).days
val daysCnt = if (numDays == 1 && isStartTimeDay) 0 else numDays val daysCnt = if (numDays == 1 && isStartTimeDay) 0 else numDays
val startDateTimeInWeek = Formatter.getDateTimeFromTS(minTS) val startDateTimeInWeek = Formatter.getDateTimeFromTS(minTS)
val firstDayIndex = (startDateTimeInWeek.dayOfWeek - if (mConfig.isSundayFirst) 0 else 1) % 7 val firstDayIndex = (startDateTimeInWeek.dayOfWeek - if (config.isSundayFirst) 0 else 1) % 7
var doesEventFit: Boolean var doesEventFit: Boolean
val cnt = allDayRows.size - 1 val cnt = allDayRows.size - 1
@@ -460,16 +596,25 @@ class WeekFragment : Fragment(), WeeklyCalendar {
allDayRows.last().add(dayIndex) allDayRows.last().add(dayIndex)
} }
} }
if (wasEventHandled) { if (wasEventHandled) {
break break
} }
} }
val dayCodeStart = Formatter.getDayCodeFromDateTime(startDateTime).toInt()
val dayCodeEnd = Formatter.getDayCodeFromDateTime(endDateTime).toInt()
val dayOfWeek = dayColumns.indexOfFirst { it.tag.toInt() == dayCodeStart || (it.tag.toInt() > dayCodeStart && it.tag.toInt() <= dayCodeEnd) }
if (dayOfWeek == -1) {
return
}
allDayHolders[drawAtLine].addView(this) allDayHolders[drawAtLine].addView(this)
val dayWidth = mView.width / config.weeklyViewDays
(layoutParams as RelativeLayout.LayoutParams).apply { (layoutParams as RelativeLayout.LayoutParams).apply {
leftMargin = getColumnWithId(firstDayIndex).x.toInt() leftMargin = dayOfWeek * dayWidth
bottomMargin = 1 bottomMargin = 1
width = getColumnWithId(Math.min(firstDayIndex + daysCnt, 6)).right - leftMargin - 1 width = (dayWidth) * (daysCnt + 1)
} }
calculateExtraHeight() calculateExtraHeight()
@@ -488,22 +633,25 @@ class WeekFragment : Fragment(), WeeklyCalendar {
mView.week_top_holder.onGlobalLayout { mView.week_top_holder.onGlobalLayout {
if (activity != null && !mWasDestroyed) { if (activity != null && !mWasDestroyed) {
if (isFragmentVisible) { if (isFragmentVisible) {
mListener?.updateHoursTopMargin(mView.week_top_holder.height) listener?.updateHoursTopMargin(mView.week_top_holder.height)
} }
if (!wasExtraHeightAdded) { if (!wasExtraHeightAdded) {
maxScrollY += mView.week_all_day_holder.height
wasExtraHeightAdded = true wasExtraHeightAdded = true
} }
} }
} }
} }
private fun getColumnWithId(id: Int) = mView.findViewById<ViewGroup>(mRes.getIdentifier("week_column_$id", "id", context!!.packageName))
fun updateScrollY(y: Int) { fun updateScrollY(y: Int) {
if (wasFragmentInit) { if (wasFragmentInit) {
mScrollView.scrollY = y scrollView.scrollY = y
}
}
fun updateNotVisibleViewScaleLevel() {
if (!isFragmentVisible) {
updateViewScale()
} }
} }
} }

View File

@@ -6,22 +6,22 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.DatePicker import android.widget.DatePicker
import android.widget.RelativeLayout
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.MainActivity import com.simplemobiletools.calendar.pro.activities.MainActivity
import com.simplemobiletools.calendar.pro.adapters.MyWeekPagerAdapter import com.simplemobiletools.calendar.pro.adapters.MyWeekPagerAdapter
import com.simplemobiletools.calendar.pro.extensions.config import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.extensions.getWeeklyViewItemHeight
import com.simplemobiletools.calendar.pro.extensions.seconds import com.simplemobiletools.calendar.pro.extensions.seconds
import com.simplemobiletools.calendar.pro.helpers.Formatter import com.simplemobiletools.calendar.pro.helpers.Formatter
import com.simplemobiletools.calendar.pro.helpers.WEEK_START_DATE_TIME import com.simplemobiletools.calendar.pro.helpers.WEEK_START_DATE_TIME
import com.simplemobiletools.calendar.pro.interfaces.WeekFragmentListener import com.simplemobiletools.calendar.pro.interfaces.WeekFragmentListener
import com.simplemobiletools.calendar.pro.views.MyScrollView import com.simplemobiletools.calendar.pro.views.MyScrollView
import com.simplemobiletools.commons.extensions.getDialogTheme import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.extensions.updateActionBarSubtitle
import com.simplemobiletools.commons.extensions.updateActionBarTitle
import com.simplemobiletools.commons.helpers.WEEK_SECONDS import com.simplemobiletools.commons.helpers.WEEK_SECONDS
import com.simplemobiletools.commons.views.MyViewPager import com.simplemobiletools.commons.views.MyViewPager
import kotlinx.android.synthetic.main.fragment_week_holder.view.* import kotlinx.android.synthetic.main.fragment_week_holder.view.*
@@ -29,6 +29,7 @@ import org.joda.time.DateTime
class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener { class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
private val PREFILLED_WEEKS = 151 private val PREFILLED_WEEKS = 151
private val MAX_SEEKBAR_VALUE = 14
private var viewPager: MyViewPager? = null private var viewPager: MyViewPager? = null
private var weekHolder: ViewGroup? = null private var weekHolder: ViewGroup? = null
@@ -48,6 +49,10 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
weekHolder = inflater.inflate(R.layout.fragment_week_holder, container, false) as ViewGroup weekHolder = inflater.inflate(R.layout.fragment_week_holder, container, false) as ViewGroup
weekHolder!!.background = ColorDrawable(context!!.config.backgroundColor) weekHolder!!.background = ColorDrawable(context!!.config.backgroundColor)
val itemHeight = context!!.getWeeklyViewItemHeight().toInt()
weekHolder!!.week_view_hours_holder.setPadding(0, 0, 0, itemHeight)
viewPager = weekHolder!!.week_view_view_pager viewPager = weekHolder!!.week_view_view_pager
viewPager!!.id = (System.currentTimeMillis() % 100000).toInt() viewPager!!.id = (System.currentTimeMillis() % 100000).toInt()
setupFragment() setupFragment()
@@ -57,6 +62,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
private fun setupFragment() { private fun setupFragment() {
val weekTSs = getWeekTimestamps(currentWeekTS) val weekTSs = getWeekTimestamps(currentWeekTS)
val weeklyAdapter = MyWeekPagerAdapter(activity!!.supportFragmentManager, weekTSs, this) val weeklyAdapter = MyWeekPagerAdapter(activity!!.supportFragmentManager, weekTSs, this)
val itemHeight = context!!.getWeeklyViewItemHeight().toInt()
val textColor = context!!.config.textColor val textColor = context!!.config.textColor
weekHolder!!.week_view_hours_holder.removeAllViews() weekHolder!!.week_view_hours_holder.removeAllViews()
@@ -66,6 +72,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
(layoutInflater.inflate(R.layout.weekly_view_hour_textview, null, false) as TextView).apply { (layoutInflater.inflate(R.layout.weekly_view_hour_textview, null, false) as TextView).apply {
text = formattedHours text = formattedHours
setTextColor(textColor) setTextColor(textColor)
height = itemHeight
weekHolder!!.week_view_hours_holder.addView(this) weekHolder!!.week_view_hours_holder.addView(this)
} }
} }
@@ -99,16 +106,38 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
} }
}) })
weekHolder!!.week_view_hours_scrollview.setOnTouchListener { view, motionEvent -> true } weekHolder!!.week_view_hours_scrollview.setOnTouchListener { view, motionEvent -> true }
weekHolder!!.week_view_seekbar.apply {
progress = context?.config?.weeklyViewDays ?: 7
max = MAX_SEEKBAR_VALUE
onSeekBarChangeListener {
if (it == 0) {
progress = 1
}
updateWeeklyViewDays(progress)
}
}
// avoid seekbar width changing if the days count changes to 1, 10 etc
weekHolder!!.week_view_days_count.onGlobalLayout {
weekHolder!!.week_view_seekbar.layoutParams.width = weekHolder!!.week_view_seekbar.width
(weekHolder!!.week_view_seekbar.layoutParams as RelativeLayout.LayoutParams).removeRule(RelativeLayout.START_OF)
}
updateDaysCount(context?.config?.weeklyViewDays ?: 7)
updateActionBarTitle() updateActionBarTitle()
} }
private fun getWeekTimestamps(targetSeconds: Long): List<Long> { private fun getWeekTimestamps(targetSeconds: Long): List<Long> {
val weekTSs = ArrayList<Long>(PREFILLED_WEEKS) val weekTSs = ArrayList<Long>(PREFILLED_WEEKS)
val dateTime = Formatter.getDateTimeFromTS(targetSeconds) val dateTime = Formatter.getDateTimeFromTS(targetSeconds)
var currentWeek = dateTime.minusWeeks(PREFILLED_WEEKS / 2) val shownWeekDays = context!!.config.weeklyViewDays
var currentWeek = dateTime.minusDays(PREFILLED_WEEKS / 2 * shownWeekDays)
for (i in 0 until PREFILLED_WEEKS) { for (i in 0 until PREFILLED_WEEKS) {
weekTSs.add(currentWeek.seconds()) weekTSs.add(currentWeek.seconds())
currentWeek = currentWeek.plusWeeks(1) currentWeek = currentWeek.plusDays(shownWeekDays)
} }
return weekTSs return weekTSs
} }
@@ -122,12 +151,12 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
if (startDateTime.year != DateTime().year) { if (startDateTime.year != DateTime().year) {
newTitle += " - ${startDateTime.year}" newTitle += " - ${startDateTime.year}"
} }
(activity as MainActivity).updateActionBarTitle(newTitle) (activity as AppCompatActivity).updateActionBarTitle(newTitle)
} else { } else {
val endMonthName = Formatter.getMonthName(context!!, endDateTime.monthOfYear) val endMonthName = Formatter.getMonthName(context!!, endDateTime.monthOfYear)
(activity as MainActivity).updateActionBarTitle("$startMonthName - $endMonthName") (activity as AppCompatActivity).updateActionBarTitle("$startMonthName - $endMonthName")
} }
(activity as MainActivity).updateActionBarSubtitle("${getString(R.string.week)} ${startDateTime.plusDays(3).weekOfWeekyear}") (activity as AppCompatActivity).updateActionBarSubtitle("${getString(R.string.week)} ${startDateTime.plusDays(3).weekOfWeekyear}")
} }
override fun goToToday() { override fun goToToday() {
@@ -171,6 +200,16 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
setupFragment() setupFragment()
} }
private fun updateWeeklyViewDays(days: Int) {
context!!.config.weeklyViewDays = days
updateDaysCount(days)
}
private fun updateDaysCount(cnt: Int) {
weekHolder!!.week_view_days_count.text = context!!.resources.getQuantityString(R.plurals.days, cnt, cnt)
(viewPager?.adapter as? MyWeekPagerAdapter)?.updateVisibleDaysCount(viewPager!!.currentItem, cnt, currentWeekTS)
}
override fun refreshEvents() { override fun refreshEvents() {
(viewPager?.adapter as? MyWeekPagerAdapter)?.updateCalendars(viewPager!!.currentItem) (viewPager?.adapter as? MyWeekPagerAdapter)?.updateCalendars(viewPager!!.currentItem)
} }
@@ -196,9 +235,27 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
} }
override fun updateHoursTopMargin(margin: Int) { override fun updateHoursTopMargin(margin: Int) {
weekHolder?.week_view_hours_divider?.layoutParams?.height = margin weekHolder?.apply {
weekHolder?.week_view_hours_scrollview?.requestLayout() week_view_hours_divider?.layoutParams?.height = margin
week_view_hours_scrollview?.requestLayout()
week_view_hours_scrollview?.onGlobalLayout {
week_view_hours_scrollview.scrollY = weekScrollY
}
}
} }
override fun getCurrScrollY() = weekScrollY override fun getCurrScrollY() = weekScrollY
override fun updateRowHeight(rowHeight: Int) {
val childCnt = weekHolder!!.week_view_hours_holder.childCount
for (i in 0..childCnt) {
val textView = weekHolder!!.week_view_hours_holder.getChildAt(i) as? TextView ?: continue
textView.layoutParams.height = rowHeight
}
weekHolder!!.week_view_hours_holder.setPadding(0, 0, 0, rowHeight)
(viewPager!!.adapter as? MyWeekPagerAdapter)?.updateNotVisibleScaleLevel(viewPager!!.currentItem)
}
override fun getFullFragmentHeight() = weekHolder!!.week_view_holder.height - weekHolder!!.week_view_seekbar.height - weekHolder!!.week_view_days_count_divider.height
} }

View File

@@ -4,9 +4,7 @@ import android.annotation.SuppressLint
import android.content.ContentUris import android.content.ContentUris
import android.content.ContentValues import android.content.ContentValues
import android.content.Context import android.content.Context
import android.database.Cursor import android.provider.CalendarContract.*
import android.provider.CalendarContract
import android.provider.CalendarContract.Reminders
import android.util.SparseIntArray import android.util.SparseIntArray
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
@@ -22,6 +20,7 @@ import org.joda.time.format.DateTimeFormat
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
@SuppressLint("MissingPermission")
class CalDAVHelper(val context: Context) { class CalDAVHelper(val context: Context) {
private val eventsHelper = context.eventsHelper private val eventsHelper = context.eventsHelper
@@ -58,45 +57,34 @@ class CalDAVHelper(val context: Context) {
return calendars return calendars
} }
val uri = CalendarContract.Calendars.CONTENT_URI val uri = Calendars.CONTENT_URI
val projection = arrayOf( val projection = arrayOf(
CalendarContract.Calendars._ID, Calendars._ID,
CalendarContract.Calendars.CALENDAR_DISPLAY_NAME, Calendars.CALENDAR_DISPLAY_NAME,
CalendarContract.Calendars.ACCOUNT_NAME, Calendars.ACCOUNT_NAME,
CalendarContract.Calendars.ACCOUNT_TYPE, Calendars.ACCOUNT_TYPE,
CalendarContract.Calendars.OWNER_ACCOUNT, Calendars.OWNER_ACCOUNT,
CalendarContract.Calendars.CALENDAR_COLOR, Calendars.CALENDAR_COLOR,
CalendarContract.Calendars.CALENDAR_ACCESS_LEVEL) Calendars.CALENDAR_ACCESS_LEVEL)
val selection = if (ids.trim().isNotEmpty()) "${CalendarContract.Calendars._ID} IN ($ids)" else null val selection = if (ids.trim().isNotEmpty()) "${Calendars._ID} IN ($ids)" else null
var cursor: Cursor? = null context.queryCursor(uri, projection, selection, showErrors = showToasts) { cursor ->
try { val id = cursor.getIntValue(Calendars._ID)
cursor = context.contentResolver.query(uri, projection, selection, null, null) val displayName = cursor.getStringValue(Calendars.CALENDAR_DISPLAY_NAME)
if (cursor?.moveToFirst() == true) { val accountName = cursor.getStringValue(Calendars.ACCOUNT_NAME)
do { val accountType = cursor.getStringValue(Calendars.ACCOUNT_TYPE)
val id = cursor.getIntValue(CalendarContract.Calendars._ID) val ownerName = cursor.getStringValue(Calendars.OWNER_ACCOUNT) ?: ""
val displayName = cursor.getStringValue(CalendarContract.Calendars.CALENDAR_DISPLAY_NAME) val color = cursor.getIntValue(Calendars.CALENDAR_COLOR)
val accountName = cursor.getStringValue(CalendarContract.Calendars.ACCOUNT_NAME) val accessLevel = cursor.getIntValue(Calendars.CALENDAR_ACCESS_LEVEL)
val accountType = cursor.getStringValue(CalendarContract.Calendars.ACCOUNT_TYPE)
val ownerName = cursor.getStringValue(CalendarContract.Calendars.OWNER_ACCOUNT) ?: ""
val color = cursor.getIntValue(CalendarContract.Calendars.CALENDAR_COLOR)
val accessLevel = cursor.getIntValue(CalendarContract.Calendars.CALENDAR_ACCESS_LEVEL)
val calendar = CalDAVCalendar(id, displayName, accountName, accountType, ownerName, color, accessLevel) val calendar = CalDAVCalendar(id, displayName, accountName, accountType, ownerName, color, accessLevel)
calendars.add(calendar) calendars.add(calendar)
} while (cursor.moveToNext())
}
} catch (e: Exception) {
if (showToasts) {
context.showErrorToast(e)
}
} finally {
cursor?.close()
} }
return calendars return calendars
} }
fun updateCalDAVCalendar(eventType: EventType) { fun updateCalDAVCalendar(eventType: EventType) {
val uri = CalendarContract.Calendars.CONTENT_URI val uri = Calendars.CONTENT_URI
val values = fillCalendarContentValues(eventType) val values = fillCalendarContentValues(eventType)
val newUri = ContentUris.withAppendedId(uri, eventType.caldavCalendarId.toLong()) val newUri = ContentUris.withAppendedId(uri, eventType.caldavCalendarId.toLong())
try { try {
@@ -108,26 +96,23 @@ class CalDAVHelper(val context: Context) {
private fun fillCalendarContentValues(eventType: EventType): ContentValues { private fun fillCalendarContentValues(eventType: EventType): ContentValues {
val colorKey = getEventTypeColorKey(eventType) val colorKey = getEventTypeColorKey(eventType)
return ContentValues().apply { return ContentValues().apply {
put(CalendarContract.Calendars.CALENDAR_COLOR_KEY, colorKey) put(Calendars.CALENDAR_COLOR_KEY, colorKey)
put(CalendarContract.Calendars.CALENDAR_DISPLAY_NAME, eventType.title) put(Calendars.CALENDAR_DISPLAY_NAME, eventType.title)
} }
} }
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
private fun getEventTypeColorKey(eventType: EventType): Int { private fun getEventTypeColorKey(eventType: EventType): Int {
val uri = CalendarContract.Colors.CONTENT_URI val uri = Colors.CONTENT_URI
val projection = arrayOf(CalendarContract.Colors.COLOR_KEY) val projection = arrayOf(Colors.COLOR_KEY)
val selection = "${CalendarContract.Colors.COLOR_TYPE} = ? AND ${CalendarContract.Colors.COLOR} = ? AND ${CalendarContract.Colors.ACCOUNT_NAME} = ?" val selection = "${Colors.COLOR_TYPE} = ? AND ${Colors.COLOR} = ? AND ${Colors.ACCOUNT_NAME} = ?"
val selectionArgs = arrayOf(CalendarContract.Colors.TYPE_CALENDAR.toString(), eventType.color.toString(), eventType.caldavEmail) val selectionArgs = arrayOf(Colors.TYPE_CALENDAR.toString(), eventType.color.toString(), eventType.caldavEmail)
var cursor: Cursor? = null val cursor = context.contentResolver.query(uri, projection, selection, selectionArgs, null)
try { cursor?.use {
cursor = context.contentResolver.query(uri, projection, selection, selectionArgs, null) if (cursor.moveToFirst()) {
if (cursor?.moveToFirst() == true) { return cursor.getStringValue(Colors.COLOR_KEY).toInt()
return cursor.getStringValue(CalendarContract.Colors.COLOR_KEY).toInt()
} }
} finally {
cursor?.close()
} }
return -1 return -1
@@ -136,23 +121,15 @@ class CalDAVHelper(val context: Context) {
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
fun getAvailableCalDAVCalendarColors(eventType: EventType): ArrayList<Int> { fun getAvailableCalDAVCalendarColors(eventType: EventType): ArrayList<Int> {
val colors = SparseIntArray() val colors = SparseIntArray()
val uri = CalendarContract.Colors.CONTENT_URI val uri = Colors.CONTENT_URI
val projection = arrayOf(CalendarContract.Colors.COLOR, CalendarContract.Colors.COLOR_KEY) val projection = arrayOf(Colors.COLOR, Colors.COLOR_KEY)
val selection = "${CalendarContract.Colors.COLOR_TYPE} = ? AND ${CalendarContract.Colors.ACCOUNT_NAME} = ?" val selection = "${Colors.COLOR_TYPE} = ? AND ${Colors.ACCOUNT_NAME} = ?"
val selectionArgs = arrayOf(CalendarContract.Colors.TYPE_CALENDAR.toString(), eventType.caldavEmail) val selectionArgs = arrayOf(Colors.TYPE_CALENDAR.toString(), eventType.caldavEmail)
var cursor: Cursor? = null context.queryCursor(uri, projection, selection, selectionArgs) { cursor ->
try { val colorKey = cursor.getIntValue(Colors.COLOR_KEY)
cursor = context.contentResolver.query(uri, projection, selection, selectionArgs, null) val color = cursor.getIntValue(Colors.COLOR)
if (cursor?.moveToFirst() == true) {
do {
val colorKey = cursor.getIntValue(CalendarContract.Colors.COLOR_KEY)
val color = cursor.getIntValue(CalendarContract.Colors.COLOR)
colors.put(colorKey, color) colors.put(colorKey, color)
} while (cursor.moveToNext())
}
} finally {
cursor?.close()
} }
var sortedColors = ArrayList<Int>(colors.size()) var sortedColors = ArrayList<Int>(colors.size())
@@ -173,50 +150,46 @@ class CalDAVHelper(val context: Context) {
importIdsMap[it.importId] = it importIdsMap[it.importId] = it
} }
val uri = CalendarContract.Events.CONTENT_URI val uri = Events.CONTENT_URI
val projection = arrayOf( val projection = arrayOf(
CalendarContract.Events._ID, Events._ID,
CalendarContract.Events.TITLE, Events.TITLE,
CalendarContract.Events.DESCRIPTION, Events.DESCRIPTION,
CalendarContract.Events.DTSTART, Events.DTSTART,
CalendarContract.Events.DTEND, Events.DTEND,
CalendarContract.Events.DURATION, Events.DURATION,
CalendarContract.Events.EXDATE, Events.EXDATE,
CalendarContract.Events.ALL_DAY, Events.ALL_DAY,
CalendarContract.Events.RRULE, Events.RRULE,
CalendarContract.Events.ORIGINAL_ID, Events.ORIGINAL_ID,
CalendarContract.Events.ORIGINAL_INSTANCE_TIME, Events.ORIGINAL_INSTANCE_TIME,
CalendarContract.Events.EVENT_LOCATION, Events.EVENT_LOCATION,
CalendarContract.Events.EVENT_TIMEZONE, Events.EVENT_TIMEZONE,
CalendarContract.Events.CALENDAR_TIME_ZONE, Events.CALENDAR_TIME_ZONE,
CalendarContract.Events.DELETED) Events.DELETED)
val selection = "${CalendarContract.Events.CALENDAR_ID} = $calendarId" val selection = "${Events.CALENDAR_ID} = $calendarId"
var cursor: Cursor? = null context.queryCursor(uri, projection, selection, showErrors = showToasts) { cursor ->
try { val deleted = cursor.getIntValue(Events.DELETED)
cursor = context.contentResolver.query(uri, projection, selection, null, null)
if (cursor?.moveToFirst() == true) {
do {
val deleted = cursor.getIntValue(CalendarContract.Events.DELETED)
if (deleted == 1) { if (deleted == 1) {
continue return@queryCursor
} }
val id = cursor.getLongValue(CalendarContract.Events._ID) val id = cursor.getLongValue(Events._ID)
val title = cursor.getStringValue(CalendarContract.Events.TITLE) ?: "" val title = cursor.getStringValue(Events.TITLE) ?: ""
val description = cursor.getStringValue(CalendarContract.Events.DESCRIPTION) ?: "" val description = cursor.getStringValue(Events.DESCRIPTION) ?: ""
val startTS = cursor.getLongValue(CalendarContract.Events.DTSTART) / 1000L val startTS = cursor.getLongValue(Events.DTSTART) / 1000L
var endTS = cursor.getLongValue(CalendarContract.Events.DTEND) / 1000L var endTS = cursor.getLongValue(Events.DTEND) / 1000L
val allDay = cursor.getIntValue(CalendarContract.Events.ALL_DAY) val allDay = cursor.getIntValue(Events.ALL_DAY)
val rrule = cursor.getStringValue(CalendarContract.Events.RRULE) ?: "" val rrule = cursor.getStringValue(Events.RRULE) ?: ""
val location = cursor.getStringValue(CalendarContract.Events.EVENT_LOCATION) ?: "" val location = cursor.getStringValue(Events.EVENT_LOCATION) ?: ""
val originalId = cursor.getStringValue(CalendarContract.Events.ORIGINAL_ID) val originalId = cursor.getStringValue(Events.ORIGINAL_ID)
val originalInstanceTime = cursor.getLongValue(CalendarContract.Events.ORIGINAL_INSTANCE_TIME) val originalInstanceTime = cursor.getLongValue(Events.ORIGINAL_INSTANCE_TIME)
val reminders = getCalDAVEventReminders(id) val reminders = getCalDAVEventReminders(id)
val attendees = Gson().toJson(getCalDAVEventAttendees(id)) val attendees = Gson().toJson(getCalDAVEventAttendees(id))
if (endTS == 0L) { if (endTS == 0L) {
val duration = cursor.getStringValue(CalendarContract.Events.DURATION) ?: "" val duration = cursor.getStringValue(Events.DURATION) ?: ""
endTS = startTS + Parser().parseDurationSeconds(duration) endTS = startTS + Parser().parseDurationSeconds(duration)
} }
@@ -224,8 +197,8 @@ class CalDAVHelper(val context: Context) {
val reminder2 = reminders.getOrNull(1) val reminder2 = reminders.getOrNull(1)
val reminder3 = reminders.getOrNull(2) val reminder3 = reminders.getOrNull(2)
val importId = getCalDAVEventImportId(calendarId, id) val importId = getCalDAVEventImportId(calendarId, id)
val eventTimeZone = cursor.getStringValue(CalendarContract.Events.EVENT_TIMEZONE) val eventTimeZone = cursor.getStringValue(Events.EVENT_TIMEZONE)
?: cursor.getStringValue(CalendarContract.Events.CALENDAR_TIME_ZONE) ?: DateTimeZone.getDefault().id ?: cursor.getStringValue(Events.CALENDAR_TIME_ZONE) ?: DateTimeZone.getDefault().id
val source = "$CALDAV-$calendarId" val source = "$CALDAV-$calendarId"
val repeatRule = Parser().parseRepeatInterval(rrule, startTS) val repeatRule = Parser().parseRepeatInterval(rrule, startTS)
@@ -258,12 +231,12 @@ class CalDAVHelper(val context: Context) {
event.parentId = parentEvent.id!! event.parentId = parentEvent.id!!
event.addRepetitionException(originalDayCode) event.addRepetitionException(originalDayCode)
eventsHelper.insertEvent(event, false, false) eventsHelper.insertEvent(event, false, false)
continue return@queryCursor
} }
} }
// some calendars add repeatable event exceptions with using the "exdate" field, not by creating a child event that is an exception // some calendars add repeatable event exceptions with using the "exdate" field, not by creating a child event that is an exception
val exdate = cursor.getStringValue(CalendarContract.Events.EXDATE) ?: "" val exdate = cursor.getStringValue(Events.EXDATE) ?: ""
if (exdate.length > 8) { if (exdate.length > 8) {
val lines = exdate.split("\n") val lines = exdate.split("\n")
for (line in lines) { for (line in lines) {
@@ -310,14 +283,6 @@ class CalDAVHelper(val context: Context) {
eventsHelper.insertEvent(event, false, false) eventsHelper.insertEvent(event, false, false)
} }
} }
} while (cursor.moveToNext())
}
} catch (e: Exception) {
if (showToasts) {
context.showErrorToast(e)
}
} finally {
cursor?.close()
} }
val eventIdsToDelete = ArrayList<Long>() val eventIdsToDelete = ArrayList<Long>()
@@ -335,7 +300,7 @@ class CalDAVHelper(val context: Context) {
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
fun insertCalDAVEvent(event: Event) { fun insertCalDAVEvent(event: Event) {
val uri = CalendarContract.Events.CONTENT_URI val uri = Events.CONTENT_URI
val values = fillEventContentValues(event) val values = fillEventContentValues(event)
val newUri = context.contentResolver.insert(uri, values) val newUri = context.contentResolver.insert(uri, values)
@@ -350,7 +315,7 @@ class CalDAVHelper(val context: Context) {
} }
fun updateCalDAVEvent(event: Event) { fun updateCalDAVEvent(event: Event) {
val uri = CalendarContract.Events.CONTENT_URI val uri = Events.CONTENT_URI
val values = fillEventContentValues(event) val values = fillEventContentValues(event)
val eventRemoteID = event.getCalDAVEventId() val eventRemoteID = event.getCalDAVEventId()
event.importId = getCalDAVEventImportId(event.getCalDAVCalendarId(), eventRemoteID) event.importId = getCalDAVEventImportId(event.getCalDAVCalendarId(), eventRemoteID)
@@ -386,15 +351,15 @@ class CalDAVHelper(val context: Context) {
val attendees = Gson().fromJson<ArrayList<Attendee>>(event.attendees, object : TypeToken<List<Attendee>>() {}.type) ?: ArrayList() val attendees = Gson().fromJson<ArrayList<Attendee>>(event.attendees, object : TypeToken<List<Attendee>>() {}.type) ?: ArrayList()
attendees.forEach { attendees.forEach {
val contentValues = ContentValues().apply { val contentValues = ContentValues().apply {
put(CalendarContract.Attendees.ATTENDEE_NAME, it.name) put(Attendees.ATTENDEE_NAME, it.name)
put(CalendarContract.Attendees.ATTENDEE_EMAIL, it.email) put(Attendees.ATTENDEE_EMAIL, it.email)
put(CalendarContract.Attendees.ATTENDEE_STATUS, it.status) put(Attendees.ATTENDEE_STATUS, it.status)
put(CalendarContract.Attendees.ATTENDEE_RELATIONSHIP, it.relationship) put(Attendees.ATTENDEE_RELATIONSHIP, it.relationship)
put(CalendarContract.Attendees.EVENT_ID, event.getCalDAVEventId()) put(Attendees.EVENT_ID, event.getCalDAVEventId())
} }
try { try {
context.contentResolver.insert(CalendarContract.Attendees.CONTENT_URI, contentValues) context.contentResolver.insert(Attendees.CONTENT_URI, contentValues)
} catch (e: Exception) { } catch (e: Exception) {
context.toast(R.string.unknown_error_occurred) context.toast(R.string.unknown_error_occurred)
} }
@@ -407,31 +372,31 @@ class CalDAVHelper(val context: Context) {
private fun fillEventContentValues(event: Event): ContentValues { private fun fillEventContentValues(event: Event): ContentValues {
return ContentValues().apply { return ContentValues().apply {
put(CalendarContract.Events.CALENDAR_ID, event.getCalDAVCalendarId()) put(Events.CALENDAR_ID, event.getCalDAVCalendarId())
put(CalendarContract.Events.TITLE, event.title) put(Events.TITLE, event.title)
put(CalendarContract.Events.DESCRIPTION, event.description) put(Events.DESCRIPTION, event.description)
put(CalendarContract.Events.DTSTART, event.startTS * 1000L) put(Events.DTSTART, event.startTS * 1000L)
put(CalendarContract.Events.ALL_DAY, if (event.getIsAllDay()) 1 else 0) put(Events.ALL_DAY, if (event.getIsAllDay()) 1 else 0)
put(CalendarContract.Events.EVENT_TIMEZONE, event.getTimeZoneString()) put(Events.EVENT_TIMEZONE, event.getTimeZoneString())
put(CalendarContract.Events.EVENT_LOCATION, event.location) put(Events.EVENT_LOCATION, event.location)
put(CalendarContract.Events.STATUS, CalendarContract.Events.STATUS_CONFIRMED) put(Events.STATUS, Events.STATUS_CONFIRMED)
val repeatRule = Parser().getRepeatCode(event) val repeatRule = Parser().getRepeatCode(event)
if (repeatRule.isEmpty()) { if (repeatRule.isEmpty()) {
putNull(CalendarContract.Events.RRULE) putNull(Events.RRULE)
} else { } else {
put(CalendarContract.Events.RRULE, repeatRule) put(Events.RRULE, repeatRule)
} }
if (event.getIsAllDay() && event.endTS >= event.startTS) if (event.getIsAllDay() && event.endTS >= event.startTS)
event.endTS += DAY event.endTS += DAY
if (event.repeatInterval > 0) { if (event.repeatInterval > 0) {
put(CalendarContract.Events.DURATION, getDurationCode(event)) put(Events.DURATION, getDurationCode(event))
putNull(CalendarContract.Events.DTEND) putNull(Events.DTEND)
} else { } else {
put(CalendarContract.Events.DTEND, event.endTS * 1000L) put(Events.DTEND, event.endTS * 1000L)
putNull(CalendarContract.Events.DURATION) putNull(Events.DURATION)
} }
} }
} }
@@ -443,9 +408,9 @@ class CalDAVHelper(val context: Context) {
} }
private fun clearEventAttendees(event: Event) { private fun clearEventAttendees(event: Event) {
val selection = "${CalendarContract.Attendees.EVENT_ID} = ?" val selection = "${Attendees.EVENT_ID} = ?"
val selectionArgs = arrayOf(event.getCalDAVEventId().toString()) val selectionArgs = arrayOf(event.getCalDAVEventId().toString())
context.contentResolver.delete(CalendarContract.Attendees.CONTENT_URI, selection, selectionArgs) context.contentResolver.delete(Attendees.CONTENT_URI, selection, selectionArgs)
} }
private fun getDurationCode(event: Event): String { private fun getDurationCode(event: Event): String {
@@ -463,7 +428,7 @@ class CalDAVHelper(val context: Context) {
} }
fun deleteCalDAVEvent(event: Event) { fun deleteCalDAVEvent(event: Event) {
val uri = CalendarContract.Events.CONTENT_URI val uri = Events.CONTENT_URI
val contentUri = ContentUris.withAppendedId(uri, event.getCalDAVEventId()) val contentUri = ContentUris.withAppendedId(uri, event.getCalDAVEventId())
try { try {
context.contentResolver.delete(contentUri, null, null) context.contentResolver.delete(contentUri, null, null)
@@ -473,7 +438,7 @@ class CalDAVHelper(val context: Context) {
} }
fun insertEventRepeatException(event: Event, occurrenceTS: Long) { fun insertEventRepeatException(event: Event, occurrenceTS: Long) {
val uri = CalendarContract.Events.CONTENT_URI val uri = Events.CONTENT_URI
val values = fillEventRepeatExceptionValues(event, occurrenceTS) val values = fillEventRepeatExceptionValues(event, occurrenceTS)
try { try {
context.contentResolver.insert(uri, values) context.contentResolver.insert(uri, values)
@@ -485,13 +450,13 @@ class CalDAVHelper(val context: Context) {
private fun fillEventRepeatExceptionValues(event: Event, occurrenceTS: Long): ContentValues { private fun fillEventRepeatExceptionValues(event: Event, occurrenceTS: Long): ContentValues {
return ContentValues().apply { return ContentValues().apply {
put(CalendarContract.Events.CALENDAR_ID, event.getCalDAVCalendarId()) put(Events.CALENDAR_ID, event.getCalDAVCalendarId())
put(CalendarContract.Events.DTSTART, occurrenceTS) put(Events.DTSTART, occurrenceTS)
put(CalendarContract.Events.DTEND, occurrenceTS + (event.endTS - event.startTS)) put(Events.DTEND, occurrenceTS + (event.endTS - event.startTS))
put(CalendarContract.Events.ORIGINAL_ID, event.getCalDAVEventId()) put(Events.ORIGINAL_ID, event.getCalDAVEventId())
put(CalendarContract.Events.EVENT_TIMEZONE, TimeZone.getDefault().id.toString()) put(Events.EVENT_TIMEZONE, TimeZone.getDefault().id.toString())
put(CalendarContract.Events.ORIGINAL_INSTANCE_TIME, occurrenceTS * 1000L) put(Events.ORIGINAL_INSTANCE_TIME, occurrenceTS * 1000L)
put(CalendarContract.Events.EXDATE, Formatter.getDayCodeFromTS(occurrenceTS)) put(Events.EXDATE, Formatter.getDayCodeFromTS(occurrenceTS))
} }
} }
@@ -502,11 +467,8 @@ class CalDAVHelper(val context: Context) {
Reminders.MINUTES, Reminders.MINUTES,
Reminders.METHOD) Reminders.METHOD)
val selection = "${Reminders.EVENT_ID} = $eventId" val selection = "${Reminders.EVENT_ID} = $eventId"
var cursor: Cursor? = null
try { context.queryCursor(uri, projection, selection) { cursor ->
cursor = context.contentResolver.query(uri, projection, selection, null, null)
if (cursor?.moveToFirst() == true) {
do {
val minutes = cursor.getIntValue(Reminders.MINUTES) val minutes = cursor.getIntValue(Reminders.MINUTES)
val method = cursor.getIntValue(Reminders.METHOD) val method = cursor.getIntValue(Reminders.METHOD)
if (method == Reminders.METHOD_ALERT || method == Reminders.METHOD_EMAIL) { if (method == Reminders.METHOD_ALERT || method == Reminders.METHOD_EMAIL) {
@@ -514,39 +476,29 @@ class CalDAVHelper(val context: Context) {
val reminder = Reminder(minutes, type) val reminder = Reminder(minutes, type)
reminders.add(reminder) reminders.add(reminder)
} }
} while (cursor.moveToNext())
}
} finally {
cursor?.close()
} }
return reminders.sortedBy { it.minutes } return reminders.sortedBy { it.minutes }
} }
private fun getCalDAVEventAttendees(eventId: Long): List<Attendee> { private fun getCalDAVEventAttendees(eventId: Long): List<Attendee> {
val attendees = ArrayList<Attendee>() val attendees = ArrayList<Attendee>()
val uri = CalendarContract.Attendees.CONTENT_URI val uri = Attendees.CONTENT_URI
val projection = arrayOf( val projection = arrayOf(
CalendarContract.Attendees.ATTENDEE_NAME, Attendees.ATTENDEE_NAME,
CalendarContract.Attendees.ATTENDEE_EMAIL, Attendees.ATTENDEE_EMAIL,
CalendarContract.Attendees.ATTENDEE_STATUS, Attendees.ATTENDEE_STATUS,
CalendarContract.Attendees.ATTENDEE_RELATIONSHIP) Attendees.ATTENDEE_RELATIONSHIP)
val selection = "${CalendarContract.Attendees.EVENT_ID} = $eventId" val selection = "${Attendees.EVENT_ID} = $eventId"
var cursor: Cursor? = null context.queryCursor(uri, projection, selection) { cursor ->
try { val name = cursor.getStringValue(Attendees.ATTENDEE_NAME) ?: ""
cursor = context.contentResolver.query(uri, projection, selection, null, null) val email = cursor.getStringValue(Attendees.ATTENDEE_EMAIL) ?: ""
if (cursor?.moveToFirst() == true) { val status = cursor.getIntValue(Attendees.ATTENDEE_STATUS)
do { val relationship = cursor.getIntValue(Attendees.ATTENDEE_RELATIONSHIP)
val name = cursor.getStringValue(CalendarContract.Attendees.ATTENDEE_NAME) ?: ""
val email = cursor.getStringValue(CalendarContract.Attendees.ATTENDEE_EMAIL) ?: ""
val status = cursor.getIntValue(CalendarContract.Attendees.ATTENDEE_STATUS)
val relationship = cursor.getIntValue(CalendarContract.Attendees.ATTENDEE_RELATIONSHIP)
val attendee = Attendee(0, name, email, status, "", false, relationship) val attendee = Attendee(0, name, email, status, "", false, relationship)
attendees.add(attendee) attendees.add(attendee)
} while (cursor.moveToNext())
}
} finally {
cursor?.close()
} }
return attendees return attendees
} }

View File

@@ -24,10 +24,6 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getInt(START_WEEKLY_AT, 7) get() = prefs.getInt(START_WEEKLY_AT, 7)
set(startWeeklyAt) = prefs.edit().putInt(START_WEEKLY_AT, startWeeklyAt).apply() set(startWeeklyAt) = prefs.edit().putInt(START_WEEKLY_AT, startWeeklyAt).apply()
var endWeeklyAt: Int
get() = prefs.getInt(END_WEEKLY_AT, 23)
set(endWeeklyAt) = prefs.edit().putInt(END_WEEKLY_AT, endWeeklyAt).apply()
var vibrateOnReminder: Boolean var vibrateOnReminder: Boolean
get() = prefs.getBoolean(VIBRATE, false) get() = prefs.getBoolean(VIBRATE, false)
set(vibrate) = prefs.edit().putBoolean(VIBRATE, vibrate).apply() set(vibrate) = prefs.edit().putBoolean(VIBRATE, vibrate).apply()
@@ -174,4 +170,20 @@ class Config(context: Context) : BaseConfig(context) {
var allowChangingTimeZones: Boolean var allowChangingTimeZones: Boolean
get() = prefs.getBoolean(ALLOW_CHANGING_TIME_ZONES, false) get() = prefs.getBoolean(ALLOW_CHANGING_TIME_ZONES, false)
set(allowChangingTimeZones) = prefs.edit().putBoolean(ALLOW_CHANGING_TIME_ZONES, allowChangingTimeZones).apply() set(allowChangingTimeZones) = prefs.edit().putBoolean(ALLOW_CHANGING_TIME_ZONES, allowChangingTimeZones).apply()
var lastExportPath: String
get() = prefs.getString(LAST_EXPORT_PATH, "")!!
set(lastExportPath) = prefs.edit().putString(LAST_EXPORT_PATH, lastExportPath).apply()
var exportPastEvents: Boolean
get() = prefs.getBoolean(EXPORT_PAST_EVENTS, false)
set(exportPastEvents) = prefs.edit().putBoolean(EXPORT_PAST_EVENTS, exportPastEvents).apply()
var weeklyViewItemHeightMultiplier: Float
get() = prefs.getFloat(WEEKLY_VIEW_ITEM_HEIGHT_MULTIPLIER, 1f)
set(weeklyViewItemHeightMultiplier) = prefs.edit().putFloat(WEEKLY_VIEW_ITEM_HEIGHT_MULTIPLIER, weeklyViewItemHeightMultiplier).apply()
var weeklyViewDays: Int
get() = prefs.getInt(WEEKLY_VIEW_DAYS, 7)
set(weeklyViewDays) = prefs.edit().putInt(WEEKLY_VIEW_DAYS, weeklyViewDays).apply()
} }

View File

@@ -41,7 +41,6 @@ const val YEAR = 31536000
// Shared Preferences // Shared Preferences
const val WEEK_NUMBERS = "week_numbers" const val WEEK_NUMBERS = "week_numbers"
const val START_WEEKLY_AT = "start_weekly_at" const val START_WEEKLY_AT = "start_weekly_at"
const val END_WEEKLY_AT = "end_weekly_at"
const val VIBRATE = "vibrate" const val VIBRATE = "vibrate"
const val REMINDER_SOUND_URI = "reminder_sound_uri" const val REMINDER_SOUND_URI = "reminder_sound_uri"
const val REMINDER_SOUND_TITLE = "reminder_sound_title" const val REMINDER_SOUND_TITLE = "reminder_sound_title"
@@ -73,6 +72,10 @@ const val DEFAULT_START_TIME = "default_start_time"
const val DEFAULT_DURATION = "default_duration" const val DEFAULT_DURATION = "default_duration"
const val DEFAULT_EVENT_TYPE_ID = "default_event_type_id" const val DEFAULT_EVENT_TYPE_ID = "default_event_type_id"
const val ALLOW_CHANGING_TIME_ZONES = "allow_changing_time_zones" const val ALLOW_CHANGING_TIME_ZONES = "allow_changing_time_zones"
const val LAST_EXPORT_PATH = "last_export_path"
const val EXPORT_PAST_EVENTS = "export_past_events"
const val WEEKLY_VIEW_ITEM_HEIGHT_MULTIPLIER = "weekly_view_item_height_multiplier"
const val WEEKLY_VIEW_DAYS = "weekly_view_days"
// repeat_rule for monthly and yearly repetition // repeat_rule for monthly and yearly repetition
const val REPEAT_SAME_DAY = 1 // i.e. 25th every month, or 3rd june (if yearly repetition) const val REPEAT_SAME_DAY = 1 // i.e. 25th every month, or 3rd june (if yearly repetition)

View File

@@ -3,7 +3,6 @@ package com.simplemobiletools.calendar.pro.helpers
import android.app.Activity import android.app.Activity
import android.content.Context import android.content.Context
import androidx.collection.LongSparseArray import androidx.collection.LongSparseArray
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.extensions.* import com.simplemobiletools.calendar.pro.extensions.*
import com.simplemobiletools.calendar.pro.models.Event import com.simplemobiletools.calendar.pro.models.Event
import com.simplemobiletools.calendar.pro.models.EventType import com.simplemobiletools.calendar.pro.models.EventType
@@ -203,6 +202,17 @@ class EventsHelper(val context: Context) {
val events = eventsDB.getEventsForSearch(searchQuery) val events = eventsDB.getEventsForSearch(searchQuery)
val displayEventTypes = config.displayEventTypes val displayEventTypes = config.displayEventTypes
val filteredEvents = events.filter { displayEventTypes.contains(it.eventType.toString()) } val filteredEvents = events.filter { displayEventTypes.contains(it.eventType.toString()) }
val eventTypeColors = LongSparseArray<Int>()
eventTypesDB.getEventTypes().forEach {
eventTypeColors.put(it.id!!, it.color)
}
filteredEvents.forEach {
it.updateIsPastEvent()
it.color = eventTypeColors.get(it.eventType) ?: config.primaryColor
}
activity.runOnUiThread { activity.runOnUiThread {
callback(text, filteredEvents) callback(text, filteredEvents)
} }
@@ -261,10 +271,9 @@ class EventsHelper(val context: Context) {
eventTypeColors.put(it.id!!, it.color) eventTypeColors.put(it.id!!, it.color)
} }
val primaryColor = context.resources.getColor(R.color.color_primary)
events.forEach { events.forEach {
it.updateIsPastEvent() it.updateIsPastEvent()
it.color = eventTypeColors.get(it.eventType) ?: primaryColor it.color = eventTypeColors.get(it.eventType) ?: config.primaryColor
} }
callback(events) callback(events)
@@ -401,10 +410,10 @@ class EventsHelper(val context: Context) {
return events return events
} }
fun getEventsToExport(includePast: Boolean, eventTypes: ArrayList<Long>): ArrayList<Event> { fun getEventsToExport(eventTypes: ArrayList<Long>): ArrayList<Event> {
val currTS = getNowSeconds() val currTS = getNowSeconds()
var events = ArrayList<Event>() var events = ArrayList<Event>()
if (includePast) { if (config.exportPastEvents) {
events.addAll(eventsDB.getAllEventsWithTypes(eventTypes)) events.addAll(eventsDB.getAllEventsWithTypes(eventTypes))
} else { } else {
events.addAll(eventsDB.getOneTimeFutureEventsWithTypes(currTS, eventTypes)) events.addAll(eventsDB.getOneTimeFutureEventsWithTypes(currTS, eventTypes))

View File

@@ -13,6 +13,7 @@ object Formatter {
const val DAYCODE_PATTERN = "YYYYMMdd" const val DAYCODE_PATTERN = "YYYYMMdd"
const val YEAR_PATTERN = "YYYY" const val YEAR_PATTERN = "YYYY"
const val TIME_PATTERN = "HHmmss" const val TIME_PATTERN = "HHmmss"
private const val MONTH_PATTERN = "MMM"
private const val DAY_PATTERN = "d" private const val DAY_PATTERN = "d"
private const val DAY_OF_WEEK_PATTERN = "EEE" private const val DAY_OF_WEEK_PATTERN = "EEE"
private const val LONGEST_PATTERN = "MMMM d YYYY (EEEE)" private const val LONGEST_PATTERN = "MMMM d YYYY (EEEE)"
@@ -60,6 +61,10 @@ object Formatter {
fun getTodayCode() = getDayCodeFromTS(getNowSeconds()) fun getTodayCode() = getDayCodeFromTS(getNowSeconds())
fun getTodayDayNumber() = getDateTimeFromTS(getNowSeconds()).toString(DAY_PATTERN)
fun getCurrentMonthShort() = getDateTimeFromTS(getNowSeconds()).toString(MONTH_PATTERN)
fun getHours(context: Context, dateTime: DateTime) = dateTime.toString(getHourPattern(context)) fun getHours(context: Context, dateTime: DateTime) = dateTime.toString(getHourPattern(context))
fun getTime(context: Context, dateTime: DateTime) = dateTime.toString(getTimePattern(context)) fun getTime(context: Context, dateTime: DateTime) = dateTime.toString(getTimePattern(context))

View File

@@ -7,13 +7,11 @@ import com.simplemobiletools.calendar.pro.helpers.IcsExporter.ExportResult.*
import com.simplemobiletools.calendar.pro.models.CalDAVCalendar import com.simplemobiletools.calendar.pro.models.CalDAVCalendar
import com.simplemobiletools.calendar.pro.models.Event import com.simplemobiletools.calendar.pro.models.Event
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.getFileOutputStream
import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.extensions.writeLn import com.simplemobiletools.commons.extensions.writeLn
import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.models.FileDirItem
import java.io.BufferedWriter import java.io.BufferedWriter
import java.io.File import java.io.OutputStream
class IcsExporter { class IcsExporter {
enum class ExportResult { enum class ExportResult {
@@ -24,12 +22,10 @@ class IcsExporter {
private var eventsFailed = 0 private var eventsFailed = 0
private var calendars = ArrayList<CalDAVCalendar>() private var calendars = ArrayList<CalDAVCalendar>()
fun exportEvents(activity: BaseSimpleActivity, file: File, events: ArrayList<Event>, showExportingToast: Boolean, callback: (result: ExportResult) -> Unit) { fun exportEvents(activity: BaseSimpleActivity, outputStream: OutputStream?, events: ArrayList<Event>, showExportingToast: Boolean, callback: (result: ExportResult) -> Unit) {
val fileDirItem = FileDirItem(file.absolutePath, file.name) if (outputStream == null) {
activity.getFileOutputStream(fileDirItem, true) {
if (it == null) {
callback(EXPORT_FAIL) callback(EXPORT_FAIL)
return@getFileOutputStream return
} }
ensureBackgroundThread { ensureBackgroundThread {
@@ -38,7 +34,7 @@ class IcsExporter {
activity.toast(R.string.exporting) activity.toast(R.string.exporting)
} }
it.bufferedWriter().use { out -> outputStream.bufferedWriter().use { out ->
out.writeLn(BEGIN_CALENDAR) out.writeLn(BEGIN_CALENDAR)
out.writeLn(CALENDAR_PRODID) out.writeLn(CALENDAR_PRODID)
out.writeLn(CALENDAR_VERSION) out.writeLn(CALENDAR_VERSION)
@@ -79,7 +75,6 @@ class IcsExporter {
}) })
} }
} }
}
private fun fillReminders(event: Event, out: BufferedWriter) { private fun fillReminders(event: Event, out: BufferedWriter) {
event.getReminders().forEach { event.getReminders().forEach {

View File

@@ -1,6 +1,5 @@
package com.simplemobiletools.calendar.pro.helpers package com.simplemobiletools.calendar.pro.helpers
import android.widget.Toast
import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.SimpleActivity import com.simplemobiletools.calendar.pro.activities.SimpleActivity
import com.simplemobiletools.calendar.pro.extensions.eventsDB import com.simplemobiletools.calendar.pro.extensions.eventsDB
@@ -110,7 +109,7 @@ class IcsImporter(val activity: SimpleActivity) {
curImportId = line.substring(UID.length).trim() curImportId = line.substring(UID.length).trim()
} else if (line.startsWith(RRULE)) { } else if (line.startsWith(RRULE)) {
curRrule = line.substring(RRULE.length) curRrule = line.substring(RRULE.length)
// some RRULRs need to know the events start datetime. If it's yet unknown, postpone RRULE parsing // some RRULEs need to know the events start datetime. If it's yet unknown, postpone RRULE parsing
if (curStart != -1L) { if (curStart != -1L) {
parseRepeatRule() parseRepeatRule()
} }
@@ -227,7 +226,7 @@ class IcsImporter(val activity: SimpleActivity) {
eventsHelper.insertEvents(eventsToInsert, true) eventsHelper.insertEvents(eventsToInsert, true)
} catch (e: Exception) { } catch (e: Exception) {
activity.showErrorToast(e, Toast.LENGTH_LONG) activity.showErrorToast(e)
eventsFailed++ eventsFailed++
} }
@@ -248,7 +247,9 @@ class IcsImporter(val activity: SimpleActivity) {
return try { return try {
if (fullString.startsWith(';')) { if (fullString.startsWith(';')) {
val value = fullString.substring(fullString.lastIndexOf(':') + 1).replace(" ", "") val value = fullString.substring(fullString.lastIndexOf(':') + 1).replace(" ", "")
if (!value.contains("T")) { if (value.isEmpty()) {
return 0
} else if (!value.contains("T")) {
curFlags = curFlags or FLAG_ALL_DAY curFlags = curFlags or FLAG_ALL_DAY
} }
@@ -257,7 +258,7 @@ class IcsImporter(val activity: SimpleActivity) {
Parser().parseDateTimeValue(fullString.substring(1)) Parser().parseDateTimeValue(fullString.substring(1))
} }
} catch (e: Exception) { } catch (e: Exception) {
activity.showErrorToast(e, Toast.LENGTH_LONG) activity.showErrorToast(e)
eventsFailed++ eventsFailed++
-1 -1
} }

View File

@@ -0,0 +1,46 @@
package com.simplemobiletools.calendar.pro.helpers
import android.app.PendingIntent
import android.appwidget.AppWidgetManager
import android.appwidget.AppWidgetProvider
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.widget.RemoteViews
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.SplashActivity
import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.commons.extensions.applyColorFilter
import com.simplemobiletools.commons.extensions.getLaunchIntent
import com.simplemobiletools.commons.extensions.setText
class MyWidgetDateProvider : AppWidgetProvider() {
private val OPEN_APP_INTENT_ID = 1
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach {
RemoteViews(context.packageName, R.layout.widget_date).apply {
applyColorFilter(R.id.widget_date_background, context.config.widgetBgColor)
setText(R.id.widget_date_label, Formatter.getTodayDayNumber())
setText(R.id.widget_month_label, Formatter.getCurrentMonthShort())
setTextColor(R.id.widget_date_label, context.config.widgetTextColor)
setTextColor(R.id.widget_month_label, context.config.widgetTextColor)
setupAppOpenIntent(context, this)
appWidgetManager.updateAppWidget(it, this)
}
appWidgetManager.notifyAppWidgetViewDataChanged(it, R.id.widget_date_holder)
}
}
private fun getComponentName(context: Context) = ComponentName(context, MyWidgetDateProvider::class.java)
private fun setupAppOpenIntent(context: Context, views: RemoteViews) {
(context.getLaunchIntent() ?: Intent(context, SplashActivity::class.java)).apply {
val pendingIntent = PendingIntent.getActivity(context, OPEN_APP_INTENT_ID, this, PendingIntent.FLAG_UPDATE_CURRENT)
views.setOnClickPendingIntent(R.id.widget_date_holder, pendingIntent)
}
}
}

View File

@@ -34,7 +34,7 @@ class MyWidgetListProvider : AppWidgetProvider() {
val appWidgetManager = AppWidgetManager.getInstance(context) val appWidgetManager = AppWidgetManager.getInstance(context)
appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach { appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach {
val views = RemoteViews(context.packageName, R.layout.widget_event_list).apply { val views = RemoteViews(context.packageName, R.layout.widget_event_list).apply {
setBackgroundColor(R.id.widget_event_list_holder, context.config.widgetBgColor) applyColorFilter(R.id.widget_event_list_background, context.config.widgetBgColor)
setTextColor(R.id.widget_event_list_empty, textColor) setTextColor(R.id.widget_event_list_empty, textColor)
setTextSize(R.id.widget_event_list_empty, fontSize) setTextSize(R.id.widget_event_list_empty, fontSize)

View File

@@ -172,7 +172,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
val views = RemoteViews(context.packageName, R.layout.fragment_month_widget) val views = RemoteViews(context.packageName, R.layout.fragment_month_widget)
views.setText(R.id.top_value, month) views.setText(R.id.top_value, month)
views.setBackgroundColor(R.id.calendar_holder, context.config.widgetBgColor) views.applyColorFilter(R.id.widget_month_background, context.config.widgetBgColor)
views.setTextColor(R.id.top_value, textColor) views.setTextColor(R.id.top_value, textColor)
views.setTextSize(R.id.top_value, largerFontSize) views.setTextSize(R.id.top_value, largerFontSize)

View File

@@ -40,6 +40,12 @@ class Parser {
if (interval.areDigitsOnly() && interval.toInt() % 7 == 0) { if (interval.areDigitsOnly() && interval.toInt() % 7 == 0) {
val dateTime = Formatter.getDateTimeFromTS(startTS) val dateTime = Formatter.getDateTimeFromTS(startTS)
repeatRule = Math.pow(2.0, (dateTime.dayOfWeek - 1).toDouble()).toInt() repeatRule = Math.pow(2.0, (dateTime.dayOfWeek - 1).toDouble()).toInt()
} else if (fullString.contains("BYDAY")) {
// some services use weekly repetition for repeating on specific week days, some use daily
// make these produce the same result
// RRULE:FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR
// RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR
repeatInterval = WEEK_SECONDS
} }
} }
} else if (key == COUNT) { } else if (key == COUNT) {
@@ -54,10 +60,12 @@ class Parser {
} else if (repeatInterval.isXMonthlyRepetition() || repeatInterval.isXYearlyRepetition()) { } else if (repeatInterval.isXMonthlyRepetition() || repeatInterval.isXYearlyRepetition()) {
repeatRule = if (value.startsWith("-1")) REPEAT_ORDER_WEEKDAY_USE_LAST else REPEAT_ORDER_WEEKDAY repeatRule = if (value.startsWith("-1")) REPEAT_ORDER_WEEKDAY_USE_LAST else REPEAT_ORDER_WEEKDAY
} }
} else if (key == BYMONTHDAY && value.toInt() == -1) { } else if (key == BYMONTHDAY) {
if (value.split(",").any { it.toInt() == -1 }) {
repeatRule = REPEAT_LAST_DAY repeatRule = REPEAT_LAST_DAY
} }
} }
}
return EventRepetition(repeatInterval, repeatRule, repeatLimit) return EventRepetition(repeatInterval, repeatRule, repeatLimit)
} }

View File

@@ -11,7 +11,7 @@ class WeeklyCalendarImpl(val callback: WeeklyCalendar, val context: Context) {
var mEvents = ArrayList<Event>() var mEvents = ArrayList<Event>()
fun updateWeeklyCalendar(weekStartTS: Long) { fun updateWeeklyCalendar(weekStartTS: Long) {
val endTS = weekStartTS + WEEK_SECONDS val endTS = weekStartTS + 2 * WEEK_SECONDS
context.eventsHelper.getEvents(weekStartTS, endTS) { context.eventsHelper.getEvents(weekStartTS, endTS) {
mEvents = it mEvents = it
callback.updateWeeklyCalendar(it) callback.updateWeeklyCalendar(it)

View File

@@ -6,4 +6,8 @@ interface WeekFragmentListener {
fun updateHoursTopMargin(margin: Int) fun updateHoursTopMargin(margin: Int)
fun getCurrScrollY(): Int fun getCurrScrollY(): Int
fun updateRowHeight(rowHeight: Int)
fun getFullFragmentHeight(): Int
} }

View File

@@ -2,9 +2,12 @@ package com.simplemobiletools.calendar.pro.views
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.view.MotionEvent
import android.widget.ScrollView import android.widget.ScrollView
class MyScrollView : ScrollView { class MyScrollView : ScrollView {
var isScrollable = true
constructor(context: Context) : super(context) constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
@@ -22,6 +25,22 @@ class MyScrollView : ScrollView {
scrollViewListener?.onScrollChanged(this, x, y, oldx, oldy) scrollViewListener?.onScrollChanged(this, x, y, oldx, oldy)
} }
override fun onTouchEvent(event: MotionEvent): Boolean {
return if (isScrollable) {
super.onTouchEvent(event)
} else {
true
}
}
override fun onInterceptTouchEvent(event: MotionEvent): Boolean {
return if (isScrollable) {
super.onInterceptTouchEvent(event)
} else {
false
}
}
interface ScrollViewListener { interface ScrollViewListener {
fun onScrollChanged(scrollView: MyScrollView, x: Int, y: Int, oldx: Int, oldy: Int) fun onScrollChanged(scrollView: MyScrollView, x: Int, y: Int, oldx: Int, oldy: Int)
} }

View File

@@ -79,11 +79,11 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
for (y in 1..6) { for (y in 1..6) {
for (x in 1..7) { for (x in 1..7) {
if (curId in 1..days) { if (curId in 1..days) {
canvas.drawText(curId.toString(), x * dayWidth, y * dayWidth, getPaint(curId)) canvas.drawText(curId.toString(), x * dayWidth - (dayWidth / 4), y * dayWidth, getPaint(curId))
if (curId == todaysId) { if (curId == todaysId) {
val dividerConstant = if (isLandscape) 6 else 4 val dividerConstant = if (isLandscape) 6 else 4
canvas.drawCircle(x * dayWidth - dayWidth / dividerConstant, y * dayWidth - dayWidth / dividerConstant, dayWidth * 0.41f, todayCirclePaint) canvas.drawCircle(x * dayWidth - dayWidth / 2, y * dayWidth - dayWidth / dividerConstant, dayWidth * 0.41f, todayCirclePaint)
} }
} }
curId++ curId++

View File

@@ -6,11 +6,13 @@ import android.graphics.Paint
import android.util.AttributeSet import android.util.AttributeSet
import android.view.View import android.view.View
import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.extensions.getWeeklyViewItemHeight
class WeeklyViewGrid(context: Context, attrs: AttributeSet, defStyle: Int) : View(context, attrs, defStyle) { class WeeklyViewGrid(context: Context, attrs: AttributeSet, defStyle: Int) : View(context, attrs, defStyle) {
private val ROWS_CNT = 24 private val ROWS_CNT = 24
private val COLS_CNT = 7
private var paint = Paint(Paint.ANTI_ALIAS_FLAG) private var paint = Paint(Paint.ANTI_ALIAS_FLAG)
var daysCount = context.config.weeklyViewDays
constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0) constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0)
@@ -20,14 +22,14 @@ class WeeklyViewGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
override fun onDraw(canvas: Canvas) { override fun onDraw(canvas: Canvas) {
super.onDraw(canvas) super.onDraw(canvas)
val rowHeight = height / ROWS_CNT.toFloat() val rowHeight = context.getWeeklyViewItemHeight()
for (i in 0 until ROWS_CNT) { for (i in 0 until ROWS_CNT) {
val y = rowHeight * i.toFloat() val y = rowHeight * i.toFloat()
canvas.drawLine(0f, y, width.toFloat(), y, paint) canvas.drawLine(0f, y, width.toFloat(), y, paint)
} }
val rowWidth = width / COLS_CNT.toFloat() val rowWidth = width / daysCount.toFloat()
for (i in 0 until COLS_CNT) { for (i in 0 until daysCount) {
val x = rowWidth * i.toFloat() val x = rowWidth * i.toFloat()
canvas.drawLine(x, 0f, x, height.toFloat(), paint) canvas.drawLine(x, 0f, x, height.toFloat(), paint)
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/attendee_circular_background">
<shape android:shape="oval">
<solid android:color="@color/color_primary"/>
</shape>
</item>
<item
android:bottom="@dimen/medium_margin"
android:drawable="@drawable/ic_person_vector"
android:left="@dimen/medium_margin"
android:right="@dimen/medium_margin"
android:top="@dimen/medium_margin"/>
</layer-list>

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M15.41,7.41L14,6l-6,6 6,6 1.41,-1.41L10.83,12z"/>
</vector>

View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"/>
</vector>

View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M16,11c1.66,0 2.99,-1.34 2.99,-3S17.66,5 16,5c-1.66,0 -3,1.34 -3,3s1.34,3 3,3zM8,11c1.66,0 2.99,-1.34 2.99,-3S9.66,5 8,5C6.34,5 5,6.34 5,8s1.34,3 3,3zM8,13c-2.33,0 -7,1.17 -7,3.5L1,19h14v-2.5c0,-2.33 -4.67,-3.5 -7,-3.5zM16,13c-0.29,0 -0.62,0.02 -0.97,0.05 1.16,0.84 1.97,1.97 1.97,3.45L17,19h6v-2.5c0,-2.33 -4.67,-3.5 -7,-3.5z"/>
</vector>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<TableLayout <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/calendar_holder" android:id="@+id/calendar_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -14,7 +13,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginEnd="@dimen/yearly_padding_full" android:layout_marginEnd="@dimen/yearly_padding_full"
android:layout_marginRight="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@@ -24,15 +22,14 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/january" android:text="@string/january"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_1" android:id="@+id/month_1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/month_1_label" android:layout_below="@+id/month_1_label"
android:layout_marginLeft="@dimen/yearly_month_padding" android:layout_marginStart="@dimen/yearly_month_padding" />
android:layout_marginStart="@dimen/yearly_month_padding"/>
</RelativeLayout> </RelativeLayout>
@@ -51,15 +48,14 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/february" android:text="@string/february"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_2" android:id="@+id/month_2"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/month_2_label" android:layout_below="@+id/month_2_label"
android:layout_marginLeft="@dimen/yearly_month_padding" android:layout_marginStart="@dimen/yearly_month_padding" />
android:layout_marginStart="@dimen/yearly_month_padding"/>
</RelativeLayout> </RelativeLayout>
@@ -67,7 +63,6 @@
android:id="@+id/month_3_holder" android:id="@+id/month_3_holder"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/yearly_padding_full"
android:layout_marginStart="@dimen/yearly_padding_full" android:layout_marginStart="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
@@ -78,15 +73,14 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/march" android:text="@string/march"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_3" android:id="@+id/month_3"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/month_3_label" android:layout_below="@+id/month_3_label"
android:layout_marginLeft="@dimen/yearly_month_padding" android:layout_marginStart="@dimen/yearly_month_padding" />
android:layout_marginStart="@dimen/yearly_month_padding"/>
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
@@ -94,7 +88,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginEnd="@dimen/yearly_padding_full" android:layout_marginEnd="@dimen/yearly_padding_full"
android:layout_marginRight="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@@ -104,16 +97,15 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/april" android:text="@string/april"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_4" android:id="@+id/month_4"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_4_label" android:layout_below="@+id/month_4_label"
android:layout_marginLeft="@dimen/yearly_month_padding"
android:layout_marginStart="@dimen/yearly_month_padding" android:layout_marginStart="@dimen/yearly_month_padding"
app:days="30"/> app:days="30" />
</RelativeLayout> </RelativeLayout>
</TableRow> </TableRow>
@@ -134,15 +126,14 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/may" android:text="@string/may"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_5" android:id="@+id/month_5"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_5_label" android:layout_below="@+id/month_5_label"
android:layout_marginLeft="@dimen/yearly_month_padding" android:layout_marginStart="@dimen/yearly_month_padding" />
android:layout_marginStart="@dimen/yearly_month_padding"/>
</RelativeLayout> </RelativeLayout>
@@ -150,7 +141,6 @@
android:id="@+id/month_6_holder" android:id="@+id/month_6_holder"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/yearly_padding_full"
android:layout_marginStart="@dimen/yearly_padding_full" android:layout_marginStart="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
@@ -161,16 +151,15 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/june" android:text="@string/june"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_6" android:id="@+id/month_6"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_6_label" android:layout_below="@+id/month_6_label"
android:layout_marginLeft="@dimen/yearly_month_padding"
android:layout_marginStart="@dimen/yearly_month_padding" android:layout_marginStart="@dimen/yearly_month_padding"
app:days="30"/> app:days="30" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
@@ -178,7 +167,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginEnd="@dimen/yearly_padding_full" android:layout_marginEnd="@dimen/yearly_padding_full"
android:layout_marginRight="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@@ -188,15 +176,14 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/july" android:text="@string/july"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_7" android:id="@+id/month_7"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_7_label" android:layout_below="@+id/month_7_label"
android:layout_marginLeft="@dimen/yearly_month_padding" android:layout_marginStart="@dimen/yearly_month_padding" />
android:layout_marginStart="@dimen/yearly_month_padding"/>
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
@@ -214,15 +201,14 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/august" android:text="@string/august"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_8" android:id="@+id/month_8"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_8_label" android:layout_below="@+id/month_8_label"
android:layout_marginLeft="@dimen/yearly_month_padding" android:layout_marginStart="@dimen/yearly_month_padding" />
android:layout_marginStart="@dimen/yearly_month_padding"/>
</RelativeLayout> </RelativeLayout>
</TableRow> </TableRow>
@@ -233,7 +219,6 @@
android:id="@+id/month_9_holder" android:id="@+id/month_9_holder"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/yearly_padding_full"
android:layout_marginStart="@dimen/yearly_padding_full" android:layout_marginStart="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
@@ -244,16 +229,15 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/september" android:text="@string/september"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_9" android:id="@+id/month_9"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_9_label" android:layout_below="@+id/month_9_label"
android:layout_marginLeft="@dimen/yearly_month_padding"
android:layout_marginStart="@dimen/yearly_month_padding" android:layout_marginStart="@dimen/yearly_month_padding"
app:days="30"/> app:days="30" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
@@ -261,7 +245,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginEnd="@dimen/yearly_padding_full" android:layout_marginEnd="@dimen/yearly_padding_full"
android:layout_marginRight="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@@ -271,15 +254,14 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/october" android:text="@string/october"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_10" android:id="@+id/month_10"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_10_label" android:layout_below="@+id/month_10_label"
android:layout_marginLeft="@dimen/yearly_month_padding" android:layout_marginStart="@dimen/yearly_month_padding" />
android:layout_marginStart="@dimen/yearly_month_padding"/>
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
@@ -297,23 +279,21 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/november" android:text="@string/november"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_11" android:id="@+id/month_11"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_11_label" android:layout_below="@+id/month_11_label"
android:layout_marginLeft="@dimen/yearly_month_padding"
android:layout_marginStart="@dimen/yearly_month_padding" android:layout_marginStart="@dimen/yearly_month_padding"
app:days="30"/> app:days="30" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/month_12_holder" android:id="@+id/month_12_holder"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/yearly_padding_full"
android:layout_marginStart="@dimen/yearly_padding_full" android:layout_marginStart="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
@@ -324,15 +304,14 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/december" android:text="@string/december"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_12" android:id="@+id/month_12"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_12_label" android:layout_below="@+id/month_12_label"
android:layout_marginLeft="@dimen/yearly_month_padding" android:layout_marginStart="@dimen/yearly_month_padding" />
android:layout_marginStart="@dimen/yearly_month_padding"/>
</RelativeLayout> </RelativeLayout>
</TableRow> </TableRow>

View File

@@ -408,7 +408,7 @@
android:layout_marginStart="@dimen/normal_margin" android:layout_marginStart="@dimen/normal_margin"
android:layout_marginTop="@dimen/small_margin" android:layout_marginTop="@dimen/small_margin"
android:padding="@dimen/medium_margin" android:padding="@dimen/medium_margin"
android:src="@drawable/ic_group_vector"/> android:src="@drawable/ic_people_vector"/>
<LinearLayout <LinearLayout
android:id="@+id/event_attendees_holder" android:id="@+id/event_attendees_holder"
@@ -435,9 +435,10 @@
android:layout_below="@+id/event_attendees_divider" android:layout_below="@+id/event_attendees_divider"
android:layout_alignTop="@+id/event_caldav_calendar_holder" android:layout_alignTop="@+id/event_caldav_calendar_holder"
android:layout_alignBottom="@+id/event_caldav_calendar_holder" android:layout_alignBottom="@+id/event_caldav_calendar_holder"
android:layout_alignEnd="@+id/event_time_image"
android:layout_marginStart="@dimen/normal_margin" android:layout_marginStart="@dimen/normal_margin"
android:padding="@dimen/medium_margin" android:padding="@dimen/medium_margin"
android:src="@drawable/ic_calendar" android:src="@drawable/ic_calendar_vector"
android:visibility="gone"/> android:visibility="gone"/>
<RelativeLayout <RelativeLayout

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/calendar_coordinator" android:id="@+id/calendar_coordinator"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -14,7 +13,7 @@
<FrameLayout <FrameLayout
android:id="@+id/fragments_holder" android:id="@+id/fragments_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
@@ -27,7 +26,7 @@
android:contentDescription="@string/new_event" android:contentDescription="@string/new_event"
android:src="@drawable/ic_plus_vector" android:src="@drawable/ic_plus_vector"
app:backgroundTint="@color/color_primary" app:backgroundTint="@color/color_primary"
app:rippleColor="@color/pressed_item_foreground"/> app:rippleColor="@color/pressed_item_foreground" />
<RelativeLayout <RelativeLayout
android:id="@+id/search_holder" android:id="@+id/search_holder"
@@ -43,11 +42,13 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/activity_margin" android:layout_marginTop="@dimen/activity_margin"
android:alpha="0.8"
android:gravity="center" android:gravity="center"
android:paddingStart="@dimen/activity_margin" android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:text="@string/no_items_found" android:text="@string/no_items_found"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size"
android:textStyle="italic" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/search_placeholder_2" android:id="@+id/search_placeholder_2"
@@ -55,13 +56,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/search_placeholder" android:layout_below="@+id/search_placeholder"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:alpha="0.8"
android:gravity="center" android:gravity="center"
android:paddingBottom="@dimen/medium_margin"
android:paddingStart="@dimen/activity_margin" android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/activity_margin"
android:paddingBottom="@dimen/medium_margin"
android:text="@string/type_2_characters" android:text="@string/type_2_characters"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size"
android:textStyle="italic" />
<com.simplemobiletools.commons.views.MyRecyclerView <com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/search_results_list" android:id="@+id/search_results_list"
@@ -69,7 +72,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false" android:clipToPadding="false"
android:scrollbars="vertical" android:scrollbars="vertical"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/> app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />
</RelativeLayout> </RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/settings_scrollview" android:id="@+id/settings_scrollview"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -29,7 +28,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/customize_colors"/> android:text="@string/customize_colors" />
</RelativeLayout> </RelativeLayout>
@@ -50,7 +49,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/manage_event_types"/> android:text="@string/manage_event_types" />
</RelativeLayout> </RelativeLayout>
@@ -72,7 +71,7 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/use_english_language"/> android:text="@string/use_english_language" />
</RelativeLayout> </RelativeLayout>
@@ -94,7 +93,7 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/use_24_hour_time_format"/> android:text="@string/use_24_hour_time_format" />
</RelativeLayout> </RelativeLayout>
@@ -116,26 +115,19 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/sunday_first"/> android:text="@string/sunday_first" />
</RelativeLayout> </RelativeLayout>
<View
android:id="@+id/reminders_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/divider_grey"
android:importantForAccessibility="no"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/reminders_label" android:id="@+id/reminders_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bigger_margin" android:layout_marginStart="@dimen/bigger_margin"
android:layout_marginTop="@dimen/activity_margin" android:layout_marginTop="@dimen/section_margin"
android:text="@string/event_reminders" android:text="@string/event_reminders"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/smaller_text_size"/> android:textSize="@dimen/smaller_text_size" />
<RelativeLayout <RelativeLayout
android:id="@+id/settings_vibrate_holder" android:id="@+id/settings_vibrate_holder"
@@ -155,7 +147,7 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/vibrate"/> android:text="@string/vibrate" />
</RelativeLayout> </RelativeLayout>
@@ -177,7 +169,7 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/loop_reminders"/> android:text="@string/loop_reminders" />
</RelativeLayout> </RelativeLayout>
@@ -194,22 +186,26 @@
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_reminder_sound_label" android:id="@+id/settings_reminder_sound_label"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toStartOf="@+id/settings_reminder_sound"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/reminder_sound"/> android:text="@string/reminder_sound" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_reminder_sound" android:id="@+id/settings_reminder_sound"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginStart="@dimen/activity_margin"
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:layout_toEndOf="@+id/settings_reminder_sound_label"
android:background="@null" android:background="@null"
android:clickable="false"/> android:clickable="false"
android:gravity="end"
android:maxLines="3"
tools:text="None" />
</RelativeLayout> </RelativeLayout>
@@ -231,7 +227,7 @@
android:layout_toStartOf="@+id/settings_reminder_audio_stream" android:layout_toStartOf="@+id/settings_reminder_audio_stream"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/reminder_stream"/> android:text="@string/reminder_stream" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_reminder_audio_stream" android:id="@+id/settings_reminder_audio_stream"
@@ -240,7 +236,7 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@null" android:background="@null"
android:clickable="false"/> android:clickable="false" />
</RelativeLayout> </RelativeLayout>
@@ -262,7 +258,7 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/use_same_snooze"/> android:text="@string/use_same_snooze" />
</RelativeLayout> </RelativeLayout>
@@ -285,7 +281,7 @@
android:layout_toStartOf="@+id/settings_snooze_time" android:layout_toStartOf="@+id/settings_snooze_time"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/snooze_time"/> android:text="@string/snooze_time" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_snooze_time" android:id="@+id/settings_snooze_time"
@@ -294,26 +290,19 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@null" android:background="@null"
android:clickable="false"/> android:clickable="false" />
</RelativeLayout> </RelativeLayout>
<View
android:id="@+id/caldav_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/divider_grey"
android:importantForAccessibility="no"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/caldav_label" android:id="@+id/caldav_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bigger_margin" android:layout_marginStart="@dimen/bigger_margin"
android:layout_marginTop="@dimen/activity_margin" android:layout_marginTop="@dimen/section_margin"
android:text="@string/caldav" android:text="@string/caldav"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/smaller_text_size"/> android:textSize="@dimen/smaller_text_size" />
<RelativeLayout <RelativeLayout
android:id="@+id/settings_caldav_sync_holder" android:id="@+id/settings_caldav_sync_holder"
@@ -333,7 +322,7 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/caldav_sync"/> android:text="@string/caldav_sync" />
</RelativeLayout> </RelativeLayout>
@@ -355,7 +344,7 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/enable_pull_to_refresh"/> android:text="@string/enable_pull_to_refresh" />
</RelativeLayout> </RelativeLayout>
@@ -377,35 +366,28 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/manage_synced_calendars"/> android:text="@string/manage_synced_calendars" />
</RelativeLayout> </RelativeLayout>
<View
android:id="@+id/new_events_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/divider_grey"
android:importantForAccessibility="no"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/new_events_label" android:id="@+id/new_events_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bigger_margin" android:layout_marginStart="@dimen/bigger_margin"
android:layout_marginTop="@dimen/activity_margin" android:layout_marginTop="@dimen/section_margin"
android:text="@string/new_events" android:text="@string/new_events"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/smaller_text_size"/> android:textSize="@dimen/smaller_text_size" />
<RelativeLayout <RelativeLayout
android:id="@+id/settings_default_start_time_holder" android:id="@+id/settings_default_start_time_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/normal_margin" android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/bigger_margin" android:paddingTop="@dimen/bigger_margin"
android:paddingRight="@dimen/normal_margin" android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/bigger_margin"> android:paddingBottom="@dimen/bigger_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@@ -414,9 +396,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toStartOf="@+id/settings_default_start_time" android:layout_toStartOf="@+id/settings_default_start_time"
android:paddingLeft="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/default_start_time"/> android:text="@string/default_start_time" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_default_start_time" android:id="@+id/settings_default_start_time"
@@ -426,7 +408,7 @@
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
tools:text="@string/next_full_hour"/> tools:text="@string/next_full_hour" />
</RelativeLayout> </RelativeLayout>
@@ -435,9 +417,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/normal_margin" android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/bigger_margin" android:paddingTop="@dimen/bigger_margin"
android:paddingRight="@dimen/normal_margin" android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/bigger_margin"> android:paddingBottom="@dimen/bigger_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@@ -446,9 +428,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toStartOf="@+id/settings_default_duration" android:layout_toStartOf="@+id/settings_default_duration"
android:paddingLeft="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/default_duration"/> android:text="@string/default_duration" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_default_duration" android:id="@+id/settings_default_duration"
@@ -458,7 +440,7 @@
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
tools:text="0 minutes"/> tools:text="0 minutes" />
</RelativeLayout> </RelativeLayout>
@@ -467,9 +449,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/normal_margin" android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/bigger_margin" android:paddingTop="@dimen/bigger_margin"
android:paddingRight="@dimen/normal_margin" android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/bigger_margin"> android:paddingBottom="@dimen/bigger_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@@ -478,9 +460,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toStartOf="@+id/settings_default_event_type" android:layout_toStartOf="@+id/settings_default_event_type"
android:paddingLeft="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/default_event_type"/> android:text="@string/default_event_type" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_default_event_type" android:id="@+id/settings_default_event_type"
@@ -490,7 +472,7 @@
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
tools:text="@string/last_used_one"/> tools:text="@string/last_used_one" />
</RelativeLayout> </RelativeLayout>
@@ -512,7 +494,7 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/use_last_event_reminders"/> android:text="@string/use_last_event_reminders" />
</RelativeLayout> </RelativeLayout>
@@ -535,7 +517,7 @@
android:layout_toStartOf="@+id/settings_default_reminder_1" android:layout_toStartOf="@+id/settings_default_reminder_1"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/default_reminder_1"/> android:text="@string/default_reminder_1" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_default_reminder_1" android:id="@+id/settings_default_reminder_1"
@@ -544,7 +526,7 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@null" android:background="@null"
android:clickable="false"/> android:clickable="false" />
</RelativeLayout> </RelativeLayout>
@@ -567,7 +549,7 @@
android:layout_toStartOf="@+id/settings_default_reminder_2" android:layout_toStartOf="@+id/settings_default_reminder_2"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/default_reminder_2"/> android:text="@string/default_reminder_2" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_default_reminder_2" android:id="@+id/settings_default_reminder_2"
@@ -576,7 +558,7 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@null" android:background="@null"
android:clickable="false"/> android:clickable="false" />
</RelativeLayout> </RelativeLayout>
@@ -599,7 +581,7 @@
android:layout_toStartOf="@+id/settings_default_reminder_3" android:layout_toStartOf="@+id/settings_default_reminder_3"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/default_reminder_3"/> android:text="@string/default_reminder_3" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_default_reminder_3" android:id="@+id/settings_default_reminder_3"
@@ -608,26 +590,19 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@null" android:background="@null"
android:clickable="false"/> android:clickable="false" />
</RelativeLayout> </RelativeLayout>
<View
android:id="@+id/weekly_view_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/divider_grey"
android:importantForAccessibility="no"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/weekly_view_label" android:id="@+id/weekly_view_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bigger_margin" android:layout_marginStart="@dimen/bigger_margin"
android:layout_marginTop="@dimen/activity_margin" android:layout_marginTop="@dimen/section_margin"
android:text="@string/weekly_view" android:text="@string/weekly_view"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/smaller_text_size"/> android:textSize="@dimen/smaller_text_size" />
<RelativeLayout <RelativeLayout
android:id="@+id/settings_start_weekly_at_holder" android:id="@+id/settings_start_weekly_at_holder"
@@ -648,7 +623,7 @@
android:layout_toStartOf="@+id/settings_start_weekly_at" android:layout_toStartOf="@+id/settings_start_weekly_at"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/start_day_at"/> android:text="@string/start_day_at" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_start_weekly_at" android:id="@+id/settings_start_weekly_at"
@@ -657,57 +632,19 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@null" android:background="@null"
android:clickable="false"/> android:clickable="false" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/settings_end_weekly_at_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/bigger_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/bigger_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_end_weekly_at_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/settings_end_weekly_at"
android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin"
android:text="@string/end_day_at"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_end_weekly_at"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/small_margin"
android:background="@null"
android:clickable="false"/>
</RelativeLayout>
<View
android:id="@+id/monthly_view_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/divider_grey"
android:importantForAccessibility="no"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/monthly_view_label" android:id="@+id/monthly_view_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bigger_margin" android:layout_marginStart="@dimen/bigger_margin"
android:layout_marginTop="@dimen/activity_margin" android:layout_marginTop="@dimen/section_margin"
android:text="@string/monthly_view" android:text="@string/monthly_view"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/smaller_text_size"/> android:textSize="@dimen/smaller_text_size" />
<RelativeLayout <RelativeLayout
android:id="@+id/settings_week_numbers_holder" android:id="@+id/settings_week_numbers_holder"
@@ -727,7 +664,7 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/week_numbers"/> android:text="@string/week_numbers" />
</RelativeLayout> </RelativeLayout>
@@ -748,26 +685,19 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/show_a_grid"/> android:text="@string/show_a_grid" />
</RelativeLayout> </RelativeLayout>
<View
android:id="@+id/events_list_view_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/divider_grey"
android:importantForAccessibility="no"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/simple_event_list_label" android:id="@+id/simple_event_list_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bigger_margin" android:layout_marginStart="@dimen/bigger_margin"
android:layout_marginTop="@dimen/activity_margin" android:layout_marginTop="@dimen/section_margin"
android:text="@string/event_lists" android:text="@string/event_lists"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/smaller_text_size"/> android:textSize="@dimen/smaller_text_size" />
<RelativeLayout <RelativeLayout
android:id="@+id/settings_replace_description_holder" android:id="@+id/settings_replace_description_holder"
@@ -787,7 +717,7 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/replace_description_with_location"/> android:text="@string/replace_description_with_location" />
</RelativeLayout> </RelativeLayout>
@@ -809,7 +739,7 @@
android:layout_toStartOf="@+id/settings_display_past_events" android:layout_toStartOf="@+id/settings_display_past_events"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/display_past_events"/> android:text="@string/display_past_events" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_display_past_events" android:id="@+id/settings_display_past_events"
@@ -818,26 +748,19 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@null" android:background="@null"
android:clickable="false"/> android:clickable="false" />
</RelativeLayout> </RelativeLayout>
<View
android:id="@+id/widgets_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/divider_grey"
android:importantForAccessibility="no"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/widgets_label" android:id="@+id/widgets_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bigger_margin" android:layout_marginStart="@dimen/bigger_margin"
android:layout_marginTop="@dimen/activity_margin" android:layout_marginTop="@dimen/section_margin"
android:text="@string/widgets" android:text="@string/widgets"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/smaller_text_size"/> android:textSize="@dimen/smaller_text_size" />
<RelativeLayout <RelativeLayout
android:id="@+id/settings_font_size_holder" android:id="@+id/settings_font_size_holder"
@@ -857,7 +780,7 @@
android:layout_toStartOf="@+id/settings_font_size" android:layout_toStartOf="@+id/settings_font_size"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/font_size"/> android:text="@string/font_size" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_font_size" android:id="@+id/settings_font_size"
@@ -866,7 +789,7 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@null" android:background="@null"
android:clickable="false"/> android:clickable="false" />
</RelativeLayout> </RelativeLayout>
@@ -888,7 +811,7 @@
android:layout_toStartOf="@+id/settings_list_widget_view_to_open" android:layout_toStartOf="@+id/settings_list_widget_view_to_open"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/view_to_open_from_widget"/> android:text="@string/view_to_open_from_widget" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_list_widget_view_to_open" android:id="@+id/settings_list_widget_view_to_open"
@@ -897,7 +820,7 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@null" android:background="@null"
android:clickable="false"/> android:clickable="false" />
</RelativeLayout> </RelativeLayout>
@@ -917,26 +840,19 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/customize_widget_colors"/> android:text="@string/customize_widget_colors" />
</RelativeLayout> </RelativeLayout>
<View
android:id="@+id/events_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/divider_grey"
android:importantForAccessibility="no"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/events_label" android:id="@+id/events_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bigger_margin" android:layout_marginStart="@dimen/bigger_margin"
android:layout_marginTop="@dimen/activity_margin" android:layout_marginTop="@dimen/section_margin"
android:text="@string/events" android:text="@string/events"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/smaller_text_size"/> android:textSize="@dimen/smaller_text_size" />
<RelativeLayout <RelativeLayout
android:id="@+id/settings_dim_past_events_holder" android:id="@+id/settings_dim_past_events_holder"
@@ -956,7 +872,7 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/dim_past_events"/> android:text="@string/dim_past_events" />
</RelativeLayout> </RelativeLayout>
@@ -977,7 +893,7 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/allow_changing_time_zones"/> android:text="@string/allow_changing_time_zones" />
</RelativeLayout> </RelativeLayout>
@@ -998,27 +914,19 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/delete_all_events"/> android:text="@string/delete_all_events" />
</RelativeLayout> </RelativeLayout>
<View
android:id="@+id/migrating_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/divider_grey"
android:importantForAccessibility="no"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/migrating_label" android:id="@+id/migrating_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bigger_margin" android:layout_marginStart="@dimen/bigger_margin"
android:layout_marginLeft="@dimen/bigger_margin" android:layout_marginTop="@dimen/section_margin"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/migrating" android:text="@string/migrating"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/smaller_text_size"/> android:textSize="@dimen/smaller_text_size" />
<RelativeLayout <RelativeLayout
android:id="@+id/settings_export_holder" android:id="@+id/settings_export_holder"
@@ -1026,9 +934,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/normal_margin" android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
android:paddingRight="@dimen/normal_margin" android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin"> android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@@ -1037,8 +945,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingLeft="@dimen/medium_margin" android:text="@string/export_settings" />
android:text="@string/export_settings"/>
</RelativeLayout> </RelativeLayout>
@@ -1048,9 +955,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/normal_margin" android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
android:paddingRight="@dimen/normal_margin" android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin"> android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@@ -1059,8 +966,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingLeft="@dimen/medium_margin" android:text="@string/import_settings" />
android:text="@string/import_settings"/>
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>

View File

@@ -1,16 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/calendar_item_account" android:id="@+id/calendar_item_account"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_margin"
android:layout_marginLeft="@dimen/big_margin"
android:layout_marginStart="@dimen/big_margin" android:layout_marginStart="@dimen/big_margin"
android:layout_marginTop="@dimen/activity_margin" android:layout_marginTop="@dimen/activity_margin"
android:alpha="0.6" android:layout_marginBottom="@dimen/activity_margin"
android:alpha="0.8"
android:textAllCaps="true" android:textAllCaps="true"
android:textColor="@color/divider_grey" android:textSize="@dimen/normal_text_size"
android:textSize="@dimen/small_text_size" tools:text="Account" />
tools:text="Account"/>

View File

@@ -1,16 +1,29 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog_select_calendars_scrollview" android:id="@+id/dialog_select_calendars_scrollview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"> android:paddingTop="@dimen/activity_margin">
<RelativeLayout
android:id="@+id/dialog_select_calendars_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialog_select_calendars_placeholder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:alpha="0.8"
android:text="@string/no_synchronized_calendars"
android:textStyle="italic" />
<LinearLayout <LinearLayout
android:id="@+id/dialog_select_calendars_holder" android:id="@+id/dialog_select_calendars_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical" />
</LinearLayout> </RelativeLayout>
</ScrollView> </ScrollView>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/calendar_events_list_holder"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/calendar_events_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:paddingStart="@dimen/activity_margin"
android:paddingTop="@dimen/medium_margin"/>
</RelativeLayout>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/calendar_events_list_holder" android:id="@+id/calendar_events_list_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -15,7 +14,7 @@
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:scrollbars="vertical" android:scrollbars="vertical"
android:visibility="gone" android:visibility="gone"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/> app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/calendar_empty_list_placeholder" android:id="@+id/calendar_empty_list_placeholder"
@@ -23,24 +22,26 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/activity_margin" android:layout_marginTop="@dimen/activity_margin"
android:alpha="0.8"
android:gravity="center" android:gravity="center"
android:paddingStart="@dimen/activity_margin" android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:text="@string/no_upcoming_events" android:text="@string/no_upcoming_events"
android:textSize="@dimen/bigger_text_size" android:textSize="@dimen/bigger_text_size"
android:visibility="gone"/> android:textStyle="italic"
android:visibility="gone" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/calendar_empty_list_placeholder_2" android:id="@+id/calendar_empty_list_placeholder_2"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/calendar_empty_list_placeholder" android:layout_below="@+id/calendar_empty_list_placeholder"
android:background="?attr/selectableItemBackground"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:gravity="center" android:gravity="center"
android:paddingBottom="@dimen/medium_margin" android:padding="@dimen/activity_margin"
android:paddingTop="@dimen/medium_margin"
android:text="@string/create_new_event" android:text="@string/create_new_event"
android:textSize="@dimen/bigger_text_size" android:textSize="@dimen/bigger_text_size"
android:visibility="gone"/> android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View File

@@ -1,12 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/calendar_holder" android:id="@+id/calendar_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="@dimen/medium_margin"> android:padding="@dimen/medium_margin">
<ImageView
android:id="@+id/widget_month_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:src="@drawable/widget_round_background" />
<ImageView <ImageView
android:id="@+id/top_left_arrow" android:id="@+id/top_left_arrow"
style="@style/ArrowStyle" style="@style/ArrowStyle"
@@ -16,7 +25,7 @@
android:layout_alignBottom="@+id/top_value" android:layout_alignBottom="@+id/top_value"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:src="@drawable/ic_chevron_left_vector"/> android:src="@drawable/ic_chevron_left_vector" />
<TextView <TextView
android:id="@+id/top_value" android:id="@+id/top_value"
@@ -30,7 +39,7 @@
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:paddingBottom="@dimen/medium_margin" android:paddingBottom="@dimen/medium_margin"
android:textSize="@dimen/month_text_size" android:textSize="@dimen/month_text_size"
tools:text="January"/> tools:text="January" />
<ImageView <ImageView
android:id="@+id/top_go_to_today" android:id="@+id/top_go_to_today"
@@ -42,7 +51,7 @@
android:layout_toStartOf="@+id/top_right_arrow" android:layout_toStartOf="@+id/top_right_arrow"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:src="@drawable/ic_today_vector"/> android:src="@drawable/ic_today_vector" />
<ImageView <ImageView
android:id="@+id/top_right_arrow" android:id="@+id/top_right_arrow"
@@ -54,7 +63,7 @@
android:layout_toStartOf="@+id/top_new_event" android:layout_toStartOf="@+id/top_new_event"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:src="@drawable/ic_chevron_right_vector"/> android:src="@drawable/ic_chevron_right_vector" />
<ImageView <ImageView
android:id="@+id/top_new_event" android:id="@+id/top_new_event"
@@ -66,7 +75,7 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:src="@drawable/ic_plus_vector"/> android:src="@drawable/ic_plus_vector" />
<include <include
android:id="@+id/first_row_widget" android:id="@+id/first_row_widget"
@@ -74,7 +83,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/top_value" android:layout_below="@+id/top_value"
tools:ignore="UnknownIdInLayout"/> tools:ignore="UnknownIdInLayout" />
<LinearLayout <LinearLayout
android:id="@+id/table_holder" android:id="@+id/table_holder"
@@ -97,7 +106,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/day_0" android:id="@+id/day_0"
@@ -105,7 +114,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_1" android:id="@+id/day_1"
@@ -113,7 +122,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_2" android:id="@+id/day_2"
@@ -121,7 +130,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_3" android:id="@+id/day_3"
@@ -129,7 +138,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_4" android:id="@+id/day_4"
@@ -137,7 +146,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_5" android:id="@+id/day_5"
@@ -145,7 +154,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_6" android:id="@+id/day_6"
@@ -153,7 +162,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -169,7 +178,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/day_7" android:id="@+id/day_7"
@@ -177,7 +186,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_8" android:id="@+id/day_8"
@@ -185,7 +194,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_9" android:id="@+id/day_9"
@@ -193,7 +202,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_10" android:id="@+id/day_10"
@@ -201,7 +210,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_11" android:id="@+id/day_11"
@@ -209,7 +218,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_12" android:id="@+id/day_12"
@@ -217,7 +226,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_13" android:id="@+id/day_13"
@@ -225,7 +234,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -241,7 +250,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/day_14" android:id="@+id/day_14"
@@ -249,7 +258,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_15" android:id="@+id/day_15"
@@ -257,7 +266,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_16" android:id="@+id/day_16"
@@ -265,7 +274,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_17" android:id="@+id/day_17"
@@ -273,7 +282,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_18" android:id="@+id/day_18"
@@ -281,7 +290,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_19" android:id="@+id/day_19"
@@ -289,7 +298,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_20" android:id="@+id/day_20"
@@ -297,7 +306,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -313,7 +322,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/day_21" android:id="@+id/day_21"
@@ -321,7 +330,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_22" android:id="@+id/day_22"
@@ -329,7 +338,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_23" android:id="@+id/day_23"
@@ -337,7 +346,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_24" android:id="@+id/day_24"
@@ -345,7 +354,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_25" android:id="@+id/day_25"
@@ -353,7 +362,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_26" android:id="@+id/day_26"
@@ -361,7 +370,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_27" android:id="@+id/day_27"
@@ -369,7 +378,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -385,7 +394,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/day_28" android:id="@+id/day_28"
@@ -393,7 +402,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_29" android:id="@+id/day_29"
@@ -401,7 +410,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_30" android:id="@+id/day_30"
@@ -409,7 +418,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_31" android:id="@+id/day_31"
@@ -417,7 +426,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_32" android:id="@+id/day_32"
@@ -425,7 +434,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_33" android:id="@+id/day_33"
@@ -433,7 +442,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_34" android:id="@+id/day_34"
@@ -441,7 +450,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -457,7 +466,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/day_35" android:id="@+id/day_35"
@@ -465,7 +474,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_36" android:id="@+id/day_36"
@@ -473,7 +482,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_37" android:id="@+id/day_37"
@@ -481,7 +490,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_38" android:id="@+id/day_38"
@@ -489,7 +498,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_39" android:id="@+id/day_39"
@@ -497,7 +506,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_40" android:id="@+id/day_40"
@@ -505,7 +514,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_41" android:id="@+id/day_41"
@@ -513,7 +522,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/month_calendar_holder" android:id="@+id/month_calendar_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/widget_round_background"
android:paddingTop="@dimen/medium_margin"> android:paddingTop="@dimen/medium_margin">
<include layout="@layout/top_navigation"/> <include layout="@layout/top_navigation" />
<include <include
android:id="@+id/first_row" android:id="@+id/first_row"
@@ -15,7 +15,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/top_value" android:layout_below="@+id/top_value"
tools:ignore="UnknownIdInLayout"/> tools:ignore="UnknownIdInLayout" />
<LinearLayout <LinearLayout
android:id="@+id/table_holder" android:id="@+id/table_holder"
@@ -38,7 +38,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/day_0" android:id="@+id/day_0"
@@ -47,7 +47,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_1" android:id="@+id/day_1"
@@ -56,7 +56,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_2" android:id="@+id/day_2"
@@ -65,7 +65,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_3" android:id="@+id/day_3"
@@ -74,7 +74,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_4" android:id="@+id/day_4"
@@ -83,7 +83,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_5" android:id="@+id/day_5"
@@ -92,7 +92,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_6" android:id="@+id/day_6"
@@ -101,7 +101,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -118,7 +118,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/day_7" android:id="@+id/day_7"
@@ -127,7 +127,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_8" android:id="@+id/day_8"
@@ -136,7 +136,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_9" android:id="@+id/day_9"
@@ -145,7 +145,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_10" android:id="@+id/day_10"
@@ -154,7 +154,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_11" android:id="@+id/day_11"
@@ -163,7 +163,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_12" android:id="@+id/day_12"
@@ -172,7 +172,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_13" android:id="@+id/day_13"
@@ -181,7 +181,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -197,7 +197,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/day_14" android:id="@+id/day_14"
@@ -206,7 +206,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_15" android:id="@+id/day_15"
@@ -215,7 +215,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_16" android:id="@+id/day_16"
@@ -224,7 +224,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_17" android:id="@+id/day_17"
@@ -233,7 +233,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_18" android:id="@+id/day_18"
@@ -242,7 +242,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_19" android:id="@+id/day_19"
@@ -251,7 +251,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_20" android:id="@+id/day_20"
@@ -260,7 +260,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -277,7 +277,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/day_21" android:id="@+id/day_21"
@@ -286,7 +286,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_22" android:id="@+id/day_22"
@@ -295,7 +295,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_23" android:id="@+id/day_23"
@@ -304,7 +304,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_24" android:id="@+id/day_24"
@@ -313,7 +313,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_25" android:id="@+id/day_25"
@@ -322,7 +322,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_26" android:id="@+id/day_26"
@@ -331,7 +331,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_27" android:id="@+id/day_27"
@@ -340,7 +340,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -357,7 +357,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/day_28" android:id="@+id/day_28"
@@ -366,7 +366,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_29" android:id="@+id/day_29"
@@ -375,7 +375,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_30" android:id="@+id/day_30"
@@ -384,7 +384,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_31" android:id="@+id/day_31"
@@ -393,7 +393,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_32" android:id="@+id/day_32"
@@ -402,7 +402,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_33" android:id="@+id/day_33"
@@ -411,7 +411,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_34" android:id="@+id/day_34"
@@ -420,7 +420,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -436,7 +436,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/day_35" android:id="@+id/day_35"
@@ -445,7 +445,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_36" android:id="@+id/day_36"
@@ -454,7 +454,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_37" android:id="@+id/day_37"
@@ -463,7 +463,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_38" android:id="@+id/day_38"
@@ -472,7 +472,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_39" android:id="@+id/day_39"
@@ -481,7 +481,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_40" android:id="@+id/day_40"
@@ -490,7 +490,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/day_41" android:id="@+id/day_41"
@@ -499,7 +499,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"/> android:orientation="vertical" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/week_holder" android:id="@+id/week_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@@ -22,57 +21,15 @@
<com.simplemobiletools.calendar.pro.views.WeeklyViewGrid <com.simplemobiletools.calendar.pro.views.WeeklyViewGrid
android:id="@+id/week_horizontal_grid_holder" android:id="@+id/week_horizontal_grid_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/weekly_view_events_height"/> android:layout_height="wrap_content" />
<LinearLayout <LinearLayout
android:id="@+id/week_events_columns_holder" android:id="@+id/week_events_columns_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/weekly_view_events_height" android:layout_height="wrap_content"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:orientation="horizontal"> android:orientation="horizontal">
<RelativeLayout
android:id="@+id/week_column_0"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<RelativeLayout
android:id="@+id/week_column_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<RelativeLayout
android:id="@+id/week_column_2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<RelativeLayout
android:id="@+id/week_column_3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<RelativeLayout
android:id="@+id/week_column_4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<RelativeLayout
android:id="@+id/week_column_5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<RelativeLayout
android:id="@+id/week_column_6"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
</com.simplemobiletools.calendar.pro.views.MyScrollView> </com.simplemobiletools.calendar.pro.views.MyScrollView>
@@ -91,72 +48,7 @@
android:background="@drawable/stroke_bottom" android:background="@drawable/stroke_bottom"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingBottom="@dimen/small_margin"> android:paddingBottom="@dimen/small_margin" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/week_day_label_0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="@string/monday_letter"
android:textSize="@dimen/normal_text_size"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/week_day_label_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="@string/tuesday_letter"
android:textSize="@dimen/normal_text_size"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/week_day_label_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="@string/wednesday_letter"
android:textSize="@dimen/normal_text_size"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/week_day_label_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="@string/thursday_letter"
android:textSize="@dimen/normal_text_size"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/week_day_label_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="@string/friday_letter"
android:textSize="@dimen/normal_text_size"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/week_day_label_5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="@string/saturday_letter"
android:textSize="@dimen/normal_text_size"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/week_day_label_6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="@string/sunday_letter"
android:textSize="@dimen/normal_text_size"/>
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/week_all_day_holder" android:id="@+id/week_all_day_holder"

View File

@@ -1,12 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/week_view_main_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<RelativeLayout
android:id="@+id/week_view_holder" android:id="@+id/week_view_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -18,12 +12,13 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignEnd="@+id/week_view_hours_scrollview" android:layout_alignEnd="@+id/week_view_hours_scrollview"
android:background="@drawable/stroke_bottom_right" android:background="@drawable/stroke_bottom_right"
android:importantForAccessibility="no"/> android:importantForAccessibility="no" />
<com.simplemobiletools.calendar.pro.views.MyScrollView <com.simplemobiletools.calendar.pro.views.MyScrollView
android:id="@+id/week_view_hours_scrollview" android:id="@+id/week_view_hours_scrollview"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@+id/week_view_seekbar"
android:layout_below="@+id/week_view_hours_divider" android:layout_below="@+id/week_view_hours_divider"
android:background="@drawable/stroke_right" android:background="@drawable/stroke_right"
android:overScrollMode="never" android:overScrollMode="never"
@@ -34,8 +29,7 @@
android:id="@+id/week_view_hours_holder" android:id="@+id/week_view_hours_holder"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical" />
android:paddingBottom="@dimen/weekly_view_row_height"/>
</com.simplemobiletools.calendar.pro.views.MyScrollView> </com.simplemobiletools.calendar.pro.views.MyScrollView>
@@ -43,7 +37,36 @@
android:id="@+id/week_view_view_pager" android:id="@+id/week_view_view_pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_toEndOf="@+id/week_view_hours_scrollview"/> android:layout_above="@+id/week_view_days_count_divider"
android:layout_toEndOf="@+id/week_view_hours_scrollview" />
</RelativeLayout> <include
</LinearLayout> android:id="@+id/week_view_days_count_divider"
layout="@layout/divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_above="@+id/week_view_seekbar" />
<com.simplemobiletools.commons.views.MySeekBar
android:id="@+id/week_view_seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginStart="@dimen/activity_margin"
android:layout_toStartOf="@+id/week_view_days_count"
android:paddingTop="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/week_view_days_count"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignTop="@+id/week_view_seekbar"
android:layout_alignBottom="@+id/week_view_seekbar"
android:layout_alignParentEnd="true"
android:layout_marginStart="@dimen/activity_margin"
android:layout_marginEnd="@dimen/activity_margin"
android:gravity="center_vertical"
tools:text="7 days" />
</RelativeLayout>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<TableLayout <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/calendar_holder" android:id="@+id/calendar_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -14,7 +13,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginEnd="@dimen/yearly_padding_full" android:layout_marginEnd="@dimen/yearly_padding_full"
android:layout_marginRight="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@@ -24,14 +22,14 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/january" android:text="@string/january"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_1" android:id="@+id/month_1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/month_1_label" android:layout_below="@+id/month_1_label"
android:layout_centerInParent="true"/> android:layout_centerInParent="true" />
</RelativeLayout> </RelativeLayout>
@@ -50,13 +48,13 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/february" android:text="@string/february"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_2" android:id="@+id/month_2"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/month_2_label"/> android:layout_below="@+id/month_2_label" />
</RelativeLayout> </RelativeLayout>
@@ -64,7 +62,6 @@
android:id="@+id/month_3_holder" android:id="@+id/month_3_holder"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/yearly_padding_full"
android:layout_marginStart="@dimen/yearly_padding_full" android:layout_marginStart="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
@@ -75,13 +72,13 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/march" android:text="@string/march"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_3" android:id="@+id/month_3"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/month_3_label"/> android:layout_below="@+id/month_3_label" />
</RelativeLayout> </RelativeLayout>
</TableRow> </TableRow>
@@ -93,7 +90,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginEnd="@dimen/yearly_padding_full" android:layout_marginEnd="@dimen/yearly_padding_full"
android:layout_marginRight="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@@ -103,14 +99,14 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/april" android:text="@string/april"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_4" android:id="@+id/month_4"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_4_label" android:layout_below="@+id/month_4_label"
app:days="30"/> app:days="30" />
</RelativeLayout> </RelativeLayout>
@@ -129,13 +125,13 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/may" android:text="@string/may"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_5" android:id="@+id/month_5"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_5_label"/> android:layout_below="@+id/month_5_label" />
</RelativeLayout> </RelativeLayout>
@@ -143,7 +139,6 @@
android:id="@+id/month_6_holder" android:id="@+id/month_6_holder"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/yearly_padding_full"
android:layout_marginStart="@dimen/yearly_padding_full" android:layout_marginStart="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
@@ -154,14 +149,14 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/june" android:text="@string/june"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_6" android:id="@+id/month_6"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_6_label" android:layout_below="@+id/month_6_label"
app:days="30"/> app:days="30" />
</RelativeLayout> </RelativeLayout>
</TableRow> </TableRow>
@@ -172,7 +167,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginEnd="@dimen/yearly_padding_full" android:layout_marginEnd="@dimen/yearly_padding_full"
android:layout_marginRight="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@@ -182,13 +176,13 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/july" android:text="@string/july"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_7" android:id="@+id/month_7"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_7_label"/> android:layout_below="@+id/month_7_label" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
@@ -206,13 +200,13 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/august" android:text="@string/august"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_8" android:id="@+id/month_8"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_8_label"/> android:layout_below="@+id/month_8_label" />
</RelativeLayout> </RelativeLayout>
@@ -220,7 +214,6 @@
android:id="@+id/month_9_holder" android:id="@+id/month_9_holder"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/yearly_padding_full"
android:layout_marginStart="@dimen/yearly_padding_full" android:layout_marginStart="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
@@ -231,14 +224,14 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/september" android:text="@string/september"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_9" android:id="@+id/month_9"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_9_label" android:layout_below="@+id/month_9_label"
app:days="30"/> app:days="30" />
</RelativeLayout> </RelativeLayout>
</TableRow> </TableRow>
@@ -250,7 +243,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginEnd="@dimen/yearly_padding_full" android:layout_marginEnd="@dimen/yearly_padding_full"
android:layout_marginRight="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@@ -260,13 +252,13 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/october" android:text="@string/october"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_10" android:id="@+id/month_10"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_10_label"/> android:layout_below="@+id/month_10_label" />
</RelativeLayout> </RelativeLayout>
@@ -285,23 +277,21 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/november" android:text="@string/november"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_11" android:id="@+id/month_11"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_11_label" android:layout_below="@+id/month_11_label"
android:layout_marginLeft="@dimen/yearly_month_padding"
android:layout_marginStart="@dimen/yearly_month_padding" android:layout_marginStart="@dimen/yearly_month_padding"
app:days="30"/> app:days="30" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/month_12_holder" android:id="@+id/month_12_holder"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/yearly_padding_full"
android:layout_marginStart="@dimen/yearly_padding_full" android:layout_marginStart="@dimen/yearly_padding_full"
android:layout_weight="1"> android:layout_weight="1">
@@ -312,13 +302,13 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="@string/december" android:text="@string/december"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.calendar.pro.views.SmallMonthView <com.simplemobiletools.calendar.pro.views.SmallMonthView
android:id="@+id/month_12" android:id="@+id/month_12"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/month_12_label"/> android:layout_below="@+id/month_12_label" />
</RelativeLayout> </RelativeLayout>
</TableRow> </TableRow>

View File

@@ -27,6 +27,7 @@
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin"
android:singleLine="true" android:singleLine="true"
android:textSize="@dimen/bigger_text_size" android:textSize="@dimen/bigger_text_size"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_autocomplete_holder" android:id="@+id/item_autocomplete_holder"
@@ -17,7 +16,7 @@
android:layout_height="@dimen/avatar_size" android:layout_height="@dimen/avatar_size"
android:layout_margin="@dimen/tiny_margin" android:layout_margin="@dimen/tiny_margin"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/> app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/item_autocomplete_name" android:id="@+id/item_autocomplete_name"
@@ -26,6 +25,7 @@
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin"
android:singleLine="true" android:singleLine="true"
android:textSize="@dimen/bigger_text_size" android:textSize="@dimen/bigger_text_size"
app:layout_constraintBottom_toTopOf="@+id/item_autocomplete_email" app:layout_constraintBottom_toTopOf="@+id/item_autocomplete_email"
@@ -33,7 +33,7 @@
app:layout_constraintStart_toEndOf="@+id/item_autocomplete_image" app:layout_constraintStart_toEndOf="@+id/item_autocomplete_image"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" app:layout_constraintVertical_chainStyle="packed"
tools:text="Simple Mobile"/> tools:text="Simple Mobile" />
<TextView <TextView
android:id="@+id/item_autocomplete_email" android:id="@+id/item_autocomplete_email"
@@ -45,12 +45,13 @@
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin"
android:singleLine="true" android:singleLine="true"
android:textSize="@dimen/normal_text_size" android:textSize="@dimen/normal_text_size"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/item_autocomplete_image" app:layout_constraintStart_toEndOf="@+id/item_autocomplete_image"
app:layout_constraintTop_toBottomOf="@+id/item_autocomplete_name" app:layout_constraintTop_toBottomOf="@+id/item_autocomplete_name"
tools:text="hello@simplemobiletools.com"/> tools:text="hello@simplemobiletools.com" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/week_column"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.commons.views.MyTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/week_day_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:textSize="@dimen/normal_text_size"
tools:text="@string/monday_letter" />

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/weekly_view_hour_textview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="bottom|center_horizontal" android:gravity="bottom|center_horizontal"
android:minHeight="@dimen/weekly_view_row_height"
android:paddingStart="@dimen/small_margin" android:paddingStart="@dimen/small_margin"
android:paddingEnd="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size" />

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/config_date_time_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/activity_margin">
<RelativeLayout
android:id="@+id/config_date_time_wrapper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/widget_round_background"
android:paddingBottom="@dimen/small_margin">
<TextView
android:id="@+id/widget_date_label"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="@dimen/medium_margin"
android:textColor="@color/md_grey_white"
android:textSize="28sp"
tools:text="13" />
<TextView
android:id="@+id/widget_month_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/widget_date_label"
android:layout_alignStart="@+id/widget_date_label"
android:layout_alignEnd="@+id/widget_date_label"
android:gravity="center"
android:paddingBottom="@dimen/medium_margin"
android:textColor="@color/md_grey_white"
android:textSize="@dimen/bigger_text_size"
tools:text="Jan" />
</RelativeLayout>
<ImageView
android:id="@+id/config_bg_color"
android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@dimen/widget_colorpicker_size"
android:layout_above="@+id/config_text_color" />
<RelativeLayout
android:id="@+id/config_bg_seekbar_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="@+id/config_bg_color"
android:layout_alignBottom="@+id/config_bg_color"
android:layout_toRightOf="@+id/config_bg_color"
android:background="@android:color/white">
<com.simplemobiletools.commons.views.MySeekBar
android:id="@+id/config_bg_seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" />
</RelativeLayout>
<ImageView
android:id="@+id/config_text_color"
android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@dimen/widget_colorpicker_size"
android:layout_alignParentBottom="true" />
<Button
android:id="@+id/config_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:fontFamily="sans-serif-light"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:text="@string/ok"
android:textColor="@android:color/white"
android:textSize="@dimen/big_text_size" />
</RelativeLayout>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/config_list_holder" android:id="@+id/config_list_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -14,24 +13,25 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_above="@+id/config_bg_color" android:layout_above="@+id/config_bg_color"
android:layout_marginBottom="@dimen/activity_margin" android:layout_marginBottom="@dimen/activity_margin"
android:background="@drawable/widget_round_background"
android:clipToPadding="false" android:clipToPadding="false"
android:divider="@null" android:divider="@null"
android:paddingStart="@dimen/activity_margin" android:paddingStart="@dimen/activity_margin"
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/> app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />
<ImageView <ImageView
android:id="@+id/config_bg_color" android:id="@+id/config_bg_color"
android:layout_width="@dimen/widget_colorpicker_size" android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@dimen/widget_colorpicker_size" android:layout_height="@dimen/widget_colorpicker_size"
android:layout_above="@+id/config_text_color"/> android:layout_above="@+id/config_text_color" />
<RelativeLayout <RelativeLayout
android:id="@+id/config_bg_seekbar_holder" android:id="@+id/config_bg_seekbar_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignBottom="@+id/config_bg_color"
android:layout_alignTop="@+id/config_bg_color" android:layout_alignTop="@+id/config_bg_color"
android:layout_alignBottom="@+id/config_bg_color"
android:layout_toEndOf="@+id/config_bg_color" android:layout_toEndOf="@+id/config_bg_color"
android:background="@android:color/white"> android:background="@android:color/white">
@@ -41,26 +41,26 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingStart="@dimen/activity_margin" android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"/> android:paddingEnd="@dimen/activity_margin" />
</RelativeLayout> </RelativeLayout>
<ImageView <ImageView
android:id="@+id/config_text_color" android:id="@+id/config_text_color"
android:layout_width="@dimen/widget_colorpicker_size" android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@dimen/widget_colorpicker_size" android:layout_height="@dimen/widget_colorpicker_size"
android:layout_alignParentBottom="true"/> android:layout_alignParentBottom="true" />
<Button <Button
android:id="@+id/config_save" android:id="@+id/config_save"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:fontFamily="sans-serif-light" android:fontFamily="sans-serif-light"
android:paddingStart="@dimen/activity_margin" android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:text="@string/ok" android:text="@string/ok"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="@dimen/big_text_size"/> android:textSize="@dimen/big_text_size" />
</RelativeLayout> </RelativeLayout>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/widget_date_holder"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/widget_date_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="@+id/widget_date_label"
android:layout_alignTop="@+id/widget_date_label"
android:layout_alignEnd="@+id/widget_date_label"
android:layout_alignBottom="@+id/widget_month_label"
android:src="@drawable/widget_round_background" />
<TextView
android:id="@+id/widget_date_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="@dimen/medium_margin"
android:textColor="@color/md_grey_white"
android:textSize="26sp"
tools:text="1" />
<TextView
android:id="@+id/widget_month_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/widget_date_label"
android:layout_alignStart="@+id/widget_date_label"
android:layout_alignEnd="@+id/widget_date_label"
android:gravity="center"
android:paddingBottom="@dimen/medium_margin"
android:textColor="@color/md_grey_white"
android:textSize="@dimen/bigger_text_size"
tools:text="Jan" />
</RelativeLayout>

View File

@@ -1,11 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/widget_event_list_holder" android:id="@+id/widget_event_list_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ImageView
android:id="@+id/widget_event_list_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:src="@drawable/widget_round_background" />
<TextView <TextView
android:id="@+id/widget_event_list_today" android:id="@+id/widget_event_list_today"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -19,7 +28,7 @@
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:textSize="@dimen/normal_text_size" android:textSize="@dimen/normal_text_size"
tools:text="July 18"/> tools:text="July 18" />
<ImageView <ImageView
android:id="@+id/widget_event_go_to_today" android:id="@+id/widget_event_go_to_today"
@@ -33,7 +42,7 @@
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/ic_today_vector"/> android:src="@drawable/ic_today_vector" />
<ImageView <ImageView
android:id="@+id/widget_event_new_event" android:id="@+id/widget_event_new_event"
@@ -47,7 +56,7 @@
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/ic_plus_vector"/> android:src="@drawable/ic_plus_vector" />
<ListView <ListView
android:id="@+id/widget_event_list" android:id="@+id/widget_event_list"
@@ -57,7 +66,7 @@
android:clipToPadding="false" android:clipToPadding="false"
android:divider="@null" android:divider="@null"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingBottom="@dimen/small_margin"/> android:paddingBottom="@dimen/small_margin" />
<TextView <TextView
android:id="@+id/widget_event_list_empty" android:id="@+id/widget_event_list_empty"
@@ -68,6 +77,6 @@
android:paddingStart="@dimen/big_margin" android:paddingStart="@dimen/big_margin"
android:paddingEnd="@dimen/big_margin" android:paddingEnd="@dimen/big_margin"
android:text="@string/no_upcoming_events" android:text="@string/no_upcoming_events"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
</RelativeLayout> </RelativeLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Some files were not shown because too many files have changed in this diff Show More