diff --git a/opensrp-gizi/src/main/java/org/smartregister/gizi/activity/GiziHomeActivity.java b/opensrp-gizi/src/main/java/org/smartregister/gizi/activity/GiziHomeActivity.java index 33eb492..a9eda85 100644 --- a/opensrp-gizi/src/main/java/org/smartregister/gizi/activity/GiziHomeActivity.java +++ b/opensrp-gizi/src/main/java/org/smartregister/gizi/activity/GiziHomeActivity.java @@ -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 onFormSubmittedListener = new Listener() { @Override @@ -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); + } @@ -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 @@ -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()); @@ -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 @@ -288,8 +250,7 @@ this, context().actionService(), context().formSubmissionSyncService(), Map> locationMap = locationTree.getLocationsHierarchy(); - /* if (LoginActivity.generator.uniqueIdController().needToRefillUniqueId(LoginActivity.generator.UNIQUE_ID_LIMIT)) // unique id part - LoginActivity.generator.requestUniqueId(); */ // unique id part + } @Override @@ -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()); diff --git a/opensrp-gizi/src/main/java/org/smartregister/gizi/activity/GiziSmartRegisterActivity.java b/opensrp-gizi/src/main/java/org/smartregister/gizi/activity/GiziSmartRegisterActivity.java index 9660870..1048dba 100755 --- a/opensrp-gizi/src/main/java/org/smartregister/gizi/activity/GiziSmartRegisterActivity.java +++ b/opensrp-gizi/src/main/java/org/smartregister/gizi/activity/GiziSmartRegisterActivity.java @@ -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 FS = new HashMap(); @@ -194,6 +200,8 @@ public void saveFormSubmission(String formSubmission, String id, String formName e.printStackTrace(); } + + } @Override @@ -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){