Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
alamkanak committed Dec 12, 2015
2 parents 8aa4ec6 + a55ae00 commit 616454f
Show file tree
Hide file tree
Showing 12 changed files with 732 additions and 266 deletions.
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ Usage
<dependency>
<groupId>com.github.alamkanak</groupId>
<artifactId>android-week-view</artifactId>
<version>1.2.3</version>
<version>1.2.4</version>
<type>aar</type>
</dependency>
```
* Grab via gradle

```groovy
compile 'com.github.alamkanak:android-week-view:1.2.3'
compile 'com.github.alamkanak:android-week-view:1.2.4'
```
2. Add WeekView in your xml layout.

Expand Down Expand Up @@ -117,13 +117,23 @@ You can customize the look of the `WeekView` in xml. Use the following attribute
- `textSize`
- `todayBackgroundColor`
- `todayHeaderTextColor`
- `showDistinctPastFutureColor`
- `futureBackgroundColor`
- `pastBackgroundColor`
- `showDistinctWeekendColor`
- `futureWeekendBackgroundColor`
- `pastWeekendBackgroundColor`
- `showNowLine`
- `nowLineColor`
- `nowLineThickness`

Interfaces
----------

Use the following interfaces according to your need.

- `mWeekView.setMonthChangeListener()` to provide events to the calendar
- `mWeekView.setWeekViewLoader()` to provide events to the calendar
- `mWeekView.setMonthChangeListener()` to provide events to the calendar by months
- `mWeekView.setOnEventClickListener()` to get a callback when an event is clicked
- `mWeekView.setEventLongPressListener()` to get a callback when an event is long pressed
- `mWeekView.setEmptyViewClickListener()` to get a callback when any empty space is clicked
Expand All @@ -145,6 +155,15 @@ To do
Changelog
---------

**Version 1.2.4**

* **NOTE:** If you are using `WeekView.MonthChangeListener`, make sure to change it into `MonthLoader.MonthChangeListener`
* Add support to have loaders other than MonthViewLoader
* Add pinch to zoom support
* Add support for location
* Add ability to have different colors for past, future, weekend days
* Add support for "now" line

**Version 1.2.3**

* Get callbacks when scrolling horizontally
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.android.tools.build:gradle:1.3.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=1.2.3
VERSION_NAME=1.2.4
GROUP=com.github.alamkanak

POM_DESCRIPTION=An android library to show day view, week view, 3 day view etc. in your app.
Expand Down
8 changes: 4 additions & 4 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ repositories {
}

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
minSdkVersion 9
targetSdkVersion 22
targetSdkVersion 23
}
}

dependencies {
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:appcompat-v7:23.0.1'
}

apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
4 changes: 0 additions & 4 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.alamkanak.weekview">

<application android:allowBackup="true">
</application>

</manifest>
43 changes: 43 additions & 0 deletions library/src/main/java/com/alamkanak/weekview/MonthLoader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.alamkanak.weekview;

import java.util.Calendar;
import java.util.List;

public class MonthLoader implements WeekViewLoader {

private MonthChangeListener mOnMonthChangeListener;

public MonthLoader(MonthChangeListener listener){
this.mOnMonthChangeListener = 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;
}

@Override
public List<WeekViewEvent> onLoad(int periodIndex){
return mOnMonthChangeListener.onMonthChange(periodIndex / 12, periodIndex % 12 + 1);
}

public MonthChangeListener getOnMonthChangeListener() {
return mOnMonthChangeListener;
}

public void setOnMonthChangeListener(MonthChangeListener onMonthChangeListener) {
this.mOnMonthChangeListener = onMonthChangeListener;
}

public interface MonthChangeListener {
/**
* 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.<br/>
* <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: month of the events required by the view <br/><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<WeekViewEvent> onMonthChange(int newYear, int newMonth);
}
}
Loading

0 comments on commit 616454f

Please sign in to comment.