Search in sources :

Example 1 with StringMapParcelableWrapper

use of com.trovebox.android.common.util.data.StringMapParcelableWrapper in project mobile-android by photo.

the class SyncUploadFragment method onActivityResult.

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch(requestCode) {
        case REQUEST_ALBUMS:
            if (resultCode == Activity.RESULT_OK && data.getExtras() != null) {
                StringMapParcelableWrapper albumsWrapper = data.getExtras().getParcelable(SelectAlbumsActivity.SELECTED_ALBUMS);
                Map<String, String> albums = albumsWrapper.getMap();
                albumsText.setText(AlbumUtils.getAlbumsString(albums));
                this.albumsWrapper = albumsWrapper;
            }
            break;
        default:
            break;
    }
}
Also used : StringMapParcelableWrapper(com.trovebox.android.common.util.data.StringMapParcelableWrapper)

Example 2 with StringMapParcelableWrapper

use of com.trovebox.android.common.util.data.StringMapParcelableWrapper in project mobile-android by photo.

the class SyncUploadFragment method init.

public void init(View v, Bundle savedInstanceState) {
    final Button uploadBtn = (Button) v.findViewById(R.id.uploadBtn);
    uploadBtn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            TrackerUtils.trackButtonClickEvent("uploadBtn", SyncUploadFragment.this);
            if (!UploadUiFragment.checkAlbumRequiredAndSpecified(albumsWrapper)) {
                return;
            }
            v.setEnabled(false);
            uploadSelectedFiles(true, true);
        }
    });
    uploadBtn.setEnabled(false);
    editTitle = (EditText) v.findViewById(R.id.edit_title);
    editTags = (EditText) v.findViewById(R.id.edit_tags);
    albumsText = ((EditText) v.findViewById(R.id.edit_albums));
    albumsText.setVisibility(Preferences.isLimitedAccountAccessType() ? View.GONE : View.VISIBLE);
    privateSwitch = (Switch) v.findViewById(R.id.private_switch);
    twitterSwitch = (Switch) v.findViewById(R.id.twitter_switch);
    facebookSwitch = (Switch) v.findViewById(R.id.facebook_switch);
    albumsText.setOnClickListener(this);
    if (Preferences.isLimitedAccountAccessType()) {
        privateSwitch.setChecked(true);
        privateSwitch.setEnabled(false);
    }
    privateSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            reinitShareSwitches(!isChecked);
        }
    });
    reinitShareSwitches();
    AccountLimitUtils2.tryToRefreshLimitInformationAndRunInContextAsync(new Runnable() {

        @Override
        public void run() {
            if (!isAdded()) {
                return;
            }
            UploadUiFragment.checkCanUpload(albumsText, uploadBtn, new RunnableWithParameter<StringMapParcelableWrapper>() {

                @Override
                public void run(StringMapParcelableWrapper parameter) {
                    SyncUploadFragment.this.albumsWrapper = parameter;
                }
            });
        }
    }, new Runnable() {

        @Override
        public void run() {
            CommonUtils.debug(TAG, "Limit information refresh failed");
        }
    }, loadingControl);
}
Also used : EditText(android.widget.EditText) StringMapParcelableWrapper(com.trovebox.android.common.util.data.StringMapParcelableWrapper) OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) Button(android.widget.Button) CompoundButton(android.widget.CompoundButton) OnClickListener(android.view.View.OnClickListener) RunnableWithParameter(com.trovebox.android.common.util.RunnableWithParameter) View(android.view.View) CompoundButton(android.widget.CompoundButton)

Aggregations

StringMapParcelableWrapper (com.trovebox.android.common.util.data.StringMapParcelableWrapper)2 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 Button (android.widget.Button)1 CompoundButton (android.widget.CompoundButton)1 OnCheckedChangeListener (android.widget.CompoundButton.OnCheckedChangeListener)1 EditText (android.widget.EditText)1 RunnableWithParameter (com.trovebox.android.common.util.RunnableWithParameter)1