当前位置: 首页>>代码示例>>Java>>正文


Java TiC类代码示例

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


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


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