diff --git a/app/src/main/java/com/example/childguard/MainActivity.java b/app/src/main/java/com/example/childguard/MainActivity.java index 76311cf..71f4007 100644 --- a/app/src/main/java/com/example/childguard/MainActivity.java +++ b/app/src/main/java/com/example/childguard/MainActivity.java @@ -110,16 +110,19 @@ public class MainActivity extends AppCompatActivity { { if (v.getItemId() == findViewById(R.id.navigation_home).getId()) { + findViewById(R.id.fab_scan_qr_code).setVisibility(FrameLayout.VISIBLE); getSupportFragmentManager().beginTransaction() .replace(findViewById(R.id.fragmentContainerView).getId(), this.homeFragment) .addToBackStack(null) .commit(); } else if (v.getItemId() == findViewById(R.id.navigation_notification).getId()) { + findViewById(R.id.fab_scan_qr_code).setVisibility(FrameLayout.VISIBLE); getSupportFragmentManager().beginTransaction() .replace(findViewById(R.id.fragmentContainerView).getId(), NotificationFragment.newInstance("test", "test")) .addToBackStack(null) .commit(); } else if (v.getItemId() == findViewById(R.id.navigation_settings).getId()) { + findViewById(R.id.fab_scan_qr_code).setVisibility(FrameLayout.GONE); getSupportFragmentManager().beginTransaction() .replace(findViewById(R.id.fragmentContainerView).getId(), SettingFragment.newInstance()) .addToBackStack(null) @@ -203,9 +206,6 @@ public class MainActivity extends AppCompatActivity { E.apply(); } - HomeFragment fragment = new HomeFragment(); - getSupportFragmentManager().beginTransaction().replace(R.id.fragmentContainerView, fragment).commit(); - homeFragment.onEvent(!isInCar); } }