public abstract class AbstractHierarchyListItem2 extends java.lang.Object implements HierarchyListItem2, HashtagSearch
HierarchyListItem.ComparatorSort, HierarchyListItem.Sort, HierarchyListItem.SortAlphabet, HierarchyListItem.SortAlphabetDesc, HierarchyListItem.SortDistanceFrom
Modifier and Type | Field and Description |
---|---|
protected boolean |
asyncRefresh |
protected java.util.List<HierarchyListItem> |
children |
protected boolean |
disposed |
protected HierarchyListFilter |
filter |
protected android.widget.BaseAdapter |
listener |
protected HierarchyListFilter |
postFilter |
protected boolean |
reusable |
protected android.os.Handler |
uiHandler |
Modifier | Constructor and Description |
---|---|
protected |
AbstractHierarchyListItem2() |
Modifier and Type | Method and Description |
---|---|
static void |
async(java.lang.Runnable r) |
protected static FeatureDataStore.FeatureQueryParameters |
buildQueryParams(HierarchyListFilter filter) |
boolean |
delete()
Execute all delete actions defined in this class
|
void |
dispose()
Unregister any listeners,
|
protected void |
disposeChildren()
Call dispose on all children and clear
|
protected static void |
disposeItems(java.util.List<HierarchyListItem> items)
Call dispose on list of items
|
java.util.Set<HierarchyListItem> |
find(java.lang.String terms) |
HierarchyListItem |
findChild(java.lang.String uid)
Find child based on matching UID
|
<T extends Action> |
getAction(java.lang.Class<T> clazz)
Returns an instance of the specified action that can be used to interact with the node's
underlying content.
|
java.lang.String |
getAssociationKey()
Get settings screen association key (see DropDownReceiver)
|
<T extends Action> |
getChildActions(java.lang.Class<T> clazz)
Get actions of a certain type from all children items
|
HierarchyListItem |
getChildAt(int index)
Returns the child node at the specified index.
|
int |
getChildCount()
Returns the number of children that this node has.
|
java.util.List<HierarchyListItem> |
getChildren()
Return a copy of the children list (post-filtered)
|
android.view.View |
getCustomLayout()
Get a custom view for the entire OM drop-down
This is smoother than switching between drop-downs using intents
|
static java.util.List<HierarchyListItem.Sort> |
getDefaultSortModes(HierarchyListItem list)
Get list of sort modes based on supported actions
|
java.util.List<Delete> |
getDeleteActions()
Get the list of delete actions in this class
Meant to serve as a default implementation of
GroupDelete.getDeleteActions() |
java.lang.String |
getDescription()
Get the item description (shown in gray under the title)
|
double[] |
getDropDownSize()
Get the preferred drop-down size for displaying this list
Width is used in landscape mode, height is used in portrait mode
|
android.view.View |
getExtraView()
Returns the extra view, if any, associated with the node.
|
android.view.View |
getExtraView(android.view.View convertView,
android.view.ViewGroup parent)
Same as
HierarchyListItem.getExtraView() except the existing view is provided
This is to allow more efficient view cycling when scrolling through OM |
protected static HierarchyListFilter |
getFilter(HierarchyListFilter filter,
java.lang.Class<?> clazz) |
android.view.View |
getFooterView()
Get the custom footer view for this list
|
android.view.View |
getHeaderView()
Get the custom header view for this list
|
int |
getIconColor()
Returns the color to be applied to the icon.
|
android.graphics.drawable.Drawable |
getIconDrawable()
Get the icon drawable
|
java.lang.String |
getIconUri()
Returns the URI for the icon for the node.
|
android.view.View |
getListItemView(android.view.View convertView,
android.view.ViewGroup parent)
Used when this item is being displayed within a list
For overriding the entire list view, see
HierarchyListItem2.getCustomLayout() |
java.lang.Object |
getLocalData(java.lang.String s)
Returns the local data associated with the node for the specified key.
|
<T> T |
getLocalData(java.lang.String s,
java.lang.Class<T> clazz)
Returns the local data associated with the node for the specified key.
|
int |
getPreferredListIndex()
Returns the preferred index in the list for the item to be displayed at.
|
java.util.List<HierarchyListItem.Sort> |
getSorts()
Return all applicable sort modes for this list
|
java.lang.String |
getUID()
Returns the unique ID of the list item
|
int |
getVisibility()
Typical calculation for determining ternary visibility
Note that this class does not implement Visibility or Visibility2
|
boolean |
isChildSupported()
Check if list item can contain children
|
boolean |
isDisposed()
Check whether this item has been disposed or not
|
boolean |
isGetChildrenSupported() |
boolean |
isMultiSelectSupported()
Does this list support multi-selection of its items?
|
boolean |
isVisible() |
protected void |
notifyListener() |
protected void |
notifyListener(boolean sizeChanged)
Notify the listener adapter
If the adapter is part of Overlay Manager, include reference to self
so we know which item has been updated
|
protected boolean |
postAccept(HierarchyListItem item)
Used for post-filtering items after refresh has been done
Useful in situations where the results of the refresh may
influence the results of a secondary filtering process
|
protected void |
postRefresh(java.lang.Runnable r)
Submit runnable to refresh thread pool
|
void |
refresh(android.widget.BaseAdapter listener,
HierarchyListFilter filter)
Update this item's listener and refresh
|
HierarchyListFilter |
refresh(HierarchyListFilter filter)
Send a refresh request to the thread pool
|
HierarchyListItem.Sort |
refresh(HierarchyListItem.Sort sort)
Deprecated.
This method will become final
|
protected static void |
refresh(HierarchyListItem item,
HierarchyListFilter filter) |
protected abstract void |
refreshImpl()
Refresh implementation to be run on a background thread
If your class doesn't need to refresh then override the filter
method above to avoid unnecessary threading
|
protected void |
requestRefresh()
Request a refresh of Overlay Manager's current list
|
protected void |
requestRefresh(java.lang.String path)
Request a refresh of Overlay Manager's current list provided
the current path is directly above or below 'path'
|
java.util.Collection<HashtagContent> |
search(java.util.Collection<java.lang.String> searchTags)
Search for content based on tags
|
java.lang.Object |
setLocalData(java.lang.String s,
java.lang.Object o)
Sets the specified local data on the object.
|
void |
setPostFilter(HierarchyListFilter filter)
Set the post-filter
|
boolean |
setVisible(boolean visible) |
void |
sortItems(java.util.List<HierarchyListItem> items)
Sort the list of items based on this.filter.sort
Unlike the function above, this requires no synchronization
(unless called on this.children, which isn't recommended)
|
void |
syncRefresh(android.widget.BaseAdapter listener,
HierarchyListFilter filter)
Call a refresh synchronously, regardless of the asyncRefresh value
|
protected void |
updateChildren(java.util.List<HierarchyListItem> items)
Copy a list of items to the children array on the UI thread
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hideIfEmpty
getDescendantCount, getTitle, getUserObject
protected final java.util.List<HierarchyListItem> children
protected HierarchyListFilter filter
protected HierarchyListFilter postFilter
protected android.widget.BaseAdapter listener
protected boolean asyncRefresh
protected boolean disposed
protected boolean reusable
protected final android.os.Handler uiHandler
public java.lang.String getUID()
HierarchyListItem
getUID
in interface HierarchyListItem
public int getPreferredListIndex()
HierarchyListItem
getPreferredListIndex
in interface HierarchyListItem
-1
to indicate no preference
(FIFO).public boolean isChildSupported()
HierarchyListItem
isChildSupported
in interface HierarchyListItem
public HierarchyListItem getChildAt(int index)
HierarchyListItem
getChildAt
in interface HierarchyListItem
index
- The indexpublic int getChildCount()
HierarchyListItem
getChildCount
in interface HierarchyListItem
protected boolean postAccept(HierarchyListItem item)
item
- Item to filterpublic void setPostFilter(HierarchyListFilter filter)
public java.lang.String getDescription()
HierarchyListItem2
getDescription
in interface HierarchyListItem2
public android.graphics.drawable.Drawable getIconDrawable()
HierarchyListItem2
getIconDrawable
in interface HierarchyListItem2
public int getIconColor()
HierarchyListItem
getIconColor
in interface HierarchyListItem
0xFFFFFFFF
(-1
)
to use the original color.public java.lang.String getIconUri()
HierarchyListItem
getIconUri
in interface HierarchyListItem
null
if the node
has no icon, or "gone" to remove the icon space entirely.public boolean isMultiSelectSupported()
HierarchyListItem2
isMultiSelectSupported
in interface HierarchyListItem2
public java.lang.String getAssociationKey()
HierarchyListItem2
getAssociationKey
in interface HierarchyListItem2
public android.view.View getExtraView()
HierarchyListItem
getExtraView
in interface HierarchyListItem
null
if there is no view.public android.view.View getExtraView(android.view.View convertView, android.view.ViewGroup parent)
HierarchyListItem2
HierarchyListItem.getExtraView()
except the existing view is provided
This is to allow more efficient view cycling when scrolling through OMgetExtraView
in interface HierarchyListItem2
convertView
- The existing extra view. Only inflate a new layout
if the id/context do not match your expected config.parent
- The extra view parent - Use this as "root" when inflatingpublic android.view.View getCustomLayout()
HierarchyListItem2
getCustomLayout
in interface HierarchyListItem2
public android.view.View getHeaderView()
HierarchyListItem2
getHeaderView
in interface HierarchyListItem2
public android.view.View getFooterView()
HierarchyListItem2
getFooterView
in interface HierarchyListItem2
public android.view.View getListItemView(android.view.View convertView, android.view.ViewGroup parent)
HierarchyListItem2
HierarchyListItem2.getCustomLayout()
getListItemView
in interface HierarchyListItem2
convertView
- The existing list item view. Only inflate a new layout
if the id/context do not match your expected config.parent
- The list view parent - Use this as "root" when inflatingpublic double[] getDropDownSize()
HierarchyListItem2
getDropDownSize
in interface HierarchyListItem2
public final java.lang.Object setLocalData(java.lang.String s, java.lang.Object o)
HierarchyListItem
setLocalData
in interface HierarchyListItem
s
- The key for the datao
- The value for the datapublic final java.lang.Object getLocalData(java.lang.String s)
HierarchyListItem
getLocalData
in interface HierarchyListItem
s
- The key for the local datapublic final <T> T getLocalData(java.lang.String s, java.lang.Class<T> clazz)
HierarchyListItem
getLocalData
in interface HierarchyListItem
s
- The key for the local dataclazz
- The return type for the dataT
.public <T extends Action> T getAction(java.lang.Class<T> clazz)
HierarchyListItem
getAction
in interface HierarchyListItem
clazz
- The action classnull
if the specified
action is not supported for the node.public java.util.List<HierarchyListItem.Sort> getSorts()
HierarchyListItem2
getSorts
in interface HierarchyListItem2
public static java.util.List<HierarchyListItem.Sort> getDefaultSortModes(HierarchyListItem list)
list
- List itempublic <T extends Action> java.util.List<T> getChildActions(java.lang.Class<T> clazz)
T
- Action typeclazz
- Action classpublic int getVisibility()
public boolean isVisible()
public boolean setVisible(boolean visible)
public boolean delete()
public java.util.List<Delete> getDeleteActions()
GroupDelete.getDeleteActions()
public java.util.Set<HierarchyListItem> find(java.lang.String terms)
public HierarchyListFilter refresh(HierarchyListFilter filter)
refresh
in interface HierarchyListItem2
filter
- The new filterpublic void refresh(android.widget.BaseAdapter listener, HierarchyListFilter filter)
listener
- New listenerfilter
- New filterpublic void syncRefresh(android.widget.BaseAdapter listener, HierarchyListFilter filter)
listener
- Listenerfilter
- Refresh filterprotected void requestRefresh()
protected void requestRefresh(java.lang.String path)
path
- Backslash-delimited path of list UIDs@Deprecated public HierarchyListItem.Sort refresh(HierarchyListItem.Sort sort)
refresh
in interface HierarchyListItem
refresh
in interface HierarchyListItem2
sort
- Sort object (usually this.filter.sort)public void sortItems(java.util.List<HierarchyListItem> items)
items
- List of itemsprotected void updateChildren(java.util.List<HierarchyListItem> items)
items
- List of filtered/sorted itemspublic java.util.List<HierarchyListItem> getChildren()
public boolean isGetChildrenSupported()
public HierarchyListItem findChild(java.lang.String uid)
uid
- UID to search forprotected void notifyListener(boolean sizeChanged)
protected void notifyListener()
protected void postRefresh(java.lang.Runnable r)
r
- Runnable to submit to background threadpublic static void async(java.lang.Runnable r)
public void dispose()
HierarchyListItem2
dispose
in interface HierarchyListItem2
public boolean isDisposed()
protected void disposeChildren()
protected abstract void refreshImpl()
public java.util.Collection<HashtagContent> search(java.util.Collection<java.lang.String> searchTags)
HashtagSearch
search
in interface HashtagSearch
searchTags
- List of hashtags to search forprotected static void disposeItems(java.util.List<HierarchyListItem> items)
items
- List of itemsprotected static void refresh(HierarchyListItem item, HierarchyListFilter filter)
protected static HierarchyListFilter getFilter(HierarchyListFilter filter, java.lang.Class<?> clazz)
protected static FeatureDataStore.FeatureQueryParameters buildQueryParams(HierarchyListFilter filter)