• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TiC类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.appcelerator.titanium.TiC的典型用法代码示例。如果您正苦于以下问题:Java TiC类的具体用法?Java TiC怎么用?Java TiC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TiC类属于org.appcelerator.titanium包,在下文中一共展示了TiC类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onReceivedSslError

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error)
{
	/*
	 * in theory this should be checked to make sure it's not null but if there is some failure 
	 * in the association then usage of webViewProxy should trigger a NPE to make sure the issue 
	 * is not ignored
	 */
	KrollProxy webViewProxy = this.webView.getProxy();
	
	KrollDict data = new KrollDict();
	data.put(TiC.ERROR_PROPERTY_CODE, error.getPrimaryError());
	webView.getProxy().fireSyncEvent(TiC.EVENT_SSL_ERROR, data);

	boolean ignoreSslError = false;
	try {
		ignoreSslError = webViewProxy.getProperties().optBoolean(TiC.PROPERTY_WEBVIEW_IGNORE_SSL_ERROR, false);

	} catch(IllegalArgumentException e) {
		Log.e(TAG, TiC.PROPERTY_WEBVIEW_IGNORE_SSL_ERROR + " property does not contain a boolean value, ignoring"); 
	}

	if (ignoreSslError == true) {
		Log.w(TAG, "ran into SSL error but ignoring...");
		handler.proceed();

	} else {
		Log.e(TAG, "SSL error occurred: " + error.toString());
		handler.cancel();
	}
}
 
开发者ID:chreck,项目名称:movento-webview,代码行数:32,代码来源:TiWebViewClient.java


示例2: setHtml

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
@Kroll.method
public void setHtml(String html, @Kroll.argument(optional = true) KrollDict d)
{
	setProperty(TiC.PROPERTY_HTML, html);
	setProperty(OPTIONS_IN_SETHTML, d);

	// If the web view has not been created yet, don't set html here. It will be set in processProperties() when the
	// view is created.
	TiUIView v = peekView();
	if (v != null) {
		if (TiApplication.isUIThread()) {
			((TiUIWebView) v).setHtml(html, d);
		} else {
			getMainHandler().sendEmptyMessage(MSG_SET_HTML);
		}
	}
}
 
开发者ID:chreck,项目名称:movento-webview,代码行数:18,代码来源:WebViewProxy.java


示例3: onPageFinished

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
@Override
public void onPageFinished(WebView view, String url)
{
	super.onPageFinished(view, url);
	WebViewProxy proxy = (WebViewProxy) webView.getProxy();
	webView.changeProxyUrl(url);
	KrollDict data = new KrollDict();
	data.put("url", url);
	proxy.fireEvent(TiC.EVENT_LOAD, data);
	boolean enableJavascriptInjection = true;
	if (proxy.hasProperty(TiC.PROPERTY_ENABLE_JAVASCRIPT_INTERFACE)) {
		enableJavascriptInjection = TiConvert.toBoolean(proxy.getProperty(TiC.PROPERTY_ENABLE_JAVASCRIPT_INTERFACE), true);
	}
	if (Build.VERSION.SDK_INT > 16 || enableJavascriptInjection) {
		WebView nativeWebView = webView.getWebView();

		if (nativeWebView != null) {
			if (webView.shouldInjectBindingCode()) {
				nativeWebView.loadUrl("javascript:" + TiWebViewBinding.INJECTION_CODE);
			}
			nativeWebView.loadUrl("javascript:" + TiWebViewBinding.POLLING_CODE);
		}
	}
	webView.setBindingCodeInjected(false);
}
 
开发者ID:chreck,项目名称:movento-webview,代码行数:26,代码来源:TiWebViewClient.java


示例4: setHtml

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
public void setHtml(String html, HashMap<String, Object> d)
{
	if (d == null) {
		setHtml(html);
		return;
	}
	
	reloadMethod = reloadTypes.HTML;
	reloadData = d;
	String baseUrl = TiC.URL_ANDROID_ASSET_RESOURCES;
	String mimeType = "text/html";
	if (d.containsKey(TiC.PROPERTY_BASE_URL_WEBVIEW)) {
		baseUrl = TiConvert.toString(d.get(TiC.PROPERTY_BASE_URL_WEBVIEW));
	} 
	if (d.containsKey(TiC.PROPERTY_MIMETYPE)) {
		mimeType = TiConvert.toString(d.get(TiC.PROPERTY_MIMETYPE));
	}
	
	setHtmlInternal(html, baseUrl, mimeType);
}
 
开发者ID:chreck,项目名称:movento-webview,代码行数:21,代码来源:TiUIWebView.java


示例5: reload

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
public void reload()
{
	switch (reloadMethod) {
	case DATA:
		if (reloadData != null && reloadData instanceof TiBlob) {
			setData((TiBlob) reloadData);
		} else {
			Log.d(TAG, "reloadMethod points to data but reloadData is null or of wrong type. Calling default", Log.DEBUG_MODE);
			getWebView().reload();
		}
		break;
		
	case HTML:
		if (reloadData == null || (reloadData instanceof HashMap<?,?>) ) {
			setHtml(TiConvert.toString(getProxy().getProperty(TiC.PROPERTY_HTML)), (HashMap<String,Object>)reloadData);
		} else {
			Log.d(TAG, "reloadMethod points to html but reloadData is of wrong type. Calling default", Log.DEBUG_MODE);
			getWebView().reload();
		}
		break;
	
	case URL:
		if (reloadData != null && reloadData instanceof String) {
			setUrl((String) reloadData);
		} else {
			Log.d(TAG, "reloadMethod points to url but reloadData is null or of wrong type. Calling default", Log.DEBUG_MODE);
			getWebView().reload();
		}
		break;
		
	default:
		getWebView().reload();
	}
}
 
开发者ID:chreck,项目名称:movento-webview,代码行数:35,代码来源:TiUIWebView.java


示例6: checkLatestEventInfoProperties

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
protected void checkLatestEventInfoProperties(KrollDict d)
{
    if (d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TITLE)
            || d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TEXT))
    {
        String contentTitle = "";
        String contentText = "";
        PendingIntent contentIntent = null;
        if (d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TITLE)) {
            contentTitle = TiConvert.toString(d, TiC.PROPERTY_CONTENT_TITLE);
        }
        if (d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TEXT)) {
            contentText = TiConvert.toString(d, TiC.PROPERTY_CONTENT_TEXT);
        }

        Context c = getActivity();
        if (c == null) {
            c = TiApplication.getInstance().getApplicationContext();
        }
        contentIntent = createDefaultIntent(c, d.getKrollDict(TiC.PROPERTY_DATA));

        notification.setLatestEventInfo(c, contentTitle, contentText, contentIntent);
    }
}
 
开发者ID:GregPerez83,项目名称:ti-gcm,代码行数:25,代码来源:GcmNotificationProxy.java


示例7: setTime

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
public void setTime(int position)
{
	if (position < 0) {
		position = 0;
	}

	if (mp != null) {
		int duration = mp.getDuration();
		if (position > duration) {
			position = duration;
		}

		mp.seekTo(position);
	}

	proxy.setProperty(TiC.PROPERTY_TIME, position);
}
 
开发者ID:DesktopSolutionsSoftware,项目名称:android-audioplayer,代码行数:18,代码来源:MediaPlayerWrapper.java


示例8: onError

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
@Override
public boolean onError(MediaPlayer mp, int what, int extra)
{
	int code = 0;
	String msg = "Unknown media error.";
	if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) 
	{
		msg = "Media server died";
	}
	release();

	KrollDict data = new KrollDict();
	data.put(TiC.PROPERTY_CODE, code);
	data.put(TiC.PROPERTY_MESSAGE, msg);
	proxy.fireEvent(EVENT_ERROR, data);

	return true;
}
 
开发者ID:DesktopSolutionsSoftware,项目名称:android-audioplayer,代码行数:19,代码来源:MediaPlayerWrapper.java


示例9: handleCreationDict

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
@Override
public void handleCreationDict(KrollDict options) {
	super.handleCreationDict(options);
	if (options.containsKey(TiC.PROPERTY_URL)) {
		setProperty(TiC.PROPERTY_URL, resolveUrl(null, TiConvert.toString(options, TiC.PROPERTY_URL)));
	}
	if (options.containsKey(TiC.PROPERTY_ALLOW_BACKGROUND)) {
		setProperty(TiC.PROPERTY_ALLOW_BACKGROUND, options.get(TiC.PROPERTY_ALLOW_BACKGROUND));
	}
	if(options.containsKey("speakerphone")) {
		setProperty("speakerphone", TiConvert.toBoolean(options.get("speakerphone")));
	}
	if (DBG) {
		Log.i(LCAT, "Creating audio player proxy for url: " + TiConvert.toString(getProperty("url")));
	}
}
 
开发者ID:DesktopSolutionsSoftware,项目名称:android-audioplayer,代码行数:17,代码来源:AudioPlayerProxy.java


示例10: setIcon

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
@Kroll.method @Kroll.setProperty
public void setIcon(Object icon)
{
	if (icon instanceof Number) {
		notificationBuilder.setSmallIcon(((Number)icon).intValue());
	} else {
		String iconUrl = TiConvert.toString(icon);
		if (iconUrl == null) {
			Log.e(TAG, "Url is null");
			return;
		}
		String iconFullUrl = resolveUrl(null, iconUrl);
		notificationBuilder.setSmallIcon(TiUIHelper.getResourceId(iconFullUrl));
	}
	setProperty(TiC.PROPERTY_ICON, icon);
}
 
开发者ID:falkolab,项目名称:Ti.NotificationFactory,代码行数:17,代码来源:NotificationProxy.java


示例11: checkLatestEventInfoProperties

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
protected void checkLatestEventInfoProperties(KrollDict d)
{
	if (d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TITLE)
		|| d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TEXT)) {
		String contentTitle = "";
		String contentText = "";
		if (d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TITLE)) {
			contentTitle = TiConvert.toString(d, TiC.PROPERTY_CONTENT_TITLE);
			notificationBuilder.setContentTitle(contentTitle);
		}
		if (d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TEXT)) {
			contentText = TiConvert.toString(d, TiC.PROPERTY_CONTENT_TEXT);
			notificationBuilder.setContentText(contentText);
		}	
	}
}
 
开发者ID:falkolab,项目名称:Ti.NotificationFactory,代码行数:17,代码来源:NotificationProxy.java


示例12: propertyChanged

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
@Override
public void propertyChanged(String key, Object oldValue, Object newValue,
		KrollProxy proxy) {


	CompoundButton cb = (CompoundButton) getNativeView();
	if (key.equals(TiC.PROPERTY_TITLE_OFF)) {
		((Switch) cb).setTextOff((String) newValue);
	} else if (key.equals(TiC.PROPERTY_TITLE_ON)) {
		((Switch) cb).setTextOff((String) newValue);
	} else if (key.equals(TiC.PROPERTY_VALUE)) {
		cb.setChecked(TiConvert.toBoolean(newValue));
	} else if (key.equals(TiC.PROPERTY_COLOR)) {
		cb.setTextColor(TiConvert.toColor(TiConvert.toString(newValue)));
	} else if (key.equals(TiC.PROPERTY_FONT)) {
		TiUIHelper.styleText(cb, (KrollDict) newValue);
	} else if (key.equals(TiC.PROPERTY_TEXT_ALIGN)) {
		TiUIHelper.setAlignment(cb, TiConvert.toString(newValue), null);
		cb.requestLayout();
	} else if (key.equals(TiC.PROPERTY_VERTICAL_ALIGN)) {
		TiUIHelper.setAlignment(cb, null, TiConvert.toString(newValue));
		cb.requestLayout();
	} else {
		super.propertyChanged(key, oldValue, newValue, proxy);
	}
}
 
开发者ID:dbankier,项目名称:RealSwitch,代码行数:27,代码来源:RealSwitch.java


示例13: CollectionViewTemplate

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
public CollectionViewTemplate(String id, KrollDict properties) {
	//Init our binding hashmaps
	dataItems = new HashMap<String, DataItem>();

	//Set item id. Item binding is always "properties"
	itemID = TiC.PROPERTY_PROPERTIES;
	//Init vars.
	templateID = id;
	templateType = -1;
	if (properties != null) {
		this.properties = properties;
		processProperties(this.properties);
	} else {
		this.properties = new KrollDict();
	}

}
 
开发者ID:nuno,项目名称:TiCollectionView,代码行数:18,代码来源:CollectionViewTemplate.java


示例14: processChildProperties

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
private void processChildProperties(Object childProperties, DataItem parent) {
	if (childProperties instanceof Object[]) {
		Object[] propertiesArray = (Object[])childProperties;
		for (int i = 0; i < propertiesArray.length; i++) {
			HashMap<String, Object> properties = (HashMap<String, Object>) propertiesArray[i];
			//bind proxies and default properties
			DataItem item = bindProxiesAndProperties(new KrollDict(properties), false, parent);
			//Recursively calls for all childTemplates
			if (properties.containsKey(TiC.PROPERTY_CHILD_TEMPLATES)) {
				if(item == null) {
					Log.e(TAG, "Unable to generate valid data from child view", Log.DEBUG_MODE);
				}
				processChildProperties(properties.get(TiC.PROPERTY_CHILD_TEMPLATES), item);
			}
		}
	}
}
 
开发者ID:nuno,项目名称:TiCollectionView,代码行数:18,代码来源:CollectionViewTemplate.java


示例15: scrollToItem

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
@Kroll.method
public void scrollToItem(int sectionIndex, int itemIndex, @SuppressWarnings("rawtypes") @Kroll.argument(optional=true)HashMap options) {
	boolean animated = true;
	if ( (options != null) && (options instanceof HashMap<?, ?>) ) {
		@SuppressWarnings("unchecked")
		KrollDict animationargs = new KrollDict(options);
		if (animationargs.containsKeyAndNotNull(TiC.PROPERTY_ANIMATED)) {
			animated = TiConvert.toBoolean(animationargs.get(TiC.PROPERTY_ANIMATED), true);
		}
	} 
	if (TiApplication.isUIThread()) {
		handleScrollToItem(sectionIndex, itemIndex, animated);
	} else {
		KrollDict d = new KrollDict();
		d.put("itemIndex", itemIndex);
		d.put("sectionIndex", sectionIndex);
		d.put(TiC.PROPERTY_ANIMATED, Boolean.valueOf(animated));
		TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SCROLL_TO_ITEM), d);
	}
}
 
开发者ID:nuno,项目名称:TiCollectionView,代码行数:21,代码来源:CollectionViewProxy.java


示例16: setSections

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
@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);
		}
		
	}
}
 
开发者ID:nuno,项目名称:TiCollectionView,代码行数:27,代码来源:CollectionViewProxy.java


示例17: handleFireItemClick

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
protected void handleFireItemClick (KrollDict data) {
	TiViewProxy listViewProxy = ((CollectionItemProxy)proxy).getListProxy();
	if (listViewProxy != null) {
		TiUIView listView = listViewProxy.peekView();
		if (listView != null) {
			KrollDict d = listView.getAdditionalEventData();
			if (d == null) {
				listView.setAdditionalEventData(new KrollDict((HashMap) additionalEventData));
			} else {
				d.clear();
				d.putAll(additionalEventData);
			}
			listView.fireEvent(TiC.EVENT_ITEM_CLICK, data);
		}
	}
}
 
开发者ID:nuno,项目名称:TiCollectionView,代码行数:17,代码来源:CollectionItem.java


示例18: CollectionItemData

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
public CollectionItemData (KrollDict properties, CollectionViewTemplate template) {
	this.properties = properties;
	this.template = template;
	//set searchableText
	if (properties.containsKey(TiC.PROPERTY_PROPERTIES)) {
		Object props = properties.get(TiC.PROPERTY_PROPERTIES);
		if (props instanceof HashMap) {
			HashMap<String, Object> propsHash = (HashMap<String, Object>) props;
			Object searchText = propsHash.get(TiC.PROPERTY_SEARCHABLE_TEXT);
			if (propsHash.containsKey(TiC.PROPERTY_SEARCHABLE_TEXT) && searchText != null) {
				searchableText = TiConvert.toString(searchText);
			}
		}
	}

}
 
开发者ID:nuno,项目名称:TiCollectionView,代码行数:17,代码来源:CollectionSectionProxy.java


示例19: replaceItemsAt

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
@Kroll.method
public void replaceItemsAt(int index, int count, Object data) {
	if (!isIndexValid(index)) {
		return;
	}

	if (TiApplication.isUIThread()) {
		handleReplaceItemsAt(index, count, data);
	} else {
		KrollDict d = new KrollDict();
		d.put(TiC.EVENT_PROPERTY_INDEX, index);
		d.put(TiC.PROPERTY_COUNT, count);
		d.put(TiC.PROPERTY_DATA, data);
		TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_REPLACE_ITEMS_AT), d);
	}
}
 
开发者ID:nuno,项目名称:TiCollectionView,代码行数:17,代码来源:CollectionSectionProxy.java


示例20: propertyChanged

import org.appcelerator.titanium.TiC; //导入依赖的package包/类
@Override
public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy) {
    super.propertyChanged(key, oldValue, newValue, proxy);

    if (key.equals("indeterminate")) {
        boolean indeterminate = TiConvert.toBoolean(newValue, false);
        handleSetIndeterminate(indeterminate);
    }
    else if (key.equals(TiC.PROPERTY_VALUE) || key.equals("min") || key.equals("max") ||
            key.equals("secondary")) {

        updateProgress();
    }
    else if (key.equals(TiC.PROPERTY_MESSAGE)) {
        String message = TiConvert.toString(newValue);
        if (message != null) {
            handleSetMessage(message);
        }
    }
}
 
开发者ID:smclab,项目名称:TiAlternativeProgressBar,代码行数:21,代码来源:TiUIProgressBar.java



注:本文中的org.appcelerator.titanium.TiC类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Expression类代码示例发布时间:2022-05-21
下一篇:
Java OHLCDataset类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap