allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.MohsenAbdelkareem:PlacePicker:1.1.2'
}
Use it: try { Intent intentBuilder = new PlacePlacePicker.IntentBuilder() .setAndroidApiKey(getResources().getString(R.string.google_maps_key)) .setGeolocationApiKey(getResources().getString(R.string.google_maps_key)) .build(this); startActivityForResult(intentBuilder, PLACE_PICKER_REQUEST); } catch (GooglePlayServicesNotAvailableException e) { e.printStackTrace(); }
Get results: protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PLACE_PICKER_REQUEST) {
if (resultCode == RESULT_OK) {
Place place = PlacePlacePicker.Companion.getPlace(data);
}
}
}
To change style:
in style
<style name="PlaceTheme" parent="PlaceThemeBase"> @color/legacy_light_primary @color/legacy_light_primary_dark @color/app_text_color @color/colorPrimary @color/textColorPrimary @color/textColorSecondary </style>in style (v21):
<style name="PlaceTheme" parent="PlaceThemeBase"> @color/legacy_light_primary @color/legacy_light_primary_dark @color/app_text_color @color/colorPrimary @color/textColorPrimary @color/textColorSecondary @style/Widget.MaterialComponents.Button.TextButton.Dialog @style/Widget.MaterialComponents.Button.TextButton.Dialog </style>