Search in sources :

Example 6 with AccountType

use of com.chute.sdk.v2.model.enums.AccountType in project photo-picker-plus-android by chute.

the class PhotoPicker method checkIfRemoteServiceIsSupported.

/**
	 * If the specified list of {@link AccountType} services contains service
	 * which is not supported by the Chute API, the service is immediately
	 * removed.
	 * 
	 * Remote supported services include: Facebook, Flickr, Picasa, Instagram,
	 * Dropbox, Google, GoogleDrive, SkyDrive and YouTube.
	 * 
	 * @param remoteServices
	 *            List of {@link AccountType} services.
	 * @return Filtered {@link AccountType} list.
	 */
private List<AccountType> checkIfRemoteServiceIsSupported(List<AccountType> remoteServices) {
    List<AccountType> accountList = new ArrayList<AccountType>(remoteServices);
    Iterator<AccountType> iterator = accountList.iterator();
    while (iterator.hasNext()) {
        AccountType accountType = iterator.next();
        if (!accountType.equals(AccountType.FACEBOOK) && !accountType.equals(AccountType.FLICKR) && !accountType.equals(AccountType.PICASA) && !accountType.equals(AccountType.INSTAGRAM) && !accountType.equals(AccountType.DROPBOX) && !accountType.equals(AccountType.GOOGLE) && !accountType.equals(AccountType.GOOGLEDRIVE) && !accountType.equals(AccountType.SKYDRIVE) && !accountType.equals(AccountType.YOUTUBE)) {
            Log.w(TAG, WARNING_UNSUPPORTED_REMOTE_SERVICES);
            iterator.remove();
        }
    }
    if (accountList.isEmpty()) {
        return new ArrayList<AccountType>();
    } else {
        return accountList;
    }
}
Also used : ArrayList(java.util.ArrayList) AccountType(com.chute.sdk.v2.model.enums.AccountType)

Aggregations

AccountType (com.chute.sdk.v2.model.enums.AccountType)5 DisplayType (com.getchute.android.photopickerplus.models.enums.DisplayType)3 SuppressLint (android.annotation.SuppressLint)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 AuthConstants (com.chute.sdk.v2.api.authentication.AuthConstants)1 AccountModel (com.chute.sdk.v2.model.AccountModel)1 PhotoPickerConfiguration (com.getchute.android.photopickerplus.config.PhotoPickerConfiguration)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Entry (java.util.Map.Entry)1