Back to project page android_device.
The source code is released under:
[Apache License](http://www.apache.org/licenses/): Version 2.0, January 2004 =============== ## TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION ## ### 1. Definitions. ### "License" sha...
If you think the Android project android_device listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * ================================================================================================= * Copyright (C) 2013 - 2014 Martin Albedinsky [Wolf-ITechnologies] * ================================================================================================= * Licensed under the Apache License, Version 2.0 or later (further "License" only). * ------------------------------------------------------------------------------------------------- * You may use this file only in compliance with the License. More details and copy of this License * you may obtain at/*from www . ja va2 s . com*/ * * http://www.apache.org/licenses/LICENSE-2.0 * * You can redistribute, modify or publish any part of the code written within this file but as it * is described in the License, the software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES or CONDITIONS OF ANY KIND. * * See the License for the specific language governing permissions and limitations under the License. * ================================================================================================= */ package com.wit.android.device.examples.model; import com.wit.android.device.Battery; import java.text.SimpleDateFormat; import java.util.Date; /** * <p> * Description. * </p> * * @author Martin Albedinsky */ public class BatteryInfo { /** * Log TAG. */ private static final String TAG = SimpleInfo.class.getSimpleName(); private static final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("[MM/dd/yyyy hh:mm:ss]"); private Battery.BatteryPluggedState mPluggedState; private Battery.BatteryHealth mHealth; private Battery.BatteryStatus mStatus; private int mStrength; private String mTime; private boolean bHasInfo; private String mChange; /** * */ public BatteryInfo() { this(null); } /** * * @param battery */ public BatteryInfo(Battery battery) { if (battery != null) { this.mStrength = battery.getStrength(); this.mPluggedState = battery.getPluggedState(); this.mHealth = battery.getHealth(); this.mStatus = battery.getStatus(); this.bHasInfo = true; } this.mTime = TIME_FORMAT.format(new Date(System.currentTimeMillis())); } /** * * @return */ public boolean hasInfo() { return bHasInfo; } /** * * @return */ public String getChange() { return mChange; } /** * * @param change */ public void setChange(String change) { mChange = change; } /** * * @return */ public Battery.BatteryPluggedState getPluggedState() { return mPluggedState; } /** * * @return */ public Battery.BatteryHealth getHealth() { return mHealth; } /** * * @return */ public Battery.BatteryStatus getStatus() { return mStatus; } /** * * @return */ public int getStrength() { return mStrength; } /** * * @return */ public String getTime() { return mTime; } }