public abstract class UniversiFragment
extends ActionBarFragment
ActionBarFragment implementation that provides Universi context features via
UniversiFragmentDelegate including other features described below.
requestBindData()
need to be called. This method can be invoked from any thread. If data binding request has
been registered, UniversiFragment will invoke onBindData() method whenever its view
hierarchy is already created or waits until it is created.
Marshmallow Android version. Permissions related methods like
checkSelfPermission(String) or supportRequestPermissions(String[], int) can be
invoked regardless of current Android version.| Constructor and Description |
|---|
UniversiFragment() |
| Modifier and Type | Method and Description |
|---|---|
protected int |
checkSelfPermission(String permission)
Delegated call to
ActivityCompat#checkSelfPermission(Context, String). |
protected boolean |
dismissDialogWithId(int dialogId)
Dismisses a dialog that is provided by the current dialog factory under the specified dialogId.
|
protected boolean |
dismissXmlDialog(int resId)
Dismisses an Xml dialog that has been shown via
showXmlDialog(int, DialogOptions). |
protected DialogController |
getDialogController()
Returns the controller that can be used to show and dismiss dialogs within context of this
fragment.
|
protected DialogFactory |
getDialogFactory()
Returns the current dialog factory specified for this fragment.
|
protected boolean |
isActiveNetworkConnected()
Checks whether the current active network is at this time connected or not.
|
protected boolean |
isNetworkConnected(int networkType)
Checks whether a network with the specified networkType is at this time connected
or no.
|
protected void |
onBindData()
Invoked due to call to
requestBindData() to perform data binding specific for this
fragment instance. |
protected void |
onBindViews(android.view.View rootView,
android.os.Bundle savedInstanceState)
Invoked from
onViewCreated(View, Bundle) to bind all views presented within context
of this fragment. |
void |
onDestroyView() |
void |
onPause() |
void |
onRequestPermissionsResult(int requestCode,
String[] permissions,
int[] grantResults) |
void |
onResume() |
void |
onViewCreated(android.view.View view,
android.os.Bundle savedInstanceState) |
protected void |
requestBindData()
Requests performing of data binding specific for this fragment via
onBindData(). |
protected void |
setDialogController(DialogController controller)
Sets a controller that should be used to show and dismiss dialogs within context of this fragment.
|
protected void |
setDialogFactory(DialogFactory factory)
Specifies a factory that should provide dialog instances for
DialogController of
this fragment to show. |
protected void |
setDialogXmlFactory(int xmlDialogsSet)
Specifies a factory that should provide dialog instances that can be parsed from an Xml file
with the specified xmlDialogsSet for
DialogController of this fragment. |
boolean |
shouldShowRequestPermissionRationale(String permission) |
protected boolean |
showDialogWithId(int dialogId)
Same as
showDialogWithId(int, DialogOptions) with null options. |
protected boolean |
showDialogWithId(int dialogId,
DialogOptions options)
Shows a dialog that is provided by the current dialog factory under the specified dialogId.
|
protected boolean |
showXmlDialog(int resId)
Same as
showXmlDialog(int, DialogOptions) with null options. |
protected boolean |
showXmlDialog(int resId,
DialogOptions options)
Like
showDialogWithId(int, DialogOptions), but in this case will be used internal
instance of DialogXmlFactory to create (inflate) the desired dialog instance to be
shown. |
protected void |
supportRequestPermissions(String[] permissions,
int requestCode)
Invokes
#requestPermissions(String[], int) on Android versions above Marshmallow
(including). |
protected void setDialogController(DialogController controller)
controller - The desired controller. May be null to use the default one.getDialogController()protected DialogController getDialogController()
If not specified, instance of DialogController is instantiated by default.
setDialogController(DialogController)protected void setDialogXmlFactory(int xmlDialogsSet)
DialogController of this fragment.xmlDialogsSet - Resource id of the desired Xml file containing Xml dialogs that the
factory should provide for this fragment. May be 0 to remove the
current one.protected void setDialogFactory(DialogFactory factory)
DialogController of
this fragment to show.factory - The desired factory. May be null to remove the current one.getDialogFactory(),
showDialogWithId(int),
showDialogWithId(int, DialogOptions)protected DialogFactory getDialogFactory()
null if no factory has been specified yet.setDialogFactory(DialogFactory)public void onViewCreated(android.view.View view,
android.os.Bundle savedInstanceState)
protected void onBindViews(android.view.View rootView,
android.os.Bundle savedInstanceState)
onViewCreated(View, Bundle) to bind all views presented within context
of this fragment.rootView - The root view of this fragment.public void onResume()
protected void requestBindData()
onBindData().
If this fragment has its view hierarchy already created onBindData() will be invoked
immediately, otherwise will wait until onViewCreated(View, Bundle) is invoked.
This method may be invoked also from a background-thread.
protected void onBindData()
requestBindData() to perform data binding specific for this
fragment instance.
This is always invoked on the UI thread.
protected boolean isActiveNetworkConnected()
True if active network is connected, false otherwise.ConnectivityManager.getActiveNetworkInfo(),
NetworkInfo.isConnected(),
isNetworkConnected(int)protected boolean isNetworkConnected(int networkType)
networkType - The desired network type to check for connection.True if the requested network is connected, false otherwise.ConnectivityManager.getNetworkInfo(int),
NetworkInfo.isConnected()protected int checkSelfPermission(String permission)
ActivityCompat#checkSelfPermission(Context, String).permission - The desired permission for which to perform check.PackageManager.PERMISSION_GRANTED if you have the
permission, or PackageManager.PERMISSION_DENIED if not.public boolean shouldShowRequestPermissionRationale(String permission)
protected void supportRequestPermissions(String[] permissions, int requestCode)
#requestPermissions(String[], int) on Android versions above Marshmallow
(including).
Calling this method on Android versions before MARSHMALLOW will be ignored.
permissions - The desired set of permissions to request.requestCode - Code to identify this request in onRequestPermissionsResult(int, String[], int[]).public void onRequestPermissionsResult(int requestCode,
String[] permissions,
int[] grantResults)
protected boolean showDialogWithId(int dialogId)
showDialogWithId(int, DialogOptions) with null options.protected boolean showDialogWithId(int dialogId,
DialogOptions options)
dialogId - Id of the desired dialog to show.options - Options for the dialog.True if dialog has been shown, false if this fragment is currently
paused or does not have its dialog factory specified.DialogController#newRequest(int),
setDialogFactory(DialogFactory),
dismissDialogWithId(int)protected boolean dismissDialogWithId(int dialogId)
dialogId - Id of the desired dialog to dismiss.True if dialog has been dismissed, false if this fragment is currently
paused or does not have its dialog factory specified.DialogController#newRequest(int),
showDialogWithId(int, DialogOptions)protected boolean showXmlDialog(int resId)
showXmlDialog(int, DialogOptions) with null options.protected boolean showXmlDialog(int resId,
DialogOptions options)
showDialogWithId(int, DialogOptions), but in this case will be used internal
instance of DialogXmlFactory to create (inflate) the desired dialog instance to be
shown.resId - Resource id of Xml file containing the desired dialog (its specification) to show.options - Options for the dialog.True if dialog has been successfully inflated and shown, false if
this fragment is currently paused or dialog failed to be inflated.DialogXmlFactory#createDialog(int, DialogOptions),
dismissXmlDialog(int)protected boolean dismissXmlDialog(int resId)
showXmlDialog(int, DialogOptions).resId - Resource id of Xml file containing the desired dialog (its specification) to dismiss.True if dialog has been dismissed, false if this fragment is currently
paused.showXmlDialog(int, DialogOptions)public void onPause()
public void onDestroyView()