From 6a056d406fab28f63ce61a411ad63a98550ce557 Mon Sep 17 00:00:00 2001 From: Chiu Yue Chun Date: Sat, 6 Jun 2015 15:40:35 +0800 Subject: [PATCH] show login button only at login tab --- .../java/com/loopbook/cuhk_loopbook/MainActivity.java | 10 ++++++++++ app/src/main/res/menu/menu_main.xml | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/loopbook/cuhk_loopbook/MainActivity.java b/app/src/main/java/com/loopbook/cuhk_loopbook/MainActivity.java index 8559f35..3cd854d 100644 --- a/app/src/main/java/com/loopbook/cuhk_loopbook/MainActivity.java +++ b/app/src/main/java/com/loopbook/cuhk_loopbook/MainActivity.java @@ -145,12 +145,22 @@ public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransac case 0: break; case 1: + View button = findViewById(R.id.action_login); + button.setVisibility(View.VISIBLE); break; } } @Override public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { + switch (tab.getPosition()) { + case 0: + break; + case 1: + View button = findViewById(R.id.action_login); + button.setVisibility(View.GONE); + break; + } } @Override diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index bc775c6..ed866cd 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -1,9 +1,9 @@ + -