Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMOB-12539 added a new property calendarViewShown #4667

Merged
merged 3 commits into from
Sep 24, 2013
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.appcelerator.kroll.common.AsyncResult;
import org.appcelerator.kroll.common.TiMessenger;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.TiContext;
import org.appcelerator.titanium.proxy.TiViewProxy;
import org.appcelerator.titanium.util.TiConvert;
Expand All @@ -41,7 +42,7 @@
import android.widget.TimePicker;

@Kroll.proxy(creatableInModule=UIModule.class, propertyAccessors={
"locale", "visibleItems", "value"
"locale", "visibleItems", "value", TiC.PROPERTY_CALENDAR_VIEW_SHOWN
})
public class PickerProxy extends TiViewProxy implements PickerColumnListener
{
Expand All @@ -62,6 +63,7 @@ public class PickerProxy extends TiViewProxy implements PickerColumnListener
public PickerProxy()
{
super();
defaultValues.put(TiC.PROPERTY_CALENDAR_VIEW_SHOWN, false);
}

public PickerProxy(TiContext tiContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollProxy;
import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.proxy.TiViewProxy;
import org.appcelerator.titanium.util.TiConvert;
import org.appcelerator.titanium.util.TiUIHelper;
import org.appcelerator.titanium.view.TiUIView;

import android.app.Activity;
import android.os.Build;
import android.widget.DatePicker;
import android.widget.DatePicker.OnDateChangedListener;

Expand Down Expand Up @@ -72,6 +75,9 @@ public void processProperties(KrollDict d) {

this.minDate = minDateCalendar.getTime();
}
if (d.containsKey(TiC.PROPERTY_CALENDAR_VIEW_SHOWN)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation is off for this clause

setCalendarView(TiConvert.toBoolean(d, TiC.PROPERTY_CALENDAR_VIEW_SHOWN));
}
if (d.containsKey("maxDate")) {
Calendar maxDateCalendar = Calendar.getInstance();
maxDateCalendar.setTime((Date) d.get("maxDate"));
Expand Down Expand Up @@ -115,6 +121,9 @@ public void propertyChanged(String key, Object oldValue, Object newValue,
Date date = (Date)newValue;
setValue(date.getTime());
}
if (key.equals(TiC.PROPERTY_CALENDAR_VIEW_SHOWN)) {
setCalendarView(TiConvert.toBoolean(newValue));
}
super.propertyChanged(key, oldValue, newValue, proxy);
}

Expand Down Expand Up @@ -160,4 +169,13 @@ public void setValue(long value, boolean suppressEvent)
.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
suppressChangeEvent = false;
}

public void setCalendarView(boolean value)
{
if (Build.VERSION.SDK_INT >= 11) {
DatePicker picker = (DatePicker) getNativeView();
picker.setCalendarViewShown(value);
}
}

}
5 changes: 5 additions & 0 deletions android/titanium/src/java/org/appcelerator/titanium/TiC.java
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,11 @@ public class TiC
*/
public static final String PROPERTY_CACHE_MODE = "cacheMode";

/**
* @module.api
*/
public static final String PROPERTY_CALENDAR_VIEW_SHOWN = "calendarViewShown";

/**
* @module.api
*/
Expand Down
9 changes: 9 additions & 0 deletions apidoc/Titanium/UI/Picker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,15 @@ properties:
type: Number
default: 5
platforms: [android]

- name: calendarViewShown
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is not properly aligned. It needs to be moved back two spaces. It is currently breaking the documentation build script.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies. I will send a new PR to fix this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

summary: |
Determines whether the calenderView is visible.
description: |
If 'calendarViewShown' is 'true', the calenderView is visible
type: Boolean
default: false
platforms: [android]
examples:
- title: Basic Single Column Picker
example: |
Expand Down