use of org.eyeseetea.malariacare.strategies.DashboardActivityStrategy in project pictureapp by EyeSeeTea.
the class DashboardActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate");
super.onCreate(savedInstanceState);
handler = new Handler(Looper.getMainLooper());
mDashboardActivityStrategy = new DashboardActivityStrategy();
dashboardActivity = this;
setContentView(R.layout.tab_dashboard);
Survey.removeInProgress();
if (savedInstanceState == null) {
initImprove();
initMonitor();
if (GradleVariantConfig.isStockFragmentActive()) {
initStock();
}
initAssess();
}
initTabHost(savedInstanceState);
/* set tabs in order */
LayoutUtils.setTabHosts(this);
LayoutUtils.setTabDivider(this);
//set the tabs background as transparent
setTabsBackgroundColor(R.color.tab_unpressed_background);
//set first tab as selected:
tabHost.getTabWidget().getChildAt(0).setBackgroundColor(getResources().getColor(R.color.tab_pressed_background));
tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
@Override
public void onTabChanged(String tabId) {
/** If current tab is android */
//set the tabs background as transparent
setTabsBackgroundColor(R.color.tab_unpressed_background);
//If change of tab from surveyFragment or FeedbackFragment they could be closed.
if (isSurveyFragmentActive()) {
onSurveyBackPressed();
}
if (isReviewFragmentActive()) {
exitReviewOnChangeTab(null);
}
if (tabId.equalsIgnoreCase(getResources().getString(R.string.tab_tag_assess))) {
if (!isReadOnly) {
unsentFragment.reloadData();
}
unsentFragment.reloadHeader(dashboardActivity);
} else if (tabId.equalsIgnoreCase(getResources().getString(R.string.tab_tag_improve))) {
sentFragment.reloadData();
sentFragment.reloadHeader(dashboardActivity);
} else if (tabId.equalsIgnoreCase(getResources().getString(R.string.tab_tag_stock))) {
mDashboardActivityStrategy.reloadStockFragment(dashboardActivity);
} else if (tabId.equalsIgnoreCase(getResources().getString(R.string.tab_tag_monitor))) {
monitorFragment.reloadData();
monitorFragment.reloadHeader(dashboardActivity);
}
tabHost.getCurrentTabView().setBackgroundColor(getResources().getColor(R.color.tab_pressed_background));
}
});
// init tabHost
for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) {
tabHost.getTabWidget().getChildAt(i).setFocusable(false);
}
getSurveysFromService();
}
use of org.eyeseetea.malariacare.strategies.DashboardActivityStrategy in project pictureapp by EyeSeeTea.
the class DashboardActivity method closeReceiptBalanceFragment.
public void closeReceiptBalanceFragment() {
DashboardActivityStrategy mDashboardActivityStrategy = new DashboardActivityStrategy();
mDashboardActivityStrategy.showStockFragment(this, false);
tabHost.getTabWidget().setVisibility(View.VISIBLE);
}
Aggregations