171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck/* 271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck * Copyright (C) 2011 The Android Open Source Project 371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck * 471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck * Licensed under the Apache License, Version 2.0 (the "License"); 571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck * you may not use this file except in compliance with the License. 671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck * You may obtain a copy of the License at 771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck * 871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck * http://www.apache.org/licenses/LICENSE-2.0 971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck * 1071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck * Unless required by applicable law or agreed to in writing, software 1171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck * distributed under the License is distributed on an "AS IS" BASIS, 1271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck * See the License for the specific language governing permissions and 1471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck * limitations under the License. 1571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck */ 1671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 1771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckpackage com.android.browser.view; 1871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 1971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.content.Context; 2071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.database.DataSetObserver; 2171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.provider.BrowserContract; 2271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.util.AttributeSet; 2371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.view.ContextMenu; 2471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.view.ContextMenu.ContextMenuInfo; 2571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.view.LayoutInflater; 2671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.view.View; 2771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.view.ViewGroup; 2871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.widget.BaseExpandableListAdapter; 2971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.widget.ExpandableListAdapter; 3071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.widget.ExpandableListView; 3171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.widget.FrameLayout; 3271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.widget.LinearLayout; 3371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport android.widget.TextView; 3471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 35e7c97de989b75a591d598da63e0bef51831462d4John Reckimport com.android.browser.BreadCrumbView; 36e7c97de989b75a591d598da63e0bef51831462d4John Reckimport com.android.browser.BrowserBookmarksAdapter; 37e7c97de989b75a591d598da63e0bef51831462d4John Reckimport com.android.browser.R; 38e7c97de989b75a591d598da63e0bef51831462d4John Reckimport com.android.internal.view.menu.MenuBuilder; 39e7c97de989b75a591d598da63e0bef51831462d4John Reck 404f61ee45c1a2794d4254998c735a320fa6718eddJohn Reckimport org.json.JSONException; 414f61ee45c1a2794d4254998c735a320fa6718eddJohn Reckimport org.json.JSONObject; 424f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck 4371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport java.util.ArrayList; 4471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reckimport java.util.HashMap; 4571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 469db9529bdb7490ccd72fbe66f7e9c9d7cdd73899John Reckpublic class BookmarkExpandableView extends ExpandableListView 4771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck implements BreadCrumbView.Controller { 4871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 494f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck public static final String LOCAL_ACCOUNT_NAME = "local"; 504f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck 5171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck private BookmarkAccountAdapter mAdapter; 5271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck private int mColumnWidth; 5371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck private Context mContext; 5471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck private OnChildClickListener mOnChildClickListener; 5571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck private ContextMenuInfo mContextMenuInfo = null; 5671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck private OnCreateContextMenuListener mOnCreateContextMenuListener; 5771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck private boolean mLongClickable; 5871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck private BreadCrumbView.Controller mBreadcrumbController; 59f3828cd09f12cbf2980af72187628a608db8e938John Reck private int mMaxColumnCount; 6071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 619db9529bdb7490ccd72fbe66f7e9c9d7cdd73899John Reck public BookmarkExpandableView(Context context) { 6271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck super(context); 6371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck init(context); 6471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 6571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 669db9529bdb7490ccd72fbe66f7e9c9d7cdd73899John Reck public BookmarkExpandableView(Context context, AttributeSet attrs) { 6771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck super(context, attrs); 6871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck init(context); 6971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 7071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 719db9529bdb7490ccd72fbe66f7e9c9d7cdd73899John Reck public BookmarkExpandableView( 7271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck Context context, AttributeSet attrs, int defStyle) { 7371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck super(context, attrs, defStyle); 7471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck init(context); 7571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 7671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 7771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck void init(Context context) { 7871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mContext = context; 7971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck setItemsCanFocus(true); 8071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck setLongClickable(false); 81f3828cd09f12cbf2980af72187628a608db8e938John Reck mMaxColumnCount = mContext.getResources() 82f3828cd09f12cbf2980af72187628a608db8e938John Reck .getInteger(R.integer.max_bookmark_columns); 83ef4a243155bec06dfa88039e3b76f5709f014993John Reck setScrollBarStyle(SCROLLBARS_OUTSIDE_OVERLAY); 8471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mAdapter = new BookmarkAccountAdapter(mContext); 8571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck super.setAdapter(mAdapter); 8671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 8771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 8871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 8971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 90f3828cd09f12cbf2980af72187628a608db8e938John Reck int width = MeasureSpec.getSize(widthMeasureSpec); 91f3828cd09f12cbf2980af72187628a608db8e938John Reck int widthMode = MeasureSpec.getMode(widthMeasureSpec); 92f3828cd09f12cbf2980af72187628a608db8e938John Reck if (width > 0) { 93f3828cd09f12cbf2980af72187628a608db8e938John Reck mAdapter.measureChildren(width); 94ef4a243155bec06dfa88039e3b76f5709f014993John Reck setPadding(mAdapter.mRowPadding, 0, mAdapter.mRowPadding, 0); 95f3828cd09f12cbf2980af72187628a608db8e938John Reck widthMeasureSpec = MeasureSpec.makeMeasureSpec(width, widthMode); 96f3828cd09f12cbf2980af72187628a608db8e938John Reck } 9771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck super.onMeasure(widthMeasureSpec, heightMeasureSpec); 98f3828cd09f12cbf2980af72187628a608db8e938John Reck if (width != getMeasuredWidth()) { 99f3828cd09f12cbf2980af72187628a608db8e938John Reck mAdapter.measureChildren(getMeasuredWidth()); 100f3828cd09f12cbf2980af72187628a608db8e938John Reck } 10171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 10271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 10371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 10471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public void setAdapter(ExpandableListAdapter adapter) { 10571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck throw new RuntimeException("Not supported"); 10671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 10771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 10871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public void setColumnWidthFromLayout(int layout) { 10971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck LayoutInflater infalter = LayoutInflater.from(mContext); 11071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck View v = infalter.inflate(layout, this, false); 11171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck v.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); 11271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mColumnWidth = v.getMeasuredWidth(); 11371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 11471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 11571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public void clearAccounts() { 11671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mAdapter.clear(); 11771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 11871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 1194f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck public void addAccount(String accountName, BrowserBookmarksAdapter adapter, 1204f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck boolean expandGroup) { 12171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck // First, check if it already exists 12271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck int indexOf = mAdapter.mGroups.indexOf(accountName); 12371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (indexOf >= 0) { 12471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck BrowserBookmarksAdapter existing = mAdapter.mChildren.get(indexOf); 12571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (existing != adapter) { 12671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck existing.unregisterDataSetObserver(mAdapter.mObserver); 12771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck // Replace the existing one 12871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mAdapter.mChildren.remove(indexOf); 12971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mAdapter.mChildren.add(indexOf, adapter); 13071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck adapter.registerDataSetObserver(mAdapter.mObserver); 13171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 13271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } else { 13371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mAdapter.mGroups.add(accountName); 13471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mAdapter.mChildren.add(adapter); 13571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck adapter.registerDataSetObserver(mAdapter.mObserver); 13671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 13771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mAdapter.notifyDataSetChanged(); 1384f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck if (expandGroup) { 1394f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck expandGroup(mAdapter.getGroupCount() - 1); 1404f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck } 14171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 14271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 14371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 14471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public void setOnChildClickListener(OnChildClickListener onChildClickListener) { 14571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mOnChildClickListener = onChildClickListener; 14671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 14771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 14871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 14971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public void setOnCreateContextMenuListener(OnCreateContextMenuListener l) { 15071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mOnCreateContextMenuListener = l; 15171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (!mLongClickable) { 15271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mLongClickable = true; 15371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (mAdapter != null) { 15471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mAdapter.notifyDataSetChanged(); 15571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 15671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 15771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 15871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 15971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 16071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public void createContextMenu(ContextMenu menu) { 16171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck // The below is copied from View - we want to bypass the override 16271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck // in AbsListView 16371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 16471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck ContextMenuInfo menuInfo = getContextMenuInfo(); 16571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 16671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck // Sets the current menu info so all items added to menu will have 16771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck // my extra info set. 16871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck ((MenuBuilder)menu).setCurrentMenuInfo(menuInfo); 16971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 17071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck onCreateContextMenu(menu); 17171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (mOnCreateContextMenuListener != null) { 17271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mOnCreateContextMenuListener.onCreateContextMenu(menu, this, menuInfo); 17371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 17471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 17571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck // Clear the extra information so subsequent items that aren't mine don't 17671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck // have my extra info. 17771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck ((MenuBuilder)menu).setCurrentMenuInfo(null); 17871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 17971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (mParent != null) { 18071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mParent.createContextMenu(menu); 18171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 18271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 18371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 18471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 18571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public boolean showContextMenuForChild(View originalView) { 1867bf15e8a3e6badb4cf81db7e89299b8840df5843Pawel Bochenski Integer groupPosition = (Integer) originalView.getTag(R.id.group_position); 1877bf15e8a3e6badb4cf81db7e89299b8840df5843Pawel Bochenski Integer childPosition = (Integer) originalView.getTag(R.id.child_position); 18871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 1897bf15e8a3e6badb4cf81db7e89299b8840df5843Pawel Bochenski if (groupPosition == null || childPosition == null) { 1907bf15e8a3e6badb4cf81db7e89299b8840df5843Pawel Bochenski return false; 1917bf15e8a3e6badb4cf81db7e89299b8840df5843Pawel Bochenski } 1927bf15e8a3e6badb4cf81db7e89299b8840df5843Pawel Bochenski 1937bf15e8a3e6badb4cf81db7e89299b8840df5843Pawel Bochenski mContextMenuInfo = new BookmarkContextMenuInfo(childPosition, groupPosition); 19471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (getParent() != null) { 19571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck getParent().showContextMenuForChild(this); 19671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 19771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 19871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck return true; 19971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 20071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 20171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 20271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public void onTop(BreadCrumbView view, int level, Object data) { 20371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (mBreadcrumbController != null) { 20471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mBreadcrumbController.onTop(view, level, data); 20571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 20671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 20771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 20871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public void setBreadcrumbController(BreadCrumbView.Controller controller) { 20971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mBreadcrumbController = controller; 21071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 21171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 21271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 21371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck protected ContextMenuInfo getContextMenuInfo() { 21471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck return mContextMenuInfo; 21571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 21671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 21771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public BrowserBookmarksAdapter getChildAdapter(int groupPosition) { 21871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck return mAdapter.mChildren.get(groupPosition); 21971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 22071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 22171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck private OnClickListener mChildClickListener = new OnClickListener() { 22271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 22371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 22471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public void onClick(View v) { 2254eb475de8265a4d177580a137a6a7148aaec1380John Reck if (v.getVisibility() != View.VISIBLE) { 2264eb475de8265a4d177580a137a6a7148aaec1380John Reck return; 2274eb475de8265a4d177580a137a6a7148aaec1380John Reck } 22871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck int groupPosition = (Integer) v.getTag(R.id.group_position); 22971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck int childPosition = (Integer) v.getTag(R.id.child_position); 2304eb475de8265a4d177580a137a6a7148aaec1380John Reck if (mAdapter.getGroupCount() <= groupPosition 2314eb475de8265a4d177580a137a6a7148aaec1380John Reck || mAdapter.mChildren.get(groupPosition).getCount() <= childPosition) { 2324eb475de8265a4d177580a137a6a7148aaec1380John Reck return; 2334eb475de8265a4d177580a137a6a7148aaec1380John Reck } 2349ee87d9ce5aae1460f53bea66bfcafd3671505a0John Reck long id = mAdapter.mChildren.get(groupPosition).getItemId(childPosition); 23571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (mOnChildClickListener != null) { 2369db9529bdb7490ccd72fbe66f7e9c9d7cdd73899John Reck mOnChildClickListener.onChildClick(BookmarkExpandableView.this, 23771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck v, groupPosition, childPosition, id); 23871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 23971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 24071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck }; 24171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 24271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck private OnClickListener mGroupOnClickListener = new OnClickListener() { 24371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 24471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 24571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public void onClick(View v) { 24671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck int groupPosition = (Integer) v.getTag(R.id.group_position); 247e74d9f8e84c8b5dfdbc3dd0d689d01d945841100John Reck if (isGroupExpanded(groupPosition)) { 248e74d9f8e84c8b5dfdbc3dd0d689d01d945841100John Reck collapseGroup(groupPosition); 249e74d9f8e84c8b5dfdbc3dd0d689d01d945841100John Reck } else { 250e74d9f8e84c8b5dfdbc3dd0d689d01d945841100John Reck expandGroup(groupPosition, true); 25171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 25271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 25371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck }; 25471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 25571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public BreadCrumbView getBreadCrumbs(int groupPosition) { 25671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck return mAdapter.getBreadCrumbView(groupPosition); 25771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 25871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 2594f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck public JSONObject saveGroupState() throws JSONException { 2604f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck JSONObject obj = new JSONObject(); 2614f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck int count = mAdapter.getGroupCount(); 2624f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck for (int i = 0; i < count; i++) { 2634f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck String acctName = mAdapter.mGroups.get(i); 2644f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck if (!isGroupExpanded(i)) { 2654f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck obj.put(acctName != null ? acctName : LOCAL_ACCOUNT_NAME, false); 2664f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck } 2674f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck } 2684f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck return obj; 2694f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck } 2704f61ee45c1a2794d4254998c735a320fa6718eddJohn Reck 27171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck class BookmarkAccountAdapter extends BaseExpandableListAdapter { 27271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck ArrayList<BrowserBookmarksAdapter> mChildren; 27371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck ArrayList<String> mGroups; 27471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck HashMap<Integer, BreadCrumbView> mBreadcrumbs = 27571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck new HashMap<Integer, BreadCrumbView>(); 27671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck LayoutInflater mInflater; 27771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck int mRowCount = 1; // assume at least 1 child fits in a row 27871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck int mLastViewWidth = -1; 27971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck int mRowPadding = -1; 28071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck DataSetObserver mObserver = new DataSetObserver() { 28171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 28271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public void onChanged() { 28371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck notifyDataSetChanged(); 28471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 28571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 28671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 28771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public void onInvalidated() { 288c3c46d7731006ba78497c61aa4fec34d58ac182eJohn Reck notifyDataSetInvalidated(); 28971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 29071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck }; 29171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 29271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public BookmarkAccountAdapter(Context context) { 29371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mContext = context; 29471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mInflater = LayoutInflater.from(mContext); 29571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mChildren = new ArrayList<BrowserBookmarksAdapter>(); 29671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mGroups = new ArrayList<String>(); 29771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 29871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 29971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public void clear() { 30071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mGroups.clear(); 30171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mChildren.clear(); 30271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck notifyDataSetChanged(); 30371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 30471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 30571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 30671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public Object getChild(int groupPosition, int childPosition) { 30771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck return mChildren.get(groupPosition).getItem(childPosition); 30871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 30971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 31071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 31171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public long getChildId(int groupPosition, int childPosition) { 31271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck return childPosition; 31371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 31471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 31571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 31671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public View getChildView(int groupPosition, int childPosition, 31771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck boolean isLastChild, View convertView, ViewGroup parent) { 31871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (convertView == null) { 31971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck convertView = mInflater.inflate(R.layout.bookmark_grid_row, parent, false); 32071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 3219db9529bdb7490ccd72fbe66f7e9c9d7cdd73899John Reck BrowserBookmarksAdapter childAdapter = mChildren.get(groupPosition); 3229db9529bdb7490ccd72fbe66f7e9c9d7cdd73899John Reck int rowCount = mRowCount; 32371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck LinearLayout row = (LinearLayout) convertView; 3249db9529bdb7490ccd72fbe66f7e9c9d7cdd73899John Reck if (row.getChildCount() > rowCount) { 3259db9529bdb7490ccd72fbe66f7e9c9d7cdd73899John Reck row.removeViews(rowCount, row.getChildCount() - rowCount); 32671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 3279db9529bdb7490ccd72fbe66f7e9c9d7cdd73899John Reck for (int i = 0; i < rowCount; i++) { 32871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck View cv = null; 32971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (row.getChildCount() > i) { 33071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck cv = row.getChildAt(i); 33171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 3329db9529bdb7490ccd72fbe66f7e9c9d7cdd73899John Reck int realChildPosition = (childPosition * rowCount) + i; 33371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (realChildPosition < childAdapter.getCount()) { 33471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck View v = childAdapter.getView(realChildPosition, cv, row); 33571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck v.setTag(R.id.group_position, groupPosition); 33671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck v.setTag(R.id.child_position, realChildPosition); 33771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck v.setOnClickListener(mChildClickListener); 33871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck v.setLongClickable(mLongClickable); 33971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (cv == null) { 34071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck row.addView(v); 34171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } else if (cv != v) { 34271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck row.removeViewAt(i); 34371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck row.addView(v, i); 34471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } else { 34571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck cv.setVisibility(View.VISIBLE); 34671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 34771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } else if (cv != null) { 34871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck cv.setVisibility(View.GONE); 34971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 35071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 35171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck return row; 35271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 35371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 35471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 35571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public int getChildrenCount(int groupPosition) { 3569db9529bdb7490ccd72fbe66f7e9c9d7cdd73899John Reck BrowserBookmarksAdapter adapter = mChildren.get(groupPosition); 3579db9529bdb7490ccd72fbe66f7e9c9d7cdd73899John Reck return (int) Math.ceil(adapter.getCount() / (float)mRowCount); 35871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 35971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 36071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 36171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public Object getGroup(int groupPosition) { 36271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck return mChildren.get(groupPosition); 36371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 36471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 36571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 36671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public int getGroupCount() { 36771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck return mGroups.size(); 36871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 36971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 370f3828cd09f12cbf2980af72187628a608db8e938John Reck public void measureChildren(int viewWidth) { 37171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (mLastViewWidth == viewWidth) return; 37271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 37371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck int rowCount = viewWidth / mColumnWidth; 374f3828cd09f12cbf2980af72187628a608db8e938John Reck if (mMaxColumnCount > 0) { 375f3828cd09f12cbf2980af72187628a608db8e938John Reck rowCount = Math.min(rowCount, mMaxColumnCount); 376f3828cd09f12cbf2980af72187628a608db8e938John Reck } 37771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck int rowPadding = (viewWidth - (rowCount * mColumnWidth)) / 2; 37871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck boolean notify = rowCount != mRowCount || rowPadding != mRowPadding; 37971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mRowCount = rowCount; 38071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mRowPadding = rowPadding; 38171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mLastViewWidth = viewWidth; 38271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (notify) { 38371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck notifyDataSetChanged(); 38471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 38571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 38671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 38771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 38871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public long getGroupId(int groupPosition) { 38971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck return groupPosition; 39071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 39171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 39271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 39371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public View getGroupView(int groupPosition, boolean isExpanded, 39471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck View view, ViewGroup parent) { 39571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (view == null) { 39671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck view = mInflater.inflate(R.layout.bookmark_group_view, parent, false); 39771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck view.setOnClickListener(mGroupOnClickListener); 39871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 39971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck view.setTag(R.id.group_position, groupPosition); 40071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck FrameLayout crumbHolder = (FrameLayout) view.findViewById(R.id.crumb_holder); 40171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck crumbHolder.removeAllViews(); 40271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck BreadCrumbView crumbs = getBreadCrumbView(groupPosition); 40371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (crumbs.getParent() != null) { 40471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck ((ViewGroup)crumbs.getParent()).removeView(crumbs); 40571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 40671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck crumbHolder.addView(crumbs); 40771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck TextView name = (TextView) view.findViewById(R.id.group_name); 40871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck String groupName = mGroups.get(groupPosition); 40971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (groupName == null) { 41071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck groupName = mContext.getString(R.string.local_bookmarks); 41171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 41271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck name.setText(groupName); 41371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck return view; 41471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 41571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 41671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public BreadCrumbView getBreadCrumbView(int groupPosition) { 41771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck BreadCrumbView crumbs = mBreadcrumbs.get(groupPosition); 41871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck if (crumbs == null) { 41971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck crumbs = (BreadCrumbView) 42071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mInflater.inflate(R.layout.bookmarks_header, null); 4219db9529bdb7490ccd72fbe66f7e9c9d7cdd73899John Reck crumbs.setController(BookmarkExpandableView.this); 42271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck crumbs.setUseBackButton(true); 42371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck crumbs.setMaxVisible(2); 42471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck String bookmarks = mContext.getString(R.string.bookmarks); 42571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck crumbs.pushView(bookmarks, false, 42671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck BrowserContract.Bookmarks.CONTENT_URI_DEFAULT_FOLDER); 42771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck crumbs.setTag(R.id.group_position, groupPosition); 428cece1fe59c45893bb46e321917aa881705ab0b7eJohn Reck crumbs.setVisibility(View.GONE); 42971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck mBreadcrumbs.put(groupPosition, crumbs); 43071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 43171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck return crumbs; 43271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 43371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 43471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 43571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public boolean hasStableIds() { 43671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck return false; 43771efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 43871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 43971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck @Override 44071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public boolean isChildSelectable(int groupPosition, int childPosition) { 44171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck return true; 44271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 44371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 44471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 44571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public static class BookmarkContextMenuInfo implements ContextMenuInfo { 44671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 44766302e5f0622fce8f0250afcd722c5597ba76261John Reck private BookmarkContextMenuInfo(int childPosition, int groupPosition) { 44871efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck this.childPosition = childPosition; 44971efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck this.groupPosition = groupPosition; 45071efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 45171efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 45271efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public int childPosition; 45371efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck public int groupPosition; 45471efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck } 45571efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck 45671efc2bbf08574425a387c992e24cb9eaf0a6e6cJohn Reck} 457