Methods Summary |
---|
public void | add(TabControl.Tab t)Called by BrowserActivity to add a new window to the tab picker.
This does not happen dynamically, this only happens during view
setup.
mAdapter.add(t);
|
public void | clear()Do some internal cleanup of the ImageGrid's adapter.
mAdapter.clear();
|
public boolean | dispatchKeyEvent(android.view.KeyEvent event)
// We always consume the BACK key even if mListener is null or the
// ImageGrid is not "live." This prevents crashes during tab animations
// if the user presses BACK.
if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
(event.getKeyCode() == KeyEvent.KEYCODE_BACK)) {
if (mListener != null && mIsLive) {
mListener.onClick(CANCEL);
invalidate();
}
return true;
}
return super.dispatchKeyEvent(event);
|
public int | getContextMenuPosition(android.view.MenuItem menu)
AdapterView.AdapterContextMenuInfo info =
(AdapterView.AdapterContextMenuInfo) menu.getMenuInfo();
int pos = info.position;
if (!mAdapter.maxedOut()) {
pos--;
}
return pos;
|
public com.android.browser.ImageGrid$Listener | getListener()
return mListener;
|
public boolean | isLive()Return true if the ImageGrid is live. This means that tabs can be chosen
and the menu can be invoked.
return mIsLive;
|
public void | onCreateContextMenu(android.view.ContextMenu menu, android.view.View v, android.view.ContextMenu.ContextMenuInfo menuInfo)
// Do not create the context menu if there is no listener or the Tab
// overview is not "live."
if (mListener == null || !mIsLive) {
return;
}
AdapterView.AdapterContextMenuInfo info =
(AdapterView.AdapterContextMenuInfo) menuInfo;
boolean maxed = mAdapter.maxedOut();
if (info.position > 0 || maxed) {
MenuInflater inflater = new MenuInflater(mContext);
inflater.inflate(R.menu.tabscontext, menu);
int position = info.position;
if (!maxed) {
position--;
}
menu.setHeaderTitle(mAdapter.mItems.get(position).getTitle());
}
|
public void | onItemClick(android.widget.AdapterView parent, android.view.View v, int position, long id)
if (!mAdapter.maxedOut()) {
position--;
}
// Position will be -1 for the "New Tab" cell.
if (mListener != null) {
mListener.onClick(position);
}
|
protected void | onSizeChanged(int w, int h, int oldw, int oldh)
// Called when our orientation changes. Tell the adapter about the new
// size. Compute the individual tab height by taking the grid height
// and subtracting the SPACING. Then subtract the list padding twice
// (once for each tab on screen) and divide the remaining height by 2.
int tabHeight = (h - SPACING
- 2 * (getListPaddingTop() + getListPaddingBottom())) / 2;
mAdapter.heightChanged(tabHeight);
super.onSizeChanged(w, h, oldw, oldh);
|
public void | remove(int index)Called by BrowserActivity when a window has been removed from the
tab list.
if (Config.DEBUG && (index < 0 || index >= TabControl.MAX_TABS)) {
throw new AssertionError();
}
mAdapter.remove(index);
|
public void | setCurrentIndex(int startingIndex)Request focus to initially set to a particular tab.
if (!mAdapter.maxedOut()) {
startingIndex++;
}
setSelection(startingIndex);
|
public void | setListener(com.android.browser.ImageGrid$Listener l)
mListener = l;
|