Search in sources :

Example 1 with TaskFragment

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);
}
Also used : TaskFragment(ve.com.abicelis.remindy.app.fragments.TaskFragment) ReminderFragment(ve.com.abicelis.remindy.app.fragments.ReminderFragment) Bundle(android.os.Bundle) TaskViewPagerAdapter(ve.com.abicelis.remindy.app.adapters.TaskViewPagerAdapter)

Example 2 with TaskFragment

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);
        }
    }
}
Also used : TaskFragment(ve.com.abicelis.remindy.app.fragments.TaskFragment) ImageAttachmentViewHolder(ve.com.abicelis.remindy.app.holders.ImageAttachmentViewHolder) ImageAttachment(ve.com.abicelis.remindy.model.attachment.ImageAttachment)

Aggregations

TaskFragment (ve.com.abicelis.remindy.app.fragments.TaskFragment)2 Bundle (android.os.Bundle)1 TaskViewPagerAdapter (ve.com.abicelis.remindy.app.adapters.TaskViewPagerAdapter)1 ReminderFragment (ve.com.abicelis.remindy.app.fragments.ReminderFragment)1 ImageAttachmentViewHolder (ve.com.abicelis.remindy.app.holders.ImageAttachmentViewHolder)1 ImageAttachment (ve.com.abicelis.remindy.model.attachment.ImageAttachment)1