Пример #1
0
 @Override
 public void onClick(View v) {
   if (v == iconFavorite) {
     if (isFavorite) {
       isFavorite = false;
       iconFavorite.setTextColor(getResources().getColor(R.color.gray));
       favoriteController.delete(LocalStorage.getInstance().getMember(), jobdetail);
     } else {
       isFavorite = true;
       iconFavorite.setTextColor(getResources().getColor(R.color.pink_500));
       favoriteController.store(LocalStorage.getInstance().getMember(), jobdetail);
       progressDialog.show();
     }
   } else if (v == iconResume) {
     Intent intent = new Intent(getActivity(), SendResumeActivity.class);
     intent.putExtra(getString(R.string.intent_obj), jobdetail.getId());
     startActivity(intent);
   } else {
     // Operator has not lat&lng
     if (jobdetail.getOperator().getLat().isEmpty()
         || jobdetail.getOperator().getLng().isEmpty()) {
       Toast.makeText(getActivity(), getString(R.string.error_gps_null), Toast.LENGTH_SHORT)
           .show();
     } else {
       double lat = Double.parseDouble(jobdetail.getOperator().getLat());
       double lng = Double.parseDouble(jobdetail.getOperator().getLng());
       LatLng latLng = new LatLng(lat, lng);
       navigation(latLng);
     }
   }
 }
Пример #2
0
  @Subscribe
  public void showJobdetailSubscribe(JobdetailEvent.Show showJobdetailEvent) {
    if (showJobdetailEvent.isSuccess()) {
      this.jobdetail = showJobdetailEvent.getJobdetail();
      setupTextView();

      // Call to check this favorite
      if (LocalStorage.getInstance().getMember() != null)
        favoriteController.check(jobdetail.getId(), LocalStorage.getInstance().getMember().getId());
      else progressDialog.dismiss();
    } else {
      Toast.makeText(getActivity(), getString(R.string.status_fail), Toast.LENGTH_SHORT).show();
    }
  }