Skip to content

Updated to be compatible with Android 26 or higher without need of java.util.Calendar #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.1.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -19,5 +24,9 @@ allprojects {

repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Aug 06 18:02:35 CEST 2017
#Sat Jul 14 17:14:50 EDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
12 changes: 6 additions & 6 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ repositories {
}

android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
compileSdkVersion 28
buildToolsVersion '28.0.1'

defaultConfig {
minSdkVersion 9
targetSdkVersion 25
minSdkVersion 26
targetSdkVersion 28
}
}

configurations {
javadocDeps
}
dependencies {
compile 'com.android.support:appcompat-v7:25.1.0'
javadocDeps 'com.android.support:appcompat-v7:25.1.0'
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
javadocDeps 'com.android.support:appcompat-v7:28.0.0-alpha3'
}

apply from: 'gradle-mvn-push.gradle'
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.alamkanak.weekview;

import java.util.Calendar;
import java.time.LocalDateTime;

/**
* Created by Raquib on 1/6/2015.
*/
public interface DateTimeInterpreter {
public String interpretDate(Calendar date);
String interpretDate(LocalDateTime date);

public String interpretTime(int hour, int minutes);
String interpretTime(int hour, int minutes);
}
18 changes: 11 additions & 7 deletions library/src/main/java/com/alamkanak/weekview/MonthLoader.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.alamkanak.weekview;

import java.util.Calendar;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

public class MonthLoader implements WeekViewLoader {
Expand All @@ -12,8 +13,8 @@ public MonthLoader(MonthChangeListener listener) {
}

@Override
public double toWeekViewPeriodIndex(Calendar instance) {
return instance.get(Calendar.YEAR) * 12 + instance.get(Calendar.MONTH) + (instance.get(Calendar.DAY_OF_MONTH) - 1) / 30.0;
public double toWeekViewPeriodIndex(LocalDateTime instance) {
return instance.getYear() * 12 + instance.getMonthValue() + (instance.getDayOfMonth() - 1) / 30.0;
}

@Override
Expand All @@ -32,11 +33,14 @@ public void setOnMonthChangeListener(MonthChangeListener onMonthChangeListener)
public interface MonthChangeListener {
/**
* <p>Very important interface, it's the base to load events in the calendar.
* This method is called three times: once to load the previous month, once to load the next month and once to load the current month.</p>
* <strong>That's why you can have three times the same event at the same place if you mess up with the configuration</strong>
* This method is called three times: once to load the previous month, once to load the next month and once
* to load the current month.</p>
* <strong>That's why you can have three times the same event at the same place if you mess up with the
* configuration</strong>
*
* @param newYear : year of the events required by the view.
* @param newMonth : <p>month of the events required by the view </p><strong>1 based (not like JAVA API) : January = 1 and December = 12</strong>.
* @param newYear : year of the events required by the view.
* @param newMonth : <p>month of the events required by the view </p><strong>1 based (not like JAVA API) :
* January = 1 and December = 12</strong>.
* @return a list of the events happening <strong>during the specified month</strong>.
*/
List<? extends WeekViewEvent> onMonthChange(int newYear, int newMonth);
Expand Down
Loading