+ Data.accountFilter.setValue(savedInstanceState.getString(STATE_ACC_FILTER, null));
+ }
+
+ Data.lastUpdateDate.observe(this, this::updateLastUpdateDisplay);
+
+ findViewById(R.id.btn_no_profiles_add).setOnClickListener(
+ v -> startEditProfileActivity(null));
+
+ findViewById(R.id.btn_add_transaction).setOnClickListener(this::fabNewTransactionClicked);
+
+ findViewById(R.id.nav_new_profile_button).setOnClickListener(
+ v -> startEditProfileActivity(null));
+
+ RecyclerView root = findViewById(R.id.nav_profile_list);
+ if (root == null)
+ throw new RuntimeException("Can't get hold on the transaction value view");
+
+ if (mProfileListAdapter == null)
+ mProfileListAdapter = new ProfilesRecyclerViewAdapter();
+ root.setAdapter(mProfileListAdapter);
+
+ mProfileListAdapter.editingProfiles.observe(this, newValue -> {
+ if (newValue) {
+ profileListHeadMore.setVisibility(View.GONE);
+ profileListHeadCancel.setVisibility(View.VISIBLE);
+ profileListHeadAddProfile.setVisibility(View.VISIBLE);
+ if (drawer.isDrawerOpen(GravityCompat.START)) {
+ profileListHeadMore.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_out));
+ profileListHeadCancel.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_in));
+ profileListHeadAddProfile.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_in));
+ }
+ }
+ else {
+ profileListHeadCancel.setVisibility(View.GONE);
+ profileListHeadMore.setVisibility(View.VISIBLE);
+ profileListHeadAddProfile.setVisibility(View.GONE);
+ if (drawer.isDrawerOpen(GravityCompat.START)) {
+ profileListHeadCancel.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_out));
+ profileListHeadMore.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_in));
+ profileListHeadAddProfile.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_out));
+ }
+ }
+
+ mProfileListAdapter.notifyDataSetChanged();