@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); } } }
@Subscribe public void deleteFavoriteSubscribe(FavoriteEvent.Delete deleteFavoriteEvent) { if (deleteFavoriteEvent.isSuccess()) { isFavorite = false; iconFavorite.setTextColor(getResources().getColor(R.color.gray)); } else { isFavorite = true; iconFavorite.setTextColor(getResources().getColor(R.color.pink_500)); } }
@Subscribe public void checkFavoriteSubscribe(FavoriteEvent.Check checkFavoriteEvent) { if (checkFavoriteEvent.isSuccess()) { isFavorite = checkFavoriteEvent.isChecked(); iconFavorite.setTextColor(getResources().getColor(R.color.pink_500)); } else { isFavorite = checkFavoriteEvent.isChecked(); iconFavorite.setTextColor(getResources().getColor(R.color.gray)); } progressDialog.dismiss(); }