• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ActivityUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onCreateResources

import org.andengine.util.ActivityUtils; //导入依赖的package包/类
@Override
public void onCreateResources(final OnCreateResourcesCallback pOnCreateResourcesCallback) {
	this.runOnUiThread(new Runnable() {
		@Override
		public void run() {
			ActivityUtils.doProgressAsync(SimpleAsyncGameActivity.this, "Loading Resources...", android.R.drawable.ic_menu_rotate, new ProgressCallable<Void>() {
				@Override
				public Void call(final IProgressListener pProgressListener) throws Exception {
					SimpleAsyncGameActivity.this.onCreateResourcesAsync(pProgressListener);

					pProgressListener.onProgressChanged(100);

					pOnCreateResourcesCallback.onCreateResourcesFinished();

					return null;
				}
			}, new Callback<Void>() {
				@Override
				public void onCallback(final Void pCallbackValue) {
					/* Nothing. */
				}
			});
		}
	});
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:26,代码来源:SimpleAsyncGameActivity.java


示例2: onCreateScene

import org.andengine.util.ActivityUtils; //导入依赖的package包/类
@Override
public void onCreateScene(final OnCreateSceneCallback pOnCreateSceneCallback) {
	this.runOnUiThread(new Runnable() {
		@Override
		public void run() {
			ActivityUtils.doProgressAsync(SimpleAsyncGameActivity.this, "Loading Scene...", android.R.drawable.ic_menu_rotate, new ProgressCallable<Void>() {
				@Override
				public Void call(final IProgressListener pProgressListener) throws Exception {
					final Scene scene = SimpleAsyncGameActivity.this.onCreateSceneAsync(pProgressListener);

					pProgressListener.onProgressChanged(100);

					pOnCreateSceneCallback.onCreateSceneFinished(scene);

					return null;
				}
			}, new Callback<Void>() {
				@Override
				public void onCallback(final Void pCallbackValue) {
					/* Nothing. */
				}
			});
		}
	});
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:26,代码来源:SimpleAsyncGameActivity.java


示例3: onPopulateScene

import org.andengine.util.ActivityUtils; //导入依赖的package包/类
@Override
public void onPopulateScene(final Scene pScene, final OnPopulateSceneCallback pOnPopulateSceneCallback) {
	this.runOnUiThread(new Runnable() {
		@Override
		public void run() {
			ActivityUtils.doProgressAsync(SimpleAsyncGameActivity.this, "Populating Scene...", android.R.drawable.ic_menu_rotate, new ProgressCallable<Void>() {
				@Override
				public Void call(final IProgressListener pProgressListener) throws Exception {
					SimpleAsyncGameActivity.this.onPopulateSceneAsync(pScene, pProgressListener);

					pProgressListener.onProgressChanged(100);

					pOnPopulateSceneCallback.onPopulateSceneFinished();

					return null;
				}
			}, new Callback<Void>() {
				@Override
				public void onCallback(final Void pCallbackValue) {
					/* Nothing. */
				}
			});
		}
	});
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:26,代码来源:SimpleAsyncGameActivity.java


示例4: onPopulateScene

import org.andengine.util.ActivityUtils; //导入依赖的package包/类
@Override
public void onPopulateScene(final Scene pScene, final OnPopulateSceneCallback pOnPopulateSceneCallback) {
	this.runOnUiThread(new Runnable() {
		@Override
		public void run() {
			ActivityUtils.doProgressAsync(SimpleAsyncGameActivity.this, "Populating Scene...", android.R.drawable.ic_menu_rotate, new ProgressCallable<Void>() {
				@Override
				public Void call(final IProgressListener pProgressListener) throws Exception {
					SimpleAsyncGameActivity.this.onPopulateSceneAsync(pScene, pProgressListener);
					
					pProgressListener.onProgressChanged(100);
					
					pOnPopulateSceneCallback.onPopulateSceneFinished();
					
					return null;
				}
			}, new Callback<Void>() {
				@Override
				public void onCallback(final Void pCallbackValue) {
					/* Nothing. */
				}
			});
		}
	});
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:26,代码来源:SimpleAsyncGameActivity.java


示例5: onCreate

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

    setContentView(R.layout.activity_frame_container);
    ButterKnife.bind(this);
    ActivityUtils.keepScreenOn(this);

    String fragment;
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        fragment = extras.getString(IntentKeys.FRAGMENT);
    } else {
        fragment = Fragments.GAME_FLOW_SELECT_LEVEL;
    }

    navigateTo(fragment);

    _justCreated = true;
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:21,代码来源:SinglePlayerGameFlowActivity.java


示例6: acquireWakeLock

import org.andengine.util.ActivityUtils; //导入依赖的package包/类
private void acquireWakeLock(final WakeLockOptions pWakeLockOptions) {
	if (pWakeLockOptions == WakeLockOptions.SCREEN_ON) {
		ActivityUtils.keepScreenOn(this);
	} else {
		final PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
		this.mWakeLock = pm.newWakeLock(pWakeLockOptions.getFlag() | PowerManager.ON_AFTER_RELEASE, Constants.DEBUGTAG);
		try {
			this.mWakeLock.acquire();
		} catch (final SecurityException pSecurityException) {
			Debug.e("You have to add\n\t<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>\nto your AndroidManifest.xml !", pSecurityException);
		}
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:14,代码来源:BaseGameActivity.java


示例7: applyEngineOptions

import org.andengine.util.ActivityUtils; //导入依赖的package包/类
private void applyEngineOptions() {
	final EngineOptions engineOptions = this.mEngine.getEngineOptions();

	if (engineOptions.isFullscreen()) {
		ActivityUtils.requestFullscreen(this);
	}

	if (engineOptions.getAudioOptions().needsMusic() || engineOptions.getAudioOptions().needsSound()) {
		this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
	}

	switch (engineOptions.getScreenOrientation()) {
		case LANDSCAPE_FIXED:
			this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
			break;
		case LANDSCAPE_SENSOR:
			if (SystemUtils.SDK_VERSION_GINGERBREAD_OR_LATER) {
				this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
			} else {
				Debug.w(ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.LANDSCAPE_SENSOR + " is not supported on this device. Falling back to " + ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.LANDSCAPE_FIXED);
				this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
			}
			break;
		case PORTRAIT_FIXED:
			this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
			break;
		case PORTRAIT_SENSOR:
			if (SystemUtils.SDK_VERSION_GINGERBREAD_OR_LATER) {
				this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
			} else {
				Debug.w(ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.PORTRAIT_SENSOR + " is not supported on this device. Falling back to " + ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.PORTRAIT_FIXED);
				this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
			}
			break;
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:37,代码来源:BaseGameActivity.java


示例8: toastOnUiThread

import org.andengine.util.ActivityUtils; //导入依赖的package包/类
public void toastOnUiThread(final CharSequence pText, final int pDuration) {
	if (ActivityUtils.isOnUiThread()) {
		Toast.makeText(BaseActivity.this, pText, pDuration).show();
	} else {
		this.runOnUiThread(new Runnable() {
			@Override
			public void run() {
				Toast.makeText(BaseActivity.this, pText, pDuration).show();
			}
		});
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:13,代码来源:BaseActivity.java


示例9: loadMusic

import org.andengine.util.ActivityUtils; //导入依赖的package包/类
public void loadMusic() throws IOException {
    final String baseMusicPath = "mfx/";
    final String musicFile = "lepeltheme.mod";

    SoundFactory.setAssetBasePath(baseMusicPath);
    mMenuClickSound = SoundFactory.createSoundFromAsset(mContext.getSoundManager(), mContext, "fwapfwap.ogg");
    mExplosionSound = SoundFactory.createSoundFromAsset(mContext.getSoundManager(), mContext, "explosion.ogg");
    mExplosionSound.setVolume(0.2f);

    final ModPlayer mModPlayer = ModPlayer.getInstance();

    File musicDir = new File(mContext.getFilesDir(), baseMusicPath);

    if (!musicDir.isDirectory())
        musicDir.mkdirs();

    final File musicSrc = new File(musicDir, musicFile);

    if (musicSrc.isFile()) {
        ((GameActivity)mContext).onModMusicLoaded(mModPlayer, musicSrc);
    } else {
        mContext.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ActivityUtils.doAsync(mContext, "Loading music", "Please wait...", new Callable<Void>() {
                    @Override
                    public Void call() throws Exception {
                        FileUtils.copyToInternalStorage(mContext, baseMusicPath + musicFile, baseMusicPath + musicFile);
                        return null;
                    }
                }, new Callback<Void>() {
                    @Override
                    public void onCallback(Void pCallbackValue) {
                        ((GameActivity)mContext).onModMusicLoaded(mModPlayer, new File(baseMusicPath, musicFile));
                    }
                });
            }
        });
    }
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:41,代码来源:ResourceManager.java


示例10: acquireWakeLock

import org.andengine.util.ActivityUtils; //导入依赖的package包/类
private void acquireWakeLock(final WakeLockOptions pWakeLockOptions) {
	if(pWakeLockOptions == WakeLockOptions.SCREEN_ON) {
		ActivityUtils.keepScreenOn(this);
	} else {
		final PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
		this.mWakeLock = pm.newWakeLock(pWakeLockOptions.getFlag() | PowerManager.ON_AFTER_RELEASE, Constants.DEBUGTAG);
		try {
			this.mWakeLock.acquire();
		} catch (final SecurityException pSecurityException) {
			Debug.e("You have to add\n\t<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>\nto your AndroidManifest.xml !", pSecurityException);
		}
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:14,代码来源:BaseGameActivity.java


示例11: applyEngineOptions

import org.andengine.util.ActivityUtils; //导入依赖的package包/类
private void applyEngineOptions() {
	final EngineOptions engineOptions = this.mEngine.getEngineOptions();

	if(engineOptions.isFullscreen()) {
		ActivityUtils.requestFullscreen(this);
	}

	if(engineOptions.getAudioOptions().needsMusic() || engineOptions.getAudioOptions().needsSound()) {
		this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
	}

	switch(engineOptions.getScreenOrientation()) {
		case LANDSCAPE_FIXED:
			this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
			break;
		case LANDSCAPE_SENSOR:
			if(SystemUtils.SDK_VERSION_GINGERBREAD_OR_LATER) {
				this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
			} else {
				Debug.w(ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.LANDSCAPE_SENSOR + " is not supported on this device. Falling back to " + ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.LANDSCAPE_FIXED);
				this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
			}
			break;
		case PORTRAIT_FIXED:
			this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
			break;
		case PORTRAIT_SENSOR:
			if(SystemUtils.SDK_VERSION_GINGERBREAD_OR_LATER) {
				this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
			} else {
				Debug.w(ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.PORTRAIT_SENSOR + " is not supported on this device. Falling back to " + ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.PORTRAIT_FIXED);
				this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
			}
			break;
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:37,代码来源:BaseGameActivity.java


示例12: onCreate

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

    setContentView(R.layout.activity_frame_container);
    ButterKnife.bind(this);
    ActivityUtils.keepScreenOn(this);

    _gameClient = GoogleFlipGameApplication.getGameClient();

    _multiplayerMode = MultiplayerMode.values()[Prefs.getInt(PrefKeys.MULTIPLAYER_MODE, 0)];
    if (_multiplayerMode.equals(MultiplayerMode.CLIENT)) {
        _clientService = GoogleFlipGameApplication.getBluetoothClientService();

        _clientDeviceChangedListener = new DeviceChangeListenerAdapter() {
            @Override
            public void onDeviceRemoved(String deviceName, String address) {
                handleConnectionLost();
            }
        };
    }

    _gameClientListener = new GameClientListenerAdapter() {
        @Override
        public void onClientsChanged(List<ClientVO> clients) {
            checkConnectionLost();
        }
    };

    String fragment;
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        fragment = extras.getString(IntentKeys.FRAGMENT);
    } else {
        fragment = Fragments.GAME_FLOW_SCOREBOARD;
    }

    navigateTo(fragment);
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:40,代码来源:MultiPlayerGameFlowActivity.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RecursionGuard类代码示例发布时间:2022-05-22
下一篇:
Java OWLObjectRenderer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap