@Implements(android.net.NetworkInfo.class) public class ShadowNetworkInfo extends Object
Constructor | Description |
---|---|
ShadowNetworkInfo() |
Modifier and Type | Method | Description |
---|---|---|
protected static void |
__staticInitializer__() |
|
protected NetworkInfo.DetailedState |
getDetailedState() |
|
protected NetworkInfo.State |
getState() |
|
protected int |
getSubtype() |
|
protected int |
getType() |
|
protected boolean |
isAvailable() |
|
protected boolean |
isConnected() |
|
protected boolean |
isConnectedOrConnecting() |
|
static NetworkInfo |
newInstance(NetworkInfo.DetailedState detailedState,
int type,
int subType,
boolean isAvailable,
boolean isConnected) |
Deprecated.
|
static NetworkInfo |
newInstance(NetworkInfo.DetailedState detailedState,
int type,
int subType,
boolean isAvailable,
NetworkInfo.State state) |
Allows developers to create a
NetworkInfo instance for testing. |
void |
setAvailableStatus(boolean isAvailable) |
Sets up the return value of
isAvailable() . |
void |
setConnectionStatus(boolean isConnected) |
Deprecated.
use
setConnectionStatus(NetworkInfo.State) instead |
void |
setConnectionStatus(NetworkInfo.State state) |
Sets up the return value of
getState() . |
void |
setConnectionType(int connectionType) |
Sets up the return value of
getType() . |
void |
setDetailedState(NetworkInfo.DetailedState detailedState) |
|
void |
setSubType(int subType) |
@Implementation protected static void __staticInitializer__()
@Deprecated public static NetworkInfo newInstance(NetworkInfo.DetailedState detailedState, int type, int subType, boolean isAvailable, boolean isConnected)
newInstance(NetworkInfo.DetailedState, int, int, boolean,
NetworkInfo.State)
insteadpublic static NetworkInfo newInstance(NetworkInfo.DetailedState detailedState, int type, int subType, boolean isAvailable, NetworkInfo.State state)
NetworkInfo
instance for testing.@Implementation protected boolean isConnected()
@Implementation protected boolean isConnectedOrConnecting()
@Implementation protected NetworkInfo.State getState()
@Implementation protected NetworkInfo.DetailedState getDetailedState()
@Implementation protected int getType()
@Implementation protected int getSubtype()
@Implementation protected boolean isAvailable()
public void setAvailableStatus(boolean isAvailable)
isAvailable()
.isAvailable
- the value that isAvailable()
will return.@Deprecated public void setConnectionStatus(boolean isConnected)
setConnectionStatus(NetworkInfo.State)
insteadisConnectedOrConnecting()
, isConnected()
, and
getState()
. If the input is true, state will be NetworkInfo.State.CONNECTED
,
else it will be NetworkInfo.State.DISCONNECTED
.isConnected
- the value that isConnectedOrConnecting()
and isConnected()
will return.public void setConnectionStatus(NetworkInfo.State state)
getState()
.state
- the value that getState()
will return.public void setConnectionType(int connectionType)
getType()
.connectionType
- the value that getType()
will return.public void setSubType(int subType)
public void setDetailedState(NetworkInfo.DetailedState detailedState)