Java Code Examples for org.appcelerator.kroll.annotations.Kroll#setProperty()

The following examples show how to use org.appcelerator.kroll.annotations.Kroll#setProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CollectionViewProxy.java    From TiCollectionView with MIT License 6 votes vote down vote up
@Kroll.setProperty @Kroll.method
public void setSections(Object sections)
{
	if (!(sections instanceof Object[])) {
		Log.e(TAG, "Invalid argument type to setSection(), needs to be an array", Log.DEBUG_MODE);
		return;
	}
	//Update java and javascript property
	setProperty(TiC.PROPERTY_SECTIONS, sections);

	Object[] sectionsArray = (Object[]) sections;
	TiUIView listView = peekView();
	//Preload sections if listView is not opened.
	if (listView == null) {
		preload = true;
		clearPreloadSections();
		addPreloadSections(sectionsArray, -1, true);
	} else {
		if (TiApplication.isUIThread()) {
			((CollectionView)listView).processSectionsAndNotify(sectionsArray);
		} else {
			TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SET_SECTIONS), sectionsArray);
		}
		
	}
}
 
Example 2
Source File: CollectionSectionProxy.java    From TiCollectionView with MIT License 5 votes vote down vote up
@Kroll.method @Kroll.setProperty
public void setHeaderView(TiViewProxy headerView) {
	if (TiApplication.isUIThread()) {
		handleSetHeaderView(headerView);
	} else {
		TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SET_HEADER_VIEW), headerView);
	}
}
 
Example 3
Source File: ActionbarextrasModule.java    From actionbarextras with MIT License 5 votes vote down vote up
/**
 * disables or enables the icon
 * @param arg
 */
@Kroll.method @Kroll.setProperty
public void setDisableIcon(@Kroll.argument(optional = true) Boolean arg) {
	
	Boolean disabled = true;
	
	if (arg != null) {
		disabled = TiConvert.toBoolean(arg);
	}
	
	Message message = getMainHandler().obtainMessage(MSG_DISABLE_ICON, disabled);
	message.sendToTarget();
}
 
Example 4
Source File: ActionbarextrasModule.java    From actionbarextras with MIT License 5 votes vote down vote up
/**
 * You can set just the subtitle with setSubtitle("subtitle")
 * or subtitle, color and font at once with:
 * setSubtitle({
 *     text: "subtitle",
 *     color: "#f00",
 *     font: "MyFont.otf"
 * })
 * 
 * @param obj
 */
@Kroll.method @Kroll.setProperty
public void setSubtitle(Object obj) {
	
	String subtitle;
	
	if (obj instanceof String){
		subtitle = (String) obj;
	}else if(obj instanceof HashMap){
		@SuppressWarnings("unchecked")
		HashMap<String, String> d = (HashMap<String, String>) obj;
		subtitle = (String) d.get(TiC.PROPERTY_TEXT);
		
		if (d.containsKey(TiC.PROPERTY_COLOR)){
			setSubtitleColor((String) d.get(TiC.PROPERTY_COLOR));
		}
		
		if (d.containsKey(TiC.PROPERTY_FONT)){
			setSubtitleFont(d.get(TiC.PROPERTY_FONT));
		}
	}else if(obj == null){
		subtitle = null;
	}else{
		return;
	}
	
	Message message = getMainHandler().obtainMessage(MSG_SUBTITLE, subtitle);
	message.sendToTarget();
}
 
Example 5
Source File: CollectionSectionProxy.java    From TiCollectionView with MIT License 5 votes vote down vote up
@Kroll.method @Kroll.setProperty
public void setItems(Object data) {
	if (TiApplication.isUIThread()) {
		handleSetItems(data);
	} else {
		TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SET_ITEMS), data);
	}
}
 
Example 6
Source File: ActionbarextrasModule.java    From actionbarextras with MIT License 5 votes vote down vote up
/**
 * You can set just the title with setTitle("title")
 * or title, color and font at once with:
 * setTitle({
 *     text: "title",
 *     color: "#f00",
 *     font: "MyFont.otf"
 * })
 * 
 * @param obj
 */
@Kroll.method @Kroll.setProperty
public void setTitle(Object obj) {
	
	String title;
	
	if (obj instanceof String){
		title = (String) obj;
	}else if(obj instanceof HashMap){
		@SuppressWarnings("unchecked")
		HashMap<String, String> d = (HashMap<String, String>) obj;
		title = (String) d.get(TiC.PROPERTY_TEXT);
		
		if (d.containsKey(TiC.PROPERTY_COLOR)){
			setTitleColor((String) d.get(TiC.PROPERTY_COLOR));
		}
		
		if (d.containsKey(TiC.PROPERTY_FONT)){
			setTitleFont(d.get(TiC.PROPERTY_FONT));
		}
	}else{
		return;
	}
	
	Message message = getMainHandler().obtainMessage(MSG_TITLE, title);
	message.sendToTarget();
}
 
Example 7
Source File: ActionbarextrasModule.java    From actionbarextras with MIT License 4 votes vote down vote up
/**
 * set title color
 * @param color
 */
@Kroll.method @Kroll.setProperty
public void setTitleColor(String color){
	Message message = getMainHandler().obtainMessage(MSG_TITLE_COLOR, color);
	message.sendToTarget();
}
 
Example 8
Source File: DrawerProxy.java    From Ti.DrawerLayout with MIT License 4 votes vote down vote up
@Kroll.method @Kroll.setProperty
public void setCenterView(Object arg) {
	setPropertyAndFire(Drawer.PROPERTY_CENTER_VIEW, arg);
}
 
Example 9
Source File: ActionbarextrasModule.java    From actionbarextras with MIT License 4 votes vote down vote up
/**
 * Set title and subtitle font at once
 * @param value
 */
@Kroll.method @Kroll.setProperty
public void setFont(Object value) {
	setTitleFont(value);
	setSubtitleFont(value);
}
 
Example 10
Source File: ActionbarextrasModule.java    From actionbarextras with MIT License 4 votes vote down vote up
/**
 * sets the homeAsUp icon
 * @param arg
 */
@Kroll.method @Kroll.setProperty
public void setHomeAsUpIcon(Object arg) {
	Message message = getMainHandler().obtainMessage(MSG_HOMEASUP_ICON, arg);
	message.sendToTarget();
}
 
Example 11
Source File: ActionbarextrasModule.java    From actionbarextras with MIT License 4 votes vote down vote up
/**
 * Set the Statusbar background color
 * @param color
 */
@Kroll.method @Kroll.setProperty
public void setStatusbarColor(String color) {
	Message message = getMainHandler().obtainMessage(MSG_STATUSBAR_COLOR, color);
	message.sendToTarget();
}
 
Example 12
Source File: ActionbarextrasModule.java    From actionbarextras with MIT License 4 votes vote down vote up
/**
 * Set the Actionbar background color
 * @param color
 */
@Kroll.method @Kroll.setProperty
public void setBackgroundColor(String color) {
	Message message = getMainHandler().obtainMessage(MSG_BACKGROUND_COLOR, color);
	message.sendToTarget();
}
 
Example 13
Source File: DrawerProxy.java    From Ti.DrawerLayout with MIT License 4 votes vote down vote up
@Kroll.method @Kroll.setProperty
public void setLeftWindow(Object arg) {
	setPropertyAndFire(Drawer.PROPERTY_LEFT_WINDOW, arg);
}
 
Example 14
Source File: AutofocusModule.java    From TiAndroidAutofocus with MIT License 4 votes vote down vote up
@Kroll.setProperty
public void setExampleProp(String value) {
	Log.d(TAG, "set example property: " + value);
}
 
Example 15
Source File: ActionbarextrasModule.java    From actionbarextras with MIT License 4 votes vote down vote up
/**
 * set subtitle color
 * @param color
 */
@Kroll.method @Kroll.setProperty
public void setSubtitleColor(String color){
	Message message = getMainHandler().obtainMessage(MSG_SUBTITLE_COLOR, color);
	message.sendToTarget();
}
 
Example 16
Source File: ActionbarextrasModule.java    From actionbarextras with MIT License 4 votes vote down vote up
/**
 * exposes setDisplayShowHomeEnabled
 * @param boolean
 */
@Kroll.method @Kroll.setProperty
public void setDisplayShowHomeEnabled(boolean showHome){
	Message message = getMainHandler().obtainMessage(MSG_DISPLAY_HOME, showHome);
	message.sendToTarget();
}
 
Example 17
Source File: ActionbarextrasModule.java    From actionbarextras with MIT License 4 votes vote down vote up
/**
 * Set title and subtitle color at once
 * @param value
 */
@Kroll.method @Kroll.setProperty
public void setColor(String color) {
	setTitleColor(color);
	setSubtitleColor(color);
}
 
Example 18
Source File: ActionbarextrasModule.java    From actionbarextras with MIT License 4 votes vote down vote up
/**
 * sets a reference to a window
 * @param arg
 */
@Kroll.method @Kroll.setProperty
public void setWindow(Object arg) {
	Message message = getMainHandler().obtainMessage(MSG_WINDOW, arg);
	message.sendToTarget();
}
 
Example 19
Source File: CustomAndroidCameraModule.java    From Ti-Android-CameraView with MIT License 4 votes vote down vote up
@Kroll.setProperty
public void setExampleProp(String value) {
	Log.d(TAG, "set example property: " + value);
}
 
Example 20
Source File: ActionbarextrasModule.java    From actionbarextras with MIT License 4 votes vote down vote up
/**
 * sets the Actionbar elevation
 * @param arg
 */
@Kroll.method @Kroll.setProperty
public void setElevation(Object arg) {
	Message message = getMainHandler().obtainMessage(MSG_ELEVATION, arg);
	message.sendToTarget();
}