Search in sources :

Example 1 with ExpenseDetailActivity

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

the class ExpenseDetailActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Intent intent;
    Log.d(TAG, "Clicked item: " + item.getItemId());
    switch(item.getItemId()) {
        case R.id.one:
            Log.d(TAG, "clicked Modify expense");
            intent = new Intent(this, ExpenseEdit.class);
            intent.putExtra("expenseID", expenseID);
            intent.putExtra("EXPENSE_TYPE", "EXPENSE_EDIT");
            startActivity(intent);
            finish();
            return true;
        case R.id.two:
            Log.d(TAG, "clicked Remove expense");
            FirebaseUtils.getInstance().removeExpenseFirebase(expenseID, getApplicationContext());
            finish();
            return true;
        case android.R.id.home:
            Log.d(TAG, "Clicked up button on ExpenseDetailActivity");
            intent = new Intent(this, GroupDetailActivity.class);
            intent.putExtra("groupID", groupID);
            intent.putExtra("userID", userID);
            setResult(RESULT_OK, intent);
            finish();
            return (true);
    }
    return (super.onOptionsItemSelected(item));
}
Also used : GroupDetailActivity(com.polito.mad17.madmax.activities.groups.GroupDetailActivity) Intent(android.content.Intent)

Example 2 with ExpenseDetailActivity

use of com.polito.mad17.madmax.activities.expenses.ExpenseDetailActivity 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

Intent (android.content.Intent)1 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 GroupDetailActivity (com.polito.mad17.madmax.activities.groups.GroupDetailActivity)1