Skip to content

Commit

Permalink
Merge pull request #35 from OpenSRP/new_dashboard
Browse files Browse the repository at this point in the history
New dashboard
  • Loading branch information
mahmud6390 authored Nov 22, 2020
2 parents 6dba727 + 3a693b1 commit 22782d7
Show file tree
Hide file tree
Showing 69 changed files with 3,711 additions and 390 deletions.
6 changes: 3 additions & 3 deletions opensrp-brac-hnpp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ android {
buildConfigField "String[]", "ALLOWED_LOCATION_LEVELS", '{"MOH Jhpiego Facility Name" , "Village"}'
buildConfigField "String", 'DEFAULT_LOCATION', '"Village"'
buildConfigField "boolean", 'SUPPORT_QR', 'false'
buildConfigField "int", "DATABASE_VERSION", '25'
buildConfigField "int", "DATABASE_VERSION", '26'
buildConfigField "int", "DATA_SYNC_DURATION_MINUTES", '10'
buildConfigField "long", "MAX_SERVER_TIME_DIFFERENCE", "1800000l"
buildConfigField "boolean", "TIME_CHECK", "false"
Expand Down Expand Up @@ -108,7 +108,7 @@ android {

training{
versionCode 27
versionName "3.0.1"
versionName "3.0.2"
dimension = 'baseDimension'
applicationIdSuffix ".training"
buildConfigField "boolean", 'IS_TRAINING', 'true'
Expand All @@ -117,7 +117,7 @@ android {
}
normal{
versionCode 28
versionName "1.3.2"
versionName "1.3.3"
dimension = 'baseDimension'
buildConfigField "boolean", 'IS_TRAINING', 'false'
// buildConfigField "String", 'opensrp_url_training', '"http://mhealth.brac.net:8080/opensrp/"'
Expand Down
3 changes: 2 additions & 1 deletion opensrp-brac-hnpp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
android:name=".activity.ForceSyncActivity"
android:screenOrientation="portrait"
android:theme="@style/HNPPTheme.NoActionBar" />
<activity android:name=".activity.DashBoardActivity" android:screenOrientation="portrait"
<activity android:name=".activity.NewDashBoardActivity" android:screenOrientation="portrait"
android:theme="@style/HNPPTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize"/>
<activity android:name=".activity.SimprintsIdentityActivity" android:screenOrientation="portrait"
Expand Down Expand Up @@ -248,6 +248,7 @@
<service android:name="org.smartregister.sync.intent.PlanIntentService" />
<service android:name="org.smartregister.brac.hnpp.sync.intent.PullHouseholdIdIntentService"/>
<service android:name=".service.SSLocationFetchIntentService" />
<service android:name=".service.TargetFetchIntentService" />
<service android:name=".service.HomeVisitIntentService" />
<service android:name=".service.VisitLogIntentService" />
<service android:name=".service.HnppPncCloseDateIntent" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.smartregister.brac.hnpp.repository.RiskDetailsRepository;
import org.smartregister.brac.hnpp.repository.SSLocationRepository;
import org.smartregister.brac.hnpp.repository.HouseholdIdRepository;
import org.smartregister.brac.hnpp.repository.TargetVsAchievementRepository;
import org.smartregister.brac.hnpp.sync.HnppClientProcessor;
import org.smartregister.brac.hnpp.sync.HnppSyncConfiguration;
import org.smartregister.brac.hnpp.utils.HNPPApplicationUtils;
Expand Down Expand Up @@ -89,6 +90,7 @@ public class HnppApplication extends CoreChwApplication implements CoreApplicati
private HnppVisitLogRepository hnppVisitLogRepository;
private static SSLocationRepository locationRepository;
private static RiskDetailsRepository riskDetailsRepository;
private static TargetVsAchievementRepository targetVsAchievementRepository;
private static CommonFtsObject commonFtsObject = null;
private EventClientRepository eventClientRepository;
@Override
Expand Down Expand Up @@ -279,6 +281,12 @@ public static RiskDetailsRepository getRiskDetailsRepository() {
}
return riskDetailsRepository;
}
public static TargetVsAchievementRepository getTargetRepository() {
if ( targetVsAchievementRepository == null) {
targetVsAchievementRepository = new TargetVsAchievementRepository(getInstance().getRepository());
}
return targetVsAchievementRepository;
}
public void setOpenSRPUrl() {
AllSharedPreferences preferences = Utils.getAllSharedPreferences();
boolean isRelease = HnppConstants.isReleaseBuild();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.smartregister.brac.hnpp.R;
import org.smartregister.brac.hnpp.job.PullHouseholdIdsServiceJob;
import org.smartregister.brac.hnpp.job.SSLocationFetchJob;
import org.smartregister.brac.hnpp.job.TargetFetchJob;
import org.smartregister.brac.hnpp.location.SaveDistrictTask;
import org.smartregister.brac.hnpp.presenter.LoginPresenter;
import org.smartregister.brac.hnpp.repository.DistrictListRepository;
Expand Down Expand Up @@ -73,10 +74,10 @@ protected void onCreate(Bundle savedInstanceState) {
passwordText = findViewById(R.id.login_password_edit_text);
userNameView = findViewById(R.id.login_user_name_view);
passwordView = findViewById(R.id.login_password_view);
if(BuildConfig.DEBUG){
userNameText.setText("testsk");
passwordText.setText("brac2019");
}
// if(BuildConfig.DEBUG){
// userNameText.setText("testsk");
// passwordText.setText("brac2019");
// }

userNameText.addTextChangedListener(new TextWatcher() {
@Override
Expand Down Expand Up @@ -377,6 +378,7 @@ private void getToFamilyList(boolean remote) {
try{
PullHouseholdIdsServiceJob.scheduleJobImmediately(PullHouseholdIdsServiceJob.TAG);
SSLocationFetchJob.scheduleJobImmediately(SSLocationFetchJob.TAG);
TargetFetchJob.scheduleJobImmediately(TargetFetchJob.TAG);
}catch (Exception e){

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
package org.smartregister.brac.hnpp.activity;

import android.os.Handler;
import android.support.design.widget.TabLayout;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.github.ybq.android.spinkit.style.FadingCircle;

import org.smartregister.brac.hnpp.R;
import org.smartregister.brac.hnpp.fragment.BaseDashBoardFragment;
import org.smartregister.brac.hnpp.fragment.CountSummeryDashBoardFragment;
import org.smartregister.brac.hnpp.fragment.DailyServiceTargetAchievementFragment;
import org.smartregister.brac.hnpp.fragment.DailyTargetAchievementFragment;
import org.smartregister.brac.hnpp.fragment.ForumTargetAchievementFragment;
import org.smartregister.brac.hnpp.fragment.MonthlyServiceTargetAchievementFragment;
import org.smartregister.brac.hnpp.fragment.MonthlyTargetAchievementFragment;
import org.smartregister.brac.hnpp.fragment.WorkSummeryDashBoardFragment;
import org.smartregister.brac.hnpp.utils.HnppConstants;
import org.smartregister.view.activity.SecuredActivity;

public class NewDashBoardActivity extends SecuredActivity {
private ImageView refreshIndicatorsIcon;
private ProgressBar refreshIndicatorsProgressBar;
private TextView titleText;
private BaseDashBoardFragment dashBoardFragment;
private TabLayout tabs;

@Override
protected void onCreation() {
setContentView(R.layout.activity_dashboard);
setUpView();
loadCountSummeryFragment(0);

}
private void loadCountSummeryFragment(int position){
switch (position){
case 0:
dashBoardFragment = new CountSummeryDashBoardFragment();
break;
case 1:
dashBoardFragment = new WorkSummeryDashBoardFragment();
break;
case 2:
dashBoardFragment = new DailyTargetAchievementFragment();
break;
case 3:
dashBoardFragment = new MonthlyTargetAchievementFragment();
break;
case 4:
dashBoardFragment = new DailyServiceTargetAchievementFragment();
break;
case 5:
dashBoardFragment = new MonthlyServiceTargetAchievementFragment();
break;
case 6:
dashBoardFragment = new ForumTargetAchievementFragment();
break;
}

FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction =
fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.container, dashBoardFragment);
fragmentTransaction.commit();
}
private void setUpView() {
refreshIndicatorsIcon = findViewById(R.id.refreshIndicatorsIcon);
refreshIndicatorsProgressBar = findViewById(R.id.refreshIndicatorsPB);
// Initial view until we determined by the refresh function
refreshIndicatorsProgressBar.setVisibility(View.GONE);
titleText = findViewById(R.id.textview_detail_two);

if(!HnppConstants.isReleaseBuild()){
findViewById(R.id.toolbar).setBackgroundResource(R.color.test_app_color);

}else{
findViewById(R.id.toolbar).setBackgroundResource(org.smartregister.family.R.color.customAppThemeBlue);

}

refreshIndicatorsIcon.setOnClickListener(view -> {
refreshIndicatorsIcon.setVisibility(View.GONE);
FadingCircle circle = new FadingCircle();
refreshIndicatorsProgressBar.setIndeterminateDrawable(circle);
refreshIndicatorsProgressBar.setVisibility(View.VISIBLE);
new Handler().postDelayed(() -> dashBoardFragment.refreshData(() -> {
refreshIndicatorsProgressBar.setVisibility(View.GONE);
refreshIndicatorsIcon.setVisibility(View.VISIBLE);
}),500);

});
tabs = findViewById(R.id.tabs);
tabs.addTab(tabs.newTab().setText("জনসংখ্যা সারসংক্ষেপ"));
tabs.addTab(tabs.newTab().setText("কার্যক্রম সারসংক্ষেপ"));
tabs.addTab(tabs.newTab().setText("দৈনিক পরিদর্শন"));
tabs.addTab(tabs.newTab().setText("মাসিক পরিদর্শন"));
tabs.addTab(tabs.newTab().setText("দৈনিক সেবা"));
tabs.addTab(tabs.newTab().setText("মাসিক সেবা"));
tabs.addTab(tabs.newTab().setText("ফোরাম"));
//tabs.addTab(tabs.newTab().setText("স্টক"));
tabs.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
loadCountSummeryFragment(tabs.getSelectedTabPosition());

}

@Override
public void onTabUnselected(TabLayout.Tab tab) {

}

@Override
public void onTabReselected(TabLayout.Tab tab) {

}
});
}
@Override
protected void onResumption() {
if(refreshIndicatorsProgressBar !=null && refreshIndicatorsProgressBar.getVisibility() == View.VISIBLE){
refreshIndicatorsProgressBar.setVisibility(View.GONE);
}

}
public void updateTitle(String title){
titleText.setText(title);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.AppCompatTextView;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
Expand All @@ -22,22 +18,15 @@
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

import com.github.ybq.android.spinkit.style.FadingCircle;
import com.simprints.libsimprints.Constants;
import com.simprints.libsimprints.Identification;
import com.simprints.libsimprints.Tier;

import org.smartregister.brac.hnpp.R;
import org.smartregister.brac.hnpp.adapter.IdentityAdapter;
import org.smartregister.brac.hnpp.fragment.HnppDashBoardFragment;
import org.smartregister.brac.hnpp.location.SSLocationHelper;
import org.smartregister.brac.hnpp.location.SSLocations;
import org.smartregister.brac.hnpp.location.SSModel;
Expand All @@ -46,24 +35,16 @@
import org.smartregister.brac.hnpp.utils.IdentityModel;
import org.smartregister.chw.core.utils.ChildDBConstants;
import org.smartregister.chw.core.utils.CoreConstants;
import org.smartregister.commonregistry.CommonPersonObject;
import org.smartregister.commonregistry.CommonPersonObjectClient;
import org.smartregister.commonregistry.CommonRepository;
import org.smartregister.family.util.AppExecutors;
import org.smartregister.family.util.DBConstants;
import org.smartregister.family.util.Utils;
import org.smartregister.simprint.SimPrintsConstantHelper;
import org.smartregister.simprint.SimPrintsIdentification;
import org.smartregister.simprint.SimPrintsIdentifyActivity;
import org.smartregister.simprint.SimPrintsRegistration;
import org.smartregister.view.activity.SecuredActivity;

import java.util.ArrayList;

import static com.simprints.libsimprints.Tier.TIER_1;
import static com.simprints.libsimprints.Tier.TIER_2;
import static com.simprints.libsimprints.Tier.TIER_3;
import static com.simprints.libsimprints.Tier.TIER_4;
import static org.smartregister.brac.hnpp.utils.HnppConstants.MEMBER_ID_SUFFIX;

public class SimprintsIdentityActivity extends SecuredActivity implements View.OnClickListener {
Expand Down
Loading

0 comments on commit 22782d7

Please sign in to comment.