當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。