当前位置: 首页>>代码示例>>Java>>正文


Java ActivityUtils.keepScreenOn方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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.keepScreenOn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。