Persian Calendar View


Source link: https://github.com/mirrajabi/persian-calendar-view

PersianCalendarView - ????? ????? ???????

Persian calendar view for android based on ebraminio's DroidPersianCalendar open-source project.

Usage

First add jitpack to your projects build.gradle file

allprojects {

  repositories {

...

maven {
 url "https://jitpack.io" 
}

  
}
 
}

Then add the dependency in modules build.gradle file

dependencies {

  compile 'com.github.roojin:persian-calendar-view:1.2.1' 
}

now just simply add PersianCalendarView to your layouts

<ir.mirrajabi.persiancalendar.PersianCalendarView
  android:id="@+id/persian_calendar"
  android:layout_width="match_parent"
  android:layout_height="290dp"
  app:pcv_colorBackground="#292929"
  app:pcv_colorDayName="#bab6b6"
  app:pcv_colorHoliday="#ffd506"
  app:pcv_colorHolidaySelected="#f1f2f3"
  app:pcv_colorNormalDaySelected="#d9d9d9"
  app:pcv_colorNormalDay="#f3f4f5"
  app:pcv_eventUnderlineColor="#02f0f0"/>

Sample App is provided to demonstrate the basic scenario.

You can also interact with the sample app in this Page

Styling

Attributes

Attribute Type Description
pcv_typefacePath string Path to custom font in assets folder
pcv_headersTypefacePath string Path to custom font for header in assets folder
pcv_colorBackground color Calendar's background color
pcv_colorHoliday color Text color of holidays
pcv_colorHolidaySelected color Text color of holidays when selected
pcv_colorNormalDay color Text color of normal days
pcv_colorNormalDaySelected color Text color of normal days when selected
pcv_colorDayName color Text color of day name headers
pcv_eventUnderlineColor color Underline color of days with events
pcv_todayBackground reference Background resource used to highlight today
pcv_selectedDayBackground reference Background resource used to highlight selected day
pcv_fontSize dimension Day digits font size
pcv_HeadersFontSize dimension Day name headers font size

Functions

Most of the functionalities are inside the handler class. you can get it like this

  PersianCalendarView calendarView  = (PersianCalendarView) findViewById(R.id.persian_calendar);

PersianCalendarHandler calendarHandler = persianCalendarView.getCalendar();

  PersianDate today = calendar.getToday();

Events

The library includes official events but you can also add your own events to it

Adding local events

// Add an event called "Custom event" to this day calendarHandler.addLocalEvent(new CalendarEvent(calendar.getToday(), "Custom event", false));
 // Add an event called "Custom event 2" to 12 days later calendarHandler.addLocalEvent(new CalendarEvent(today.clone().rollDay(12,true), "Custom event 2", true));
 // Add an event called "Custom event 3" to 1399/1/10 later calendarHandler.addLocalEvent(new CalendarEvent(new PersianDate(1399,1,10), "Custom event 2", true));

Getting events for specific day

PersianDate today = calendar.getToday();
 calendarHandler.getAllEventsForDay(today);
 calendarHandler.getLocalEvents();
 calendarHandler.getLocalEventsForDay(today);
 calendarHandler.getOfficialEventsForDay(today);

Listeners

currently you can set Click, LongClick and MonthChange listeners on PersianCalendarView

void setOnDayClickedListener(OnDayClickedListener listener) void setOnDayLongClickedListener(OnDayLongClickedListener listener) void setOnMonthChangedListener(OnMonthChangedListener listener)

Other functions of PersianCalendarView

void update() void goToDate(PersianDate date) void goToToday() void goToNextMonth() void goToPreviousMonth() void goToMonthFromNow(int offset) PersianCalendarHandler getCalendar()

Useful methods of PersianCalendarHandler

PersianDate getToday() // These ones Convert english digits to persian String formatNumber(int number)  String formatNumber(String number) // Converts classes inherited from AbstractDate class to date string String dateToString(AbstractDate date) String dayTitleSummary String dayTitleSummary(PersianDate persianDate) String getMonthName(AbstractDate date) String getWeekDayName(AbstractDate date) List<CalendarEvent> getOfficialEventsForDay(PersianDate day) List<CalendarEvent> getAllEventsForDay(PersianDate day) List<CalendarEvent> getLocalEvents() List<CalendarEvent> getLocalEventsForDay(PersianDate day) String getEventsTitle(PersianDate day, boolean holiday) // These ones also have getters PersianCalendarHandler setMonthNames(String[] monthNames) PersianCalendarHandler setWeekDaysNames(String[] weekDaysNames) PersianCalendarHandler setTypeface(Typeface typeface) PersianCalendarHandler setColorBackground(int colorBackground)  PersianCalendarHandler setColorDayName(int colorDayName) PersianCalendarHandler setColorHoliday(int colorHoliday) PersianCalendarHandler setColorHolidaySelected(int colorHolidaySelected) PersianCalendarHandler setColorNormalDay(int colorNormalDay) PersianCalendarHandler setColorNormalDaySelected(int colorNormalDaySelected) PersianCalendarHandler setColorEventUnderline(int colorEventUnderline) PersianCalendarHandler setDaysFontSize(int daysFontSize) PersianCalendarHandler setHeadersFontSize(int headersFontSize) PersianCalendarHandler setTodayBackground(int todayBackground) PersianCalendarHandler setSelectedDayBackground(int selectedDayBackground) PersianCalendarHandler setHighlightOfficialEvents(boolean highlightOfficialEvents) PersianCalendarHandler setHighlightLocalEvents(boolean highlightLocalEvents)

Todo

  • Make it even more flexible and customizable
  • Clean it up

Contributions

Any contributions are welcome. just fork it and submit your changes to your fork and then create a pull request

Thanks

Special thanks to ebrahimino for his open-source project which this library is based on

Links

Roojin co

Roojin co (Github page)

Mirrajabi.ir

Resources

Android library with collection of some smart toasts designs which will help in situations of following:

  • Completion of some work
  • Errors & Warnings
  • Connection Established
  • Update Status

Advancement Utils for Android Developer with 100% interoperable with Java, written by Kotlin. RichUtils help Android developer to make better application with clean code.

Enhanced Pull-To-Action layout.

Features

  • Pull gesture in UP, DOWN or BOTH directions
  • Scroll thresholding. Bound views are snapped to anchor position if scroll over threshold else are reset to default position
  • Bind views for animating (alpha and translation for now) them in respect to scroll

ViewPager template with cool animation.

Simple RunTime permission manager.

A fully customizable photo editor for your app. Integrate the PhotoEditor SDK into your own Android, iOS or Html5 app in minutes!

The PhotoEditor SDK provides a variety of tools and functions for creating photo applications for Android.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes