Skip to content

Commit 2f1e6e3

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 58a11a1 + 616454f commit 2f1e6e3

File tree

12 files changed

+732
-266
lines changed

12 files changed

+732
-266
lines changed

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ Usage
3131
<dependency>
3232
<groupId>com.github.alamkanak</groupId>
3333
<artifactId>android-week-view</artifactId>
34-
<version>1.2.3</version>
34+
<version>1.2.4</version>
3535
<type>aar</type>
3636
</dependency>
3737
```
3838
* Grab via gradle
3939

4040
```groovy
41-
compile 'com.github.alamkanak:android-week-view:1.2.3'
41+
compile 'com.github.alamkanak:android-week-view:1.2.4'
4242
```
4343
2. Add WeekView in your xml layout.
4444

@@ -117,13 +117,23 @@ You can customize the look of the `WeekView` in xml. Use the following attribute
117117
- `textSize`
118118
- `todayBackgroundColor`
119119
- `todayHeaderTextColor`
120+
- `showDistinctPastFutureColor`
121+
- `futureBackgroundColor`
122+
- `pastBackgroundColor`
123+
- `showDistinctWeekendColor`
124+
- `futureWeekendBackgroundColor`
125+
- `pastWeekendBackgroundColor`
126+
- `showNowLine`
127+
- `nowLineColor`
128+
- `nowLineThickness`
120129

121130
Interfaces
122131
----------
123132

124133
Use the following interfaces according to your need.
125134

126-
- `mWeekView.setMonthChangeListener()` to provide events to the calendar
135+
- `mWeekView.setWeekViewLoader()` to provide events to the calendar
136+
- `mWeekView.setMonthChangeListener()` to provide events to the calendar by months
127137
- `mWeekView.setOnEventClickListener()` to get a callback when an event is clicked
128138
- `mWeekView.setEventLongPressListener()` to get a callback when an event is long pressed
129139
- `mWeekView.setEmptyViewClickListener()` to get a callback when any empty space is clicked
@@ -145,6 +155,15 @@ To do
145155
Changelog
146156
---------
147157

158+
**Version 1.2.4**
159+
160+
* **NOTE:** If you are using `WeekView.MonthChangeListener`, make sure to change it into `MonthLoader.MonthChangeListener`
161+
* Add support to have loaders other than MonthViewLoader
162+
* Add pinch to zoom support
163+
* Add support for location
164+
* Add ability to have different colors for past, future, weekend days
165+
* Add support for "now" line
166+
148167
**Version 1.2.3**
149168

150169
* Get callbacks when scrolling horizontally

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:1.0.0'
8+
classpath 'com.android.tools.build:gradle:1.3.0'
99

1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION_NAME=1.2.3
1+
VERSION_NAME=1.2.4
22
GROUP=com.github.alamkanak
33

44
POM_DESCRIPTION=An android library to show day view, week view, 3 day view etc. in your app.

library/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ repositories {
55
}
66

77
android {
8-
compileSdkVersion 22
9-
buildToolsVersion "22.0.1"
8+
compileSdkVersion 23
9+
buildToolsVersion "23.0.1"
1010

1111
defaultConfig {
1212
minSdkVersion 9
13-
targetSdkVersion 22
13+
targetSdkVersion 23
1414
}
1515
}
1616

1717
dependencies {
18-
compile 'com.android.support:appcompat-v7:22.0.0'
18+
compile 'com.android.support:appcompat-v7:23.0.1'
1919
}
2020

2121
apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'

library/src/main/AndroidManifest.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.alamkanak.weekview">
3-
4-
<application android:allowBackup="true">
5-
</application>
6-
73
</manifest>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.alamkanak.weekview;
2+
3+
import java.util.Calendar;
4+
import java.util.List;
5+
6+
public class MonthLoader implements WeekViewLoader {
7+
8+
private MonthChangeListener mOnMonthChangeListener;
9+
10+
public MonthLoader(MonthChangeListener listener){
11+
this.mOnMonthChangeListener = listener;
12+
}
13+
14+
@Override
15+
public double toWeekViewPeriodIndex(Calendar instance){
16+
return instance.get(Calendar.YEAR) * 12 + instance.get(Calendar.MONTH) + (instance.get(Calendar.DAY_OF_MONTH) - 1) / 30.0;
17+
}
18+
19+
@Override
20+
public List<WeekViewEvent> onLoad(int periodIndex){
21+
return mOnMonthChangeListener.onMonthChange(periodIndex / 12, periodIndex % 12 + 1);
22+
}
23+
24+
public MonthChangeListener getOnMonthChangeListener() {
25+
return mOnMonthChangeListener;
26+
}
27+
28+
public void setOnMonthChangeListener(MonthChangeListener onMonthChangeListener) {
29+
this.mOnMonthChangeListener = onMonthChangeListener;
30+
}
31+
32+
public interface MonthChangeListener {
33+
/**
34+
* Very important interface, it's the base to load events in the calendar.
35+
* 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.<br/>
36+
* <strong>That's why you can have three times the same event at the same place if you mess up with the configuration</strong>
37+
* @param newYear: year of the events required by the view.
38+
* @param newMonth: month of the events required by the view <br/><strong>1 based (not like JAVA API) --> January = 1 and December = 12</strong>.
39+
* @return a list of the events happening <strong>during the specified month</strong>.
40+
*/
41+
List<WeekViewEvent> onMonthChange(int newYear, int newMonth);
42+
}
43+
}

0 commit comments

Comments
 (0)