예제 #1
0
  private void callVet() {
    if (vetNumber == null || vetNumber.isEmpty()) {
      Helper.makeText(context, "Please pick a vet's number first.");
      return;
    }

    Date timeOfCall = new Date();
    SaveSharedPreference.setKeyValuePair(context, PREF_VET_LAST_CALL, timeOfCall.toString());

    Helper.makeText(context, "Calling...");

    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:" + vetNumber));
    startActivity(intent);
  }
예제 #2
0
  private void saveVet(String number, String name) {
    SaveSharedPreference.setKeyValuePair(context, PREF_VET_NUMBER, number);
    SaveSharedPreference.setKeyValuePair(context, PREF_VET_NAME, name);
    vetNumber = number;
    vetName = name;

    // UserData.setVetNumber(number);
    Helper.makeText(context, name + ": " + number + " saved.", Toast.LENGTH_LONG);
  }
예제 #3
0
 private void setViewsVisibility() {
   if (vetNumber != null && !vetNumber.isEmpty()) {
     vetNumberTextView.setText(vetName + ": " + vetNumber);
     pickVetNumber.setVisibility(View.GONE);
     editVetNumber.setVisibility(View.VISIBLE);
     deleteVetNumber.setVisibility(View.VISIBLE);
     callVet.setVisibility(View.VISIBLE);
     Helper.makeText(context, getResources().getString(R.string.hintCallBtn, Toast.LENGTH_LONG));
   } else {
     editVetNumber.setVisibility(View.GONE);
     deleteVetNumber.setVisibility(View.GONE);
     pickVetNumber.setVisibility(View.VISIBLE);
     vetNumberTextView.setText(context.getResources().getString(R.string.tvNoVetNumberYet));
     callVet.setVisibility(View.GONE);
   }
 }