├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── xml │ │ │ │ └── backup.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values-w376dp │ │ │ │ └── styles.xml │ │ │ ├── values-w600dp │ │ │ │ ├── styles.xml │ │ │ │ └── dimens.xml │ │ │ ├── drawable │ │ │ │ ├── horizontal_divider.xml │ │ │ │ ├── ic_expand_toggle_white_24dp.xml │ │ │ │ ├── ic_add_white_24dp.xml │ │ │ │ ├── ic_expand_less_white_24dp.xml │ │ │ │ ├── ic_expand_more_white_24dp.xml │ │ │ │ ├── ic_event_white_24dp.xml │ │ │ │ ├── ic_event_white_96dp.xml │ │ │ │ ├── ic_title_white_24dp.xml │ │ │ │ ├── ic_access_time_white_24dp.xml │ │ │ │ ├── ic_clear_night_24dp.xml │ │ │ │ ├── ic_rain_24dp.xml │ │ │ │ ├── ic_wind_24dp.xml │ │ │ │ ├── ic_snow_24dp.xml │ │ │ │ ├── ic_clear_day_24dp.xml │ │ │ │ ├── ic_partly_cloudy_night_24dp.xml │ │ │ │ ├── ic_cloudy_24dp.xml │ │ │ │ └── ic_partly_cloudy_day_24dp.xml │ │ │ ├── values-w820dp-land │ │ │ │ └── dimens.xml │ │ │ ├── values │ │ │ │ ├── ids.xml │ │ │ │ ├── arrays.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ ├── layout │ │ │ │ ├── grid_item_header.xml │ │ │ │ ├── grid_item_content.xml │ │ │ │ ├── fab_add.xml │ │ │ │ ├── list_item_calendar.xml │ │ │ │ ├── include_activity_main.xml │ │ │ │ ├── empty_permission.xml │ │ │ │ ├── activity_edit.xml │ │ │ │ ├── toolbar_main.xml │ │ │ │ ├── list_item_content.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── list_item_header.xml │ │ │ │ └── event_edit_view.xml │ │ │ ├── menu │ │ │ │ ├── menu_edit.xml │ │ │ │ └── menu_main.xml │ │ │ ├── layout-land │ │ │ │ └── include_activity_main.xml │ │ │ └── layout-w820dp-land │ │ │ │ ├── include_activity_main.xml │ │ │ │ ├── toolbar_main.xml │ │ │ │ └── activity_edit.xml │ │ ├── java │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── hidroh │ │ │ │ └── calendar │ │ │ │ ├── weather │ │ │ │ ├── WeatherSyncAlarmReceiver.java │ │ │ │ ├── Weather.java │ │ │ │ └── WeatherSyncService.java │ │ │ │ ├── ViewUtils.java │ │ │ │ ├── content │ │ │ │ ├── CalendarCursor.java │ │ │ │ ├── EventCursor.java │ │ │ │ └── EventsQueryHandler.java │ │ │ │ ├── text │ │ │ │ └── style │ │ │ │ │ ├── UnderDotSpan.java │ │ │ │ │ └── CircleSpan.java │ │ │ │ └── widget │ │ │ │ ├── CalendarSelectionView.java │ │ │ │ ├── MonthViewPagerAdapter.java │ │ │ │ ├── EventCalendarView.java │ │ │ │ └── AgendaView.java │ │ └── AndroidManifest.xml │ └── test │ │ ├── resources │ │ └── robolectric.properties │ │ └── java │ │ ├── android │ │ ├── net │ │ │ └── http │ │ │ │ └── AndroidHttpClient.java │ │ └── content │ │ │ └── ShadowAsyncQueryHandler.java │ │ └── io │ │ └── github │ │ └── hidroh │ │ └── calendar │ │ ├── test │ │ ├── shadows │ │ │ ├── ShadowViewHolder.java │ │ │ ├── ShadowLinearLayoutManager.java │ │ │ ├── ShadowViewPager.java │ │ │ └── ShadowRecyclerView.java │ │ ├── TestEventCursor.java │ │ └── assertions │ │ │ ├── SpannableStringAssert.java │ │ │ └── DayTimeAssert.java │ │ ├── MainActivityPermissionTest.java │ │ ├── MainActivityCalendarSelectionTest.java │ │ ├── MainActivityWeatherTest.java │ │ ├── weather │ │ └── WeatherSyncServiceTest.java │ │ ├── widget │ │ ├── MonthViewTest.java │ │ └── EventCalendarViewTest.java │ │ └── CalendarUtilsTest.java └── build.gradle ├── settings.gradle ├── screenshots ├── 1.png ├── 2.png ├── 3.png ├── 4.png └── 5.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── README.md ├── .travis.yml ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /screenshots/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidroh/calendar/HEAD/screenshots/1.png -------------------------------------------------------------------------------- /screenshots/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidroh/calendar/HEAD/screenshots/2.png -------------------------------------------------------------------------------- /screenshots/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidroh/calendar/HEAD/screenshots/3.png -------------------------------------------------------------------------------- /screenshots/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidroh/calendar/HEAD/screenshots/4.png -------------------------------------------------------------------------------- /screenshots/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidroh/calendar/HEAD/screenshots/5.png -------------------------------------------------------------------------------- /app/src/main/res/xml/backup.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/test/resources/robolectric.properties: -------------------------------------------------------------------------------- 1 | constants=io.github.hidroh.calendar.BuildConfig 2 | sdk=21 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidroh/calendar/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidroh/calendar/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidroh/calendar/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidroh/calendar/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidroh/calendar/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidroh/calendar/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/test/java/android/net/http/AndroidHttpClient.java: -------------------------------------------------------------------------------- 1 | package android.net.http; 2 | 3 | /** 4 | * Stub to replace deprecated legacy AndroidHttpClient 5 | */ 6 | public class AndroidHttpClient { 7 | } 8 | -------------------------------------------------------------------------------- /app/src/main/res/values-w376dp/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values-w600dp/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/horizontal_divider.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 32dp 4 | 32dp 5 | 392dp 6 | 92dp 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Nov 26 13:08:28 GMT 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-4.4-20171031235950+0000-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/values-w600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 32dp 4 | 16dp 5 | 16dp 6 | 120dp 7 | 24dp 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_expand_toggle_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @color/blue50 5 | @color/cyan50 6 | @color/green50 7 | @color/yellow50 8 | @color/red50 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_add_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_expand_less_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_expand_more_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/grid_item_header.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_event_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_event_white_96dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_title_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/grid_item_content.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_edit.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fab_add.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #E3F2FD 4 | #E0F7FA 5 | #E8F5E9 6 | #FFFDE7 7 | #FFEBEE 8 | #2196F3 9 | #1976D2 10 | #00C853 11 | #1F000000 12 | 13 | -------------------------------------------------------------------------------- /app/src/test/java/io/github/hidroh/calendar/test/shadows/ShadowViewHolder.java: -------------------------------------------------------------------------------- 1 | package io.github.hidroh.calendar.test.shadows; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | 5 | import org.robolectric.annotation.Implementation; 6 | import org.robolectric.annotation.Implements; 7 | 8 | @Implements(RecyclerView.ViewHolder.class) 9 | public class ShadowViewHolder { 10 | public int adapterPosition; 11 | 12 | @Implementation 13 | public int getAdapterPosition() { 14 | return adapterPosition; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Log Files 26 | *.log 27 | 28 | # Android Studio Navigation editor temp files 29 | .navigation/ 30 | 31 | # Android Studio captures folder 32 | captures/ 33 | .idea/ 34 | *.iml 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_access_time_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 8dp 6 | 8dp 7 | 8dp 8 | 4dp 9 | 1dp 10 | 4dp 11 | 96dp 12 | 16dp 13 | 4dp 14 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/hidroh/calendar/weather/WeatherSyncAlarmReceiver.java: -------------------------------------------------------------------------------- 1 | package io.github.hidroh.calendar.weather; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.support.v4.content.WakefulBroadcastReceiver; 6 | 7 | /** 8 | * Broadcast receiver that triggers launching weather sync service 9 | */ 10 | public class WeatherSyncAlarmReceiver extends WakefulBroadcastReceiver { 11 | @Override 12 | public void onReceive(Context context, Intent intent) { 13 | startWakefulService(context, new Intent(context, WeatherSyncService.class)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_clear_night_24dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item_calendar.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | org.gradle.daemon=true 20 | android.enableAapt2=false -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # My Calendar 2 | Simple event calendar, with agenda view. 3 | 4 | ## Requirements 5 | * Android SDK 26 6 | * Android SDK Build-tools 26.0.2 7 | * Android Support Library 26.1.0 8 | 9 | ## Build & Test 10 | 11 | **Build** 12 | 13 | ./gradlew :app:assembleDebug 14 | 15 | **Test & Coverage** [![Build Status](https://travis-ci.org/hidroh/calendar.svg?branch=master)](https://travis-ci.org/hidroh/calendar) [![Coverage Status](https://coveralls.io/repos/hidroh/calendar/badge.svg?branch=master)](https://coveralls.io/r/hidroh/calendar?branch=master) 16 | 17 | ./gradlew :app:lintDebug 18 | ./gradlew :app:testDebug 19 | ./gradlew :app:jacocoTestCoverage 20 | 21 | ## Screenshots 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | *Weather icons are from Meteocons set by Alessio Atzeni* 30 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | jdk: 3 | - oraclejdk8 4 | android: 5 | components: 6 | # Uncomment the lines below if you want to 7 | # use the latest revision of Android SDK Tools 8 | - tools 9 | - tools # TODO remove once travis support API 24 10 | - platform-tools 11 | 12 | # The BuildTools version used by your project 13 | - build-tools-26.0.2 14 | 15 | # The SDK version used to compile your project 16 | - android-26 17 | 18 | # Additional components 19 | - extra-android-m2repository 20 | # - addon-google_apis-google-19 21 | 22 | # Specify at least one system image, 23 | # if you need to run emulator(s) during your tests 24 | # - sys-img-armeabi-v7a-android-19 25 | # - sys-img-x86-android-17 26 | before_cache: 27 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock 28 | cache: 29 | directories: 30 | - $HOME/.gradle/caches/ 31 | - $HOME/.gradle/wrapper/ 32 | script: "./gradlew assembleDebug && ./gradlew lintDebug &&./gradlew testDebug" 33 | after_success: 34 | - ./gradlew jacocoTestReport coveralls -------------------------------------------------------------------------------- /app/src/main/res/layout-land/include_activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_rain_24dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_wind_24dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/hidroh/calendar/ViewUtils.java: -------------------------------------------------------------------------------- 1 | package io.github.hidroh.calendar; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.support.v4.content.ContextCompat; 6 | 7 | /** 8 | * Utility class for view logic 9 | */ 10 | public class ViewUtils { 11 | 12 | /** 13 | * Retrieves pool of colors for calendars and events 14 | * @param context resources provider 15 | * @return array of {@link android.support.annotation.ColorInt} integers 16 | */ 17 | public static int[] getCalendarColors(Context context) { 18 | int transparentColor = ContextCompat.getColor(context, android.R.color.transparent); 19 | TypedArray ta = context.getResources().obtainTypedArray(R.array.calendar_colors); 20 | int[] colors; 21 | if (ta.length() > 0) { 22 | colors = new int[ta.length()]; 23 | for (int i = 0; i < ta.length(); i++) { 24 | colors[i] = ta.getColor(i, transparentColor); 25 | } 26 | } else { 27 | colors = new int[]{transparentColor}; 28 | } 29 | ta.recycle(); 30 | return colors; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/include_activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 22 | 23 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/test/java/io/github/hidroh/calendar/test/TestEventCursor.java: -------------------------------------------------------------------------------- 1 | package io.github.hidroh.calendar.test; 2 | 3 | import android.database.ContentObserver; 4 | import android.database.MatrixCursor; 5 | 6 | import io.github.hidroh.calendar.content.EventCursor; 7 | 8 | public class TestEventCursor extends EventCursor { 9 | private ContentObserver contentObserver; 10 | 11 | public TestEventCursor() { 12 | super(new MatrixCursor(EventCursor.PROJECTION)); 13 | } 14 | 15 | public void addRow(Object[] columnValues) { 16 | ((MatrixCursor) getWrappedCursor()).addRow(columnValues); 17 | } 18 | 19 | @Override 20 | public void registerContentObserver(ContentObserver observer) { 21 | contentObserver = observer; 22 | } 23 | 24 | @Override 25 | public void unregisterContentObserver(ContentObserver observer) { 26 | contentObserver = null; 27 | } 28 | 29 | public void notifyContentChange(boolean selfChange) { 30 | if (contentObserver != null) { 31 | contentObserver.onChange(selfChange); 32 | } 33 | } 34 | 35 | public boolean hasContentObserver() { 36 | return contentObserver != null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout-w820dp-land/include_activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 21 | 22 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/test/java/io/github/hidroh/calendar/test/shadows/ShadowLinearLayoutManager.java: -------------------------------------------------------------------------------- 1 | package io.github.hidroh.calendar.test.shadows; 2 | 3 | import android.support.v7.widget.LinearLayoutManager; 4 | 5 | import org.robolectric.annotation.Implementation; 6 | import org.robolectric.annotation.Implements; 7 | 8 | @Implements(LinearLayoutManager.class) 9 | public class ShadowLinearLayoutManager { 10 | private static final int TOTAL_VISIBLE = 10; // assume we can layout 10 items on screen 11 | private int firstVisiblePosition = 0; 12 | private int lastVisiblePosition = TOTAL_VISIBLE - 1; 13 | 14 | @Implementation 15 | public void scrollToPosition(int position) { 16 | firstVisiblePosition = position; 17 | lastVisiblePosition = position + TOTAL_VISIBLE - 1; 18 | } 19 | 20 | @Implementation 21 | public int findFirstVisibleItemPosition() { 22 | return firstVisiblePosition; 23 | } 24 | 25 | 26 | @Implementation 27 | public int findLastVisibleItemPosition() { 28 | return lastVisiblePosition; 29 | } 30 | 31 | public void scrollToLastPosition(int position) { 32 | lastVisiblePosition = position; 33 | firstVisiblePosition = position - TOTAL_VISIBLE + 1; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout-w820dp-land/toolbar_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/hidroh/calendar/content/CalendarCursor.java: -------------------------------------------------------------------------------- 1 | package io.github.hidroh.calendar.content; 2 | 3 | import android.database.Cursor; 4 | import android.database.CursorWrapper; 5 | import android.provider.CalendarContract; 6 | 7 | /** 8 | * {@link android.provider.CalendarContract.Calendars} cursor wrapper 9 | */ 10 | public class CalendarCursor extends CursorWrapper { 11 | 12 | /** 13 | * {@link android.provider.CalendarContract.Calendars} query projection 14 | */ 15 | public static final String[] PROJECTION = new String[]{ 16 | CalendarContract.Calendars._ID, 17 | CalendarContract.Calendars.CALENDAR_DISPLAY_NAME 18 | }; 19 | private static final int PROJECTION_INDEX_ID = 0; 20 | private static final int PROJECTION_INDEX_DISPLAY_NAME = 1; 21 | 22 | public CalendarCursor(Cursor cursor) { 23 | super(cursor); 24 | } 25 | 26 | /** 27 | * Gets calendar ID 28 | * @return calendar ID 29 | */ 30 | public long getId() { 31 | return getLong(PROJECTION_INDEX_ID); 32 | } 33 | 34 | /** 35 | * Gets calendar display name 36 | * @return calendar display name 37 | */ 38 | public String getDisplayName() { 39 | return getString(PROJECTION_INDEX_DISPLAY_NAME); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/res/layout/empty_permission.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 21 | 22 |