Giter Site home page Giter Site logo

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 jakewharton avatar johnjohndoe avatar kakone avatar koch-t avatar koocbor avatar ligi avatar mattprecious avatar mgrtrifork avatar nahomagidew avatar niqo01 avatar pdegand avatar peterbergmann avatar pforhan avatar quentin41500 avatar rjrjr avatar robinvandervliet avatar samuil-yanovski avatar sannyo avatar skyisle avatar stevenbyle avatar suleymanbilgin avatar tobiasschuerg avatar vitvetal avatar wching avatar zhenleiji avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-times-square's Issues

Enhancement: include better error messaging for selected date on init.

Because the library uses a setMidnight convenience method, the boundary on init should be to 0:00:00:00 on the next day outside of the range otherwise you get a nice bug where the last day on your calendar isn't selectable. This wasn't inherently obvious to me when deploying the library and I wasted a day digging around trying to figure out why. The error toast didn't tell me what Date the library was using when it barfed on selecting the final day of the month which made debugging this challenging.

How to show 2-month calendar?

With

.add(Calendar.DATE, endMonth.getActualMaximum(Calendar.DATE) - endMonth.get(Calendar.DATE) +1 );

I can add remaining days to the end of month. But I can't add one more month, because

Calendar.getInstance().getActualMaximum((Calendar.MONTH)+1)

gives some unreal data, like 52 days.

Not withSelectedDate is Visible when initiialize

Hello,

I'm using this code

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

        final Calendar lastYear = Calendar.getInstance();
        lastYear.add(Calendar.YEAR, -1);

        calendar = (CalendarPickerView) findViewById(R.id.calendar_view);
        calendar.init(lastYear.getTime(), nextYear.getTime()) //
        .inMode(SelectionMode.SINGLE) //
        .withSelectedDate(new Date());

but when app runs is not scrolling to the month that is the SelectedDate

How to set a onClickListener for a date?

Hello,
I wanna invoke a method when a date is clicked. Could you please tell me how to do it? I have check the issues and your README file, but got no answer. Thanks in advanced.

Is it possible to handle cell clicks?

Sorry for disturbance caused from my previous questions.
I'm using calendar in Multiple-DisplayOnly mode just to show some information.
Is it possible to do something when clicking some day? For example, open a Dialog with some information) without highlightening it?

current date always selected, even when specifying a default date?

Not sure if this is expected behavior, but given the following code, the resulting image occurs: http://i39.tinypic.com/10yqj9v.jpg

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

    final CalendarPickerView calendar = (CalendarPickerView) findViewById(R.id.calendar_view);
    Intent passedIntent = getIntent();
    long passedDate;
    final Date mSelectedDate;
    final Date today = new Date();
    if (passedIntent.hasExtra("dateToEdit")) {
      passedDate = passedIntent.getLongExtra("dateToEdit", today.getTime());
      mSelectedDate = new Date(passedDate);
    } else {
      mSelectedDate = today;
    }

    calendar.init(mSelectedDate, nextYear.getTime()).withSelectedDate(mSelectedDate);

The code above loads a date, in the image below December 17th gets fed in. The calendar loads with this date selected (in blue) but the 19th (today) is still selected in grey. Is this expected, or am I doing something wrong?

Maven build failing; improper SDK level in pom.xml

mvn clean verify will fail on a fresh checkout with the following error:

[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.4.1:generate-sources (default-generate-sources) on project android-times-square: MojoExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /Users/tad/git/android-times-square/library && /Users/tad/dev/sdk/platform-tools/aapt package -m -J /Users/tad/git/android-times-square/library/target/generated-sources/r -M /Users/tad/git/android-times-square/library/AndroidManifest.xml -S /Users/tad/git/android-times-square/library/res --auto-add-overlay -A /Users/tad/git/android-times-square/library/assets -I /Users/tad/dev/sdk/platforms/android-16/android.jar, Result = 1 -> [Help 1]

The output of that command is:

/Users/tad/git/android-times-square/library/res/values/styles.xml:13: error: Error: No resource found that matches the given name: attr 'android:textAlignment'.

The textAlignment resource ID was added in API 17. Changing the android.platform value to 17 in pom.xml solves the problem.

Allow overriding CellClickedListener

1.CellClickedListener in CalendarPickerView should be public ,so I can extends
2.in CalendarPickerView
private final MonthView.Listener listener = new CellClickedListener();
should be used in getCellListener method
then define method
public Listener getCellCilckListener() {
return listener;
}

in MonthAdapter getView methodView create by
monthView =
MonthView.create(parent, inflater, weekdayNameFormat, getCellCilckListener(), today);

in this way I can create my listener and set My listener in order to handler Cell click event

First day of week

Hello,

The first day of week isn't always Sunday, it depends of the country. So, to show the good first day of week, I replaced in getMonthCells method of CalendarPickerView :

cal.add(DATE, SUNDAY - firstDayOfWeek);

by

cal.add(DATE, cal.getFirstDayOfWeek() - firstDayOfWeek);

and I changed MonthView create method like this :

public static MonthView create(ViewGroup parent, LayoutInflater inflater, DateFormat weekdayNameFormat, Listener listener, Calendar today) {
    final MonthView view = (MonthView) inflater.inflate(R.layout.month,
        parent, false);

    final int originalDayOfWeek = today.get(Calendar.DAY_OF_WEEK);

    int firstDayOfWeek = today.getFirstDayOfWeek();
    final CalendarRowView headerRow = (CalendarRowView) view.grid
        .getChildAt(0);
    for (int c = Calendar.SUNDAY; c <= Calendar.SATURDAY; c++) {
        today.set(Calendar.DAY_OF_WEEK, firstDayOfWeek + c - 1);
        final TextView textView = (TextView) headerRow.getChildAt(c - 1);
        textView.setText(weekdayNameFormat.format(today.getTime()));
    }
    today.set(Calendar.DAY_OF_WEEK, originalDayOfWeek);
    view.listener = listener;
    return view;
    }

Cells' text is aligned to the left if supportRtl="true"

If you set in the manifest's the attribute supportRtl="true" (targetSdk needs to be 17), the cells' text won't be centered because CheckedTextView ignores the Gravity setting in this case.

I created a small example with CheckedTextView and saw the text always aligned to the left if supportRtl is true. I believe it's a platform bug, so I opened an issue on the Android project site: https://code.google.com/p/android/issues/detail?id=54607

I tried overcoming this with manually setting the view or the layout to be Left-to-Right but it doesn't help. The only thing that helps is to set the supportRtl to false.

Any other ideas?

Some months draw extra row

Some months are rendering with an extra blank row at the bottom. This problem is evident in the calendar in the dialog in the sample app, as well as when using the calendar in a fragment.

Rotating device/emulator causes calendar to then render correctly.

screen shot 2013-06-13 at 4 51 23 pm
screen shot 2013-06-13 at 4 51 34 pm

Thanks

Thanks for your sharing~

setEnabled(false) causes the CalendarPickerView Vertical scrolling to become unresponsive

CalendarPickerView is one of the cleanest Android calendars I have seen.

In my attempt to use Selection Mode Multiple to show programmatically set highlighted dates without the ability to select or deselect others, I tried calling setEnabled(false). It caused the Calendar still to be scrollable, but very poorly and unresponsively.

I now realise that is what caused me to open

#62

and

#61

I apologize for creating issue spam with those. I know there is a real bug here somewhere.

Incidentally, I have also tried setClickable(false) and that seems to have no effect. My next idea was to overlay a transparent view on top of the calendar to intercept click events. Otherwise I will try to fork the library, but I'd prefer the library had the functionality.

You guys are really close to having an amazing calendar display, not just and amazing calendar picker. Maybe I just haven't figured out how to use it correctly. Thank you in advance.

Joseph Malone
malone.joseph .AT. gmail

performance in dialogs

When I place times-square into an AlertDialog or DialogFragment, it's performance get worse. When you select a new date the old selection disappears some time after the new appears, which makes the experience in using it fairly bad.

Infinitely scrolling.

Hi there!
Is there any way to make this widget scroll infilitely? I mean, I don't want to set starting time and ending time during init() method. I need a calendar picker view which enable user to pick any date, and scroll to find any date.

Thanks.

How to change the calendarview style?

Hi, there! thanks for your sharing.
You know, your times-square is very good and matches my style requirements. But it is still not friendly to change its face. If I want a more colorful view, do I have to change its styleable resource? Why not add some attributes to the CalendarPickerView?? like:
android:background="#111155"
android:firstDayOfWeek="1"
android:focusedMonthDateColor="#009933"
android:selectedWeekBackgroundColor="#55ffffff"
android:showWeekNumber="true"
android:shownWeekCount=""5

Robolectric + Roboguice + gradle

I have a issue in unit testing my project, I have a fragment that loads up CalendarPickerView and then adds a OnDateSelectedListener, the code works and executes fine on actual device, However in unit testing Robolectric says its not able to ding the OnDateSelectedListener, if I comment the anonymous listener the test passes. What I'm not able to understand it If it is able to find CalendarPickerView why would it not be able to find CalendarPickerView$OnDateSelectedListener

CalendarFragment.java

    /**
      * Returns a new instance of this fragment for the given section
      * number.
      */
     public static CalendarFragment newInstance(int startMonth, int endMonth) {
         CalendarFragment fragment = new CalendarFragment();
         Bundle args = new Bundle();
         args.putInt(ARG_START_MONTH, startMonth);
         args.putInt(ARG_END_MONTH, endMonth);
         fragment.setArguments(args);
         return fragment;
     }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {

        calendarPickerView.setOnDateSelectedListener(new OnDateSelectedListener() {
            @Override
            public void onDateSelected(Date date) {
                Toast.makeText(getActivity(), "You selected :" + date, Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onDateUnselected(Date date) {

            }
        });
    }

CalendarFragmentTest.java

    @Test
    public void newInstanceShouldAddStartMonthAndEndMonthInFragmentBundle() throws Exception {
        CalendarFragment calendarFragment = CalendarFragment.newInstance(1, 2);

        assertThat(1, is(calendarFragment.getArguments().get(CalendarFragment.ARG_START_MONTH)));
        assertThat(2, is(calendarFragment.getArguments().get(CalendarFragment.ARG_END_MONTH)));
    }

However on running this test I get

java.lang.NoClassDefFoundError: com/squareup/timessquare/CalendarPickerView$OnDateSelectedListener
at com.ccd.corrections.fragments.CalendarFragmentTest.newInstanceShouldAddStartMonthAndEndMonthInFragmentBundle(CalendarFragmentTest.java:19)

How to use mode(SINGLE) more with dates selected before ?

For example...

//dates in my database for example
Calendar today = Calendar.getInstance();
ArrayList dates = new ArrayList();
for (int i = 0; i < 5; i++) {
today.add(Calendar.DAY_OF_MONTH, 3);
dates.add(today.getTime());
}

calendar = (CalendarPickerView) view.findViewById(R.id.calendar_view);
calendar.init(lastYear.getTime(), nextYear.getTime()).inMode(SelectionMode.SINGLE)
.withSelectedDates(dates);

date only one has been selected in this example....why not all ?

Add Multiselect Ability

There is some base code for doing multiselect and I managed to hack the code a bit to enable it, but the API for it is disabled in your current master code. Please would it be possible for you guys to do it? I think I might have broken something when I tried.

How to format Date for this calendar's supported?

Sorry for such stupid question.

In example:

Calendar today = Calendar.getInstance();
                ArrayList<Date> dates = new ArrayList<Date>();
                for (int i = 0; i < 5; i++) {
                    today.add(Calendar.DAY_OF_MONTH, 3);
                    dates.add(today.getTime());
                }
                CalendarActivity.this.calendar
                        .init(new Date(), nextYear.getTime()) //
                        .inMode(SelectionMode.MULTIPLE) //
                        .withSelectedDates(dates);
            }

What should dates look like? In what format?
I'm trying to add DD.MM.yyyy with no luck =(

Calendar resizes itself when date is selected (dialog)

I am using the Calendar in a dialog and the Calendar grows when a date is selected.

Before selection:

After selection:

Note how the OK/Cancel-buttons suddenly are slightly off-screen.
It might be important (I don't know) that I am running my app on a Galaxy Nexus.
Larger screens might not have this issue? I did not experience this before I rebased
to the latest master (was previously rebased to ddf82a9)

The images were taken with slightly different code but was reproducible with
this as well (modified from your dialog sample):

CalendarPickerView dialogView = (CalendarPickerView) layoutInflater
                .inflate(R.layout.fragment_dialog_calendar_builder, null, false);

        final Calendar future = Calendar.getInstance();
        future.add(Calendar.YEAR, 1);
        final Calendar selected = Calendar.getInstance();
        if (mTask != null && mTask.due != null) {
            selected.setTimeInMillis(mTask.due);
        }

        dialogView.init(Calendar.getInstance().getTime(), future.getTime(),
                ActivityHelper.getUserLocale(getActivity())).withSelectedDate(
                selected.getTime());
        new AlertDialog.Builder(getActivity())
                .setTitle("I'm a dialog!")
                // R.string.select_date
                .setView(dialogView)
                .setNegativeButton("GET OUT",
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(
                                    DialogInterface dialogInterface, int i) {
                                dialogInterface.dismiss();
                            }
                        })
                .setPositiveButton("POSITIVE",
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(
                                    DialogInterface dialogInterface, int i) {
                                dialogInterface.dismiss();
                            }
                        }).create().show();

fragment_dialog_calendar_builder:

<?xml version="1.0" encoding="utf-8"?>
<com.squareup.timessquare.CalendarPickerView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/calendarView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?CalendarPickerBackground"
    android:clipToPadding="false"
    android:paddingBottom="16dp"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:scrollbarStyle="outsideOverlay" />

Scroll to selected date

First of all thank you for creating this awesome widget.
I would like to suggest an enhancement since I'm missing a certain feature.

Scroll to selected date

Use-case:
This widget is used to select a date, The second time the user opens the CalendarPickerView I would like to select the previously selected date and scroll to that date.

So far I was able to restore the previous selected date with following code (using fragments). But I'm not able to reposition the ScrollView to that date.

Code to select previous date

// If a previous date was selected, restore it
        if (isFirstSelection()) {
            mCalendar.init(new Date(), new Date(), nextYear.getTime());
        } else {
            final Date currentDate = (Date) getArguments().get(KEY_CURRENTDATE);
            mCalendar.init(currentDate, new Date(), nextYear.getTime());
            //missing function                    
            //mCalendar.scrollToPostion()
        }

Is this behavior implemented? I personally think this feature would be a good enhancement.

Rotation inside fragment with configChanges

First of all: thank you for creating this awesome widget.

I want to point out that there is a small bug using a certain configuration.

I'm using fragments with the manifest configured to let the activity handle configuration changes (this being orientation,screensize and keyboardhidden)

When I rotate the device the measured areas are incorrect. Some months/days of the calendar are resized while others aren't. Is someone else having this problem? Can someone take a look at this?

Best regards,

Tobrun

Calendar position when calendar is created

Hello, i am trying to create a calendar witch presents one year before and after current date. i am creating the calendar with the following code but after the calendar appears it shows the second month (June 2012). Shouldn't it be showing the current month (May 2013)?

I 've also tried the .smoothScrollToPosition(position), but is scrolls the calendar by on month every time even if i try position = 1000.

Is it normal behavior or am i missing something?

Thanks in advance!

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

Calendar previousYear = Calendar.getInstance();
previousYear.add(Calendar.YEAR, -1);

ArrayList dates = new ArrayList();
Calendar today = Calendar.getInstance();
dates.add(today.getTime());

tsCalendar = (CalendarPickerView) myView.findViewById(R.id.my_view_id);
tsCalendar.init(SelectionMode.SINGLE, dates, previousYear.getTime(), nextYear.getTime());

Dates not highlighted until date clicked.

Hi,

Not sure if an issue with my code or with the library. (Great library by the way). I believe this may be an issue.

Here's what I'm doing to initialise the calendar.

    calendar.init(lastYear.getTime(), nextYear.getTime()).inMode(SelectionMode.SINGLE).withSelectedDate(new Date()).withHighlightedDates(dates);

When the fragment loads, it isn't highlighted by default, but when a date is clicked, then it all the dates which are to be highlighted show correctly.

Thanks.

Edit #2:

Seems to be dependent on screen size. The issue occurred when using dates, that were 1 year apart, when only 2 months apart or less no issue occurs.

For example, I'm on a Nexus 4, displaying Oct 2013 -> Feb 2014 works perfectly which is 5 months. Anything more then this for my screensize, then the highlighted dates show on the wrong months. And on higher resolution devices which can fit more calendar months on a single view, it can take more months while still displaying correctly.

Multiselection

It would be nice if we can select several dates instead of single one. Is the mutiselection feature planned ?

Missing locale support

First of all: thanks for creating this beautiful library.

I want to point out that i'm missing an important feature is this library and this functionality cannot be added to any project without changing the library itself. I'm creating an application where the user has the choice to select different languages but the currently the names of the month and days of the week are based on the OS-language.

Could it be possible to change the locale settings in the different initiations of the Calendar class e.g. Calendar.getInstance() / Calendar.getInstance(locale).

Any thoughts about this suggestion?

Use styles for theming

Create state-list drawable programmatically from style attributes. Provide holo light/dark styles in the library. Have attributes so you can specify styles in the layout XML using the res-auto namespace.

(originally filed by @JakeWharton)

Add code formatting settings

Can you please export the code formatting settings of your IDE so it is easier for contributors to commit stuff? Please add the export to the project. Those settings should match with the rules defined in checkstyle.xml.

Only single month visible

One of my users reported that the calendar (which I show in a dialog) would only show a single month (november). He tells me that a clear data for the app does not change anything. I on the other hand have been unable to reproduce the issue myself.

Any ideas on what might be causing this?

[...] I have also tried to set the clock of my phone to a past/future months,
 the result is the same, only the "current" month seems to be available. 

Another detail:
on landscape the screen of my smartphone is too tiny to contain an entire
table of a month, so the dialog allow me to scroll, but it scroll only for show
the entirely current month.

This happens also after a "clear data" for the app

Styles after last update

Hi !

I just got the most updated version of the library, and it seems that styles are not working anymore.
Selecting a date doesn't highlight it anymore on the calendar, and the current date doesn't have its style anymore either.

Does not play nicely inside Fragments

I created a Calendar View inside of a fragment inside of a TabViewPager. The calendar would still scroll up and down but not at all responsively and would tend to freeze up entirely. Have you guys seen anything similar?

Provide a way to disable arbitrary dates

A common requirement for date pickers is to disable the selection of certain dates, such as weekends and holidays. This functionality could be implemented through a callback that is queried in getMonthCells, similar to the method used by the jQuery UI Datepicker library.

How to start activity with DisplayOnly style?

Sorry for my bad English, I'm newbie in Android development, could you explain, is it possible to start Activity with your calendar in DisplayOnly style? So that user can only see some highlighetened dates.

SelectionModes available: SINGLE, MULTI, RANGE, but not NONE or smth like that.

Thanks in advance

Should not display last month with no selectable date

When I init the calendar with minDate 2013-02-01 and maxDate 2013-03-01, so that the user can choose any day in the month of 2013-02.

What happened:
The CalendarPickerView shows both Feb 2013 and Mar 2013, with no days in Mar 2013 that can be selected.

What should happen:
The CalendarPickerView shows only Feb 2013.

withSelectedDate scrolls to maxDate

When I load the view (in my dialog fragment), the calendar automatically scrolls to the end of the allowed range. I don't want to restrict the date in this case so I selected a 10 year limit. The view scrolls to 2023 upon loading.

However, if you comment out the line "withSelectedDate", the calendar loads fine and does not scroll to maxDate.

Device: Galaxy Nexus, Android 4.2.2

Code:

final Calendar future = Calendar.getInstance();
        future.add(Calendar.YEAR, 10);
        final Calendar selected = Calendar.getInstance();
        // Default to tomorrow
        selected.add(Calendar.DAY_OF_YEAR, 1);
        // New item hides delete button and disables OK initially
        if (getArguments().getLong(SELECTED_DATE, -1) > 0) {
            // TODO default date
            selected.setTimeInMillis(getArguments().getLong(SELECTED_DATE, -1));
        }

        calendarView.init(Calendar.getInstance().getTime(), future.getTime())
        .withSelectedDate(selected.getTime());

AAR Package

The new Android build system (http://tools.android.com/tech-docs/new-build-system) expects libraries that contain code and resources to be in AAR format (http://tools.android.com/tech-docs/new-build-system/aar-format). apklib, the format introduced by the android-maven-plugin, is currently not supported (Conversely the android-maven-plugin does not understand AAR). Therefore it would be helpful if TimesSquare for Android would be published as apklib and as AAR as well.

The easiest way to achieve this seems to be to use the new Android build system which is apparently capable of producing an AAR and an apklib from the same build (for an example see https://github.com/googlemaps/android-maps-utils/blob/master/library/build.gradle). But this would require a switch over to Gradle. Another possibility is to keep Maven and invoke Gradle later in the build to produce the AAR (ActionBarSherlock does this). I also read somewhere that the android-maven-plugin guys plan to add AAR support but I haven't seen any results yet.

I'd be willing to prepare a pull request with the necessary changes to move over to the new Android build system. But I need to know whether such a pull request would be accepted before I invest time into it.

onDateChangedEventListener?

Is something like that implemented? I would rather listen to an event that constantly call calendar.getSelectedDate()

first of the month

When I select the first of the month in code:
calendar.setSelectedDate();
the Calendar shows the correct date, but it is shown in the previous month-table.

Screenshot_2013-04-24-15-52-52

performance in dialog - take 2

Hi

I'm in the process of integrating the control within my app (will let you know when it's out :)

Problem is that there is a slight but still noticeable delay when launching a DialogFragment that houses the control..(and only it).

I tested this on a Galaxy S2 running jellybean, no debugger attached

The dialog scenario is important for me and I'm concerned of user pushback despite
being a great control.

Can you help ?

-itai

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.