GithubHelp home page GithubHelp logo

nivalamata / android-times-square Goto Github PK

View Code? Open in Web Editor NEW

This project forked from square/android-times-square

0.0 2.0 0.0 1.49 MB

Standalone Android widget for picking a single date from a calendar view.

License: Apache License 2.0

Shell 0.96% Java 99.04%

android-times-square's Introduction

TimesSquare for Android

Standalone Android widget for picking a single date from a calendar view.

Screenshot

Usage

Include CalendarPickerView in your layout XML.

<com.squareup.timessquare.CalendarPickerView
    android:id="@+id/calendar_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    />

This is a fairly large control so it is wise to give it ample space in your layout. On small devices it is recommended to use a dialog, full-screen fragment, or dedicated activity. On larger devices like tablets, displaying full-screen is not recommended. A fragment occupying part of the layout or a dialog is a better choice.

In the onCreate of your activity/dialog or the onCreateView of your fragment, initialize the view with a range of valid dates as well as the currently selected date.

Calendar nextYear = Calendar.getInstance();
nextYear.add(Calendar.YEAR, 1);

CalendarPickerView calendar = (CalendarPickerView) findViewById(R.id.calendar_view);
Date today = new Date();
calendar.init(today, nextYear.getTime())
    .withSelectedDate(today);

The default mode of the view is to have one selectable date. If you want the user to be able to select multiple dates or a date range, use the inMode() method:

calendar.init(today, nextYear.getTime())
    .inMode(RANGE);

Download

The latest version can be downloaded in zip and referenced by your application as a library project.

You can also depend on the library through Maven:

<dependency>
  <groupId>com.squareup</groupId>
  <artifactId>android-times-square</artifactId>
  <version>1.6.5</version>
  <type>apklib</type>
</dependency>

or Gradle:

compile 'com.squareup:android-times-square:1.6.5@aar'

Snapshots of the development version are available in Sonatype's snapshots repository.

License

Copyright 2012 Square, Inc.

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-times-square's People

Contributors

aahlenst avatar ajma avatar dlubarov avatar edenman avatar f2prateek avatar gdacarv avatar jakewharton avatar johnjohndoe avatar kakone avatar koch-t avatar koocbor avatar ligi avatar mattprecious avatar mgrtrifork avatar mochadwi avatar nahomagidew avatar niqo01 avatar pdegand avatar peterbergmann avatar pforhan avatar rjrjr avatar robinvandervliet avatar samuil-yanovski avatar sannyo avatar skyisle avatar stevenbyle avatar tobiasschuerg avatar vitvetal avatar wching avatar zhenleiji 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.