@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
  public View getView(int position, View convertView, ViewGroup parent) {
    View rowView = convertView;
    // reuse views
    if (rowView == null) {
      LayoutInflater inflater = mContext.getLayoutInflater();
      rowView = inflater.inflate(mResourceID, null);
      // configure view holder
      ViewHolder viewHolder = new ViewHolder();
      viewHolder.mRowLayout = (LinearLayout) rowView;
      viewHolder.mIdentifier = (TextView) rowView.findViewById(R.id.patientIdentifier);
      viewHolder.mDisplayName = (TextView) rowView.findViewById(R.id.patientDisplayName);
      viewHolder.mGender = (TextView) rowView.findViewById(R.id.patientGender);
      viewHolder.mAge = (TextView) rowView.findViewById(R.id.patientAge);
      viewHolder.mBirthDate = (TextView) rowView.findViewById(R.id.patientBirthDate);
      viewHolder.mAvailableOfflineCheckbox = (CheckBox) rowView.findViewById(R.id.offlineCheckbox);
      rowView.setTag(viewHolder);
    }

    // fill data
    final ViewHolder holder = (ViewHolder) rowView.getTag();
    final Patient patient = mItems.get(position);

    if (null != patient.getIdentifier()) {
      holder.mIdentifier.setText("#" + patient.getIdentifier());
    }
    if (null != patient.getDisplay()) {
      holder.mDisplayName.setText(patient.getDisplay());
    }
    if (null != patient.getGender()) {
      holder.mGender.setText(patient.getGender());
    }
    if (null != patient.getAge()) {
      holder.mAge.setText(patient.getAge());
    }
    holder.mBirthDate.setText(DateUtils.convertTime(patient.getBirthDate()));
    if (null != holder.mAvailableOfflineCheckbox) {
      setUpCheckBoxLogic(holder, patient);
    }
    holder.mRowLayout.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (new PatientDAO().isUserAlreadySaved(patient.getUuid())) {
              Intent intent = new Intent(mContext, PatientDashboardActivity.class);
              Long patientID = new PatientDAO().findPatientByUUID(patient.getUuid()).getId();
              intent.putExtra(ApplicationConstants.BundleKeys.PATIENT_ID_BUNDLE, patientID);
              mContext.startActivity(intent);
            }
          }
        });

    FontsUtil.setFont((ViewGroup) rowView);
    return rowView;
  }
 @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
  public View onCreateView(
      LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

    mFragmentLayout = inflater.inflate(R.layout.fragment_last_viewed_patients, null, false);
    mEmptyList = (TextView) mFragmentLayout.findViewById(R.id.emptyPatientList);
    mEmptyList.setVisibility(View.VISIBLE);

    patientsRecyclerView = (RecyclerView) mFragmentLayout.findViewById(R.id.patientRecyclerView);
    patientsRecyclerView.setVisibility(View.GONE);
    patientsRecyclerView.setHasFixedSize(true);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
    patientsRecyclerView.setLayoutManager(linearLayoutManager);

    mSpinner = (ProgressBar) mFragmentLayout.findViewById(R.id.patientRecyclerViewLoading);

    mSwipeLayout = (SwipeRefreshLayout) mFragmentLayout.findViewById(R.id.swipe_container);
    mSwipeLayout.setEnabled(false);
    mSwipeLayout.setOnRefreshListener(this);
    mSwipeLayout.setColorSchemeResources(
        R.color.light_teal, R.color.green, R.color.yellow, R.color.light_red);

    patientsRecyclerView.setOnScrollListener(
        new RecyclerView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(RecyclerView recyclerView, int i) {}

          @Override
          public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            if (dy > 0 && !mSwipeLayout.isRefreshing()) {
              mSwipeLayout.setEnabled(true);
            } else {
              mSwipeLayout.setEnabled(false);
            }
          }
        });

    FontsUtil.setFont((ViewGroup) mFragmentLayout);
    // registerForContextMenu(mPatientsListView);
    return mFragmentLayout;
  }