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));
}
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;
}
}
Aggregations