Skip to content

Commit

Permalink
show login button only at login tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Chiu Yue Chun committed Jun 6, 2015
1 parent c9a3e03 commit 6a056d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions app/src/main/java/com/loopbook/cuhk_loopbook/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/menu/menu_main.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
<item android:id="@+id/action_login" android:title="@string/menu_login"
android:orderInCategory="100" app:showAsAction="ifRoom" />
<item android:id="@+id/action_settings" android:title="@string/menu_setting_label"
android:icon="@drawable/ic_menu_login"
android:orderInCategory="100" app:showAsAction="ifRoom" />
<item android:id="@+id/action_login" android:title="@string/menu_login"
android:orderInCategory="100" app:showAsAction="ifRoom" />
</menu>

0 comments on commit 6a056d4

Please sign in to comment.