use of ve.com.abicelis.remindy.app.fragments.TaskFragment in project Remindy by abicelis.
the class TaskActivity method setupViewPagerAndTabLayout.
private void setupViewPagerAndTabLayout() {
mTaskFragment = new TaskFragment();
mReminderFragment = new ReminderFragment();
Bundle bundle = new Bundle();
bundle.putSerializable(TaskFragment.TASK_ARGUMENT, mTask);
mTaskFragment.setArguments(bundle);
bundle = new Bundle();
bundle.putSerializable(ReminderFragment.TASK_ARGUMENT, mTask);
mReminderFragment.setArguments(bundle);
//Rebuild lists
mTitleList.clear();
mFragmentList.clear();
mTitleList.add(getResources().getString(R.string.activity_task_fragment_task_tab_title));
mTitleList.add(getResources().getString(R.string.activity_task_fragment_reminder_tab_title));
mFragmentList.add(mTaskFragment);
mFragmentList.add(mReminderFragment);
//Setup adapter, viewpager and tablayout
mTaskViewPagerAdapter = new TaskViewPagerAdapter(getSupportFragmentManager(), mTitleList, mFragmentList);
mViewpager.setAdapter(mTaskViewPagerAdapter);
mTabLayout.setupWithViewPager(mViewpager);
}
use of ve.com.abicelis.remindy.app.fragments.TaskFragment in project Remindy by abicelis.
the class TaskActivity method onActivityResult.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//This request comes from ImageAttachmentViewHolder calling startActivityForResult() on EditImageAttachmentActivity
if (requestCode == EditImageAttachmentActivity.EDIT_IMAGE_ATTACHMENT_REQUEST_CODE && resultCode == RESULT_OK) {
int position = data.getIntExtra(EditImageAttachmentActivity.HOLDER_POSITION_EXTRA, -1);
ImageAttachment imageAttachment = (ImageAttachment) data.getSerializableExtra(EditImageAttachmentActivity.IMAGE_ATTACHMENT_EXTRA);
if (position != -1) {
TaskFragment taskFragment = (TaskFragment) mTaskViewPagerAdapter.getRegisteredFragment(0);
ImageAttachmentViewHolder holder = (ImageAttachmentViewHolder) taskFragment.mRecyclerView.findViewHolderForAdapterPosition(position);
holder.updateImageAttachment(imageAttachment);
}
}
//This request comes from ImageAttachmentViewHolder calling startActivityForResult() on ViewImageAttachmentActivity
if (requestCode == ViewImageAttachmentActivity.VIEW_IMAGE_ATTACHMENT_REQUEST_CODE && resultCode == RESULT_OK) {
int position = data.getIntExtra(ViewImageAttachmentActivity.HOLDER_POSITION_EXTRA, -1);
ImageAttachment imageAttachment = (ImageAttachment) data.getSerializableExtra(ViewImageAttachmentActivity.IMAGE_ATTACHMENT_EXTRA);
if (position != -1) {
TaskFragment taskFragment = (TaskFragment) mTaskViewPagerAdapter.getRegisteredFragment(0);
ImageAttachmentViewHolder holder = (ImageAttachmentViewHolder) taskFragment.mRecyclerView.findViewHolderForAdapterPosition(position);
holder.updateImageAttachment(imageAttachment);
}
}
}
Aggregations