WeekCalendar


Source link: https://github.com/nomanr/WeekCalendar

I AM NOT WORKING ON THIS LIBRARY ANYMORE. I AM NOT VERY PROUD OF THEY WAY I WROTE THIS WIDGET 😁. I WOULD RECOMMEND TO USE CALENDAR AS A CUSTOM VIEW INSTEAD OF ADDING IT AS GRADLE DEPENDENCY. FORKS + PRS ARE WELCOME.



WeekCalendar is a library which provides a weekly calendar.

The sample project includes the usage of the library. Support for Android 4.0 and up.

Feel free to fork or issue pull requests on github. Issues can be reported on the github issue tracker.

Demo

Setup


Gradle
dependencies {

 compile 'noman.weekcalendar:weekcalendar:1.0.6' 
}
 
Maven
<dependency>
<groupId>noman.weekcalendar</groupId>
<artifactId>weekcalendar</artifactId>
<version>1.0.6</version> </dependency> 

Sample Usage


 <noman.weekcalendar.WeekCalendar
  android:id="@+id/weekCalendar"
  android:layout_width="match_parent"
  android:layout_height="65dp"
  android:background="@color/colorPrimary"/> 

Theme the calendar

There are a few xml attributes to customise the calendar. If you feel that any customization option is missing, let me know.
  • numOfPages
  • daysTextSize
  • daysTextColor
  • daysBackgroundColor
  • weekTextSize
  • weekTextColor
  • weekBackgroundColor
  • selectedBgColor
  • todaysDateBgColor
  • todaysDateTextColor
  • dayNameLength
  • hideNames

Example
 <noman.weekcalendar.WeekCalendar
 android:id="@+id/weekCalendar"
 android:layout_width="match_parent"
 android:layout_height="65dp"
 android:background="@color/colorPrimary"
 app:numOfPages="150"
 app:dayNameLength="threeLetters"
 app:todaysDateBgColor="#ffffff"
 app:todaysDateTextColor="#000000"/> 
Explained
  • numOfPages by default, calendar has 100 pages. You can scroll 49 to left and 49 to right. Using this attribute you can set number of pages. You can send it to 1000, it depends on requirements.
  • daysTextSize day means day of the month. By default text size is 17sp.
  • daysTextColor by default the day text color is set to be white.
  • daysBackgroundColor if you have colorPrimary attribute in color.xml, then the backgroud color will be that one. Otherwise the purple color shown in the demo.
  • weekTextSize week means day of the week,i.e (S,M,T ..). By default text size is 17sp.
  • weekTextColor by default the week day text color is set to be white.
  • weekBackgroundColor same as daysBackgroundColor
  • selectedBgColor By default, its color is set to be colorAccent, if you've that attribute in attribute in color.xml, then the backgroud color will be that one. Otherwise the pink color shown in the demo.
  • todaysDateBgColor todays date background color, same as selectedBgColor.
  • todaysDateTextColor todays date text color, by default the text color is set to be white.
  • dayNameLength week day name length, singleLetter means (S,M,T..) and threeLetters means (Sun, Mun, Tue..)
  • hideNames , set this attribute to hide name of week days.

Impelement Listener

`OnDateClickListener` returns `DateTime` object. `DateTime` is class available in Joda Time. I will recommend using this library if you are playing with date and time.
weekCalendar.setOnDateClickListener(new OnDateClickListener() {

@Override

public void onDateClick(DateTime dateTime) {

 Toast.makeText(MainActivity.this,

  "You Selected " + dateTime.toString(), Toast.LENGTH_SHORT).show();

}

}
);
 

See the sample project for usage of methods like

  • reset()
  • moveToNext()
  • moveToPrevious()
  • setSelectedDate(DateTime)
  • setStartDate(DateTime)

Libraries Used


License


Copyright (c) 2015 Noman Rafique  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

Pearl is a powerful image caching and loading library.

Backport of Java 8 java.util.stream API to Java 6/7 and Android.

Implementation of various string similarity and distance algorithms: Levenshtein, Jaro-winkler, n-Gram, Q-Gram, Jaccard index, Longest Common Subsequence edit distance, cosine similarity...

A cool gallery view with vertical smooth animation which shows content more attractive.

An open source camera for google glass. This is a an alternative to the default camera on Glass. CuXtom Cam provides you the default behaviour along with some special feature.

Endoscope allows you to fast link two android devices and stream live video from camera one device to another. Video stream is over Wi-Fi. One device hosts live stream and another connect to it.

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