Search in sources :

Example 1 with AccountModel

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

the class ServicesActivity method accountLogin.

@Override
public void accountLogin(AccountType type) {
    accountType = type;
    PhotoPickerPreferenceUtil.get().setAccountType(accountType);
    if (PreferenceUtil.get().hasAccount(type.getLoginMethod())) {
        AccountModel account = PreferenceUtil.get().getAccount(type.getLoginMethod());
        accountClicked(account, accountType);
    } else {
        AuthenticationFactory.getInstance().startAuthenticationActivity(ServicesActivity.this, accountType, new AuthenticationOptions.Builder().setClearCookiesForAccount(false).setShouldRetainSession(false).build());
    }
}
Also used : AccountModel(com.chute.sdk.v2.model.AccountModel)

Example 2 with AccountModel

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

the class PhotoPickerPlusTutorialActivity method onActivityResult.

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode != Activity.RESULT_OK) {
        return;
    }
    final PhotoPickerPlusIntentWrapper wrapper = new PhotoPickerPlusIntentWrapper(data);
    List<AssetModel> accountMediaList = wrapper.getMediaCollection();
    AccountModel accountModel = wrapper.getAccountModel();
    Log.d(TAG, accountMediaList.toString());
    Intent intent = new Intent(getApplicationContext(), PhotoGridActivity.class);
    intent.putParcelableArrayListExtra(KEY_MEDIA_LSIT, (ArrayList) accountMediaList);
    startActivity(intent);
}
Also used : AccountModel(com.chute.sdk.v2.model.AccountModel) PhotoPickerPlusIntentWrapper(com.getchute.android.photopickerplus.util.intent.PhotoPickerPlusIntentWrapper) AssetModel(com.chute.sdk.v2.model.AssetModel) Intent(android.content.Intent)

Example 3 with AccountModel

use of com.chute.sdk.v2.model.AccountModel 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

AccountModel (com.chute.sdk.v2.model.AccountModel)2 Intent (android.content.Intent)1 AuthConstants (com.chute.sdk.v2.api.authentication.AuthConstants)1 AccountMediaModel (com.chute.sdk.v2.model.AccountMediaModel)1 AssetModel (com.chute.sdk.v2.model.AssetModel)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 PhotoPickerPlusIntentWrapper (com.getchute.android.photopickerplus.util.intent.PhotoPickerPlusIntentWrapper)1 ArrayList (java.util.ArrayList)1