Java Code Examples for com.adobe.fre.FREObject#newObject()

The following examples show how to use com.adobe.fre.FREObject#newObject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IsOperationalFunction.java    From face-detection-ane with Apache License 2.0 6 votes vote down vote up
@Override
public FREObject call( FREContext context, FREObject[] args ) {
	super.call( context, args );

	AIR.log( "FaceDetection::isOperational" );

	Activity activity = AIR.getContext().getActivity();

	FaceDetector.Builder fb = new FaceDetector.Builder( activity.getApplicationContext() );
	final FaceDetector detector = fb.build();
	try {
		return FREObject.newObject( detector.isOperational() );
	} catch( FREWrongThreadException e ) {
		e.printStackTrace();
	}

	return null;
}
 
Example 2
Source File: ImmersiveHeightFunction.java    From air-ane-fullscreen with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public FREObject call(FREContext context, FREObject[] args) 
{
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
	{
		try
		{
			View decorView = context.getActivity().getWindow().getDecorView();
			Point outSize = new Point();
			
			decorView.getDisplay().getRealSize(outSize);
			
			return FREObject.newObject(outSize.y);
		}
		catch (Exception e0) {}
	}
	
	try { return FREObject.newObject(0); }
	catch (Exception e1) { return null; }
}
 
Example 3
Source File: ImmersiveWidthFunction.java    From air-ane-fullscreen with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public FREObject call(FREContext context, FREObject[] args) 
{
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
	{
		try
		{
			View decorView = context.getActivity().getWindow().getDecorView();
			Point outSize = new Point();
			
			decorView.getDisplay().getRealSize(outSize);
			
			return FREObject.newObject(outSize.x);
		}
		catch (Exception e0) {} 
	}
	
	try { return FREObject.newObject(0); }
	catch (Exception e1) { return null; }
}
 
Example 4
Source File: SetSystemUiVisibilityFunction.java    From air-ane-fullscreen with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public FREObject call(FREContext context, FREObject[] args) 
{
	try
	{
		final FullScreenContext fsc = (FullScreenContext) context;
		
		int uiOptions = args[0].getAsInt();
		
		fsc.resetUi();
		fsc.setSystemUiVisibility(uiOptions);
	}
	catch (Exception e0)
	{
		try { return FREObject.newObject(false); }
		catch (Exception e1) { return null; }
	}
	
	try { return FREObject.newObject(true); }
	catch (Exception e2) {}
	
	return null;
}
 
Example 5
Source File: AirGooglePlayGamesGetActivePlayerName.java    From ANE-Google-Play-Game-Services with Apache License 2.0 6 votes vote down vote up
@Override
public FREObject call(FREContext arg0, FREObject[] arg1) {
	
	Extension.context.createHelperIfNeeded(arg0.getActivity());
	Player player = Games.Players.getCurrentPlayer(Extension.context.getApiClient());
	
	FREObject playerName = null;
	if (player != null)
	{
		try {
			playerName = FREObject.newObject(player.getDisplayName());
		} catch (FREWrongThreadException e) {
			e.printStackTrace();
		}
	}
	
	return playerName;
}
 
Example 6
Source File: IsAvailableFunction.java    From face-detection-ane with Apache License 2.0 5 votes vote down vote up
@Override
public FREObject call( FREContext context, FREObject[] args ) {
	super.call( context, args );

	AIR.log( "FaceDetection::isAvailable" );
	Activity activity = AIR.getContext().getActivity();

	try {
		return FREObject.newObject( checkPlayServices( activity ) );
	} catch( FREWrongThreadException e ) {
		e.printStackTrace();
	}

	return null;
}
 
Example 7
Source File: Context.java    From google-play-game-services-ane with MIT License 5 votes vote down vote up
@Override
public FREObject call(FREContext context, FREObject[] args) {
	FREObject bool = null;
	try {
		 bool = FREObject.newObject(SignInActivity.mHelper.isSignedIn()) ;
	} catch (FREWrongThreadException e) {
		e.printStackTrace();
	}
	
	return bool;
}
 
Example 8
Source File: GetVersionFunction.java    From ANE-Crashlytics with Apache License 2.0 5 votes vote down vote up
public FREObject call(FREContext context, FREObject[] args) {
	super.call(context, args);
	
	try {
		return FREObject.newObject(Crashlytics.getInstance().getVersion());
	}
	catch (Exception e) {
		e.printStackTrace();
		return null;
	}
}
 
Example 9
Source File: CrashFunction.java    From ANE-Crashlytics with Apache License 2.0 5 votes vote down vote up
public FREObject call(FREContext context, FREObject[] args) {
	super.call(context, args);
	
	Intent intent = new Intent(context.getActivity().getApplicationContext(), CrashActivity.class);
	Boolean activityDeclared = (context.getActivity().getPackageManager().resolveActivity(intent, 0) != null);
	context.getActivity().startActivity(intent);
	
	try {
		return FREObject.newObject(activityDeclared);
	}
	catch (Exception e) {
		e.printStackTrace();
		return null;
	}
}
 
Example 10
Source File: GetApiKeyFunction.java    From ANE-Crashlytics with Apache License 2.0 5 votes vote down vote up
public FREObject call(FREContext context, FREObject[] args) {
	super.call(context, args);
	
	try {
		Activity activity = context.getActivity();
		ApplicationInfo ai = activity.getPackageManager().getApplicationInfo(activity.getPackageName(), PackageManager.GET_META_DATA);
	    String apiKey = ai.metaData.getString("io.fabric.ApiKey");
		return FREObject.newObject(apiKey);
	}
	catch (Exception e) {
		e.printStackTrace();
		return null;
	}
}
 
Example 11
Source File: GetSkuDetailsFunction.java    From AndroidInAppPurchase with Apache License 2.0 5 votes vote down vote up
@Override
public FREObject call(FREContext arg0, FREObject[] arg1)
{	
	try
	{
		FREObject sku = arg1[0];
		FREObject res = FREObject.newObject("com.pozirk.payment.android.InAppSkuDetails", null);
		
		SkuDetails skuDetails = Billing.getInstance().getSKuDetails(sku.getAsString());
		
		if(skuDetails != null)
		{
			res.setProperty("_sku", FREObject.newObject(skuDetails.getSku()));
			res.setProperty("_type", FREObject.newObject(skuDetails.getType()));
			res.setProperty("_price", FREObject.newObject(skuDetails.getPrice()));
			res.setProperty("_title", FREObject.newObject(skuDetails.getTitle()));
			res.setProperty("_descr", FREObject.newObject(skuDetails.getDescription()));
			
			return res;
		}
	}
	catch (Exception e)
	{
		e.printStackTrace();
	}
	
	return null;
}
 
Example 12
Source File: GetPurchaseDetailsFunction.java    From AndroidInAppPurchase with Apache License 2.0 5 votes vote down vote up
@Override
public FREObject call(FREContext arg0, FREObject[] arg1)
{	
	try
	{
		FREObject sku = arg1[0];
		FREObject res = FREObject.newObject("com.pozirk.payment.android.InAppPurchaseDetails", null);
		
		Purchase purchase = Billing.getInstance().getPurchaseDetails(sku.getAsString());
		
		if(purchase != null)
		{
			res.setProperty("_type", FREObject.newObject(purchase.getItemType()));
			res.setProperty("_orderId", FREObject.newObject(purchase.getOrderId()));
			res.setProperty("_packageName", FREObject.newObject(purchase.getPackageName()));
			res.setProperty("_sku", FREObject.newObject(purchase.getSku()));
			res.setProperty("_time", FREObject.newObject(purchase.getPurchaseTime()));
			res.setProperty("_purchaseState", FREObject.newObject(purchase.getPurchaseState()));
			res.setProperty("_payload", FREObject.newObject(purchase.getDeveloperPayload()));
			res.setProperty("_token", FREObject.newObject(purchase.getToken()));
			res.setProperty("_json", FREObject.newObject(purchase.getOriginalJson()));
			res.setProperty("_signature", FREObject.newObject(purchase.getSignature()));
			
			return res;
		}
	}
	catch (Exception e)
	{
		e.printStackTrace();
	}
	
	return null;
}
 
Example 13
Source File: IsImmersiveModeSupportedFunction.java    From air-ane-fullscreen with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public FREObject call(FREContext context, FREObject[] args) 
{
	try { return FREObject.newObject(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT); }
	catch (Exception e1) { return null; }
}