Package com.zendesk.sdk.ui
Class NetworkAwareActionbarActivity
- java.lang.Object
-
- AppCompatActivity
-
- com.zendesk.sdk.ui.NetworkAwareActionbarActivity
-
- All Implemented Interfaces:
- NetworkAware, Retryable
- Direct Known Subclasses:
- ContactZendeskActivity, RequestActivity, ViewArticleActivity, ViewRequestActivity
public abstract class NetworkAwareActionbarActivity extends AppCompatActivity implements NetworkAware, Retryable
This activity can be used when you need to be notified of whether the network is available or not. This is only supplied as an example and a more flexible solution will be designed with lifecycle plugins.To do this it registers a
android.content.BroadcastReceiver
inNetworkAwareActionbarActivity.onResume()
withandroid.net.ConnectivityManager#CONNECTIVITY_ACTION
set as anandroid.content.IntentFilter
.
-
-
Field Summary
Fields Modifier and Type Field and Description protected boolean
mNetworkAvailable
-
Constructor Summary
Constructors Constructor and Description NetworkAwareActionbarActivity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description protected void
onCreate(Bundle savedInstanceState)
void
onNetworkAvailable()
This is called when network connectivity is available and you should be able to carry out network requests.void
onNetworkUnavailable()
This is called when network connectivity is unavailable and network requests are expected to fail.protected void
onPause()
protected void
onResume()
void
onRetryAvailable(java.lang.String message, View.OnClickListener retryAction)
Called when retrying something may be possible.void
onRetryUnavailable()
Called when retrying something will not be possible.
-
-
-
Method Detail
-
onNetworkAvailable
public void onNetworkAvailable()
This is called when network connectivity is available and you should be able to carry out network requests.If you override this method make sure to call super.onNetworkAvailable if you want the no network view to be dismissed
- Specified by:
onNetworkAvailable
in interfaceNetworkAware
-
onNetworkUnavailable
public void onNetworkUnavailable()
This is called when network connectivity is unavailable and network requests are expected to fail.- Specified by:
onNetworkUnavailable
in interfaceNetworkAware
-
onCreate
protected void onCreate(Bundle savedInstanceState)
-
onResume
protected void onResume()
-
onPause
protected void onPause()
-
onRetryAvailable
public void onRetryAvailable(java.lang.String message, View.OnClickListener retryAction)
Description copied from interface:Retryable
Called when retrying something may be possible.- Specified by:
onRetryAvailable
in interfaceRetryable
- Parameters:
message
- A message detailing something about the action that we are going to retryretryAction
- A listener to invoke which will retry the action
-
onRetryUnavailable
public void onRetryUnavailable()
Description copied from interface:Retryable
Called when retrying something will not be possible.- Specified by:
onRetryUnavailable
in interfaceRetryable
-
-