Skip to content

Commit

Permalink
MI | Updating form registration logic #6
Browse files Browse the repository at this point in the history
Signed-off-by: mib-iqbal <[email protected]>
  • Loading branch information
mib-iqbal committed Nov 10, 2017
1 parent 0e66600 commit 278428c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,31 +76,10 @@ public void onEvent(Boolean data) {
}
updateRegisterCounts();

// new Tools(context());
// Tools.download_images();
// Tools.setVectorfromAPI(getApplicationContext());
// AllConstants.SLEEP_TIME = AllConstants.WAITING_TIME;
// Tools.setVectorsBuffered();
// flagActivator();
}
};

/* private void flagActivator(){
new Thread(){
public void run(){
try{
while(AllConstants.SLEEP_TIME>0){
sleep(1000);
if(AllConstants.IDLE)
AllConstants.SLEEP_TIME-=1000;
}
Support.ONSYNC=false;
}catch (InterruptedException ie){

}
}
}.start();
}*/

private Listener<String> onFormSubmittedListener = new Listener<String>() {
@Override
Expand Down Expand Up @@ -157,15 +136,13 @@ protected void onCreation() {

private void setupViews() {
findViewById(R.id.btn_gizi_register).setOnClickListener(onRegisterStartListener);
// findViewById(R.id.btn_gizi_ibu_register).setOnClickListener(onRegisterStartListener);
// findViewById(R.id.btn_test2_register).setOnClickListener(onRegisterStartListener);
// findViewById(R.id.btn_tt_register).setVisibility(View.INVISIBLE);


findViewById(R.id.btn_reporting).setOnClickListener(onButtonsClickListener);
// findViewById(R.id.btn_videos).setOnClickListener(onButtonsClickListener);


anakRegisterClientCountView = (TextView) findViewById(R.id.txt_child_register_client_count);
// ibuRegisterClientCountView = (TextView) findViewById(R.id.txt_mother_register_client_count);


}

Expand All @@ -181,8 +158,7 @@ private void initialize() {
getSupportActionBar().setDisplayUseLogoEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
LoginActivity.setLanguage();
// getActionBar().setBackgroundDrawable(getReso
// urces().getDrawable(R.color.action_bar_background));

}

@Override
Expand All @@ -195,10 +171,7 @@ protected void onResumption() {
// initFR();
}

/* private void initFR() {
new Tools(context());
Log.e("TAG", "initFR: "+ Tools.getAppContext() );
}*/


private void updateRegisterCounts() {
NativeUpdateANMDetailsTask task = new NativeUpdateANMDetailsTask(Context.getInstance().anmController());
Expand All @@ -219,18 +192,7 @@ private void updateRegisterCounts(HomeContext homeContext) {

anakRegisterClientCountView.setText(valueOf(childcount));

/* Cursor ibucountcursor = context().commonrepository("ec_ibu").rawCustomQueryForAdapter(sqb.queryForCountOnRegisters("ec_ibu", "ec_ibu.is_closed=0 and ec_ibu.pptest ='Positive'"));
ibucountcursor.moveToFirst();
ibucount = ibucountcursor.getInt(0);
ibucountcursor.close();

ibuRegisterClientCountView.setText(valueOf(ibucount));*/

/* CommonPersonObjectController hhcontroller = new CommonPersonObjectController(context.allCommonsRepositoryobjects("anak"),
context.allBeneficiaries(), context.listCache(),
context.personObjectClientsCache(),"nama_bayi","anak","tanggal_lahir", CommonPersonObjectController.ByColumnAndByDetails.byDetails);
anakRegisterClientCountView.setText(valueOf(hhcontroller.getClients("form_ditutup","true").size()));*/
}

@Override
Expand Down Expand Up @@ -288,8 +250,7 @@ this, context().actionService(), context().formSubmissionSyncService(),
Map<String, TreeNode<String, Location>> locationMap =
locationTree.getLocationsHierarchy();

/* if (LoginActivity.generator.uniqueIdController().needToRefillUniqueId(LoginActivity.generator.UNIQUE_ID_LIMIT)) // unique id part
LoginActivity.generator.requestUniqueId(); */ // unique id part

}

@Override
Expand Down Expand Up @@ -334,21 +295,7 @@ public void onClick(View view) {
navigationController.startChildSmartRegistry();
break;

/* case R.id.btn_gizi_ibu_register:
navigationController.startANCSmartRegistry();
break;*/
/*
case R.id.btn_pnc_register:
// navigationController.startPNCSmartRegistry();
break;
case R.id.btn_child_register:
// navigationController.startChildSmartRegistry();
break;

case R.id.btn_fp_register:
// navigationController.startFPSmartRegistry();
break; */

}
String HomeEnd = timer.format(new Date());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,14 @@ public void saveFormSubmission(String formSubmission, String id, String formName
switchToBaseFragment(formSubmission); // Unnecessary!! passing on data

if(formName.equals("registrasi_gizi")) {
// saveuniqueid();
Log.d(TAG, "saveFormSubmission: it was registrasi_jurim form");
// FieldOverrides fieldOverrides = new FieldOverrides(combined.toString());

fieldOverrides.put("ibuCaseId",submission.entityId());
FieldOverrides fo = new FieldOverrides(fieldOverrides.toString());
activatingForm("registrasi_anak", null, fo.getJSONString());
}

//end capture flurry log for FS
String end = timer.format(new Date());
Map<String, String> FS = new HashMap<String, String>();
Expand All @@ -194,6 +200,8 @@ public void saveFormSubmission(String formSubmission, String id, String formName
e.printStackTrace();
}



}

@Override
Expand Down Expand Up @@ -248,30 +256,8 @@ public void startFormActivity(final String formName, final String entityId, fina
FS.put("start", start);
FlurryAgent.logEvent(formName, FS, true);

/*if(formName.equals("kunjungan_gizi")) {
if(getNumOfChild()<4)
activatingForm(formName,entityId,metaData);
else {
final int choice = new java.util.Random().nextInt(3);
CharSequence[] selections = selections(choice, entityId);
final AlertDialog.Builder builder = new AlertDialog.Builder(GiziSmartRegisterActivity.this);
builder.setTitle(context().getStringResource(R.string.reconfirmChildName));
builder.setItems(selections, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// the user clicked on colors[which]
if (which == choice) {
activatingForm(formName, entityId, metaData);
}
}
});
builder.show();
}
}
else{*/
activatingForm(formName,entityId,metaData);
//}

}

private void activatingForm(String formName, String entityId, String metaData){
Expand Down

0 comments on commit 278428c

Please sign in to comment.