use of com.bourke.glimmr.tasks.AddItemToGroupTask in project glimmr by brk3.
the class AddToGroupDialogFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TaskQueueDelegateFactory<AddItemToGroupTask> factory = new TaskQueueDelegateFactory<AddItemToGroupTask>(mActivity);
mQueue = new TaskQueue(factory.get(Constants.GROUP_QUEUE, AddItemToGroupTask.class));
BusProvider.getInstance().register(this);
setStyle(STYLE_NO_TITLE, 0);
}
use of com.bourke.glimmr.tasks.AddItemToGroupTask in project glimmr by brk3.
the class AddToGroupTaskQueueService method initTaskQueue.
@Override
protected void initTaskQueue() {
TaskQueueDelegateFactory<AddItemToGroupTask> factory = new TaskQueueDelegateFactory<AddItemToGroupTask>(this);
mQueue = new TaskQueue(factory.get(Constants.GROUP_QUEUE, AddItemToGroupTask.class));
}
use of com.bourke.glimmr.tasks.AddItemToGroupTask 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;
}
Aggregations