Skip to content

Commit

Permalink
WD| Fix Start Registers: casting Location view to Registers activity #4
Browse files Browse the repository at this point in the history
  • Loading branch information
baksosapi committed Nov 16, 2017
1 parent 4fd9b9c commit b7194f2
Show file tree
Hide file tree
Showing 25 changed files with 86 additions and 122 deletions.
8 changes: 8 additions & 0 deletions bidan-cloudant/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ android {
}

debug {
resValue "string", 'opensrp_url', '"http://192.168.1.253:8080/opensrp"'
resValue "string", 'debug_mode', '"ON"'
buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '250'
buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '100'
buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2'
buildConfigField "int", "DATABASE_VERSION", '9'
buildConfigField "long", "MAX_SERVER_TIME_DIFFERENCE", "1800000l"
buildConfigField "boolean", "TIME_CHECK", "false"
testCoverageEnabled true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
import com.flurry.android.FlurryAgent;

import org.smartregister.Context;
import org.smartregister.bidan_cloudant.R;
import org.smartregister.bidan_cloudant.libs.FlurryFacade;
import org.smartregister.commonregistry.AllCommonsRepository;
import org.smartregister.commonregistry.CommonPersonObject;
import org.smartregister.commonregistry.CommonPersonObjectClient;
import org.smartregister.repository.DetailsRepository;
import org.smartregister.bidan_cloudant.R;
//import org.smartregister.bidan_cloudant.face.camera.SmartShutterActivity;
import org.smartregister.view.activity.DrishtiApplication;

import java.io.File;
Expand All @@ -31,6 +30,8 @@
import util.ImageFetcher;
import util.formula.Support;

//import org.smartregister.bidan_cloudant.face.camera.SmartShutterActivity;

/**
* Created by Iq on 09/06/16.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@

import org.json.JSONObject;
import org.smartregister.Context;
import org.smartregister.bidan_cloudant.R;
import org.smartregister.bidan_cloudant.controller.BidanNavigationController;
import org.smartregister.bidan_cloudant.utils.AllConstantsINA;
import org.smartregister.cursoradapter.SmartRegisterQueryBuilder;
import org.smartregister.enketo.view.fragment.DisplayFormFragment;
import org.smartregister.event.Listener;
import org.smartregister.service.PendingFormSubmissionService;
import org.smartregister.bidan_cloudant.R;
import org.smartregister.view.activity.SecuredActivity;
import org.smartregister.view.contract.HomeContext;
import org.smartregister.view.controller.NativeAfterANMDetailsFetchListener;
import org.smartregister.view.controller.NativeUpdateANMDetailsTask;
import org.smartregister.enketo.view.fragment.DisplayFormFragment;

import java.text.SimpleDateFormat;
import java.util.Date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import android.widget.TextView;

import org.smartregister.Context;
import org.smartregister.bidan_cloudant.R;
import org.smartregister.commonregistry.CommonPersonObjectClient;
import org.smartregister.cursoradapter.SmartRegisterQueryBuilder;
import org.smartregister.bidan_cloudant.R;

import java.util.Date;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
Expand Down Expand Up @@ -161,8 +160,8 @@ protected void onCreate(Bundle savedInstanceState) {
TextView highRiskPostPartumDistosia = (TextView) findViewById(R.id.txt_highRiskPostPartumDistosia);
TextView txt_highRiskHIVAIDS = (TextView) findViewById(R.id.txt_highRiskHIVAIDS);

ImageView heart_bpm = (ImageView) findViewById(R.id.icon_device);
heart_bpm.setVisibility(View.VISIBLE);
// ImageView heart_bpm = (ImageView) findViewById(R.id.icon_device);
// heart_bpm.setVisibility(View.VISIBLE);

ImageButton back = (ImageButton) findViewById(R.id.btn_back_to_home);
back.setOnClickListener(new View.OnClickListener() {
Expand All @@ -178,7 +177,7 @@ public void onClick(View v) {
}
});

ImageView device = (ImageView) findViewById(R.id.icon_device);
// ImageView device = (ImageView) findViewById(R.id.icon_device);
// device.setOnClickListener(bpmListener);

DetailsRepository detailsRepository = org.smartregister.Context.getInstance().detailsRepository();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import android.widget.ImageView;
import android.widget.TextView;

import com.flurry.android.FlurryAgent;

import org.smartregister.Context;
import org.smartregister.bidan_cloudant.R;
import org.smartregister.bidan_cloudant.libs.FlurryFacade;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@

import com.flurry.android.FlurryAgent;

import org.json.JSONException;
import org.json.JSONObject;
import org.smartregister.bidan_cloudant.R;
import org.smartregister.bidan_cloudant.fragment.ChildSmartRegisterFragment;
import org.smartregister.bidan_cloudant.pageradapter.BaseRegisterActivityPagerAdapter;
import org.smartregister.bidan_cloudant.service.SaveService;
import org.smartregister.cursoradapter.SmartRegisterQueryBuilder;
import org.smartregister.domain.form.FieldOverrides;
import org.smartregister.domain.form.FormSubmission;
import org.smartregister.enketo.listener.DisplayFormListener;
import org.smartregister.enketo.view.fragment.DisplayFormFragment;
import org.smartregister.provider.SmartRegisterClientsProvider;
import org.smartregister.bidan_cloudant.R;
import org.smartregister.sync.ClientProcessor;
import org.smartregister.view.activity.SecuredNativeSmartRegisterActivity;
import org.smartregister.view.dialog.DialogOption;
import org.smartregister.view.dialog.LocationSelectorDialogFragment;
import org.smartregister.view.dialog.OpenFormOption;
import org.smartregister.enketo.view.fragment.DisplayFormFragment;
import org.smartregister.view.fragment.SecuredNativeSmartRegisterFragment;
import org.smartregister.view.viewpager.OpenSRPViewPager;
import org.json.JSONException;
import org.json.JSONObject;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.flurry.android.FlurryAgent;

import org.json.JSONObject;
import org.smartregister.Context;
import org.smartregister.bidan_cloudant.R;
import org.smartregister.bidan_cloudant.libs.FlurryFacade;
Expand All @@ -27,11 +24,9 @@
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import util.ImageFetcher;
import util.Utils;
import util.formula.Support;

import static org.smartregister.util.StringUtil.humanize;
import static org.smartregister.util.StringUtil.humanizeAndDoUPPERCASE;
Expand Down Expand Up @@ -89,8 +84,8 @@ protected void onCreate(Bundle savedInstanceState) {
// TextView risk8 = (TextView) findViewById(R.id.txt_risk8);

// ImageView heart_bpm = (ImageView) findViewById(R.id.icon_device);
ImageView device = (ImageView) findViewById(R.id.icon_device);
device.setVisibility(View.VISIBLE);
// ImageView device = (ImageView) findViewById(R.id.icon_device);
// device.setVisibility(View.VISIBLE);
// device.setOnClickListener(bpmListener);

//detail data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,26 @@
import android.widget.TextView;

import org.smartregister.Context;
import org.smartregister.bidan_cloudant.application.BidanApplication;
import org.smartregister.bidan_cloudant.BuildConfig;
import org.smartregister.bidan_cloudant.R;
import org.smartregister.bidan_cloudant.application.BidanApplication;
import org.smartregister.bidan_cloudant.utils.Config;
import org.smartregister.domain.LoginResponse;
import org.smartregister.domain.Response;
import org.smartregister.domain.ResponseStatus;
import org.smartregister.event.Listener;
//import org.smartregister.bidan_cloudant.lib.ErrorReportingFacade;
import org.smartregister.repository.AllSharedPreferences;
import org.smartregister.service.UserService;
import org.smartregister.util.Log;
import org.smartregister.view.BackgroundAction;
import org.smartregister.view.LockingBackgroundTask;
import org.smartregister.view.ProgressIndicator;
import org.smartregister.view.activity.DrishtiApplication;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

//import io.fabric.sdk.android.Fabric;
import util.uniqueIdGenerator.Generator;

import static android.preference.PreferenceManager.getDefaultSharedPreferences;
Expand All @@ -59,6 +56,9 @@
import static org.smartregister.util.Log.logError;
import static org.smartregister.util.Log.logVerbose;

//import org.smartregister.bidan_cloudant.lib.ErrorReportingFacade;
//import io.fabric.sdk.android.Fabric;

public class LoginActivity extends AppCompatActivity {
private static final String TAG = LoginActivity.class.getSimpleName();
private Context context;
Expand Down Expand Up @@ -106,25 +106,25 @@ public void onCreate(Bundle savedInstanceState) {

setLanguage();

debugApp();

if (BuildConfig.DEBUG) {
debugApp();
}
}

private void debugApp() {
Config config = new Config();
String uname = "demo1", pwd = "Satu2345";
String uname = null, pwd = null;
try {
uname = config.getCredential("uname", getApplicationContext());
pwd = config.getCredential("pwd", getApplicationContext());
pwd = config.getCredential("pwd", getApplicationContext());
} catch (IOException e) {
e.printStackTrace();
}

LayoutInflater layoutInflater = getLayoutInflater();
View view = layoutInflater.inflate(R.layout.login, null);
if (context.userService().hasARegisteredUser()){
localLoginWith(uname, pwd);
//localLogin(view, uname, pwd);
if (BidanApplication.getInstance().context().userService().hasARegisteredUser()) {
localLogin(view, uname, pwd);
} else {
remoteLogin(view, uname, pwd);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
import android.content.Intent;
import android.content.res.Configuration;

import org.smartregister.Context;
import org.smartregister.CoreLibrary;
import org.smartregister.bidan_cloudant.activity.LoginActivity;
import org.smartregister.bidan_cloudant.libs.FlurryFacade;
import org.smartregister.bidan_cloudant.repository.BidanRepository;
import org.smartregister.Context;
import org.smartregister.CoreLibrary;
import org.smartregister.commonregistry.CommonFtsObject;
import org.smartregister.repository.Repository;
import org.smartregister.sync.DrishtiSyncScheduler;
import org.smartregister.view.activity.DrishtiApplication;
import org.smartregister.view.receiver.SyncBroadcastReceiver;

import java.util.Locale;

import static org.smartregister.util.Log.logError;
import static org.smartregister.util.Log.logInfo;

import java.util.Locale;

/**
* Created by koros on 1/22/16.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@
import android.content.SharedPreferences;
import android.net.Uri;


//import org.ei.opensrp.vaksinator.test.TestSmartRegisterActivity;
import org.json.JSONObject;
import org.smartregister.bidan_cloudant.R;
import org.smartregister.bidan_cloudant.activity.KANCSmartRegisterActivity;
import org.smartregister.bidan_cloudant.activity.KChildSmartRegisterActivity;
import org.smartregister.bidan_cloudant.R;
import org.smartregister.bidan_cloudant.activity.KFPSmartRegisterActivity;
import org.smartregister.bidan_cloudant.activity.KMotherSmartRegisterActivity;
import org.smartregister.bidan_cloudant.activity.KPNCSmartRegisterActivity;
import org.smartregister.view.controller.ANMController;
import org.json.JSONObject;


import static android.preference.PreferenceManager.getDefaultSharedPreferences;

//import org.ei.opensrp.vaksinator.test.TestSmartRegisterActivity;

public class BidanNavigationController extends org.smartregister.view.controller.NavigationController {
private Activity activity;
private ANMController anmController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import org.smartregister.Context;
import org.smartregister.bidan_cloudant.R;
import org.smartregister.bidan_cloudant.activity.KANCDetailActivity;
import org.smartregister.bidan_cloudant.activity.KChildSmartRegisterActivity;
import org.smartregister.bidan_cloudant.activity.KANCSmartRegisterActivity;
import org.smartregister.bidan_cloudant.activity.LoginActivity;
import org.smartregister.bidan_cloudant.libs.FlurryFacade;
import org.smartregister.bidan_cloudant.option.KICommonObjectFilterOption;
import org.smartregister.bidan_cloudant.option.ANCServiceModeOption;
import org.smartregister.bidan_cloudant.option.KICommonObjectFilterOption;
import org.smartregister.bidan_cloudant.provider.ANCSmartClientsProvider;
import org.smartregister.commonregistry.CommonPersonObjectClient;
import org.smartregister.commonregistry.CommonPersonObjectController;
Expand Down Expand Up @@ -181,7 +181,7 @@ protected SmartRegisterClientsProvider clientsProvider() {
}

private DialogOption[] getEditOptions() {
return ((KChildSmartRegisterActivity)getActivity()).getEditOptions();
return ((KANCSmartRegisterActivity)getActivity()).getEditOptions();
}

@Override
Expand Down Expand Up @@ -314,7 +314,7 @@ public void startRegistration() {

ft.addToBackStack(null);
LocationSelectorDialogFragment
.newInstance((KChildSmartRegisterActivity) getActivity(), new EditDialogOptionModel(), context().anmLocationController().get(), "registrasi_ibu")
.newInstance((KANCSmartRegisterActivity) getActivity(), new EditDialogOptionModel(), context().anmLocationController().get(), "registrasi_ibu")
.show(ft, locationDialogTAG);
}

Expand Down Expand Up @@ -640,7 +640,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data){
if (requestCode == 2 ) {

if (resultCode != 0) {
Intent myIntent = new Intent(getActivity(), KChildSmartRegisterActivity.class);
Intent myIntent = new Intent(getActivity(), KANCSmartRegisterActivity.class);
if (data != null) {
myIntent.putExtra("org.smartregister.indonesia.face.face_mode", true);
myIntent.putExtra("org.smartregister.indonesia.face.base_id", data.getStringExtra("org.smartregister.indonesia.face.base_id"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

import com.google.common.base.Strings;

import org.smartregister.domain.form.FieldOverrides;
import org.smartregister.view.activity.SecuredNativeSmartRegisterActivity;
import org.smartregister.view.dialog.DialogOption;
import org.smartregister.view.dialog.DialogOptionModel;
import org.json.JSONObject;
import org.opensrp.api.domain.Location;
import org.opensrp.api.util.EntityUtils;
import org.opensrp.api.util.LocationTree;
import org.smartregister.domain.form.FieldOverrides;
import org.smartregister.view.activity.SecuredNativeSmartRegisterActivity;
import org.smartregister.view.dialog.DialogOption;
import org.smartregister.view.dialog.DialogOptionModel;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import org.smartregister.bidan_cloudant.activity.KChildSmartRegisterActivity;
import org.smartregister.bidan_cloudant.activity.LoginActivity;
import org.smartregister.bidan_cloudant.libs.FlurryFacade;
import org.smartregister.bidan_cloudant.option.KICommonObjectFilterOption;
import org.smartregister.bidan_cloudant.option.ChildServiceModeOption;
import org.smartregister.bidan_cloudant.option.KICommonObjectFilterOption;
import org.smartregister.bidan_cloudant.provider.ChildSmartClientsProvider;
import org.smartregister.commonregistry.CommonPersonObjectClient;
import org.smartregister.commonregistry.CommonPersonObjectController;
Expand Down
Loading

0 comments on commit b7194f2

Please sign in to comment.