Skip to content

Commit

Permalink
Issue(#476): Items in option menu are not stable
Browse files Browse the repository at this point in the history
  • Loading branch information
karsai1993 committed Mar 14, 2017
1 parent bb5e875 commit d5a8dcf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,31 +103,30 @@ public void onBackStackChanged() {
setMenuCreateCentre(false);
setMenuCreateGroup(true);
}

}
});

}

private void setMenuCreateGroup(boolean visibility) {
private void setMenuCreateGroup(boolean isEnabled) {
if (menu != null) {
//position of mItem_create_new_group is 2
menu.getItem(2).setVisible(visibility);
menu.getItem(2).setEnabled(isEnabled);
}

}

private void setMenuCreateCentre(boolean visibility) {
private void setMenuCreateCentre(boolean isEnabled) {
if (menu != null) {
//position of mItem_create_new_centre is 1
menu.getItem(1).setVisible(visibility);
menu.getItem(1).setEnabled(isEnabled);
}
}

private void setMenuCreateClient(boolean visibility) {
private void setMenuCreateClient(boolean isEnabled) {
if (menu != null) {
//position of mItem_create_new_client is 0
menu.getItem(0).setVisible(visibility);
menu.getItem(0).setEnabled(isEnabled);
}
}

Expand Down Expand Up @@ -273,6 +272,9 @@ public void onBackPressed() {
if (mDrawerLayout != null && mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
mDrawerLayout.closeDrawer(Gravity.LEFT);
} else {
setMenuCreateClient(true);
setMenuCreateCentre(true);
setMenuCreateGroup(true);
super.onBackPressed();
}

Expand Down
19 changes: 19 additions & 0 deletions studio_android-client.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="studio_android-client" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

0 comments on commit d5a8dcf

Please sign in to comment.