Skip to content

Commit c35f12a

Browse files
Merge remote-tracking branch 'origin/master'
2 parents 7155d41 + d9e5c7e commit c35f12a

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# JCalendar
2+
3+
JCalendar is an Android library for displaying one month later and a month ago from the device's current date.
4+
## Screenshot and gif
5+
6+
7+
## Installation
8+
9+
Add Jitpack to your project build.gralde file.
10+
11+
```groovy
12+
allprojects {
13+
repositories {
14+
...
15+
maven { url 'https://jitpack.io' }
16+
}
17+
}
18+
```
19+
20+
## Usage
21+
First of all, you must add JCalendar to your layout.
22+
```xml
23+
<androidx.constraintlayout.widget.ConstraintLayout
24+
xmlns:android="http://schemas.android.com/apk/res/android"
25+
xmlns:app="http://schemas.android.com/apk/res-auto"
26+
xmlns:tools="http://schemas.android.com/tools"
27+
android:layout_width="match_parent"
28+
android:layout_height="match_parent"
29+
tools:context=".MainActivity">
30+
31+
<com.javadsh98.jcalendar.JCalendarView
32+
android:id="@+id/jcalendar"
33+
android:layout_width="0dp"
34+
android:layout_height="wrap_content"
35+
app:layout_constraintBottom_toBottomOf="parent"
36+
app:layout_constraintEnd_toEndOf="parent"
37+
app:layout_constraintStart_toStartOf="parent"
38+
app:layout_constraintTop_toTopOf="parent" />
39+
40+
</androidx.constraintlayout.widget.ConstraintLayout>
41+
```
42+
43+
### Code
44+
you can access JCalendar in activity or fragment by following code.
45+
#### Kotlin
46+
```kotlin
47+
jcalendar
48+
.setBackgroundResNormal(ResourcesCompat.getDrawable(resources, R.drawable.frm_item_normal, null)!!)
49+
.setBackgroundResSelected(ResourcesCompat.getDrawable(resources, R.drawable.frm_item_selected, null)!!)
50+
.setNameOfMonthTextColor(R.color.black_all)
51+
.setNameOfWeekTextColorNormal(R.color.black_all)
52+
.setDayOfMonthTextColorNormal(R.color.black_all)
53+
.setNameOfWeekTextColorSelected(R.color.white_all)
54+
.setDayOfMonthTextColorSelected(R.color.white_all)
55+
.setJalaliListener(object : JJalaliListener {
56+
override fun onJalali(date: String) {
57+
textView_jalali.text = date
58+
}
59+
})
60+
.setGregorianListener(object : JGregorianListener {
61+
override fun onGregorian(date: String) {
62+
textView_gregorian.text = date
63+
}
64+
})
65+
.init()
66+
```
67+
#### Java
68+
``` java
69+
JCalendarView calendarView = findViewById(R.id.jcalendar);
70+
calendarView
71+
.setBackgroundResNormal(ResourcesCompat.getDrawable(getResources(), R.drawable.frm_item_normal, null))
72+
.setBackgroundResSelected(ResourcesCompat.getDrawable(getResources(), R.drawable.frm_item_selected, null))
73+
.setNameOfMonthTextColor(R.color.black_all)
74+
.setNameOfWeekTextColorNormal(R.color.black_all)
75+
.setDayOfMonthTextColorNormal(R.color.black_all)
76+
.setNameOfWeekTextColorSelected(R.color.white_all)
77+
.setDayOfMonthTextColorSelected(R.color.white_all)
78+
.setJalaliListener(new JJalaliListener() {
79+
@Override
80+
public void onJalali(@NotNull String date) {
81+
TextView jalali = findViewById(R.id.textView_jalali);
82+
jalali.setText(date);
83+
}
84+
})
85+
.setGregorianListener(new JGregorianListener() {
86+
@Override
87+
public void onGregorian(@NotNull String date) {
88+
TextView gregorian = findViewById(R.id.textView_gregorian);
89+
gregorian.setText(date);
90+
}
91+
})
92+
.init();
93+
```
94+
95+
## Contributing
96+
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
97+
98+
Please make sure to update tests as appropriate.
99+
## Related Links

0 commit comments

Comments
 (0)