@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_visit_dashboard);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

    if (toolbar != null) {
      setSupportActionBar(toolbar);
    }

    Intent intent = getIntent();

    mVisit =
        new VisitDAO()
            .getVisitsByID(intent.getLongExtra(ApplicationConstants.BundleKeys.VISIT_ID, 0));
    mPatient = new PatientDAO().findPatientByID(String.valueOf(mVisit.getPatientID()));

    mPatientName = intent.getStringExtra(ApplicationConstants.BundleKeys.PATIENT_NAME);
    mVisitEncounters = mVisit.getEncounters();

    mEmptyListView = (TextView) findViewById(R.id.visitDashboardEmpty);
    FontsUtil.setFont(mEmptyListView, FontsUtil.OpenFonts.OPEN_SANS_BOLD);
    mExpandableListView = (ExpandableListView) findViewById(R.id.visitDashboardExpList);
    mExpandableListView.setEmptyView(mEmptyListView);
  }
 @Override
 protected void onResume() {
   mVisitsManager = new VisitsManager();
   mFormsManager = new FormsManager();
   if (!mVisitEncounters.isEmpty()) {
     mEmptyListView.setVisibility(View.GONE);
   }
   mExpandableListAdapter = new VisitExpandableListAdapter(this, mVisitEncounters);
   mExpandableListView.setAdapter(mExpandableListAdapter);
   mExpandableListView.setGroupIndicator(null);
   super.onResume();
 }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.login_view_layout);
   mUrlField = (RelativeLayout) findViewById(R.id.urlField);
   mUsername = (EditText) findViewById(R.id.loginUsernameField);
   mUsername.setText(OpenMRS.getInstance().getUsername());
   mPassword = (EditText) findViewById(R.id.loginPasswordField);
   mLoginButton = (Button) findViewById(R.id.loginButton);
   mLoginButton.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           if (validateLoginFields()) {
             if ((!mOpenMRS.getUsername().equals(ApplicationConstants.EMPTY_STRING)
                     && !mOpenMRS.getUsername().equals(mUsername.getText().toString()))
                 || ((!mOpenMRS.getServerUrl().equals(ApplicationConstants.EMPTY_STRING)
                     && !mOpenMRS.getServerUrl().equals(mUrlTextView.getText().toString())))) {
               showWarningDialog();
             } else {
               login();
             }
           } else {
             ToastUtil.showShortToast(
                 getApplicationContext(),
                 ToastUtil.ToastType.ERROR,
                 R.string.login_dialog_login_or_password_empty);
           }
         }
       });
   mSpinner = (ProgressBar) findViewById(R.id.loginLoading);
   mLoginFormView = (LinearLayout) findViewById(R.id.loginFormView);
   mDropdownLocation = (Spinner) findViewById(R.id.locationSpinner);
   mUrlTextView = (TextView) findViewById(R.id.urlText);
   if (mErrorOccurred
       || OpenMRS.getInstance().getServerUrl().equals(ApplicationConstants.EMPTY_STRING)) {
     showURLDialog();
   } else {
     if (mLastCorrectURL.equals(ApplicationConstants.EMPTY_STRING)) {
       mUrlTextView.setText(OpenMRS.getInstance().getServerUrl());
       mLastCorrectURL = OpenMRS.getInstance().getServerUrl();
     } else {
       mUrlTextView.setText(mLastCorrectURL);
     }
     mUrlField.setVisibility(View.VISIBLE);
     hideURLDialog();
   }
   FontsUtil.setFont((ViewGroup) findViewById(android.R.id.content));
 }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   switch (resultCode) {
     case RESULT_OK:
       String path = data.getData().toString();
       String instanceID = path.substring(path.lastIndexOf('/') + 1);
       FormManagerBundle bundle =
           FormsHelper.createBundle(
               new FormsDAO(getContentResolver())
                   .getSurveysSubmissionDataFromFormInstanceId(instanceID)
                   .getFormInstanceFilePath(),
               mPatient.getUuid(),
               mPatient.getId(),
               mVisit.getUuid());
       mFormsManager.uploadXFormWithMultiPartRequest(
           FormsHelper.createUploadXFormWithMultiPartRequestListener(bundle, this));
       break;
     case RESULT_CANCELED:
       finish();
     default:
       break;
   }
 }
 @Override
 protected void onDestroy() {
   super.onDestroy();
   unbindDrawableResources();
 }
 @Override
 protected void onResumeFragments() {
   super.onResumeFragments();
   bindDrawableResources();
 }