18a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk/* 28a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * Copyright 2017 The Android Open Source Project 38a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * 48a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * Licensed under the Apache License, Version 2.0 (the "License"); 58a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * you may not use this file except in compliance with the License. 68a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * You may obtain a copy of the License at 78a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * 88a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * http://www.apache.org/licenses/LICENSE-2.0 98a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * 108a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * Unless required by applicable law or agreed to in writing, software 118a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * distributed under the License is distributed on an "AS IS" BASIS, 128a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 138a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * See the License for the specific language governing permissions and 148a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * limitations under the License. 158a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk */ 168a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk 1785ef1446b82c8783a50af92c4cb1389fe0d0e907Aurimas Liutikaspackage androidx.slice.widget; 188a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk 1965d77ea1ec28f1a623a1a7f8e624cf08c27d5faeMady Mellorimport static androidx.slice.widget.SliceView.MODE_SMALL; 206975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor 218a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monkimport android.content.Context; 226975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellorimport android.os.Build; 2363fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellorimport android.util.AttributeSet; 246975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellorimport android.view.MotionEvent; 256975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellorimport android.view.View; 266975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellorimport android.widget.FrameLayout; 2763fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellor 28ac5fe7c617c66850fff75a9fce9979c6e5674b0fAurimas Liutikasimport androidx.annotation.RestrictTo; 29ac5fe7c617c66850fff75a9fce9979c6e5674b0fAurimas Liutikasimport androidx.recyclerview.widget.LinearLayoutManager; 30ac5fe7c617c66850fff75a9fce9979c6e5674b0fAurimas Liutikasimport androidx.recyclerview.widget.RecyclerView; 3163fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellorimport androidx.slice.SliceItem; 328a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk 3353380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellorimport java.util.ArrayList; 346975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellorimport java.util.Collections; 35b794b5b0f4bcd000e098265a6ec63d4b0cf3852fMady Mellorimport java.util.List; 36b794b5b0f4bcd000e098265a6ec63d4b0cf3852fMady Mellor 378a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk/** 388a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * @hide 398a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk */ 408a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk@RestrictTo(RestrictTo.Scope.LIBRARY) 41dc05204762b444dde1db9029aed2819fd72476f7Mady Mellorpublic class LargeTemplateView extends SliceChildView { 428a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk 436975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor private SliceView mParent; 446975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor private final View mForeground; 458a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk private final LargeSliceAdapter mAdapter; 468a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk private final RecyclerView mRecyclerView; 478a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk private boolean mIsScrollable; 48b794b5b0f4bcd000e098265a6ec63d4b0cf3852fMady Mellor private ListContent mListContent; 4953380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor private List<SliceItem> mDisplayedItems = new ArrayList<>(); 5053380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor private int mDisplayedItemsHeight = 0; 516975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor private int[] mLoc = new int[2]; 528a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk 538a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk public LargeTemplateView(Context context) { 548a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk super(context); 558a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk mRecyclerView = new RecyclerView(getContext()); 568a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); 578a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk mAdapter = new LargeSliceAdapter(context); 588a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk mRecyclerView.setAdapter(mAdapter); 598a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk addView(mRecyclerView); 606975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor 616975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor mForeground = new View(getContext()); 626975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor mForeground.setBackground(SliceViewUtil.getDrawable(getContext(), 636975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor android.R.attr.selectableItemBackground)); 646975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor addView(mForeground); 656975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor 666975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor FrameLayout.LayoutParams lp = (LayoutParams) mForeground.getLayoutParams(); 676975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor lp.width = LayoutParams.MATCH_PARENT; 686975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor lp.height = LayoutParams.MATCH_PARENT; 696975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor mForeground.setLayoutParams(lp); 706975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor } 716975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor 726975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor @Override 736975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor public void onAttachedToWindow() { 746975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor super.onAttachedToWindow(); 756975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor mParent = (SliceView) getParent(); 766975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor mAdapter.setParents(mParent, this); 778a2763f580c71e17a0b13e682c73012e902b4232Mady Mellor } 788a2763f580c71e17a0b13e682c73012e902b4232Mady Mellor 798a2763f580c71e17a0b13e682c73012e902b4232Mady Mellor @Override 8053380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 8153380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor int height = MeasureSpec.getSize(heightMeasureSpec); 8253380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor if (mDisplayedItems.size() > 0 && mDisplayedItemsHeight > height) { 8353380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor // Need to resize 8453380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor updateDisplayedItems(height); 8553380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor } 8653380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor super.onMeasure(widthMeasureSpec, heightMeasureSpec); 8753380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor } 8853380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor 896975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor /** 906975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor * Called when the foreground view handling touch feedback should be activated. 916975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor * @param event the event to handle. 926975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor */ 936975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor public void onForegroundActivated(MotionEvent event) { 946975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor if (mParent != null && !mParent.isSliceViewClickable()) { 956975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor // Only show highlight if clickable 966975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor mForeground.setPressed(false); 976975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor return; 986975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor } 996975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 1006975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor mForeground.getLocationOnScreen(mLoc); 1016975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor final int x = (int) (event.getRawX() - mLoc[0]); 1026975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor final int y = (int) (event.getRawY() - mLoc[1]); 1036975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor mForeground.getBackground().setHotspot(x, y); 1046975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor } 1056975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor int action = event.getActionMasked(); 1066975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor if (action == MotionEvent.ACTION_DOWN) { 1076975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor mForeground.setPressed(true); 1086975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor } else if (action == MotionEvent.ACTION_CANCEL 1096975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor || action == MotionEvent.ACTION_UP 1106975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor || action == MotionEvent.ACTION_MOVE) { 1116975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor mForeground.setPressed(false); 1126975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor } 1136975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor } 1146975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor 1156975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor @Override 1166975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor public void setMode(int newMode) { 1176975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor super.setMode(newMode); 1186975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor updateDisplayedItems(getMeasuredHeight()); 1196975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor } 1206975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor 12153380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor @Override 1228a2763f580c71e17a0b13e682c73012e902b4232Mady Mellor public int getActualHeight() { 12353380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor return mDisplayedItemsHeight; 1245b2c0ce4135a0531d1b8ddb4bd35698859678b83Mady Mellor } 1255b2c0ce4135a0531d1b8ddb4bd35698859678b83Mady Mellor 1265b2c0ce4135a0531d1b8ddb4bd35698859678b83Mady Mellor @Override 1276975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor public int getSmallHeight() { 1286975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor if (mListContent == null || mListContent.getHeaderItem() == null) { 1296975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor return 0; 1306975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor } 1316975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor SliceItem headerItem = mListContent.getHeaderItem(); 13265d77ea1ec28f1a623a1a7f8e624cf08c27d5faeMady Mellor return mListContent.getHeight(getContext(), headerItem, true /* isHeader */, 13365d77ea1ec28f1a623a1a7f8e624cf08c27d5faeMady Mellor 0 /* rowIndex */, 1 /* rowCount */, MODE_SMALL); 1340922d59222960ed7c88c5e5098399e33a343c9c6Mady Mellor } 1350922d59222960ed7c88c5e5098399e33a343c9c6Mady Mellor 1360922d59222960ed7c88c5e5098399e33a343c9c6Mady Mellor @Override 1376975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor public void setTint(int tint) { 1386975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor super.setTint(tint); 1396975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor populate(); 1408a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk } 1418a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk 1428a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk @Override 143abd7ffd938056760f750af041b0e6f02d2cb6e1eMady Mellor public void setSliceActionListener(SliceView.OnSliceActionListener observer) { 144238b9b6aad4ef0c63acbecfa89605a3d753931feMady Mellor mObserver = observer; 145238b9b6aad4ef0c63acbecfa89605a3d753931feMady Mellor if (mAdapter != null) { 146238b9b6aad4ef0c63acbecfa89605a3d753931feMady Mellor mAdapter.setSliceObserver(mObserver); 147238b9b6aad4ef0c63acbecfa89605a3d753931feMady Mellor } 148238b9b6aad4ef0c63acbecfa89605a3d753931feMady Mellor } 149238b9b6aad4ef0c63acbecfa89605a3d753931feMady Mellor 150238b9b6aad4ef0c63acbecfa89605a3d753931feMady Mellor @Override 151b794b5b0f4bcd000e098265a6ec63d4b0cf3852fMady Mellor public void setSliceActions(List<SliceItem> actions) { 152b794b5b0f4bcd000e098265a6ec63d4b0cf3852fMady Mellor mAdapter.setSliceActions(actions); 153b794b5b0f4bcd000e098265a6ec63d4b0cf3852fMady Mellor } 154b794b5b0f4bcd000e098265a6ec63d4b0cf3852fMady Mellor 155b794b5b0f4bcd000e098265a6ec63d4b0cf3852fMady Mellor @Override 15665d77ea1ec28f1a623a1a7f8e624cf08c27d5faeMady Mellor public void setSliceContent(ListContent sliceContent) { 15765d77ea1ec28f1a623a1a7f8e624cf08c27d5faeMady Mellor mListContent = sliceContent; 158dc05204762b444dde1db9029aed2819fd72476f7Mady Mellor populate(); 159dc05204762b444dde1db9029aed2819fd72476f7Mady Mellor } 160dc05204762b444dde1db9029aed2819fd72476f7Mady Mellor 161dc05204762b444dde1db9029aed2819fd72476f7Mady Mellor @Override 16277d3fe9d9b671c0b3853fec6bc21b91d8418afc9Mady Mellor public void setStyle(AttributeSet attrs, int defStyleAttrs, int defStyleRes) { 16377d3fe9d9b671c0b3853fec6bc21b91d8418afc9Mady Mellor super.setStyle(attrs, defStyleAttrs, defStyleRes); 16477d3fe9d9b671c0b3853fec6bc21b91d8418afc9Mady Mellor mAdapter.setStyle(attrs, defStyleAttrs, defStyleRes); 165dc05204762b444dde1db9029aed2819fd72476f7Mady Mellor } 166dc05204762b444dde1db9029aed2819fd72476f7Mady Mellor 16763fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellor @Override 16863fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellor public void setShowLastUpdated(boolean showLastUpdated) { 16963fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellor super.setShowLastUpdated(showLastUpdated); 17063fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellor mAdapter.setShowLastUpdated(showLastUpdated); 17163fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellor } 17263fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellor 17363fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellor @Override 17463fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellor public void setLastUpdated(long lastUpdated) { 17563fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellor super.setLastUpdated(lastUpdated); 17663fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellor mAdapter.setLastUpdated(lastUpdated); 17763fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellor } 17863fb9955b209f1bb9d19e41df9784bfbdf63defeMady Mellor 179dc05204762b444dde1db9029aed2819fd72476f7Mady Mellor private void populate() { 18065d77ea1ec28f1a623a1a7f8e624cf08c27d5faeMady Mellor if (mListContent == null) { 18153380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor resetView(); 182dc05204762b444dde1db9029aed2819fd72476f7Mady Mellor return; 183dc05204762b444dde1db9029aed2819fd72476f7Mady Mellor } 18453380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor updateDisplayedItems(getMeasuredHeight()); 1858a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk } 1868a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk 1878a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk /** 1888a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk * Whether or not the content in this template should be scrollable. 1898a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk */ 1908a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk public void setScrollable(boolean isScrollable) { 1918a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk mIsScrollable = isScrollable; 19253380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor updateDisplayedItems(getMeasuredHeight()); 19353380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor } 19453380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor 19553380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor private void updateDisplayedItems(int height) { 19653380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor if (mListContent == null) { 19753380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor return; 19853380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor } 19953380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor if (!mIsScrollable) { 20053380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor // If we're not scrollable we must cap the number of items we're displaying such 20153380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor // that they fit in the available space 20253380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor if (height == 0) { 20353380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor // Not measured, use default 20453380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor mDisplayedItems = mListContent.getItemsForNonScrollingList(-1); 20553380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor } else { 20653380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor mDisplayedItems = mListContent.getItemsForNonScrollingList(height); 20753380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor } 20853380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor } else { 20953380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor mDisplayedItems = mListContent.getRowItems(); 21053380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor } 21165d77ea1ec28f1a623a1a7f8e624cf08c27d5faeMady Mellor mDisplayedItemsHeight = mListContent.getListHeight(getContext(), mDisplayedItems); 2120929cbe8a1ad88cb18e0cd3b50abba21840bc592Mady Mellor int mode = getMode(); 2130929cbe8a1ad88cb18e0cd3b50abba21840bc592Mady Mellor if (mode == SliceView.MODE_LARGE) { 2140929cbe8a1ad88cb18e0cd3b50abba21840bc592Mady Mellor mAdapter.setSliceItems(mDisplayedItems, mTintColor, mode); 21565d77ea1ec28f1a623a1a7f8e624cf08c27d5faeMady Mellor } else if (mode == MODE_SMALL) { 2166975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor mAdapter.setSliceItems( 2170929cbe8a1ad88cb18e0cd3b50abba21840bc592Mady Mellor Collections.singletonList(mDisplayedItems.get(0)), mTintColor, mode); 2186975e4e9eba6772c9d7d38374109a90dd4f390cdMady Mellor } 2198a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk } 220df26970a23ca28c8582178e3dd0e5502d4030293Mady Mellor 221df26970a23ca28c8582178e3dd0e5502d4030293Mady Mellor @Override 222df26970a23ca28c8582178e3dd0e5502d4030293Mady Mellor public void resetView() { 22353380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor mDisplayedItemsHeight = 0; 22453380fecd1a1537e913578d1e53aa516d3f6e58eMady Mellor mDisplayedItems.clear(); 2250929cbe8a1ad88cb18e0cd3b50abba21840bc592Mady Mellor mAdapter.setSliceItems(null, -1, getMode()); 226b794b5b0f4bcd000e098265a6ec63d4b0cf3852fMady Mellor mListContent = null; 227df26970a23ca28c8582178e3dd0e5502d4030293Mady Mellor } 2288a452e96e2308fe9515aa91b8e5b369eeefc25e7Jason Monk} 229