1266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank/******************************************************************************* 2266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * Copyright (C) 2012 Google Inc. 3266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * Licensed to The Android Open Source Project. 4266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * 5266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * Licensed under the Apache License, Version 2.0 (the "License"); 6266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * you may not use this file except in compliance with the License. 7266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * You may obtain a copy of the License at 8266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * 9266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * http://www.apache.org/licenses/LICENSE-2.0 10266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * 11266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * Unless required by applicable law or agreed to in writing, software 12266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * distributed under the License is distributed on an "AS IS" BASIS, 13266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * See the License for the specific language governing permissions and 15266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * limitations under the License. 16266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank *******************************************************************************/ 17266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank 18266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blankpackage com.android.email.provider; 19266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank 20266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blankimport android.content.Context; 21266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blankimport android.database.Cursor; 22266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank 23266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blankimport com.android.mail.providers.Folder; 24266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blankimport com.android.mail.providers.UIProvider.FolderCapabilities; 25266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blankimport com.android.mail.ui.HierarchicalFolderSelectorAdapter; 26266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank 27266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blankimport java.util.Set; 28266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank 29266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blankpublic class FolderPickerSelectorAdapter extends HierarchicalFolderSelectorAdapter { 30266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank 31266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank public FolderPickerSelectorAdapter(Context context, Cursor folders, 32c07a44240311eb0ce44654284b010e6df8b08e86Andrew Sapperstein Set<String> initiallySelected, int layout) { 33c07a44240311eb0ce44654284b010e6df8b08e86Andrew Sapperstein super(context, folders, initiallySelected, layout); 34266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank } 35266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank 36266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank /** 37266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * Return whether the supplied folder meets the requirements to be displayed 38266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank * in the folder list. 39266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank */ 409e521deb6bb525b33365cc2926cb2d0faa7095e2Scott Kennedy @Override 41266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank protected boolean meetsRequirements(Folder folder) { 42266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank // We only want to show the non-Trash folders that can accept moved messages 43f16a7612c0bc4b4f03c9f8ba982c7723a5f33e17Scott Kennedy return folder.supportsCapability(FolderCapabilities.CAN_ACCEPT_MOVED_MESSAGES) 44f16a7612c0bc4b4f03c9f8ba982c7723a5f33e17Scott Kennedy || folder.isTrash(); 45266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank } 46266064bcc7c6ed7318a284d59bb83d53edbf1921Marc Blank} 47