Android Open Source - chat.android C H A Overview Activity






From Project

Back to project page chat.android.

License

The source code is released under:

GNU General Public License

If you think the Android project chat.android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.chat.android;
/*ww w . j  a  v a  2s.co m*/
import java.sql.SQLException;
import java.util.Date;

import org.chat.android.models.CHAAccessed;
import org.chat.android.models.Client;
import org.chat.android.models.Visit;

import com.j256.ormlite.dao.Dao;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

public class CHAOverviewActivity extends BaseActivity {
  private int visitId = 0;
  private int hhId = 0;
  private int clientId = 0;
  
    @Override    
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        context = getApplicationContext();
        setContentView(R.layout.activity_cha_overview);
        
        Bundle b = getIntent().getExtras();
    visitId = b.getInt("visitId");
    hhId = b.getInt("hhId");
    clientId = b.getInt("clientId");
    }
    
    public void openCHADeliveryAsk(View v) {
      setupCHAAccessedObject("health");
      
      Intent i = new Intent(CHAOverviewActivity.this, CHADelivery.class);
      Bundle b = new Bundle();
      b.putInt("visitId",visitId);
      b.putInt("hhId",hhId);
      b.putInt("clientId",clientId);
      i.putExtras(b);
      startActivity(i);      
    }
    
    public void openImmunizationsReceived(View v) {
//      TODO: put this back in for PROD
      Client child = ModelHelper.getClientForId(getHelper(), clientId);
        new AlertDialog.Builder(this)
        .setMessage("Is " + child.getFirstName() + " " + child.getLastName() + "'s health card present?")
        .setNegativeButton(R.string.action_no, new OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {
              alertUserToHealthCard();
            }
        })
        .setPositiveButton(R.string.action_yes, new OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {
          setupCHAAccessedObject("immunization");
              
          Intent i = new Intent(CHAOverviewActivity.this, ImmunizationsReceivedActivity.class);
              Bundle b = new Bundle();
              b.putInt("visitId",visitId);
              b.putInt("hhId",hhId);
              b.putInt("clientId",clientId);
              i.putExtras(b);
              startActivity(i); 
            }
        }).create().show();
    }
    
    private void setupCHAAccessedObject(String type) {
    Date startTime = new Date();

      CHAAccessed chaAccessed = new CHAAccessed(clientId, visitId, type, startTime, getHelper());
      
      try {
        Dao<CHAAccessed, Integer> chaaDao = getHelper().getCHAAccessedDao();
        chaaDao.create(chaAccessed);
        // FIXME: Colin Where does the visit object come from and why do we use the ID
        visitId = visit.getId();
      } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } 
    }
    
    private void alertUserToHealthCard() {
      // TODO: Zulu here
      BaseActivity.toastHelper(this,"If possible please have the health card available at our next visit");
    }
}




Java Source Code List

org.chat.android.BaseActivity.java
org.chat.android.CHADelivery.java
org.chat.android.CHAOverviewActivity.java
org.chat.android.CHASelectChildActivity.java
org.chat.android.CHASelectChildAdapter.java
org.chat.android.ChatUtil.java
org.chat.android.ClientsAdapter.java
org.chat.android.DatabaseHelper.java
org.chat.android.GPSTracker.java
org.chat.android.HealthDeliveryActivity.java
org.chat.android.HealthDetailsActivity.java
org.chat.android.HealthOverviewActivity.java
org.chat.android.HealthOverviewRecordActivity.java
org.chat.android.HomeActivity.java
org.chat.android.ImmunizationsReceivedActivity.java
org.chat.android.ImmunizationsSummaryActivity.java
org.chat.android.LoginActivity.java
org.chat.android.Mail.java
org.chat.android.ModelHelper.java
org.chat.android.MyApplication.java
org.chat.android.ResourcesActivity.java
org.chat.android.RestoreVisitActivity.java
org.chat.android.ServiceDeliveryActivity.java
org.chat.android.ServiceDeliveryAdapter.java
org.chat.android.ServiceDetailsActivity.java
org.chat.android.ServiceOtherActivity.java
org.chat.android.ServiceOverviewActivity.java
org.chat.android.ServicesAdapter.java
org.chat.android.SetupDB.java
org.chat.android.SetupVisitActivity.java
org.chat.android.SyncResourcesActivity.java
org.chat.android.Auth.AccountGeneral.java
org.chat.android.Auth.AuthenticatorService.java
org.chat.android.Auth.Authenticator.java
org.chat.android.Auth.ChatAuthServerAuthenticate.java
org.chat.android.Auth.MainActivity.java
org.chat.android.Auth.ServerAuthenticate.java
org.chat.android.Sync.StubProvider.java
org.chat.android.Sync.SyncAdapter.java
org.chat.android.Sync.SyncService.java
org.chat.android.Sync.provider.ChatContentProvider.java
org.chat.android.models.Attendance.java
org.chat.android.models.CHAAccessed.java
org.chat.android.models.Client.java
org.chat.android.models.HealthPage.java
org.chat.android.models.HealthSelectRecorded.java
org.chat.android.models.HealthSelect.java
org.chat.android.models.HealthTheme.java
org.chat.android.models.HealthTopicAccessed.java
org.chat.android.models.HealthTopic.java
org.chat.android.models.Household.java
org.chat.android.models.PageAssessment1.java
org.chat.android.models.PageSelect1.java
org.chat.android.models.PageText1.java
org.chat.android.models.PageVideo1.java
org.chat.android.models.ResourceAccessed.java
org.chat.android.models.Resource.java
org.chat.android.models.Role.java
org.chat.android.models.ServiceAccessed.java
org.chat.android.models.Service.java
org.chat.android.models.TopicVideo.java
org.chat.android.models.Util.java
org.chat.android.models.VaccineRecorded.java
org.chat.android.models.Vaccine.java
org.chat.android.models.VideoAccessed.java
org.chat.android.models.Video.java
org.chat.android.models.Visit.java
org.chat.android.models.Worker.java
org.chat.android.pages.Assessment1Fragment.java
org.chat.android.pages.BaseFragment.java
org.chat.android.pages.ReferralFragment.java
org.chat.android.pages.Select1Fragment.java
org.chat.android.pages.Text1Fragment.java
org.chat.android.pages.Video1Fragment.java