mirror of
https://github.com/akaessens/NoFbEventScraper
synced 2025-06-05 23:29:13 +02:00
@ -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(""))
|
||||
|
9
app/src/main/res/drawable/ic_add_location.xml
Normal file
9
app/src/main/res/drawable/ic_add_location.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12,2C8.14,2 5,5.14 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.86 -3.14,-7 -7,-7zM16,10h-3v3h-2v-3L8,10L8,8h3L11,5h2v3h3v2z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
@ -130,10 +130,14 @@
|
||||
android:singleLine="true" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:id="@+id/location_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
app:endIconDrawable="@drawable/ic_add_location"
|
||||
app:endIconMode="custom">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/field_event_location"
|
||||
@ -142,8 +146,8 @@
|
||||
android:autoLink="map"
|
||||
android:clickable="true"
|
||||
android:cursorVisible="true"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:hint="Event location"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
Reference in New Issue
Block a user