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

Support any week day start. #844

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ captures/

# Intellij
*.iml
.idea/workspace.xml
.idea

# Keystore files
*.jks
Binary file removed .idea/caches/build_file_checksums.ser
Binary file not shown.
Binary file removed .idea/caches/gradle_models.ser
Binary file not shown.
137 changes: 0 additions & 137 deletions .idea/codeStyles/Project.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/encodings.xml

This file was deleted.

23 changes: 0 additions & 23 deletions .idea/gradle.xml

This file was deleted.

39 changes: 0 additions & 39 deletions .idea/misc.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ protected void onWeekStartChange(int weekStart) {
*/
private String getWeekString(int index, int weekStart) {
String[] weeks = getContext().getResources().getStringArray(R.array.english_week_string_array);

if (weekStart == 1) {
return weeks[index];
}
if (weekStart == 2) {
return weeks[index == 6 ? 0 : index + 1];
int offset = weekStart - java.util.Calendar.SUNDAY;
int adjustedIndex = (index + offset) % 7;
if (adjustedIndex < 0) {
adjustedIndex += 7;
}
return weeks[index == 0 ? 6 : index - 1];
return weeks[adjustedIndex];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@ protected void onWeekStartChange(int weekStart) {
*/
private String getWeekString(int index, int weekStart) {
String[] weeks = getContext().getResources().getStringArray(R.array.chinese_week_string_array);

if (weekStart == 1) {
return weeks[index];
}
if (weekStart == 2) {
return weeks[index == 6 ? 0 : index + 1];
int offset = weekStart - java.util.Calendar.SUNDAY;
int adjustedIndex = (index + offset) % 7;
if (adjustedIndex < 0) {
adjustedIndex += 7;
}
return weeks[index == 0 ? 6 : index - 1];
return weeks[adjustedIndex];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@ protected void onWeekStartChange(int weekStart) {
*/
private String getWeekString(int index, int weekStart) {
String[] weeks = getContext().getResources().getStringArray(R.array.chinese_week_string_array);

if (weekStart == 1) {
return weeks[index];
}
if (weekStart == 2) {
return weeks[index == 6 ? 0 : index + 1];
int offset = weekStart - java.util.Calendar.SUNDAY;
int adjustedIndex = (index + offset) % 7;
if (adjustedIndex < 0) {
adjustedIndex += 7;
}
return weeks[index == 0 ? 6 : index - 1];
return weeks[adjustedIndex];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ protected void onWeekStartChange(int weekStart) {
*/
private String getWeekString(int index, int weekStart) {
String[] weeks = getContext().getResources().getStringArray(R.array.english_week_string_array);

if (weekStart == 1) {
return weeks[index];
}
if (weekStart == 2) {
return weeks[index == 6 ? 0 : index + 1];
int offset = weekStart - java.util.Calendar.SUNDAY;
int adjustedIndex = (index + offset) % 7;
if (adjustedIndex < 0) {
adjustedIndex += 7;
}
return weeks[index == 0 ? 6 : index - 1];
return weeks[adjustedIndex];
}
}
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ buildscript {
repositories {
jcenter()
google()
maven { url "https://repo.grails.org/grails/core/" }
}
dependencies {
//noinspection GradleDependency
Expand All @@ -17,6 +18,7 @@ allprojects {
repositories {
jcenter()
google()
maven { url "https://repo.grails.org/grails/core/" }
}
}

Expand Down
2 changes: 2 additions & 0 deletions calendarview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
testImplementation 'junit:junit:4.12'

compileOnly("androidx.viewpager:viewpager:1.0.0")
}
apply from: '../script/gradle-jcenter-push.gradle'
Loading