-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add get table view layout and latest tallies #127
Open
allan-on
wants to merge
15
commits into
master
Choose a base branch
from
get-table-layout-and-latest-tallies
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
23398e7
:construction: Get table view layout programmatically
allan-on d39452c
:construction: Add get latest indicator tallies
allan-on 6af3a4d
:construction: Add sample table indicator display on Dashboard
allan-on a6c9ffd
:construction: Add MultiValueIndicatorTally domain class
allan-on 395efa3
:camera_flash: Update snapshot version
allan-on 2c4ca7f
:white_check_mark: Add & Update ReportIndicatorDao tests
allan-on cd6b5e4
:recycle: Remove unused field
allan-on daa54e3
:white_check_mark: Add TableDisplayFactory test
allan-on 68da73f
:recycle: Clean up code
allan-on 4c81915
:white_check_mark: Update TableDisplayFactoryTest
allan-on 03fa6d6
:white_check_mark: Add getLatestIndicatorTallies() test
allan-on 78d95ee
:recycle: Move factory tests to factory package
allan-on 435d47c
:recycle: Remove unused imports
allan-on ce45d54
:white_check_mark: Add ReportingTableView initialization test
allan-on d052dbe
:white_check_mark: Update View tests
allan-on File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...-reporting/src/main/java/org/smartregister/reporting/domain/MultiValueIndicatorTally.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.smartregister.reporting.domain; | ||
|
||
import java.util.Date; | ||
import java.util.Map; | ||
|
||
public class MultiValueIndicatorTally extends IndicatorTally { | ||
|
||
private Map<String, String> multiValuesMap; | ||
|
||
public MultiValueIndicatorTally(Long id, int count, String indicatorCode, Date createdAt, Map<String, String> multiResults) { | ||
super(id, count, indicatorCode, createdAt); | ||
this.multiValuesMap = multiResults; | ||
} | ||
|
||
public MultiValueIndicatorTally() { | ||
} | ||
|
||
public Map<String, String> getMultiValuesMap() { | ||
return multiValuesMap; | ||
} | ||
|
||
public void setMultiValuesMap(Map<String, String> multiValuesMap) { | ||
this.multiValuesMap = multiValuesMap; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
opensrp-reporting/src/main/java/org/smartregister/reporting/domain/TabularVisualization.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.smartregister.reporting.domain; | ||
|
||
import java.util.List; | ||
|
||
public class TabularVisualization extends ReportingIndicatorVisualization { | ||
|
||
private int titleLabelStringResource; | ||
private List<String> tableHeaderList; | ||
private List<String> tableDataList; | ||
private boolean tableHeaderHidden; | ||
|
||
public TabularVisualization(int titleLabelStringResource, List<String> tableHeaderList, List<String> tableDataList, boolean tableHeaderHidden) { | ||
this.titleLabelStringResource = titleLabelStringResource; | ||
this.tableHeaderList = tableHeaderList; | ||
this.tableDataList = tableDataList; | ||
this.tableHeaderHidden = tableHeaderHidden; | ||
} | ||
|
||
public int getTitleLabelStringResource() { | ||
return titleLabelStringResource; | ||
} | ||
|
||
public void setTitleLabelStringResource(int titleLabelStringResource) { | ||
this.titleLabelStringResource = titleLabelStringResource; | ||
} | ||
|
||
public List<String> getTableHeaderList() { | ||
return tableHeaderList; | ||
} | ||
|
||
public void setTableHeaderList(List<String> tableHeaderList) { | ||
this.tableHeaderList = tableHeaderList; | ||
} | ||
|
||
public List<String> getTableDataList() { | ||
return tableDataList; | ||
} | ||
|
||
public void setTableDataList(List<String> tableDataList) { | ||
this.tableDataList = tableDataList; | ||
} | ||
|
||
public boolean isTableHeaderHidden() { | ||
return tableHeaderHidden; | ||
} | ||
|
||
public void setTableHeaderHidden(boolean tableHeaderHidden) { | ||
this.tableHeaderHidden = tableHeaderHidden; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
opensrp-reporting/src/main/java/org/smartregister/reporting/factory/TableDisplayFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.smartregister.reporting.factory; | ||
|
||
import android.content.Context; | ||
import android.graphics.Typeface; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.widget.LinearLayout; | ||
import android.widget.TextView; | ||
|
||
import androidx.core.content.ContextCompat; | ||
|
||
import org.smartregister.reporting.R; | ||
import org.smartregister.reporting.domain.ReportingIndicatorVisualization; | ||
import org.smartregister.reporting.domain.TabularVisualization; | ||
import org.smartregister.reporting.view.TableView; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class TableDisplayFactory implements IndicatorVisualisationFactory { | ||
|
||
@Override | ||
public View getIndicatorView(ReportingIndicatorVisualization visualization, Context context) { | ||
LinearLayout rootLayout = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.table_view_layout, null); | ||
TextView tableTitle = rootLayout.findViewById(R.id.tableViewTitle); | ||
TableView tableView = rootLayout.findViewById(R.id.tableView); | ||
|
||
TabularVisualization tabularVisualization = (TabularVisualization) visualization; | ||
|
||
tableTitle.setText(tabularVisualization.getTitleLabelStringResource()); | ||
tableView.setTableData(tabularVisualization.getTableHeaderList(), tabularVisualization.getTableDataList(), new ArrayList<>(), null); | ||
tableView.setHeaderTextStyle(Typeface.BOLD); | ||
tableView.setRowBorderHidden(false); | ||
tableView.setBorderColor(ContextCompat.getColor(context, R.color.light_grey)); // Default | ||
tableView.setTableHeaderHidden(tabularVisualization.isTableHeaderHidden()); | ||
return rootLayout; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
opensrp-reporting/src/main/java/org/smartregister/reporting/view/ReportingTableView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.smartregister.reporting.view; | ||
|
||
import static org.smartregister.reporting.util.ReportingUtil.getIndicatorView; | ||
|
||
import android.content.Context; | ||
import android.view.View; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import org.smartregister.reporting.contract.ReportContract; | ||
import org.smartregister.reporting.domain.TabularVisualization; | ||
import org.smartregister.reporting.factory.TableDisplayFactory; | ||
|
||
public class ReportingTableView implements ReportContract.IndicatorView{ | ||
|
||
private Context context; | ||
private TableDisplayFactory tableDisplayFactory; | ||
private TabularVisualization tabularVisualization; | ||
|
||
public ReportingTableView(Context context, TabularVisualization visualization) { | ||
this.context = context; | ||
this.tabularVisualization = visualization; | ||
tableDisplayFactory = new TableDisplayFactory(); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public View createView() { | ||
return getIndicatorView(this.tabularVisualization, tableDisplayFactory, context); | ||
|
||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to update the snapshot version for tagging and snapshot release