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.BroadcastReceiverinNetworkAwareActionbarActivity.onResume()withandroid.net.ConnectivityManager#CONNECTIVITY_ACTIONset as anandroid.content.IntentFilter.
-
-
Field Summary
Fields Modifier and Type Field and Description protected booleanmNetworkAvailable
-
Constructor Summary
Constructors Constructor and Description NetworkAwareActionbarActivity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description protected voidonCreate(Bundle savedInstanceState)voidonNetworkAvailable()This is called when network connectivity is available and you should be able to carry out network requests.voidonNetworkUnavailable()This is called when network connectivity is unavailable and network requests are expected to fail.protected voidonPause()protected voidonResume()voidonRetryAvailable(java.lang.String message, View.OnClickListener retryAction)Called when retrying something may be possible.voidonRetryUnavailable()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:
onNetworkAvailablein interfaceNetworkAware
-
onNetworkUnavailable
public void onNetworkUnavailable()
This is called when network connectivity is unavailable and network requests are expected to fail.- Specified by:
onNetworkUnavailablein 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:RetryableCalled when retrying something may be possible.- Specified by:
onRetryAvailablein 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:RetryableCalled when retrying something will not be possible.- Specified by:
onRetryUnavailablein interfaceRetryable
-
-