Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7a0213b
Supported api 16.
mustafabayram Nov 30, 2018
366eb14
Version updated.
mustafabayram Nov 30, 2018
b48d96e
README updated.
mustafabayram Nov 30, 2018
f80b111
README updated.
mustafabayram Nov 30, 2018
18bddd8
README updated.
mustafabayram Nov 30, 2018
d48e6ac
Month name ui updated. Custom text appearance property added into mon…
mustafabayram Nov 30, 2018
69a32d1
README updated.
mustafabayram Nov 30, 2018
1ee82b5
Added visible min date and max date configuration. Added enable min d…
mustafabayram Dec 3, 2018
878978a
Version updated. README updated.
mustafabayram Dec 3, 2018
8835960
Version updated. README updated.
mustafabayram Dec 3, 2018
2d1c993
Nested scrolling enabled. Current day text color bug fixed. Initial p…
mustafabayram Dec 3, 2018
0368ed1
Other day visibility configuration added.
mustafabayram Dec 4, 2018
829ec4e
Month header updated. Set gravity center and border line added.
mustafabayram Dec 4, 2018
2b75f5d
Current day text color cause a bug and disabled.
mustafabayram Dec 4, 2018
e51bf6e
Version updated. README updated.
mustafabayram Dec 4, 2018
348d39e
Snap helper removed from calendar view. Max date bug fixed.
mustafabayram Dec 18, 2018
1ec9aa4
Added selected date listener
mustafabayram Dec 18, 2018
139b457
When select a day calendar view auto scroll to selected position.
mustafabayram Dec 18, 2018
f78fc91
Version updated. README updated.
mustafabayram Dec 18, 2018
aed2066
CalendarView grid margin reduced and nested scrolling disabled.
mustafabayram Dec 28, 2018
300f9c9
version updated. README updated.
mustafabayram Dec 28, 2018
1ba2b31
selected date circle padding updated.
mustafabayram Feb 15, 2019
81db085
Bug fixed. Version updated. README updated.
mustafabayram Jul 29, 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CosmoCalendar
[![GitHub license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/AppliKeySolutions/CosmoCalendar/blob/master/LICENSE)

Made by [Applikey Solutions](https://applikeysolutions.com)
Made by [Applikey Solutions](https://applikeysolutions.com) and updated by Mustafa Bayram.

![](pictures/cosmo-calendar.png)

Expand All @@ -23,7 +23,7 @@ Made by [Applikey Solutions](https://applikeysolutions.com)

# Usage
```xml
compile 'com.github.applikeysolutions:cosmocalendar:1.0.4'
compile 'com.github.mustafabayram:CosmoCalendar:1.4'
```

# Customization
Expand Down
12 changes: 10 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@ buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
}

allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}

tasks.withType(Javadoc).all {
Expand Down
20 changes: 11 additions & 9 deletions cosmocalendar/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'

group = 'com.github.mustafabayram'
ext {
bintrayRepo = 'maven'
bintrayName = 'cosmocalendar'
Expand All @@ -25,14 +27,14 @@ ext {
}

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileSdkVersion 28
buildToolsVersion "28.0.3"

defaultConfig {
minSdkVersion 17
targetSdkVersion 25
versionCode 5
versionName "1.0.4"
minSdkVersion 16
targetSdkVersion 28
versionCode 14
versionName "1.4"
}
buildTypes {
release {
Expand All @@ -43,9 +45,9 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile "com.android.support:recyclerview-v7:25.3.1"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation "com.android.support:recyclerview-v7:28.0.0"
}

// Place it at the end of the file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,28 @@ public void setWeekendDays(Set<Long> weekendDays) {
setDaysAccordingToSet(weekendDays, DayFlag.WEEKEND);
}

public void setEnableMinDate(Calendar minDate) {
for (Month month : months) {
for (Day day : month.getDays()) {
if (!day.isDisabled()) {
day.setDisabled(CalendarUtils.isDayDisabledByMinDate(day, minDate));
}
}
}
notifyDataSetChanged();
}

public void setEnableMaxDate(Calendar maxDate) {
for (Month month : months) {
for (Day day : month.getDays()) {
if (!day.isDisabled()) {
day.setDisabled(CalendarUtils.isDayDisabledByMaxDate(day, maxDate));
}
}
}
notifyDataSetChanged();
}

public void setDisabledDays(Set<Long> disabledDays) {
setDaysAccordingToSet(disabledDays, DayFlag.DISABLED);
}
Expand All @@ -133,10 +155,10 @@ public void setConnectedCalendarDays(Set<Long> connectedCalendarDays) {
setDaysAccordingToSet(connectedCalendarDays, DayFlag.FROM_CONNECTED_CALENDAR);
}

public void setDisabledDaysCriteria(DisabledDaysCriteria criteria){
public void setDisabledDaysCriteria(DisabledDaysCriteria criteria) {
for (Month month : months) {
for (Day day : month.getDays()) {
if(!day.isDisabled()){
if (!day.isDisabled()) {
day.setDisabled(CalendarUtils.isDayDisabledByCriteria(day, criteria));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.applikeysolutions.cosmocalendar.adapter.viewholder;

import android.content.res.Resources;
import android.support.v4.widget.TextViewCompat;
import android.view.View;

import com.applikeysolutions.cosmocalendar.settings.appearance.ConnectedDayIconPosition;
Expand All @@ -26,6 +27,7 @@ public DayHolder(View itemView, CalendarView calendarView) {
public void bind(Day day, BaseSelectionManager selectionManager) {
this.selectionManager = selectionManager;
ctvDay.setText(String.valueOf(day.getDayNumber()));
TextViewCompat.setTextAppearance(ctvDay, calendarView.getDayTextAppearance());

boolean isSelected = selectionManager.isDaySelected(day);
if (isSelected && !day.isDisabled()) {
Expand All @@ -36,29 +38,30 @@ public void bind(Day day, BaseSelectionManager selectionManager) {

if (day.isCurrent()) {
addCurrentDayIcon(isSelected);
//ctvDay.setTextColor(calendarView.getCurrentDayTextColor());
}

if(day.isDisabled()){
if (day.isDisabled()) {
ctvDay.setTextColor(calendarView.getDisabledDayTextColor());
}
}

private void addCurrentDayIcon(boolean isSelected){
private void addCurrentDayIcon(boolean isSelected) {
ctvDay.setCompoundDrawablePadding(getPadding(getCurrentDayIconHeight(isSelected)) * -1);
ctvDay.setCompoundDrawablesWithIntrinsicBounds(0, isSelected
? calendarView.getCurrentDaySelectedIconRes()
: calendarView.getCurrentDayIconRes(), 0, 0);
}

private int getCurrentDayIconHeight(boolean isSelected){
private int getCurrentDayIconHeight(boolean isSelected) {
if (isSelected) {
return CalendarUtils.getIconHeight(calendarView.getContext().getResources(), calendarView.getCurrentDaySelectedIconRes());
} else {
return CalendarUtils.getIconHeight(calendarView.getContext().getResources(), calendarView.getCurrentDayIconRes());
}
}

private int getConnectedDayIconHeight(boolean isSelected){
private int getConnectedDayIconHeight(boolean isSelected) {
if (isSelected) {
return CalendarUtils.getIconHeight(calendarView.getContext().getResources(), calendarView.getConnectedDaySelectedIconRes());
} else {
Expand All @@ -68,7 +71,7 @@ private int getConnectedDayIconHeight(boolean isSelected){

private void select(Day day) {
if (day.isFromConnectedCalendar()) {
if(day.isDisabled()){
if (day.isDisabled()) {
ctvDay.setTextColor(day.getConnectedDaysDisabledTextColor());
} else {
ctvDay.setTextColor(day.getConnectedDaysSelectedTextColor());
Expand All @@ -88,10 +91,10 @@ private void select(Day day) {
animateDay(state, day);
}

private void addConnectedDayIcon(boolean isSelected){
private void addConnectedDayIcon(boolean isSelected) {
ctvDay.setCompoundDrawablePadding(getPadding(getConnectedDayIconHeight(isSelected)) * -1);

switch (calendarView.getConnectedDayIconPosition()){
switch (calendarView.getConnectedDayIconPosition()) {
case ConnectedDayIconPosition.TOP:
ctvDay.setCompoundDrawablesWithIntrinsicBounds(0, isSelected
? calendarView.getConnectedDaySelectedIconRes()
Expand Down Expand Up @@ -161,7 +164,7 @@ private void animateDay(SelectionState state, Day day) {
private void unselect(Day day) {
int textColor;
if (day.isFromConnectedCalendar()) {
if(day.isDisabled()){
if (day.isDisabled()) {
textColor = day.getConnectedDaysDisabledTextColor();
} else {
textColor = day.getConnectedDaysTextColor();
Expand All @@ -179,7 +182,7 @@ private void unselect(Day day) {
ctvDay.clearView();
}

private int getPadding(int iconHeight){
private int getPadding(int iconHeight) {
return (int) (iconHeight * Resources.getSystem().getDisplayMetrics().density);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.applikeysolutions.cosmocalendar.adapter.viewholder;

import android.support.v4.widget.TextViewCompat;
import android.view.View;
import android.widget.TextView;

Expand All @@ -22,6 +23,7 @@ public DayOfWeekHolder(View itemView, CalendarView calendarView) {
}

public void bind(Day day) {
TextViewCompat.setTextAppearance(tvDay, calendarView.getDayTextAppearance());
tvDay.setText(mDayOfWeekFormatter.format(day.getCalendar().getTime()));
tvDay.setTextColor(calendarView.getWeekDayTitleTextColor());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.applikeysolutions.cosmocalendar.adapter.viewholder;

import android.support.v4.widget.TextViewCompat;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.applikeysolutions.cosmocalendar.settings.SettingsManager;
Expand All @@ -14,20 +14,16 @@

public class MonthHolder extends RecyclerView.ViewHolder {

private LinearLayout llMonthHeader;
private TextView tvMonthName;
private View viewLeftLine;
private View viewRightLine;
private MonthView monthView;
private View monthHeaderBorder;
private SettingsManager appearanceModel;

public MonthHolder(View itemView, SettingsManager appearanceModel) {
super(itemView);
llMonthHeader = (LinearLayout) itemView.findViewById(R.id.ll_month_header);
monthView = (MonthView) itemView.findViewById(R.id.month_view);
tvMonthName = (TextView) itemView.findViewById(R.id.tv_month_name);
viewLeftLine = itemView.findViewById(R.id.view_left_line);
viewRightLine = itemView.findViewById(R.id.view_right_line);
monthHeaderBorder = itemView.findViewById(R.id.month_header_border);
this.appearanceModel = appearanceModel;
}

Expand All @@ -38,11 +34,10 @@ public void setDayAdapter(DaysAdapter adapter) {
public void bind(Month month) {
tvMonthName.setText(month.getMonthName());
tvMonthName.setTextColor(appearanceModel.getMonthTextColor());
TextViewCompat.setTextAppearance(tvMonthName, appearanceModel.getMonthTextAppearance());

viewLeftLine.setVisibility(appearanceModel.getCalendarOrientation() == OrientationHelper.HORIZONTAL ? View.INVISIBLE : View.VISIBLE);
viewRightLine.setVisibility(appearanceModel.getCalendarOrientation() == OrientationHelper.HORIZONTAL ? View.INVISIBLE : View.VISIBLE);
llMonthHeader.setBackgroundResource(appearanceModel.getCalendarOrientation() == OrientationHelper.HORIZONTAL ? R.drawable.border_top_bottom : 0);

tvMonthName.setBackgroundResource(appearanceModel.getCalendarOrientation() == OrientationHelper.HORIZONTAL ? R.drawable.border_top_bottom : 0);
monthHeaderBorder.setVisibility(appearanceModel.getCalendarOrientation() == OrientationHelper.HORIZONTAL ? View.GONE : View.VISIBLE);
monthView.initAdapter(month);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.applikeysolutions.cosmocalendar.adapter.viewholder;

import android.support.v4.widget.TextViewCompat;
import android.view.View;
import android.widget.TextView;

Expand All @@ -15,7 +16,9 @@ public OtherDayHolder(View itemView, CalendarView calendarView) {
}

public void bind(Day day) {
TextViewCompat.setTextAppearance(tvDay, calendarView.getDayTextAppearance());
tvDay.setText(String.valueOf(day.getDayNumber()));
tvDay.setTextColor(calendarView.getOtherDayTextColor());
tvDay.setVisibility(calendarView.getOtherDayVisibility() ? View.VISIBLE : View.INVISIBLE);
}
}
Loading