public class

SCViewDescription

extends Object
implements Serializable
java.lang.Object
   ↳ com.c2call.sdk.pub.gui.core.controller.SCViewDescription
Known Direct Subclasses

Class Overview

A ViewDescription is used to map elements of layouts/views to known and well-defined keys within the C2Call SDK. E.g. the ViewDescription of the ForgotPassword view may look like:

 SCViewDescription VD = new SCViewDescription(new int[] { SCForgotPassViewHolder.VD_EDIT_EMAIL, 0, R.id.sc_forgot_pass_edit_email) },
                                              new int[] { SCForgotPassViewHolder.VD_BUTTON_SUBMIT, 0, R.idsc_forgot_pass_btn_submit) });

 

Summary

Public Constructors
SCViewDescription(int... data)
Instantiates a new SCViewDescription with given data
Public Methods
void add(SCViewDescription src)
Add the values of another ViewDescription to this one.
void add(int key, int rootid, int viewid)
Adds a new mapping to this ViewDescription
void add(int key, Pair<Integer, Integer> rootAndViewId)
Adds a new mapping to this ViewDescription
void add(int... data)
Adds new mappings tho this ViewDesription
void clear()
Clear all mappings from this ViewDescription
boolean contains(int key)
Checks if the current mapping contains the given key
int getResource(int key)
Gets the resource id for a given key
View getView(View view, int key)
Gets an item within the given view whose ID was mapped to the given key
Pair<Integer, Integer> remove(int key)
Removes the mapping with the given key
String toString()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public SCViewDescription (int... data)

Instantiates a new SCViewDescription with given data

Parameters
data the data used by this ViewDescription given as an array of int-arrays. By contract each int-array must contain three elements: [0] = key used by ViewHolder, [1] = the sub-parent of the item (typically 0), [2] = the resource id of the item. E.g.
 SCViewDescription VD = new SCViewDescription(new int[] { SCForgotPassViewHolder.VD_EDIT_EMAIL, 0, R.id.sc_forgot_pass_edit_email) },
                                              new int[] { SCForgotPassViewHolder.VD_BUTTON_SUBMIT, 0, R.idsc_forgot_pass_btn_submit) });

 

Public Methods

public void add (SCViewDescription src)

Add the values of another ViewDescription to this one.

public void add (int key, int rootid, int viewid)

Adds a new mapping to this ViewDescription

Parameters
key the key for the mapping, used by a SCViewHolder
rootid the parent id of the item that should be mapped, this can usually simply be 0

public void add (int key, Pair<Integer, Integer> rootAndViewId)

Adds a new mapping to this ViewDescription

Parameters
key the key of the mapping, used by a SCViewHolder
rootAndViewId Pair of resource IDs for the item and its parent (the parent ID can usually be 0)

public void add (int... data)

Adds new mappings tho this ViewDesription

Parameters
data the data used by this ViewDescription given as an array of int-arrays. By contract each int-array must contain three elements: [0] = key used by ViewHolder, [1] = the sub-parent of the item (typically 0), [2] = the resource id of the item. E.g.
 SCViewDescription VD = new SCViewDescription(new int[] { SCForgotPassViewHolder.VD_EDIT_EMAIL, 0, R.id.sc_forgot_pass_edit_email) },
                                              new int[] { SCForgotPassViewHolder.VD_BUTTON_SUBMIT, 0, R.idsc_forgot_pass_btn_submit) });

 

public void clear ()

Clear all mappings from this ViewDescription

public boolean contains (int key)

Checks if the current mapping contains the given key

Parameters
key the key to check
Returns
  • whether the key exists

public int getResource (int key)

Gets the resource id for a given key

Parameters
key the key to get the resource id for
Returns
  • the resource id

public View getView (View view, int key)

Gets an item within the given view whose ID was mapped to the given key

public Pair<Integer, Integer> remove (int key)

Removes the mapping with the given key

Parameters
key the key to remove
Returns
  • the mapped item and its parent if any, otherwise null.

public String toString ()