public interface

IController

com.c2call.sdk.pub.gui.core.controller.IController<T extends com.c2call.sdk.pub.gui.core.controller.IViewHolder>
Known Indirect Subclasses

Class Overview

This is one of the most important interfaces of the C2CallSDK. The purpose of an IController is to control the behavior of a View. In order to work correctly and to not leak any memory every controller should be bound to the Activities lifle-cycle in which it was created. This means that you have call onCreate(Activity, SCActivityResultDispatcher), onStart(), onResume(), onPause(), onStop() and onDestroy() at the corresponding stages of your activity. For similar reasons this is true for onConfigurationChanged(Configuration)

Summary

Public Methods
abstract void fireEvent(SCBaseControllerEvent event)
Fires an event to the IControllerRequestListener of this this controller, if any.
abstract Activity getContext(boolean throwIfNull)
Gets the context this controller was cretaed in and will throws an Exception if the context was not correctly initialized and throwIfNull is true
abstract Activity getContext()
abstract Fragment getFragment()
abstract Handler getHandler()
abstract IControllerRequestListener getRequestListener()
abstract SCActivityResultDispatcher getResultDispatcher()
Gets the SCActivityResultDispatcher of this controller.
abstract View getView()
abstract T getViewHolder()
abstract boolean onBackPressed()
Notify the controller that the back button was pressed
abstract boolean onConfigurationChanged(Configuration newConfig)
Notifies the controller about configuration changes.
abstract void onCreate(Activity context, SCActivityResultDispatcher resultDispatcher)
This should be called when your Activity is created.
abstract void onCreate(Fragment fragment, SCActivityResultDispatcher resultDispatcher)
This should be called when your Fragment is created, if any.
abstract void onDestroy()
Notifies the controller that tha surrounding activity will be destroyed.
abstract void onPause()
Notifies the controller that tha surrounding activity has paused
abstract void onResume()
Notifies the controller that tha surrounding activity is resumed.
abstract void onStart()
Notifies the controller that tha surrounding activity has started.
abstract void onStop()
Notifies the controller that tha surrounding activity has stopped.
abstract void reset()
Resets the controller
abstract void setRequestListener(IControllerRequestListener listener)
Sets the request listener for this controller
abstract void showProgressDialog(boolean show)
Show a simple progress dialog for background tasks.
abstract void startActivityForResult(Intent intent, int requestCode)
Starts an activity for result.

Public Methods

public abstract void fireEvent (SCBaseControllerEvent event)

Fires an event to the IControllerRequestListener of this this controller, if any.

Parameters
event the event to be fired

public abstract Activity getContext (boolean throwIfNull)

Gets the context this controller was cretaed in and will throws an Exception if the context was not correctly initialized and throwIfNull is true

Returns
  • the context this controller was created in.

public abstract Activity getContext ()

Returns
  • the context this controller was created in.

public abstract Fragment getFragment ()

Returns
  • the fragment this controller was created in. May be null if not cretaed in fragment

public abstract Handler getHandler ()

Returns
  • a Handler of the Thread in which this controller was created

public abstract IControllerRequestListener getRequestListener ()

Returns
  • the listener that is attached to this controller, if any.

public abstract SCActivityResultDispatcher getResultDispatcher ()

Gets the SCActivityResultDispatcher of this controller. This dispatcher is used to forward activity results to sub-controllers

Returns
  • the result dispatcher of this Controller

public abstract View getView ()

Returns
  • the view that is controlled by this controller

public abstract T getViewHolder ()

Returns
  • the SCViewHolder of this controller.

public abstract boolean onBackPressed ()

Notify the controller that the back button was pressed

Returns
  • true if this event was consumed.

public abstract boolean onConfigurationChanged (Configuration newConfig)

Notifies the controller about configuration changes. See onConfigurationChanged(...) for more details.

Returns
  • whether this event was consumed or not.

public abstract void onCreate (Activity context, SCActivityResultDispatcher resultDispatcher)

This should be called when your Activity is created. Typically in onCreate(...) of the surrounding Activiy.

Parameters
context the surrounding activity
resultDispatcher a result dispatcher that is used by the controller

public abstract void onCreate (Fragment fragment, SCActivityResultDispatcher resultDispatcher)

This should be called when your Fragment is created, if any. Typically in onActivityCreated(...) of the surrounding Fragmeent.

Parameters
fragment the surrounding fragment
resultDispatcher a result dispatcher that is used by the controller

public abstract void onDestroy ()

Notifies the controller that tha surrounding activity will be destroyed.

public abstract void onPause ()

Notifies the controller that tha surrounding activity has paused

public abstract void onResume ()

Notifies the controller that tha surrounding activity is resumed.

public abstract void onStart ()

Notifies the controller that tha surrounding activity has started.

public abstract void onStop ()

Notifies the controller that tha surrounding activity has stopped.

public abstract void reset ()

Resets the controller

public abstract void setRequestListener (IControllerRequestListener listener)

Sets the request listener for this controller

public abstract void showProgressDialog (boolean show)

Show a simple progress dialog for background tasks.

Parameters
show whether to show or hide

public abstract void startActivityForResult (Intent intent, int requestCode)

Starts an activity for result. By contract this should start the new activity from the fragment (if any) of this controller

Parameters
intent the intent to start.
requestCode the requst code that is passed to startActivityForResult(...)