1
0
mirror of https://github.com/akaessens/NoFbEventScraper synced 2025-06-05 23:29:13 +02:00

add maps intent

not gmaps exclusive
closes #9
This commit is contained in:
akaessens
2020-08-26 17:56:20 +02:00
parent 9fd1a975ec
commit 57b00e2e57
3 changed files with 41 additions and 3 deletions

View File

@ -41,7 +41,7 @@ public class MainActivity extends AppCompatActivity {
private ImageView toolbar_image_view;
private CollapsingToolbarLayout toolbar_layout;
private TextInputLayout input_layout;
private TextInputLayout location_layout;
private FbScraper scraper;
@Override
@ -56,6 +56,7 @@ public class MainActivity extends AppCompatActivity {
field_uri_input = (TextInputEditText) findViewById(R.id.field_uri_input);
input_layout = (TextInputLayout) findViewById(R.id.textInputLayout);
location_layout = (TextInputLayout) findViewById(R.id.location_layout);
field_event_name = (TextInputEditText) findViewById(R.id.field_event_name);
field_event_start = (TextInputEditText) findViewById(R.id.field_event_start);
field_event_end = (TextInputEditText) findViewById(R.id.field_event_end);
@ -66,6 +67,7 @@ public class MainActivity extends AppCompatActivity {
ok_button.setEnabled(false);
location_layout.setEndIconVisible(false);
toolbar_image_view.setImageResource(R.drawable.ic_banner_foreground);
@ -122,6 +124,23 @@ public class MainActivity extends AppCompatActivity {
}
});
location_layout.setEndIconOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String map_search = "geo:0,0?q=" + field_event_location.getText();
Uri gmmIntentUri = Uri.parse(map_search);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
//mapIntent.setPackage("com.google.android.apps.maps");
if (mapIntent.resolveActivity(getPackageManager()) != null) {
startActivity(mapIntent);
}
}
});
ok_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -276,6 +295,7 @@ public class MainActivity extends AppCompatActivity {
scraper = null;
}
ok_button.setEnabled(false);
location_layout.setEndIconVisible(false);
toolbar_image_view.setImageResource(R.drawable.ic_banner_foreground);
}
@ -306,6 +326,11 @@ public class MainActivity extends AppCompatActivity {
{
field_event_location.setError("no event location detected");
}
else
{
location_layout.setEndIconVisible(true);
field_event_location.setError(null);
}
field_event_description.setText(event.description);
if (event.description.equals(""))