Skip to content

Commit

Permalink
Merge pull request #1413 from dimagi/persistentMenuChanges
Browse files Browse the repository at this point in the history
Persistent menu changes
  • Loading branch information
shubham1g5 authored Aug 8, 2024
2 parents 03d2fa8 + fb0991a commit 0e14c0f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Holds essential meta data associated with the entity screen
*/
public class EntityScreenContext {
public class EntityScreenContext extends ScreenContext{
private final int mOffSet;
private final String mSearchText;
private final int mSortIndex;
Expand All @@ -21,6 +21,7 @@ public class EntityScreenContext {

public EntityScreenContext(int offset, String searchText, int sortIndex, int casesPerPage,
String[] selectedValues, String detailSelection, boolean isFuzzySearch) {
super(true);
mOffSet = offset;
mSearchText = searchText;
mSortIndex = sortIndex;
Expand All @@ -31,6 +32,11 @@ public EntityScreenContext(int offset, String searchText, int sortIndex, int cas
}

public EntityScreenContext() {
this(true);
}

public EntityScreenContext(boolean respectRelevancy) {
super(respectRelevancy);
mOffSet = 0;
mSearchText = null;
mSortIndex = 0;
Expand Down
14 changes: 14 additions & 0 deletions src/cli/java/org/commcare/util/screen/MenuScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ public boolean handleAutoMenuAdvance(SessionWrapper sessionWrapper, boolean resp
return false;
}

/**
* Checks whether a menu with given menuId exists and is a visible option on menu screen
* @param menuId id of the menu we want to check visiblility for
* @return true if menu exists and is visible, false otherwise
*/
public boolean isMenuVisible(String menuId) {
for (MenuDisplayable menuDisplayable : getMenuDisplayables()) {
if(menuDisplayable.getCommandID().contentEquals(menuId)){
return true;
}
}
return false;
}

class ScreenLogger implements LoggerInterface {

@Override
Expand Down
13 changes: 13 additions & 0 deletions src/cli/java/org/commcare/util/screen/ScreenContext.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.commcare.util.screen;
public class ScreenContext {

private boolean respectRelevancy;

public ScreenContext(boolean respectRelevancy) {
this.respectRelevancy = respectRelevancy;
}

public boolean isRespectRelevancy() {
return respectRelevancy;
}
}

0 comments on commit 0e14c0f

Please sign in to comment.