Git Product home page Git Product logo

dynamiccalendar's Introduction

Dynamic Calendar

DynamicCalendar library generates a custom calendar icon based on the date you provide. You can also change the background template of the generated date icon.

You can specify the font's typeface, size, position, color and the empty calendar icon.

!!! There may be some issues with different screen resolutions. Please let me know if you face any such problems

Features Included

  • Specify the background empty calendar icon
  • Change the typeface of both date and month
  • Change the size of the date and month fonts independently
  • Provision for saving the generated image to external storage

Change Log

  • 12 Jan 2015: First release
  • 13 Jan 2015: Added support from API 9

Screen Shots

Basic Icon Generated Typeface and color changed

Adding the library to your project

Add this to your build.gradle of your project

dependencies {
    ...
    compile 'com.github.sillebille:dynamic-calendar:1.0.1'
    ...
}

Mandatory Properties to be set

// Create an object of ImageGenerator class in your activity
// and pass the context as the parameter
ImageGenerator mImageGenerator = new ImageGenerator(this);

// Set the icon size to the generated in dip. 
mImageGenerator.setIconSize(50, 50);

// Set the size of the date and month font in dip.
mImageGenerator.setDateSize(30);
mImageGenerator.setMonthSize(10);

// Set the position of the date and month in dip.
mImageGenerator.setDatePosition(42);
mImageGenerator.setMonthPosition(14);

// Set the color of the font to be generated
mImageGenerator.setDateColor(Color.parseColor("#3c6eaf"));
mImageGenerator.setMonthColor(Color.WHITE);

Generating the Image

After setting all the required properties, generate the image. This function returns a bitmap.

// 1st param, mCurrentDate should be an instance of class Calendar
// 2nd param, send the id of the empty calendar icon
mImageGenerator.generateDateImage(mCurrentDate, R.drawable.empty_calendar);

Optional Features

1 - Storing the generated image to SDCard

// The images are stored in ../sdcard/CalendarImageGenerated/
mImageGenerator.setStorageToSDCard(true);

2 - Changing the fonts. The fonts should be placed in assets/fonts folder. Create folder if they do not exist.

// You have to add the complete name with extension
mImageGenerator.setDateTypeFace("Roboto-Light.ttf");
mImageGenerator.setMonthTypeFace("Ubuntu-R.ttf");

Sample App

A sample app using this library is available in Android Play Store.

Android app on Google Play

Author

Dinesh Prasanth

License

Copyright (c) 2015. DineshPrasanth

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.

Android Arsenal

dynamiccalendar's People

Contributors

sillebille avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.