mirror of
https://github.com/akaessens/NoFbEventScraper
synced 2025-06-05 23:29:13 +02:00
fix overlap of bottom nav bar, add error messages to fields
This commit is contained in:
@ -117,7 +117,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
|||||||
String event_description = fixLinks(readFromJson(reader, "description"));
|
String event_description = fixLinks(readFromJson(reader, "description"));
|
||||||
String location = fixLocation(readFromJson(reader, "location"));
|
String location = fixLocation(readFromJson(reader, "location"));
|
||||||
|
|
||||||
String image_url = null;
|
String image_url = "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
image_url = readFromJson(reader, "image"); // get from json
|
image_url = readFromJson(reader, "image"); // get from json
|
||||||
@ -134,6 +134,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
|||||||
throw new Exception();
|
throw new Exception();
|
||||||
} else {
|
} else {
|
||||||
this.event = new FbEvent(event_name, event_start, event_end, event_description, location, image_url);
|
this.event = new FbEvent(event_name, event_start, event_end, event_description, location, image_url);
|
||||||
|
//this.event = new FbEvent("", "", "", "", "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -99,6 +99,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
Long end_epoch = convertTimeToEpoch(field_event_end.getText().toString());
|
Long end_epoch = convertTimeToEpoch(field_event_end.getText().toString());
|
||||||
|
|
||||||
String name = parseField(field_event_name);
|
String name = parseField(field_event_name);
|
||||||
|
|
||||||
String location = parseField(field_event_location);
|
String location = parseField(field_event_location);
|
||||||
String description = parseField(field_event_description);
|
String description = parseField(field_event_description);
|
||||||
String uri = parseField(field_uri_input);
|
String uri = parseField(field_uri_input);
|
||||||
@ -248,10 +249,15 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
field_uri_input.setText("");
|
field_uri_input.setText("");
|
||||||
}
|
}
|
||||||
field_event_name.setText("");
|
field_event_name.setText("");
|
||||||
|
field_event_name.setError(null);
|
||||||
field_event_start.setText("");
|
field_event_start.setText("");
|
||||||
|
field_event_start.setError(null);
|
||||||
field_event_end.setText("");
|
field_event_end.setText("");
|
||||||
|
field_event_end.setError(null);
|
||||||
field_event_location.setText("");
|
field_event_location.setText("");
|
||||||
|
field_event_location.setError(null);
|
||||||
field_event_description.setText("");
|
field_event_description.setText("");
|
||||||
|
field_event_description.setError(null);
|
||||||
toolbar_image_view.setImageDrawable(null);
|
toolbar_image_view.setImageDrawable(null);
|
||||||
|
|
||||||
toolbar_layout.setTitle(getString(R.string.app_name));
|
toolbar_layout.setTitle(getString(R.string.app_name));
|
||||||
@ -259,14 +265,45 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
public void update(FbEvent event) {
|
public void update(FbEvent event) {
|
||||||
field_event_name.setText(event.name);
|
field_event_name.setText(event.name);
|
||||||
|
|
||||||
|
if (event.name.equals(""))
|
||||||
|
{
|
||||||
|
field_event_name.setError("no event name detected");
|
||||||
|
}
|
||||||
field_event_start.setText(event.start_date);
|
field_event_start.setText(event.start_date);
|
||||||
|
|
||||||
|
if (event.start_date.equals(""))
|
||||||
|
{
|
||||||
|
field_event_start.setError("no event start date detected");
|
||||||
|
}
|
||||||
field_event_end.setText(event.end_date);
|
field_event_end.setText(event.end_date);
|
||||||
|
|
||||||
|
if (event.end_date.equals(""))
|
||||||
|
{
|
||||||
|
field_event_end.setError("no event end date detected");
|
||||||
|
}
|
||||||
|
|
||||||
field_event_location.setText(event.location);
|
field_event_location.setText(event.location);
|
||||||
|
|
||||||
|
if (event.location.equals(""))
|
||||||
|
{
|
||||||
|
field_event_location.setError("no event location detected");
|
||||||
|
}
|
||||||
field_event_description.setText(event.description);
|
field_event_description.setText(event.description);
|
||||||
|
|
||||||
toolbar_layout.setTitle(" ");
|
if (event.description.equals(""))
|
||||||
|
{
|
||||||
|
field_event_description.setError("no event description detected");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
Picasso.get().load(event.image_url).into(toolbar_image_view);
|
Picasso.get().load(event.image_url).into(toolbar_image_view);
|
||||||
|
toolbar_layout.setTitle(" ");
|
||||||
|
} catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,37 +62,8 @@
|
|||||||
|
|
||||||
<include layout="@layout/content_main" />
|
<include layout="@layout/content_main" />
|
||||||
|
|
||||||
<!-- <LinearLayout
|
|
||||||
android:id="@+id/groupbutton"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:weightSum="2">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/cancel_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:padding="12dp"
|
|
||||||
android:text="@android:string/cancel"
|
|
||||||
app:cornerRadius="12dp" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/ok_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginLeft="8dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="@android:string/ok"
|
|
||||||
app:cornerRadius="12dp" />
|
|
||||||
</LinearLayout>-->
|
|
||||||
|
|
||||||
<com.google.android.material.bottomappbar.BottomAppBar
|
<com.google.android.material.bottomappbar.BottomAppBar
|
||||||
|
android:id="@+id/bottomButtonLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
|
@ -6,11 +6,13 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
tools:context=".MainActivity"
|
tools:context=".MainActivity"
|
||||||
tools:showIn="@layout/activity_main">
|
tools:showIn="@layout/activity_main"
|
||||||
|
android:id="@+id/nested_scroll_view" >
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/constraint_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/linearLayout4"
|
android:id="@+id/linearLayout4"
|
||||||
@ -59,7 +61,7 @@
|
|||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/bottomButtonLayout"
|
app:layout_constraintBottom_toTopOf="@+id/spacer"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textInputLayout">
|
app:layout_constraintTop_toBottomOf="@+id/textInputLayout">
|
||||||
@ -67,14 +69,14 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
|
||||||
android:divider="@drawable/divider"
|
android:divider="@drawable/divider"
|
||||||
|
android:orientation="vertical"
|
||||||
android:showDividers="middle">
|
android:showDividers="middle">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" >
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/field_event_name"
|
android:id="@+id/field_event_name"
|
||||||
@ -87,9 +89,9 @@
|
|||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" >
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/field_event_start"
|
android:id="@+id/field_event_start"
|
||||||
@ -102,9 +104,9 @@
|
|||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" >
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/field_event_end"
|
android:id="@+id/field_event_end"
|
||||||
@ -117,9 +119,9 @@
|
|||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" >
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/field_event_location"
|
android:id="@+id/field_event_location"
|
||||||
@ -133,9 +135,9 @@
|
|||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" >
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/field_event_description"
|
android:id="@+id/field_event_description"
|
||||||
@ -151,6 +153,16 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:id="@+id/spacer"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/constraint_layout"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
Reference in New Issue
Block a user