Search in sources :

Example 1 with ExpenseDetailFragment

use of com.polito.mad17.madmax.activities.expenses.ExpenseDetailFragment in project MadMax by deviz92.

the class ExpenseDetailPagerAdapter method getItem.

@Override
public Fragment getItem(int position) {
    Bundle bundle = new Bundle();
    bundle.putString("expenseID", expenseID);
    switch(position) {
        case 0:
            if (fragmentName.equals("ExpenseDetailActivity")) {
                Log.i(TAG, "here in case 0: ExpenseDetailFragment");
                expenseDetailFragment = new ExpenseDetailFragment();
                expenseDetailFragment.setArguments(bundle);
                return expenseDetailFragment;
            } else {
                Log.i(TAG, "here in case 0: PendingExpenseDetailFragment");
                pendingExpenseDetailFragment = new PendingExpenseDetailFragment();
                pendingExpenseDetailFragment.setArguments(bundle);
                return pendingExpenseDetailFragment;
            }
        case 1:
            if (fragmentName.equals("ExpenseDetailActivity")) {
                Log.i(TAG, "here in case 1: ExpenseCommentsFragment");
                expenseCommentsFragment = new ExpenseCommentsFragment();
                expenseCommentsFragment.setArguments(bundle);
                return expenseCommentsFragment;
            } else {
                Log.i(TAG, "here in case 0: PendingExpenseDetailFragment");
                proposedExpenseCommentsFragment = new ProposedExpenseCommentsFragment();
                proposedExpenseCommentsFragment.setArguments(bundle);
                return proposedExpenseCommentsFragment;
            }
        default:
            return null;
    }
}
Also used : ExpenseCommentsFragment(com.polito.mad17.madmax.activities.expenses.ExpenseCommentsFragment) ProposedExpenseCommentsFragment(com.polito.mad17.madmax.activities.expenses.ProposedExpenseCommentsFragment) ProposedExpenseCommentsFragment(com.polito.mad17.madmax.activities.expenses.ProposedExpenseCommentsFragment) PendingExpenseDetailFragment(com.polito.mad17.madmax.activities.expenses.PendingExpenseDetailFragment) Bundle(android.os.Bundle) ExpenseDetailFragment(com.polito.mad17.madmax.activities.expenses.ExpenseDetailFragment) PendingExpenseDetailFragment(com.polito.mad17.madmax.activities.expenses.PendingExpenseDetailFragment)

Aggregations

Bundle (android.os.Bundle)1 ExpenseCommentsFragment (com.polito.mad17.madmax.activities.expenses.ExpenseCommentsFragment)1 ExpenseDetailFragment (com.polito.mad17.madmax.activities.expenses.ExpenseDetailFragment)1 PendingExpenseDetailFragment (com.polito.mad17.madmax.activities.expenses.PendingExpenseDetailFragment)1 ProposedExpenseCommentsFragment (com.polito.mad17.madmax.activities.expenses.ProposedExpenseCommentsFragment)1