Back to project page diceplus_test.
The source code is released under:
This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a co...
If you think the Android project diceplus_test listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.dice_test2; /*from w ww . j a v a 2s. co m*/ import us.dicepl.android.sdk.Die; import us.dicepl.android.sdk.protocol.constants.Constants.PowerMode; import us.dicepl.android.sdk.responsedata.PowerModeData; import android.util.Log; public class PowerModeHandler extends DiceEventHandler { public static void onPowerMode(Die die, PowerModeData readout, Exception exception, MainActivity _mainActivity) { final MainActivity mainActivity = _mainActivity; final long ts = readout.timestamp; final String _powerMode; if (readout.mode == PowerMode.POWER_MODE_NORMAL) { _powerMode = "Normal"; } else if (readout.mode == PowerMode.POWER_MODE_SHUTDOWN) { _powerMode = "Shutdown"; } else if (readout.mode == PowerMode.POWER_MODE_SLEEP) { _powerMode = "Sleep"; } else { _powerMode = "Unknown"; } Log.d(TAG, "power mode"); mainActivity.runOnUiThread(new Runnable() { @Override public void run() { mainActivity.powerMode.setText("Power mode: ts: " + ts + ", Power mode: " + _powerMode); } }); } }