本文整理汇总了Java中com.adobe.fre.FREContext类的典型用法代码示例。如果您正苦于以下问题:Java FREContext类的具体用法?Java FREContext怎么用?Java FREContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FREContext类属于com.adobe.fre包,在下文中一共展示了FREContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
@Override
public FREObject call( FREContext context, FREObject[] args ) {
super.call( context, args );
AIR.log( "GameServices::unlockAchievement" );
String achievementId = FREObjectUtils.getString( args[0] );
boolean immediate = FREObjectUtils.getBoolean( args[1] );
GameServicesHelper helper = GameServicesHelper.getInstance();
if( helper.isAuthenticated() ) {
if( immediate ) {
PendingResult<Achievements.UpdateAchievementResult> result = Games.Achievements.unlockImmediate( helper.getClient(), achievementId );
result.setResultCallback( this, 10, TimeUnit.SECONDS );
return null;
}
Games.Achievements.unlock( helper.getClient(), achievementId );
AIR.log( "Successfully unlocked achievement: " + achievementId );
AIR.dispatchEvent( GameServicesEvent.ACHIEVEMENT_UPDATE_SUCCESS );
} else {
helper.dispatchAchievementUpdateError();
}
return null;
}
示例2: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
@Override
public FREObject call( FREContext context, FREObject[] args ) {
super.call( context, args );
AIR.log( "GameServices::loadAchievements" );
if( GameServicesHelper.getInstance().isAuthenticated() ) {
PendingResult<Achievements.LoadAchievementsResult> result = Games.Achievements.load( GameServicesHelper.getInstance().getClient(), false );
result.setResultCallback( this, 10, TimeUnit.SECONDS );
} else {
AIR.log( "User is not signed in." );
AIR.dispatchEvent( GameServicesEvent.ACHIEVEMENT_LOAD_ERROR, "User is not signed in." );
}
return null;
}
示例3: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
@Override
public FREObject call( FREContext context, FREObject[] args ) {
super.call( context, args );
AIR.log( "GameServices::revealAchievement" );
String achievementId = FREObjectUtils.getString( args[0] );
boolean immediate = FREObjectUtils.getBoolean( args[1] );
GameServicesHelper helper = GameServicesHelper.getInstance();
if( helper.isAuthenticated() ) {
if( immediate ) {
PendingResult<Achievements.UpdateAchievementResult> result = Games.Achievements.revealImmediate( helper.getClient(), achievementId );
result.setResultCallback( this, 10, TimeUnit.SECONDS );
return null;
}
Games.Achievements.reveal( helper.getClient(), achievementId );
AIR.log( "Successfully revealed achievement: " + achievementId );
AIR.dispatchEvent( GameServicesEvent.ACHIEVEMENT_UPDATE_SUCCESS );
} else {
helper.dispatchAchievementUpdateError();
}
return null;
}
示例4: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
@Override
public FREObject call( FREContext context, FREObject[] args ) {
super.call( context, args );
AIR.log( "GameServices::setAchievementSteps" );
String achievementId = FREObjectUtils.getString( args[0] );
int numSteps = FREObjectUtils.getInt( args[1] );
boolean immediate = FREObjectUtils.getBoolean( args[2] );
GameServicesHelper helper = GameServicesHelper.getInstance();
if( helper.isAuthenticated() ) {
if( immediate ) {
PendingResult<Achievements.UpdateAchievementResult> result = Games.Achievements.setStepsImmediate( helper.getClient(), achievementId, numSteps );
result.setResultCallback( this, 10, TimeUnit.SECONDS );
return null;
}
Games.Achievements.setSteps( helper.getClient(), achievementId, numSteps );
AIR.log( "Successfully set steps for achievement: " + achievementId );
AIR.dispatchEvent( GameServicesEvent.ACHIEVEMENT_UPDATE_SUCCESS );
} else {
helper.dispatchAchievementUpdateError();
}
return null;
}
示例5: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
@Override
public FREObject call( FREContext context, FREObject[] args ) {
super.call( context, args );
AIR.log( "GameServices::incrementAchievement" );
String achievementId = FREObjectUtils.getString( args[0] );
int numSteps = FREObjectUtils.getInt( args[1] );
boolean immediate = FREObjectUtils.getBoolean( args[2] );
GameServicesHelper helper = GameServicesHelper.getInstance();
if( helper.isAuthenticated() ) {
if( immediate ) {
PendingResult<Achievements.UpdateAchievementResult> result = Games.Achievements.incrementImmediate( helper.getClient(), achievementId, numSteps );
result.setResultCallback( this, 10, TimeUnit.SECONDS );
return null;
}
Games.Achievements.increment( helper.getClient(), achievementId, numSteps );
AIR.log( "Successfully incremented steps for achievement: " + achievementId );
AIR.dispatchEvent( GameServicesEvent.ACHIEVEMENT_UPDATE_SUCCESS );
} else {
helper.dispatchAchievementUpdateError();
}
return null;
}
示例6: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
@Override
public FREObject call( FREContext context, FREObject[] args ) {
super.call( context, args );
GameServicesHelper helper = GameServicesHelper.getInstance();
if( helper.isAuthenticated() ) {
boolean showBanner = FREObjectUtils.getBoolean( args[0] );
AIR.log( "GameServices::showAchievementBanner - " + showBanner );
if( showBanner ) {
AIR.log( "Setting AIR activity decor view" );
Games.setViewForPopups( helper.getClient(), AIR.getContext().getActivity().getWindow().getDecorView() );
} else {
AIR.log( "Setting dummy view" );
ImageView dummyView = new ImageView( AIR.getContext().getActivity() );
Games.setViewForPopups( helper.getClient(), dummyView );
}
}
return null;
}
示例7: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
@Override
public FREObject call(FREContext context, FREObject[] args) {
super.call(context, args);
AIR.log( "GameServices::showLeaderboardsUI" );
String leaderboardId = (args[0] == null) ? null : FREObjectUtils.getString( args[0] );
if( leaderboardId == null ) {
AIR.dispatchEvent( GameServicesEvent.LEADERBOARDS_UI_ERROR, "The leaderboard id must be set on Android." );
return null;
}
GameServicesHelper.getInstance().showLeaderboardsUI( leaderboardId );
return null;
}
示例8: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
public FREObject call(FREContext ctx, FREObject[] args){
UsbContext usbCtx = (UsbContext) ctx;
ArrayList<UsbAccessory> accessories = usbCtx.usbAccessories();
Iterator<UsbAccessory> accessoryIterator = accessories.iterator();
JSONArray jsonArray = new JSONArray();
while (accessoryIterator.hasNext()) {
UsbAccessory accessory = accessoryIterator.next();
JSONObject jsonObject = new JSONObject();
UsbEvent.addUsbToJson(accessory, jsonObject);
jsonArray.put(jsonObject);
}
try{
return FREObject.newObject(jsonArray.toString());
}catch(FREWrongThreadException e){
}
return null;
}
示例9: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
public FREObject call(FREContext ctx, FREObject[] args){
UsbContext usbCtx = (UsbContext) ctx;
Iterator<UsbDevice> deviceIterator = usbCtx.usbDevices().iterator();
JSONArray jsonArray = new JSONArray();
while (deviceIterator.hasNext()) {
UsbDevice device = deviceIterator.next();
JSONObject jsonObject = new JSONObject();
UsbEvent.addUsbToJson(device, jsonObject);
jsonArray.put(jsonObject);
}
try{
return FREObject.newObject(jsonArray.toString());
}catch(FREWrongThreadException e){
}
return null;
}
示例10: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
@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;
}
示例11: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
@Override
public FREObject call( FREContext context, FREObject[] args ) {
super.call( context, args );
FREArray params = (args[1] != null) ? (FREArray) args[1] : null;
VKParameters vkParameters = new VKParameters();
String errorMessage = parseRequestParameters( params, vkParameters );
mRequestId = FREObjectUtils.getInt( args[2] );
/* Send request if there's no error parsing the parameters */
if( errorMessage == null ) {
String method = FREObjectUtils.getString( args[0] );
/* Execute the request */
AIR.log( "Sending VKRequest " + method );
VKRequest request = new VKRequest( method );
request.addExtraParameters( vkParameters );
request.executeWithListener( getRequestListener( mRequestId ) );
}
/* Or dispatch error */
else {
AIR.log( "Error parsing request parameters: " + errorMessage );
AIR.dispatchEvent( AIRVKEvent.VK_REQUEST_ERROR, StringUtils.getEventErrorJSON( mRequestId, errorMessage ) );
}
return null;
}
示例12: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
@Override
public FREObject call( FREContext context, FREObject[] args ) {
super.call( context, args );
Set<Integer> supportedFlags = new HashSet<Integer>();
int systemVersion = Build.VERSION.SDK_INT;
if( systemVersion >= Build.VERSION_CODES.ICE_CREAM_SANDWICH ) {
supportedFlags.add( View.SYSTEM_UI_FLAG_VISIBLE );
supportedFlags.add( View.SYSTEM_UI_FLAG_LOW_PROFILE );
supportedFlags.add( View.SYSTEM_UI_FLAG_HIDE_NAVIGATION );
}
if( systemVersion >= Build.VERSION_CODES.JELLY_BEAN ) {
supportedFlags.add( View.SYSTEM_UI_FLAG_FULLSCREEN );
}
if( systemVersion >= Build.VERSION_CODES.KITKAT ) {
supportedFlags.add( View.SYSTEM_UI_FLAG_IMMERSIVE );
supportedFlags.add( View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY );
}
return FREObjectUtils.getVectorFromSet( supportedFlags.size(), true, supportedFlags );
}
示例13: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
@Override
public FREObject call( FREContext context, FREObject[] args ) {
super.call( context, args );
if( Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ) {
AIR.log( "Changing status bar color is not supported" );
return null;
}
try {
int color = Color.parseColor( FREObjectUtils.getString( args[0] ) );
Window window = AIR.getContext().getActivity().getWindow();
window.clearFlags( WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS );
window.addFlags( WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS );
window.setStatusBarColor( color );
} catch( Exception e ) {
AIR.log( "Error parsing status bar color: " + e.getMessage() );
}
return null;
}
示例14: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
@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; }
}
示例15: call
import com.adobe.fre.FREContext; //导入依赖的package包/类
@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; }
}