Search in sources :

Example 1 with PhotoStreamGridFragment

use of com.bourke.glimmr.fragments.home.PhotoStreamGridFragment in project glimmr by brk3.

the class AddToPhotosetDialogFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mLayout = (LinearLayout) inflater.inflate(R.layout.add_to_photoset_fragment, container, false);
    TextView titleTextView = (TextView) mLayout.findViewById(R.id.titleText);
    titleTextView.setText(R.string.add_photos);
    mTextUtils.setFont(titleTextView, TextUtils.FONT_ROBOTOBOLD);
    // ProgressBar progressBar = (ProgressBar)
    // mLayout.findViewById(R.id.progressIndicator);
    /* Nested fragments have to be added this way, not from xml */
    FragmentTransaction ft = getChildFragmentManager().beginTransaction();
    final boolean retainInstance = false;
    final PhotoStreamGridFragment frag = PhotoStreamGridFragment.newInstance(mOAuth.getUser(), retainInstance, ListView.CHOICE_MODE_MULTIPLE);
    ft.replace(R.id.photoStreamFragment, frag);
    ft.commit();
    /* When add button is clicked, get selected ids and add to queue */
    mLayout.findViewById(R.id.buttonAddToPhotoset).setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            List<Photo> selectedPhotos = frag.getSelectedPhotos();
            for (Photo photo : selectedPhotos) {
                mQueue.add(new AddItemToPhotosetTask(mPhotoset.getId(), photo.getId(), mOAuth));
            }
            mActivity.startService(new Intent(mActivity, AddToPhotosetTaskQueueService.class));
            dismiss();
            Crouton.makeText(mActivity, R.string.photos_will_be_added, Style.CONFIRM).show();
        }
    });
    return mLayout;
}
Also used : AddItemToPhotosetTask(com.bourke.glimmr.tasks.AddItemToPhotosetTask) FragmentTransaction(android.support.v4.app.FragmentTransaction) PhotoStreamGridFragment(com.bourke.glimmr.fragments.home.PhotoStreamGridFragment) TextView(android.widget.TextView) List(java.util.List) Photo(com.googlecode.flickrjandroid.photos.Photo) Intent(android.content.Intent) View(android.view.View) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 2 with PhotoStreamGridFragment

use of com.bourke.glimmr.fragments.home.PhotoStreamGridFragment in project glimmr by brk3.

the class AddToGroupDialogFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mLayout = (LinearLayout) inflater.inflate(R.layout.add_to_group_fragment, container, false);
    mTitleView = (TextView) mLayout.findViewById(R.id.titleText);
    mTextUtils.setFont(mTitleView, TextUtils.FONT_ROBOTOBOLD);
    mProgressBar = (ProgressBar) mLayout.findViewById(R.id.progressIndicator);
    mProgressBar.setVisibility(View.VISIBLE);
    /* Nested fragments have to be added this way, not from xml */
    FragmentTransaction ft = getChildFragmentManager().beginTransaction();
    final boolean retainInstance = false;
    final PhotoStreamGridFragment frag = PhotoStreamGridFragment.newInstance(mOAuth.getUser(), retainInstance, ListView.CHOICE_MODE_MULTIPLE);
    ft.replace(R.id.photoStreamFragment, frag);
    ft.commit();
    /* When add button is clicked, get selected ids and add to queue */
    mLayout.findViewById(R.id.buttonAddToGroup).setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            List<Photo> selectedPhotos = frag.getSelectedPhotos();
            if (mRemaining < 0 || selectedPhotos.size() == 0) {
                Log.e(TAG, "None or too many items selected");
                return;
            }
            for (Photo photo : selectedPhotos) {
                mQueue.add(new AddItemToGroupTask(mGroup.getId(), photo.getId(), mOAuth));
            }
            mActivity.startService(new Intent(mActivity, AddToGroupTaskQueueService.class));
            dismiss();
            Crouton.makeText(mActivity, R.string.photos_will_be_added, Style.CONFIRM).show();
        }
    });
    return mLayout;
}
Also used : AddItemToGroupTask(com.bourke.glimmr.tasks.AddItemToGroupTask) FragmentTransaction(android.support.v4.app.FragmentTransaction) PhotoStreamGridFragment(com.bourke.glimmr.fragments.home.PhotoStreamGridFragment) List(java.util.List) Photo(com.googlecode.flickrjandroid.photos.Photo) Intent(android.content.Intent) View(android.view.View) TextView(android.widget.TextView) ListView(android.widget.ListView)

Aggregations

Intent (android.content.Intent)2 FragmentTransaction (android.support.v4.app.FragmentTransaction)2 View (android.view.View)2 ListView (android.widget.ListView)2 TextView (android.widget.TextView)2 PhotoStreamGridFragment (com.bourke.glimmr.fragments.home.PhotoStreamGridFragment)2 Photo (com.googlecode.flickrjandroid.photos.Photo)2 List (java.util.List)2 AddItemToGroupTask (com.bourke.glimmr.tasks.AddItemToGroupTask)1 AddItemToPhotosetTask (com.bourke.glimmr.tasks.AddItemToPhotosetTask)1