Search in sources :

Example 1 with AuthConstants

use of com.chute.sdk.v2.api.authentication.AuthConstants in project photo-picker-plus-android by chute.

the class PhotoPickerPlusTutorialApp method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    /**
     * Fill in using "app_id" and "app_secret" values from your Chute
     * application.
     *
     * See <a href="https://apps.getchute.com">https://apps.getchute.com</a>
     */
    Chute.init(this, new AuthConstants(APP_ID, APP_SECRET));
    Map<AccountType, DisplayType> map = new HashMap<AccountType, DisplayType>();
    map.put(AccountType.INSTAGRAM, DisplayType.LIST);
    PhotoPickerConfiguration config = new PhotoPickerConfiguration.Builder(getApplicationContext()).isMultiPicker(false).defaultAccountDisplayType(DisplayType.LIST).enableLogout(true).accountList(AccountType.FLICKR, AccountType.DROPBOX, AccountType.INSTAGRAM, AccountType.GOOGLE, AccountType.YOUTUBE, AccountType.FACEBOOK, AccountType.CHUTE, AccountType.FOURSQUARE, AccountType.GOOGLEDRIVE, AccountType.PICASA, AccountType.SKYDRIVE, AccountType.TWITTER).localMediaList(LocalServiceType.ALL_MEDIA, LocalServiceType.CAMERA_MEDIA, LocalServiceType.RECORD_VIDEO, LocalServiceType.LAST_VIDEO_CAPTURED, LocalServiceType.TAKE_PHOTO, LocalServiceType.LAST_PHOTO_TAKEN).configUrl(ConfigEndpointURLs.SERVICES_CONFIG_URL).supportImages(true).supportVideos(true).build();
    PhotoPicker.getInstance().init(config);
}
Also used : DisplayType(com.getchute.android.photopickerplus.models.enums.DisplayType) AuthConstants(com.chute.sdk.v2.api.authentication.AuthConstants) HashMap(java.util.HashMap) PhotoPickerConfiguration(com.getchute.android.photopickerplus.config.PhotoPickerConfiguration) AccountType(com.chute.sdk.v2.model.enums.AccountType)

Example 2 with AuthConstants

use of com.chute.sdk.v2.api.authentication.AuthConstants in project photo-picker-plus-android by chute.

the class ImageDataResponseLoader method postImageData.

public static void postImageData(Context context, ArrayList<AccountMediaModel> selectedImages, ListenerFilesAccount accountListener, AccountModel accountModel) {
    String token = TokenAuthenticationProvider.getInstance().getToken();
    AuthConstants authConstants = AuthenticationFactory.getInstance().getAuthConstants();
    String clientId = authConstants.clientId;
    String clientSecret = authConstants.clientSecret;
    Chute.init(context, new AuthConstants(clientId, clientSecret), token);
    ArrayList<MediaDataModel> mediaModelList = new ArrayList<MediaDataModel>();
    for (AccountMediaModel accountMediaModel : selectedImages) {
        MediaDataModel mediaModel = new MediaDataModel();
        if (accountMediaModel.getVideoUrl() != null) {
            mediaModel.setFileType(MediaType.VIDEO.name().toLowerCase());
        } else {
            mediaModel.setFileType(MediaType.IMAGE.name().toLowerCase());
        }
        mediaModel.setVideoUrl(accountMediaModel.getVideoUrl());
        mediaModel.setImageUrl(accountMediaModel.getImageUrl());
        mediaModel.setThumbnail(accountMediaModel.getThumbnail());
        mediaModelList.add(mediaModel);
    }
    OptionsModel options = new OptionsModel();
    options.setCliendId(clientId);
    MediaModel imageDataModel = new MediaModel();
    imageDataModel.setOptions(options);
    imageDataModel.setMedia(mediaModelList);
    getImageData(imageDataModel, new ImageDataCallback(context, accountListener, accountModel)).executeAsync();
}
Also used : MediaModel(com.getchute.android.photopickerplus.models.MediaModel) AccountMediaModel(com.chute.sdk.v2.model.AccountMediaModel) AuthConstants(com.chute.sdk.v2.api.authentication.AuthConstants) ArrayList(java.util.ArrayList) AccountMediaModel(com.chute.sdk.v2.model.AccountMediaModel) OptionsModel(com.getchute.android.photopickerplus.models.OptionsModel) MediaDataModel(com.getchute.android.photopickerplus.models.MediaDataModel)

Aggregations

AuthConstants (com.chute.sdk.v2.api.authentication.AuthConstants)2 AccountMediaModel (com.chute.sdk.v2.model.AccountMediaModel)1 AccountType (com.chute.sdk.v2.model.enums.AccountType)1 PhotoPickerConfiguration (com.getchute.android.photopickerplus.config.PhotoPickerConfiguration)1 MediaDataModel (com.getchute.android.photopickerplus.models.MediaDataModel)1 MediaModel (com.getchute.android.photopickerplus.models.MediaModel)1 OptionsModel (com.getchute.android.photopickerplus.models.OptionsModel)1 DisplayType (com.getchute.android.photopickerplus.models.enums.DisplayType)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1