Skip to content

Commit e70b92f

Browse files
committed
Execute Kotlin conversion
1 parent 08d3249 commit e70b92f

File tree

13 files changed

+3647
-3987
lines changed

13 files changed

+3647
-3987
lines changed
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package com.alamkanak.weekview;
2-
3-
import java.util.Calendar;
4-
5-
/**
6-
* Created by Raquib on 1/6/2015.
7-
*/
8-
public interface DateTimeInterpreter {
9-
public String interpretDate(Calendar date);
10-
11-
public String interpretTime(int hour, int minutes);
12-
}
1+
package com.alamkanak.weekview
2+
3+
import java.util.Calendar
4+
5+
/**
6+
* Created by Raquib on 1/6/2015.
7+
*/
8+
interface DateTimeInterpreter {
9+
fun interpretDate(date: Calendar): String
10+
11+
fun interpretTime(hour: Int, minutes: Int): String
12+
}
Lines changed: 30 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,30 @@
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<? extends 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-
* <p>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.</p>
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-
*
38-
* @param newYear : year of the events required by the view.
39-
* @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>.
40-
* @return a list of the events happening <strong>during the specified month</strong>.
41-
*/
42-
List<? extends WeekViewEvent> onMonthChange(int newYear, int newMonth);
43-
}
44-
}
1+
package com.alamkanak.weekview
2+
3+
import java.util.Calendar
4+
5+
class MonthLoader(var onMonthChangeListener: MonthChangeListener?) : WeekViewLoader {
6+
7+
override fun toWeekViewPeriodIndex(instance: Calendar): Double {
8+
return (instance.get(Calendar.YEAR) * 12).toDouble() + instance.get(Calendar.MONTH).toDouble() + (instance.get(Calendar.DAY_OF_MONTH) - 1) / 30.0
9+
}
10+
11+
override fun onLoad(periodIndex: Int): List<WeekViewEvent> {
12+
return onMonthChangeListener!!.onMonthChange(periodIndex / 12, periodIndex % 12 + 1)
13+
}
14+
15+
interface MonthChangeListener {
16+
/**
17+
*
18+
* Very important interface, it's the base to load events in the calendar.
19+
* 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.
20+
* **That's why you can have three times the same event at the same place if you mess up with the configuration**
21+
*
22+
* @param newYear : year of the events required by the view.
23+
* @param newMonth :
24+
*
25+
*month of the events required by the view **1 based (not like JAVA API) : January = 1 and December = 12**.
26+
* @return a list of the events happening **during the specified month**.
27+
*/
28+
fun onMonthChange(newYear: Int, newMonth: Int): List<WeekViewEvent>
29+
}
30+
}
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package com.alamkanak.weekview;
2-
3-
import android.support.annotation.ColorInt;
4-
5-
public interface TextColorPicker {
6-
7-
@ColorInt
8-
int getTextColor(WeekViewEvent event);
9-
10-
}
1+
package com.alamkanak.weekview
2+
3+
import android.support.annotation.ColorInt
4+
5+
interface TextColorPicker {
6+
7+
@ColorInt
8+
fun getTextColor(event: WeekViewEvent): Int
9+
10+
}

0 commit comments

Comments
 (0)