Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent menu changes #1413

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
Loading