@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_CANCELED) return; refresh(); setupActionBarNavigation(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_transactions); ViewPager pager = (ViewPager) findViewById(R.id.pager); mTitlePageIndicator = (TitlePageIndicator) findViewById(R.id.titles); mSectionHeaderTransactions = (TextView) findViewById(R.id.section_header_transactions); if (sLastTitleColor == -1) // if this is first launch of app. Previous launches would have set the color already sLastTitleColor = getResources().getColor(R.color.title_green); mAccountId = getIntent().getLongExtra(UxArgument.SELECTED_ACCOUNT_ID, -1); mAccountsDbAdapter = new AccountsDbAdapter(this); setupActionBarNavigation(); if (getIntent().getAction().equals(Intent.ACTION_INSERT_OR_EDIT)) { pager.setVisibility(View.GONE); mTitlePageIndicator.setVisibility(View.GONE); initializeCreateOrEditTransaction(); } else { // load the transactions list mSectionHeaderTransactions.setVisibility(View.GONE); PagerAdapter pagerAdapter = new AccountViewPagerAdapter(getSupportFragmentManager()); pager.setAdapter(pagerAdapter); mTitlePageIndicator.setViewPager(pager); pager.setCurrentItem(INDEX_TRANSACTIONS_FRAGMENT); } // done creating, activity now running mActivityRunning = true; }