Skip to content

Commit

Permalink
Replace toasts with log
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinPac committed Jul 29, 2020
1 parent 62b1054 commit 8847303
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 31 deletions.
30 changes: 30 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/src/main/java/co/ke/locationpicker/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 {

Expand All @@ -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();
}

}
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,12 @@

<ImageView
android:tint="@color/quantum_vanillared500"
android:onClick="text"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/easylocation_ic_current_place"
android:contentDescription="Current Location Marker" />

<!-- <com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:src="@drawable/leku_ic_gps_lime"
app:tint="@color/colorPrimary"
app:backgroundTint="@color/leku_white"
app:elevation="2dp"
app:fabSize="mini"
app:rippleColor="@color/leku_soft_grey"
tools:background="@color/leku_white"
tools:ignore="elevation" />-->

<LinearLayout
android:layout_width="match_parent"
Expand Down

0 comments on commit 8847303

Please sign in to comment.