當前位置: 首頁>>代碼示例>>Java>>正文


Java TiApplication.getAppCurrentActivity方法代碼示例

本文整理匯總了Java中org.appcelerator.titanium.TiApplication.getAppCurrentActivity方法的典型用法代碼示例。如果您正苦於以下問題:Java TiApplication.getAppCurrentActivity方法的具體用法?Java TiApplication.getAppCurrentActivity怎麽用?Java TiApplication.getAppCurrentActivity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.appcelerator.titanium.TiApplication的用法示例。


在下文中一共展示了TiApplication.getAppCurrentActivity方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: openURL

import org.appcelerator.titanium.TiApplication; //導入方法依賴的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

示例2: EnablePush

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
public static void EnablePush(TiApplication app) {
  Context appContext = app.getApplicationContext();
  Activity appActivity = app.getAppCurrentActivity();

  if (appContext == null) {
    Log.e(TAG, "Application context is null, can't initialize Parse");
    return;
  }
  else if (appActivity == null) {
    Log.e(TAG, "Application activity is null, can't initialize Parse");
    return;
  }
  else {
    //PushService.setDefaultPushCallback(appContext, appActivity.getClass());
    ParseAnalytics.trackAppOpened(appActivity.getIntent());
    ParseInstallation.getCurrentInstallation().saveInBackground();
  }
}
 
開發者ID:E2010,項目名稱:android-parse-module-titanium-3-5,代碼行數:19,代碼來源:ParseSingleton.java

示例3: scan

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
@Kroll.method
@SuppressWarnings({ "rawtypes", "unchecked" })
public void scan(@Kroll.argument(optional = false) HashMap args) {

	Log.d(LCAT, "scan called with arguments:" + args);

	TiApplication appContext = TiApplication.getInstance();
	Intent intent = new Intent(appContext, Pdf417ScanActivity.class);
	Pdf417MobiSettings sett = new Pdf417MobiSettings();
	
	// Parse scan arguments into settings and intent extras
	parseArguments(args, sett, intent);

	// put settings as intent extra
	intent.putExtra(BaseBarcodeActivity.EXTRAS_SETTINGS, sett);
	
	Activity activity = TiApplication.getAppCurrentActivity();
	TiActivitySupport activitySupport = (TiActivitySupport) activity;
	
	final int resultCode = activitySupport.getUniqueResultCode();
	activitySupport.launchActivityForResult(intent, resultCode, this);
}
 
開發者ID:PDF417,項目名稱:pdf417-titanium,代碼行數:23,代碼來源:Pdf417pluginModule.java

示例4: signin

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
@Kroll.method
public void signin(KrollDict props)
{
	if (props.containsKey("success")) {
		successCallback = (KrollFunction) props.get("success");
	}
	if (props.containsKey("error")) {
		errorCallback = (KrollFunction) props.get("error");
	}
	

	String[] accountTypes = new String[] { GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE };
	Intent intent = AccountPicker.newChooseAccountIntent(null, null,
			accountTypes, false, null, null, null, null);

	Activity activity = TiApplication.getAppCurrentActivity();
	TiActivitySupport support = (TiActivitySupport) activity;
	requestCode = support.getUniqueResultCode();
	support.launchActivityForResult(intent, requestCode, this);

}
 
開發者ID:Sitata,項目名稱:titanium_google_auth_util,代碼行數:22,代碼來源:TitaniumGoogleAuthUtilModule.java

示例5: handleRequest

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
private boolean handleRequest(String[] permissions, Integer requestCode, KrollFunction permissionCallback) {
	Activity activity = TiApplication.getAppCurrentActivity();

	if (!(activity instanceof TiBaseActivity)) {
		Log.w(LCAT,	"Requesting permission from non-Titanium activity - not supported");
		return false;
	}

	TiBaseActivity currentActivity = (TiBaseActivity) activity;
	// Do we need a callback and request code in any case?
	if (requestCode == null) {
		Log.d(LCAT, "No request code given - Ti Permissions module will generate one");
		requestCode = currentActivity.getUniqueResultCode();
	}

	// register callback in current activity
	// TODO what is the exact purpose of the context? We should provide the Activity's Proxy, not the module object
	KrollObject context = currentActivity.getActivityProxy().getKrollObject();

	Log.d(LCAT, "Registering callback");
	currentActivity.registerPermissionRequestCallback(requestCode, 
			permissionCallback, context,permissions);

	Log.d(LCAT, "Calling permission request");
	ActivityCompat.requestPermissions(activity,	permissions, requestCode);
	return true;
}
 
開發者ID:stgrosshh,項目名稱:tipermissions,代碼行數:28,代碼來源:TipermissionsModule.java

示例6: handleRecoverableException

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
public void handleRecoverableException(Intent recoveryIntent) {
	Logger.getLogger(TAG).info("Launchng recoverable intent.");

	// Use the intent in a custom dialog or just startActivityForResult.
	Activity activity = TiApplication.getAppCurrentActivity();
	TiActivitySupport support = (TiActivitySupport) activity;
	recoveryRequestCode = support.getUniqueResultCode();
	support.launchActivityForResult(recoveryIntent, recoveryRequestCode,
			this);

}
 
開發者ID:Sitata,項目名稱:titanium_google_auth_util,代碼行數:12,代碼來源:TitaniumGoogleAuthUtilModule.java

示例7: handleGooglePlayException

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
public void handleGooglePlayException(
		GooglePlayServicesAvailabilityException playEx) {
	// Use the dialog to present to the user.
	Activity activity = TiApplication.getAppCurrentActivity();
	Dialog dialog = GooglePlayServicesUtil.getErrorDialog(
			playEx.getConnectionStatusCode(), activity, requestCode);
	dialog.show();
}
 
開發者ID:Sitata,項目名稱:titanium_google_auth_util,代碼行數:9,代碼來源:TitaniumGoogleAuthUtilModule.java

示例8: getUserToken

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
private void getUserToken() {
	if (mEmail == null) {
		handleError(NO_EMAIL);
	} else {
		String scopeStr = TextUtils.join(" ", mScopes);
		
		FetchUserTokenTask task = new FetchUserTokenTask(TiApplication.getAppCurrentActivity(), 
				mEmail, scopeStr, mServerId);
		task.execute();
	}
}
 
開發者ID:Sitata,項目名稱:titanium_google_auth_util,代碼行數:12,代碼來源:TitaniumGoogleAuthUtilModule.java

示例9: createCustomGallery

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Kroll.method
public void createCustomGallery(KrollDict options) {
	if ( (options != null) && options.containsKeyAndNotNull(Defaults.Params.IMAGES) ) {
		Object[] imageArray = (Object []) options.get(Defaults.Params.IMAGES);
		int size = imageArray.length;
		
		if (size != 0) { 
			ArrayList<ImageViewerInfo> imagesInfo = new ArrayList<ImageViewerInfo>();
			
			for (int i=0; i<size; i++) {
				Object o = imageArray[i];
				KrollDict info = new KrollDict((HashMap<String, Object>) o);
				
				if ( (info != null) && info.containsKeyAndNotNull(Defaults.Params.IMAGE_PATH) ) {
					String path = info.getString(Defaults.Params.IMAGE_PATH);
					String title = info.containsKeyAndNotNull(Defaults.Params.IMAGE_TITLE) ? info.getString(Defaults.Params.IMAGE_TITLE) : "";
					String titleColor = info.containsKeyAndNotNull(Defaults.Params.IMAGE_TITLE_COLOR) ? info.getString(Defaults.Params.IMAGE_TITLE_COLOR) : Defaults.IMAGE_TITLE_COLOR;		
					String titleBgColor = info.containsKeyAndNotNull(Defaults.Params.IMAGE_TITLE_BACKGROUND_COLOR) ? info.getString(Defaults.Params.IMAGE_TITLE_BACKGROUND_COLOR) : Defaults.IMAGE_TITLE_BACKGROUND_COLOR;		
					
					imagesInfo.add(new ImageViewerInfo(path, title, titleColor, titleBgColor));
				}
			}
			
			if (imagesInfo.size() > 0) {
				Activity activity = TiApplication.getAppCurrentActivity();
				
				Intent intent = new Intent(activity, ImageViewerActivity.class);
				intent = prepareExtrasForIntent(intent, options, false);
				intent.putParcelableArrayListExtra(Defaults.Params.IMAGES, imagesInfo);
				
				activity.startActivity(intent);
			}
			
		} else {
			Log.e(Defaults.LCAT, "No images passed.");
		}
		
	} else {
		Log.e(Defaults.LCAT, "No options passed.");
	}
}
 
開發者ID:prashantsaini1,項目名稱:titanium-android-imagepicker,代碼行數:43,代碼來源:ImagepickerModule.java

示例10: GcmLauncherActivity

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
public GcmLauncherActivity() {
    super();
    appWasRunning = TiApplication.getAppCurrentActivity() != null;
}
 
開發者ID:GregPerez83,項目名稱:ti-gcm,代碼行數:5,代碼來源:GcmLauncherActivity.java

示例11: initializeCrittercism

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
@Kroll.method
public void initializeCrittercism(KrollDict dict) {
	Log.d(TAG, "Crittercism Init called");
	currentActivity = TiApplication.getAppCurrentActivity();
	initCrittercism(dict);
}
 
開發者ID:shivakumars,項目名稱:Titanium-Crittercism-Android,代碼行數:7,代碼來源:CrittercismModule.java


注:本文中的org.appcelerator.titanium.TiApplication.getAppCurrentActivity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。