Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* This view shows a table which can scroll in both directions. Also still
* leaves the headers fixed.
*
*
* @author Brais Gabín (InQBarna)
*/
public class TableFixHeaders extends ViewGroup {
Expand Down Expand Up @@ -69,7 +69,7 @@ public class TableFixHeaders extends ViewGroup {

/**
* Simple constructor to use when creating a view from code.
*
*
* @param context
* The Context the view is running in, through which it can
* access the current theme, resources, etc.
Expand All @@ -84,10 +84,10 @@ public TableFixHeaders(Context context) {
* that were specified in the XML file. This version uses a default style of
* 0, so the only attribute values applied are those in the Context's Theme
* and the given AttributeSet.
*
*
* The method onFinishInflate() will be called after all children have been
* added.
*
*
* @param context
* The Context the view is running in, through which it can
* access the current theme, resources, etc.
Expand Down Expand Up @@ -125,7 +125,7 @@ public TableFixHeaders(Context context, AttributeSet attrs) {

/**
* Returns the adapter currently associated with this widget.
*
*
* @return The adapter used to provide this view's content.
*/
public TableAdapter getAdapter() {
Expand All @@ -134,7 +134,7 @@ public TableAdapter getAdapter() {

/**
* Sets the data behind this TableFixHeaders.
*
*
* @param adapter
* The TableAdapter which is responsible for maintaining the data
* backing this list and for producing a view to represent an
Expand Down Expand Up @@ -822,4 +822,47 @@ void forceFinished() {
}
}
}

/**
* Get tag data from View
* @param view Child view
* @param tag Resource Tag ID
* @return Resource integer value
* @throws IllegalArgumentException
*/
private static int getTagIntValue(View view, int tag) throws IllegalArgumentException {
final Integer value = (Integer) view.getTag(tag);
if(value == null) {
throw new IllegalArgumentException("tag not found");
}

return value;
}

/**
* Extract type from View
* @param view Child View
* @return Type value
*/
public static int getType(View view) throws IllegalArgumentException {
return getTagIntValue(view, R.id.tag_type_view);
}

/**
* Extract row from View
* @param view Child View
* @return Row value
*/
public static int getRow(View view) throws IllegalArgumentException {
return getTagIntValue(view, R.id.tag_row);
}

/**
* Extract column from View
* @param view Child View
* @return Column value
*/
public static int getColumn(View view) throws IllegalArgumentException {
return getTagIntValue(view, R.id.tag_column);
}
}