From 88473038a9af7971d408629cdb9a25062963933d Mon Sep 17 00:00:00 2001 From: Kelvin Date: Thu, 30 Jul 2020 02:58:33 +0300 Subject: [PATCH] Replace toasts with log --- .idea/jarRepositories.xml | 30 +++++++++++++++++++ .../co/ke/locationpicker/MainActivity.java | 2 +- .../easylocationpicker/EasyLocation.java | 8 ----- .../EasyLocationPickerActivity.java | 16 +++++----- .../layout/activity_easy_location_picker.xml | 15 ---------- 5 files changed, 40 insertions(+), 31 deletions(-) create mode 100644 .idea/jarRepositories.xml diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..eb2873e --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/co/ke/locationpicker/MainActivity.java b/app/src/main/java/co/ke/locationpicker/MainActivity.java index cef2f4b..1c3d581 100644 --- a/app/src/main/java/co/ke/locationpicker/MainActivity.java +++ b/app/src/main/java/co/ke/locationpicker/MainActivity.java @@ -37,7 +37,7 @@ public void onClick(View v) { .showCurrentLocation(true) .useGeoCoder(true) .setResultOnBackPressed(false) - .withLocation(loc) + //.withLocation(loc) .setCallbacks(new EasyLocationCallbacks() { @Override public void onSuccess(SelectedLocation location) { diff --git a/easylocationpicker/src/main/java/com/loginext/easylocationpicker/EasyLocation.java b/easylocationpicker/src/main/java/com/loginext/easylocationpicker/EasyLocation.java index fc0e6f3..7940524 100644 --- a/easylocationpicker/src/main/java/com/loginext/easylocationpicker/EasyLocation.java +++ b/easylocationpicker/src/main/java/com/loginext/easylocationpicker/EasyLocation.java @@ -7,7 +7,6 @@ import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; -import android.widget.Toast; import androidx.fragment.app.Fragment; @@ -85,16 +84,12 @@ private void openActivity(EasyLocation easyLocation) { if (callbacks != null) { String reason = getContext().getString(R.string.easylocation_no_map_keys); callbacks.onFailed(reason); - } else { - Toast.makeText(context, R.string.easylocation_no_map_keys, Toast.LENGTH_SHORT).show(); } } else if (TextUtils.isEmpty(easyLocation.placesApiKey)) { //supplied places api key is empty if (callbacks != null) { String reason = getContext().getString(R.string.easylocation_empty_places_api_key); callbacks.onFailed(reason); - } else { - Toast.makeText(context, R.string.easylocation_empty_places_api_key, Toast.LENGTH_SHORT).show(); } } else { @@ -104,8 +99,6 @@ private void openActivity(EasyLocation easyLocation) { activity.startActivityForResult(intent,LOCATION_REQUEST_CODE); }else if (fragment !=null){ fragment.startActivityForResult(intent,LOCATION_REQUEST_CODE); - }else { - Toast.makeText(context, "Can't find fragment or activity", Toast.LENGTH_SHORT).show(); } } @@ -215,7 +208,6 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { SelectedLocation selectedLocation = data.getParcelableExtra(EXTRA_LOCATION_RESULTS_SUCCESS); callbacks.onSuccess(selectedLocation); } else { - String reason = getContext().getString(R.string.easylocation_load_location_error); callbacks.onFailed(reason); } diff --git a/easylocationpicker/src/main/java/com/loginext/easylocationpicker/EasyLocationPickerActivity.java b/easylocationpicker/src/main/java/com/loginext/easylocationpicker/EasyLocationPickerActivity.java index e2ef72f..a3b6aa8 100644 --- a/easylocationpicker/src/main/java/com/loginext/easylocationpicker/EasyLocationPickerActivity.java +++ b/easylocationpicker/src/main/java/com/loginext/easylocationpicker/EasyLocationPickerActivity.java @@ -126,7 +126,7 @@ public void onClick(View v) { // Specify the types of place data to return. assert autocompleteFragment != null; //todo remove and add dynamically - autocompleteFragment.setCountry("ke"); + //autocompleteFragment.setCountry("ke"); autocompleteFragment.setPlaceFields(Arrays.asList( Place.Field.ID, Place.Field.NAME, @@ -259,7 +259,7 @@ public void onCameraIdle() { getGeoCoderAddress(midLatLng); } else { showCoordinatesOnly(); - Toast.makeText(EasyLocationPickerActivity.this, R.string.easylocation_no_geocoder_available, Toast.LENGTH_SHORT).show(); + showToast(R.string.easylocation_no_geocoder_available); } }else { //show coordinates @@ -333,10 +333,6 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis } - public void text(View view) { - Toast.makeText(this, "hello", Toast.LENGTH_SHORT).show(); - } - private void displayAddressOutput(String addressOutput) { locationTitle.setText(R.string.easylocation_address); address.setText(addressOutput); @@ -349,7 +345,13 @@ private void displayAddressOutput(String addressOutput) { } private void showToast(String string) { - Toast.makeText(this, string, Toast.LENGTH_SHORT).show(); + Log.d(TAG,string); + // Toast.makeText(this, string, Toast.LENGTH_SHORT).show(); + } + + private void showToast(int resources) { + Log.d(TAG,getResources().getString(resources)); + //Toast.makeText(this, getResources().getString(resources), Toast.LENGTH_SHORT).show(); } //show data from getting address service diff --git a/easylocationpicker/src/main/res/layout/activity_easy_location_picker.xml b/easylocationpicker/src/main/res/layout/activity_easy_location_picker.xml index 0307131..111a9d2 100644 --- a/easylocationpicker/src/main/res/layout/activity_easy_location_picker.xml +++ b/easylocationpicker/src/main/res/layout/activity_easy_location_picker.xml @@ -21,27 +21,12 @@ -