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


Java KrollDict类代码示例

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


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

示例1: onReceivedSslError

import org.appcelerator.kroll.KrollDict; //导入依赖的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: handleCreationDict

import org.appcelerator.kroll.KrollDict; //导入依赖的package包/类
@Override
public void handleCreationDict(KrollDict dict) {
	super.handleCreationDict(dict);
	
	if (dict.containsKey(PROPERTY_ID)) {
		setId(TiConvert.toInt(dict, PROPERTY_ID));
	} else {
		throw new IllegalArgumentException("property 'id' is required");
	}
	if (dict.containsKey(PROPERTY_TITLE)) {
		setTitle(TiConvert.toString(dict, PROPERTY_TITLE));
	}
	if (dict.containsKey(PROPERTY_TEXT)) {
		setText(TiConvert.toString(dict, PROPERTY_TEXT));
	}
	if (dict.containsKey(PROPERTY_ICON)) {
		setIcon(TiConvert.toInt(dict, PROPERTY_ICON));
	}
	if (dict.containsKey(PROPERTY_PENDING_INTENT)) {
		setPendingIntent((PendingIntentProxy) dict.get(PROPERTY_PENDING_INTENT));
	}
	if (dict.containsKey(PROPERTY_NUMBER)) {
		setNumber(TiConvert.toInt(dict, PROPERTY_NUMBER));
	}
}
 
开发者ID:azwan082,项目名称:nc_progress_notification,代码行数:26,代码来源:NotificationProxy.java

示例3: flushResponse

import org.appcelerator.kroll.KrollDict; //导入依赖的package包/类
protected void flushResponse(Object... params) {
	if (null != callback) {
		ArrayList<Object> args = new ArrayList<Object>();
		
		for (Object a : params) {
			args.add(a);	
		}
		
		int length = args.size();
		KrollDict response = new KrollDict();
		
		for (int i=0; i<length; i++) {		// double increase i to make key-value pair
			String key = (String) args.get(i);
			++i;
			response.put(key, args.get(i));
		}
		
		callback.callAsync(krollObject, response);
	}
}
 
开发者ID:prashantsaini1,项目名称:titanium-android-imagepicker,代码行数:21,代码来源:GalleryResultHandler.java

示例4: prepareExtrasForIntent

import org.appcelerator.kroll.KrollDict; //导入依赖的package包/类
private Intent prepareExtrasForIntent(Intent intent, KrollDict options, boolean openGallery) {
	Defaults.resetValues(openGallery);
	
	checkAndSetParameters(1, Defaults.Params.STATUS_BAR_COLOR, Defaults.STATUS_BAR_COLOR, options, intent);
	checkAndSetParameters(1, Defaults.Params.BAR_COLOR, Defaults.BAR_COLOR, options, intent);
	checkAndSetParameters(1, Defaults.Params.BACKGROUND_COLOR, Defaults.BACKGROUND_COLOR, options, intent);
	checkAndSetParameters(1, Defaults.Params.COVER_VIEW_COLOR, Defaults.COVER_VIEW_COLOR, options, intent);
	checkAndSetParameters(1, Defaults.Params.CHECKMARK_COLOR, Defaults.CHECKMARK_COLOR, options, intent);
	checkAndSetParameters(1, Defaults.Params.TITLE, Defaults.TITLE, options, intent);
	checkAndSetParameters(1, Defaults.Params.DONE_BTN_TITLE, Defaults.DONE_BTN_TITLE, options, intent);
	checkAndSetParameters(1, Defaults.Params.MAX_IMAGE_MSG, Defaults.MAX_IMAGE_MSG, options, intent);
	checkAndSetParameters(2, Defaults.Params.GRID_SIZE, Defaults.GRID_SIZE, options, intent);
	checkAndSetParameters(2, Defaults.Params.IMAGE_HEIGHT, Defaults.IMAGE_HEIGHT, options, intent);
	checkAndSetParameters(2, Defaults.Params.SHOW_DIVIDER, Defaults.SHOW_DIVIDER, options, intent);
	checkAndSetParameters(2, Defaults.Params.DIVIDER_WIDTH, Defaults.DIVIDER_WIDTH, options, intent);
	checkAndSetParameters(2, Defaults.Params.MAX_IMAGE_SELECTION, Defaults.MAX_IMAGE_SELECTION, options, intent);
	checkAndSetParameters(2, Defaults.Params.SHAPE, Defaults.SHAPE, options, intent);
	checkAndSetParameters(2, Defaults.Params.CIRCLE_RADIUS, Defaults.CIRCLE_RADIUS, options, intent);
	checkAndSetParameters(2, Defaults.Params.CIRCLE_PADDING, Defaults.CIRCLE_PADDING, options, intent);
    
	return intent;
}
 
开发者ID:prashantsaini1,项目名称:titanium-android-imagepicker,代码行数:23,代码来源:ImagepickerModule.java

示例5: start

import org.appcelerator.kroll.KrollDict; //导入依赖的package包/类
@Kroll.method
public void start()
{
    setState(STATE_RUNNING);
    // App opens analytics
    ParseAnalytics.trackAppOpenedInBackground(TiApplication.getAppRootOrCurrentActivity().getIntent());
    ParseInstallation.getCurrentInstallation().put("androidId", getAndroidId());
    ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
        public void done(ParseException e) {
            if (e != null) {
                Log.e(TAG, "Installation initialization failed: " + e.getMessage());
            }
            // fire event
            try {
            	JSONObject pnData = new JSONObject();
	pnData.put("objectId", getObjectId());
	pnData.put("installationId", getCurrentInstallationId());
	KrollDict data = new KrollDict(pnData);
             module.fireEvent("installationId", data);
} catch (JSONException e1) {
	Log.e(TAG, "InstallationId event failed: " + e1.getMessage());
}
        }
    });
}
 
开发者ID:gimdongwoo,项目名称:Titanium-Parse-Android,代码行数:26,代码来源:ParseModule.java

示例6: openURL

import org.appcelerator.kroll.KrollDict; //导入依赖的package包/类
@Kroll.method
public boolean openURL(KrollDict options) {
	if ( (options != null) && options.containsKeyAndNotNull(Params.URL)) {
		Context context = TiApplication.getAppCurrentActivity();
		List<ResolveInfo> browsersList = Utils.allBrowsers(context);
		
		if (!browsersList.isEmpty()) {
			List<String> customTabBrowsers = getCustomTabBrowsers(context, browsersList);				
			
			// show supported browsers list or open directly if only 1 supported browser is available
			openCustomTab(context, customTabBrowsers, options);
	        
			return true;
			
		} else {
			Log.i(Params.LCAT, "No browsers available in this device.");
			return false;
		}
	}
	
	Log.i(Params.LCAT, "Check your paramters. URL parameter is mandatory.");
	return false;
}
 
开发者ID:prashantsaini1,项目名称:ti-chrometabs,代码行数:24,代码来源:TichrometabsModule.java

示例7: setHtml

import org.appcelerator.kroll.KrollDict; //导入依赖的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

示例8: onPageFinished

import org.appcelerator.kroll.KrollDict; //导入依赖的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

示例9: onCreate

import org.appcelerator.kroll.KrollDict; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();
    HashMap<String, Object> data = (HashMap)intent.getSerializableExtra(TiGCMModule.NTF_KEY_DATA);

    TiGCMModule module = TiGCMModule.getInstance();
    TiApplication instance = TiApplication.getInstance();

    if(module != null) {
        module.fireMessage(data, false);
    } else {
        KrollDict kdata = new KrollDict(data);

        TiApplication.getInstance().getAppProperties().setString(TiGCMModule.PROPERTY_PENDING_DATA, kdata.toString());
        Log.d(TAG, "Saving data in props: " + kdata.toString());
    }

    String pkg = instance.getApplicationContext().getPackageName();
    Intent launcherIntent = instance.getApplicationContext().getPackageManager().getLaunchIntentForPackage(pkg);

    startActivity(launcherIntent);
    finish();
}
 
开发者ID:hyperlab,项目名称:TiAndroidNotifications,代码行数:26,代码来源:NotificationActivity.java

示例10: checkLatestEventInfoProperties

import org.appcelerator.kroll.KrollDict; //导入依赖的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

示例11: onStart

import org.appcelerator.kroll.KrollDict; //导入依赖的package包/类
@Override
protected void onStart() {
    super.onStart();
    TiGcmModule.logd("GcmLauncherActivity: Starting activity");

    KrollDict data = extractIntentData();
    if (!appWasRunning) {
        TiApplication tiApp = TiApplication.getInstance();
        String tiPackageName = tiApp.getPackageName();
        String mainClassName = tiApp.getPackageManager().getLaunchIntentForPackage(tiPackageName).getComponent().getClassName();

        Intent mainActivityIntent = new Intent();
        mainActivityIntent.setClassName(tiPackageName, mainClassName);
        mainActivityIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        mainActivityIntent.addCategory(Intent.CATEGORY_LAUNCHER);

        startActivity(mainActivityIntent);

        TiGcmModule.queueDataFromBackground(data);

    } else {
        TiGcmModule.queueDataFromBackground(data);
        this.finish();
    }
}
 
开发者ID:GregPerez83,项目名称:ti-gcm,代码行数:26,代码来源:GcmLauncherActivity.java

示例12: onError

import org.appcelerator.kroll.KrollDict; //导入依赖的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

示例13: handleCreationDict

import org.appcelerator.kroll.KrollDict; //导入依赖的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

示例14: applicationError

import org.appcelerator.kroll.KrollDict; //导入依赖的package包/类
@Override
public void applicationError(int errorCode) {
          if (DEBUG)
              Log.d(TAG, "LicenseCheckerCallback.applicationError " + errorCode);

          // This is a polite way of saying the developer made a mistake
          // while setting up or calling the license checker library.
          // Please examine the error code and fix the error.

          KrollDict info = new KrollDict();

          info.put("response", "error");
          info.put("reason", errorCode);
          
  		fireEvent("licenseCheckerEvent", info);

}
 
开发者ID:eric-sofisoftwarellc,项目名称:TiLicensing,代码行数:18,代码来源:LicensingModule.java

示例15: handleCreationDict

import org.appcelerator.kroll.KrollDict; //导入依赖的package包/类
@Override
public void handleCreationDict(KrollDict d)
{
	super.handleCreationDict(d);
	if (d == null) {
		return;
	}
	
	if (d.containsKey(NotificationfactoryModule.PROPERTY_BIG_TEXT)) {
		setBigText(TiConvert.toString(d.get(NotificationfactoryModule.PROPERTY_BIG_TEXT)));
	}
	
	if (d.containsKey(NotificationfactoryModule.PROPERTY_BIG_CONTENT_TITLE)) {
		setBigContentTitle(TiConvert.toString(d.get(NotificationfactoryModule.PROPERTY_BIG_CONTENT_TITLE)));
	}
	
	if (d.containsKey(NotificationfactoryModule.PROPERTY_SUMMARY_TEXT)) {
		setSummaryText(TiConvert.toString(d.get(NotificationfactoryModule.PROPERTY_SUMMARY_TEXT)));
	}
}
 
开发者ID:falkolab,项目名称:Ti.NotificationFactory,代码行数:21,代码来源:BigTextStyleProxy.java


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