Android Open Source - androidtool Data Connection State






From Project

Back to project page androidtool.

License

The source code is released under:

MIT License

If you think the Android project androidtool listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.chris.android.tool.mobiledata;
//  w  w  w .j  a  va 2  s .c  o m
import android.telephony.TelephonyManager;
import android.util.SparseArray;

import org.chris.android.tool.R;

public enum DataConnectionState {

    DISCONNECTED(TelephonyManager.DATA_DISCONNECTED, R.string.mobile_data_state_disconnected, false), CONNECTED(
            TelephonyManager.DATA_CONNECTED, R.string.mobile_data_state_connected, true), CONNECTING(
            TelephonyManager.DATA_CONNECTING, R.string.mobile_data_state_connecting, true), SUSPENDED(
            TelephonyManager.DATA_SUSPENDED, R.string.mobile_data_state_suspended, true);
    private final int state;
    private final static SparseArray<DataConnectionState> states = new SparseArray<>();
    private final boolean connected;
    private final int labelTextId;

    static {
        for (DataConnectionState val : values()) {
            states.put(val.state, val);
        }
    }

    private DataConnectionState(int state, int labelTextId, boolean connected) {
        this.state = state;
        this.labelTextId = labelTextId;
        this.connected = connected;
    }

    public static DataConnectionState forId(int id) {
        return states.get(id);
    }

    public boolean isConnected() {
        return connected;
    }

    public int getLabelTextId() {
        return labelTextId;
    }
}




Java Source Code List

org.chris.android.tool.MainActivity.java
org.chris.android.tool.TorchHelper.java
org.chris.android.tool.gps.GpsActivity.java
org.chris.android.tool.gps.GpsStatusType.java
org.chris.android.tool.gps.SelectDestinationActivity.java
org.chris.android.tool.mobiledata.DataConnectionNetworkType.java
org.chris.android.tool.mobiledata.DataConnectionState.java
org.chris.android.tool.mobiledata.MobileDataHelper.java
org.chris.android.tool.nfc.NfcActivity.java
org.chris.android.tool.sensor.SensorDetailActivity.java
org.chris.android.tool.sensor.SensorListActivity.java
org.chris.android.tool.sensor.SensorService.java
org.chris.android.tool.sensor.SensorType.java
org.chris.android.tool.service.WifiService.java
org.chris.android.tool.service.WifiState.java