Skip to content
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

A lot of changes: Kotlin, time/date formatting fixes, demo activity for whole view snapping... #97

Open
wants to merge 48 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
472162d
-updated sdks
AndroidDeveloperLB May 7, 2018
2b59062
-converted project to Kotlin. Code can be shortened a lot, but requir…
AndroidDeveloperLB May 7, 2018
9865f5e
-added fix for day&month formatting, to be according to current locale:
AndroidDeveloperLB May 8, 2018
1406c08
Fixed possible null issues with providing null as list of events.
AndroidDeveloperLB May 8, 2018
1f9e199
Cleaned code a bit.
AndroidDeveloperLB May 8, 2018
c37823c
Handled some warnings...
AndroidDeveloperLB May 8, 2018
3438aad
further consideration of current locale to use the best format for th…
AndroidDeveloperLB May 9, 2018
9523d1b
handled auto-refreshing of the view every minute, to reflect changes …
AndroidDeveloperLB May 9, 2018
291461b
Some code cleaning
AndroidDeveloperLB May 9, 2018
8873a5d
Using proper conversion of dp units as the default values of the Week…
AndroidDeveloperLB May 9, 2018
b1a88c0
Replaced "compile" with "implementation
AndroidDeveloperLB May 9, 2018
e58f6f5
minor tweaks to sample of the WholeViewSnappingActivity.
AndroidDeveloperLB May 9, 2018
078b791
reduced Calendar instance creation a bit
AndroidDeveloperLB May 9, 2018
99c423a
Fix scroll snapping
May 9, 2018
0be2f1d
Merge pull request #1 from SkyleKayma/ScrollFix
AndroidDeveloperLB May 10, 2018
0228dad
-a lot of conversions (and fixes) from fields to properties.
AndroidDeveloperLB May 10, 2018
79d8e04
-a lot of conversions (and fixes) from fields to properties.
AndroidDeveloperLB May 10, 2018
1bc68ab
Merge branch 'develop' of https://github.com/AndroidDeveloperLB/Andro…
AndroidDeveloperLB May 10, 2018
f2a4226
sample bug fix (reported here: https://github.com/Quivr/Android-Week-…
AndroidDeveloperLB May 10, 2018
10a7614
Refactored some attributes to make it easier to understand what they …
AndroidDeveloperLB May 13, 2018
4241b17
fixed text alignment and spacing issues
AndroidDeveloperLB May 14, 2018
ae17dee
-removed dropping from WholeViewSnappingActivity. It makes scrolling …
AndroidDeveloperLB May 15, 2018
7cb7cd8
-added a way to put text on the left of the all-day events.
AndroidDeveloperLB May 15, 2018
edd87c1
fixed background color of samples.
AndroidDeveloperLB May 15, 2018
50585ff
fixed positioning of events and their lines.
AndroidDeveloperLB May 16, 2018
ef94b8d
- fixed issue of not being able to add an all-day event with same sta…
AndroidDeveloperLB May 17, 2018
8ebc646
Restored prefetching mechanism, fixing this issue:
AndroidDeveloperLB May 27, 2018
9d6f070
fixed possible OOM when setting a time of 0:00 to events, due to spli…
AndroidDeveloperLB May 28, 2018
0be8d77
fixed various issues with all-day events.
AndroidDeveloperLB May 29, 2018
d021bc1
moved implementation of textColorPicker to default one of WeekView.
AndroidDeveloperLB May 29, 2018
2c8ca57
made WeekViewEvent to be extendable, yet made most of its fields final
AndroidDeveloperLB May 29, 2018
eacd593
handled NPE in PrefetchingWeekViewLoader.
AndroidDeveloperLB May 29, 2018
610bd21
added feature to set a default title for events that don't have a tit…
AndroidDeveloperLB May 29, 2018
068fdfb
allowed using extended classes of WeekViewEvent in various functions
AndroidDeveloperLB May 30, 2018
3e11806
split the padding of the header into top+bottom
AndroidDeveloperLB May 31, 2018
09435f8
optimized code a bit.
AndroidDeveloperLB May 31, 2018
b73991c
More optimizations, by caching formatted dates and times.
AndroidDeveloperLB May 31, 2018
125c9dc
fixed weird issue in sample about January events
AndroidDeveloperLB May 31, 2018
46e5259
setting a default gap between overlapping events as 1dp, because when…
AndroidDeveloperLB Jun 10, 2018
7fd7e08
setting a default gap between overlapping events as 1dp, because when…
AndroidDeveloperLB Jun 10, 2018
da67353
Merge branch 'develop' of https://github.com/AndroidDeveloperLB/Andro…
AndroidDeveloperLB Jun 10, 2018
b0b098f
added side subtitle text, so you can show the year in case it's not t…
AndroidDeveloperLB Jun 10, 2018
a6ff5c8
targeting Android P
AndroidDeveloperLB Jun 10, 2018
6f829dd
trying to fix not being able to use the library.
AndroidDeveloperLB Jun 11, 2018
2f9b1b9
Updated SDKs.
AndroidDeveloperLB Sep 30, 2018
5688b50
updated gradle version
AndroidDeveloperLB Oct 23, 2018
91ab45f
updated sdks
AndroidDeveloperLB Feb 8, 2019
88c9020
Update README.md
AndroidDeveloperLB Feb 10, 2019
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
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.41'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.2.0-alpha14'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

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

repositories {
jcenter()
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
#Mon May 07 11:03:02 IDT 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.6-all.zip
18 changes: 11 additions & 7 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
//apply plugin: 'kotlin-android-extensions'

repositories {
mavenCentral()
}

android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
compileSdkVersion 27

defaultConfig {
minSdkVersion 9
targetSdkVersion 25
minSdkVersion 14
targetSdkVersion 27
}
}

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:27.1.1'
javadocDeps 'com.android.support:appcompat-v7:27.1.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//implementation 'androidx.core:core-ktx:0.3'

}

apply from: 'gradle-mvn-push.gradle'
apply from: 'gradle-mvn-push.gradle'
4 changes: 2 additions & 2 deletions library/gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ apply plugin: 'maven'
apply plugin: 'signing'

def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
return !VERSION_NAME.contains("SNAPSHOT")
}

def getReleaseRepositoryUrl() {
Expand Down Expand Up @@ -112,4 +112,4 @@ afterEvaluate { project ->
archives androidSourcesJar
// archives androidJavadocsJar
}
}
}
2 changes: 1 addition & 1 deletion library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<manifest package="com.alamkanak.weekview"></manifest>
<manifest package="com.alamkanak.weekview"/>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.alamkanak.weekview

import java.util.*

/**
* Created by Raquib on 1/6/2015.
*/
interface DateTimeInterpreter {
fun interpretDate(date: Calendar): String

fun interpretTime(hour: Int, minutes: Int): String
}
44 changes: 0 additions & 44 deletions library/src/main/java/com/alamkanak/weekview/MonthLoader.java

This file was deleted.

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

import java.util.*

class MonthLoader(var onMonthChangeListener: MonthChangeListener?) : WeekViewLoader {

override fun toWeekViewPeriodIndex(instance: Calendar): Double {
return (instance.get(Calendar.YEAR) * 12).toDouble() + instance.get(Calendar.MONTH).toDouble() + (instance.get(Calendar.DAY_OF_MONTH) - 1) / 30.0
}

override fun onLoad(periodIndex: Int): MutableList<WeekViewEvent>? {
return onMonthChangeListener!!.onMonthChange(periodIndex / 12, periodIndex % 12 + 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can you be sure that "onMonthChangeListener" will not be null here ?
I think that nullable "?" is better. It returns nullable List btw.

Copy link

@SkyleKayma SkyleKayma May 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can you be sure that "onMonthChangeListener" will not be null here ?
I think that nullable "?" is better. It returns nullable List btw.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are both correct and incorrect. For some reason the library has code to check it that when you use it, you must set a listener:

    if (weekViewLoader == null && !isInEditMode)
        throw IllegalStateException("You must provide a MonthChangeListener")

and then when you set it:

var monthChangeListener: MonthLoader.MonthChangeListener?
    get() = if (weekViewLoader is MonthLoader) (weekViewLoader as MonthLoader).onMonthChangeListener else null
    set(monthChangeListener) {
        this.weekViewLoader = MonthLoader(monthChangeListener)
    }

So you can't escape it from being non null.

But why this requirement exists at all?
How odd...
I think it's better to remove the requirement, and check for null...

For now I will let it stay how it is.

}

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.
* **That's why you can have three times the same event at the same place if you mess up with the configuration**
*
* @param newYear : year of the events required by the view.
* @param newMonth :
*
*month of the events required by the view **1 based (not like JAVA API) : January = 1 and December = 12**.
* @return a list of the events happening **during the specified month**.
*/
fun onMonthChange(newYear: Int, newMonth: Int): MutableList<WeekViewEvent>?
}
}
10 changes: 0 additions & 10 deletions library/src/main/java/com/alamkanak/weekview/TextColorPicker.java

This file was deleted.

10 changes: 10 additions & 0 deletions library/src/main/java/com/alamkanak/weekview/TextColorPicker.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.alamkanak.weekview

import android.support.annotation.ColorInt

interface TextColorPicker {

@ColorInt
fun getTextColor(event: WeekViewEvent): Int

}
Loading