first recyclerview with multiple events prototype
This commit is contained in:
parent
c43911fc77
commit
926c2c612a
|
@ -25,11 +25,12 @@ android {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
|
'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
|
||||||
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||||
|
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
implementation 'com.google.android.material:material:1.2.0'
|
implementation 'com.google.android.material:material:1.2.1'
|
||||||
implementation 'androidx.navigation:navigation-fragment:2.3.0'
|
implementation 'androidx.navigation:navigation-fragment:2.3.0'
|
||||||
implementation 'androidx.navigation:navigation-ui:2.3.0'
|
implementation 'androidx.navigation:navigation-ui:2.3.0'
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,104 @@
|
||||||
|
package com.akdev.nofbeventscraper;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.google.android.material.textfield.TextInputEditText;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class EventAdapter extends
|
||||||
|
RecyclerView.Adapter<EventAdapter.ViewHolder> {
|
||||||
|
|
||||||
|
private List<FbEvent> events;
|
||||||
|
|
||||||
|
// Pass in the contact array into the constructor
|
||||||
|
public EventAdapter(List<FbEvent> events) {
|
||||||
|
this.events = events;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int view_type) {
|
||||||
|
Context context = parent.getContext();
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
|
|
||||||
|
// Inflate the custom layout
|
||||||
|
View contact_view = inflater.inflate(R.layout.item_event, parent, false);
|
||||||
|
|
||||||
|
// Return a new holder instance
|
||||||
|
return new ViewHolder(contact_view);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(EventAdapter.ViewHolder holder, int position) {
|
||||||
|
// Get the data model based on position
|
||||||
|
FbEvent event = events.get(position);
|
||||||
|
|
||||||
|
// Set item views based on your views and data model
|
||||||
|
if (event.name.equals("")) {
|
||||||
|
//holder.edit_text_event_name.setError(R.string.error_no_name);
|
||||||
|
} else {
|
||||||
|
holder.edit_text_event_name.setText(event.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.start_date == null) {
|
||||||
|
//holder.edit_text_event_start.setError(getString(R.string.error_no_start_date));
|
||||||
|
} else {
|
||||||
|
String str = FbEvent.dateTimeToString(event.start_date);
|
||||||
|
holder.edit_text_event_start.setText(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.end_date == null) {
|
||||||
|
//edit_text_event_end.setError(getString(R.string.error_no_end_date));
|
||||||
|
} else {
|
||||||
|
String str = FbEvent.dateTimeToString(event.end_date);
|
||||||
|
holder.edit_text_event_end.setText(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.location.equals("")) {
|
||||||
|
//edit_text_event_location.setError(getString(R.string.error_no_location));
|
||||||
|
} else {
|
||||||
|
holder.edit_text_event_location.setText(event.location);
|
||||||
|
//layout_event_location.setEndIconVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.description.equals("")) {
|
||||||
|
//holder.edit_text_event_description.setError(getString(R.string.error_no_description));
|
||||||
|
} else {
|
||||||
|
holder.edit_text_event_description.setText(event.description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the total count of items in the list
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return events.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
protected TextInputEditText edit_text_event_name;
|
||||||
|
protected TextInputEditText edit_text_event_start;
|
||||||
|
protected TextInputEditText edit_text_event_end;
|
||||||
|
protected TextInputEditText edit_text_event_location;
|
||||||
|
protected TextInputEditText edit_text_event_description;
|
||||||
|
|
||||||
|
|
||||||
|
public ViewHolder(View item_view) {
|
||||||
|
super(item_view);
|
||||||
|
|
||||||
|
|
||||||
|
edit_text_event_name = (TextInputEditText) item_view.findViewById(R.id.edit_text_event_name);
|
||||||
|
edit_text_event_start = (TextInputEditText) item_view.findViewById(R.id.edit_text_event_start);
|
||||||
|
edit_text_event_end = (TextInputEditText) item_view.findViewById(R.id.edit_text_event_end);
|
||||||
|
edit_text_event_location = (TextInputEditText) item_view.findViewById(R.id.edit_text_event_location);
|
||||||
|
edit_text_event_description = (TextInputEditText) item_view.findViewById(R.id.edit_text_event_description);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,10 @@
|
||||||
package com.akdev.nofbeventscraper;
|
package com.akdev.nofbeventscraper;
|
||||||
|
|
||||||
|
import android.app.usage.UsageEvents;
|
||||||
|
import android.util.EventLog;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@ -18,6 +22,15 @@ public class FbEvent {
|
||||||
public final String location;
|
public final String location;
|
||||||
public final String image_url;
|
public final String image_url;
|
||||||
|
|
||||||
|
public FbEvent() {
|
||||||
|
url = "url";
|
||||||
|
name= "name";
|
||||||
|
start_date = null;
|
||||||
|
end_date = null;
|
||||||
|
description = "description";
|
||||||
|
location = "location";
|
||||||
|
image_url = null;
|
||||||
|
}
|
||||||
|
|
||||||
public FbEvent(String url, String name, Date start_date, Date end_date,
|
public FbEvent(String url, String name, Date start_date, Date end_date,
|
||||||
String description, String location, String image_url) {
|
String description, String location, String image_url) {
|
||||||
|
@ -30,6 +43,16 @@ public class FbEvent {
|
||||||
this.image_url = image_url;
|
this.image_url = image_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ArrayList<FbEvent> createEventList(int num_events) {
|
||||||
|
ArrayList<FbEvent> events = new ArrayList<FbEvent>();
|
||||||
|
|
||||||
|
for (int i = 1; i <= num_events; i++) {
|
||||||
|
events.add(new FbEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
return events;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts datetime to epoch.
|
* Converts datetime to epoch.
|
||||||
*
|
*
|
||||||
|
|
|
@ -17,10 +17,13 @@ import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import static com.akdev.nofbeventscraper.FbEvent.createEventList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class can asynchronously scrape public facebook events
|
* This class can asynchronously scrape public facebook events
|
||||||
* and gather the most important information. It is stored in a FbEvent object.
|
* and gather the most important information. It is stored in a FbEvent object.
|
||||||
|
@ -30,7 +33,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||||
private int error;
|
private int error;
|
||||||
private String input_url;
|
private String input_url;
|
||||||
private WeakReference<MainActivity> main; // no context leak with WeakReference
|
private WeakReference<MainActivity> main; // no context leak with WeakReference
|
||||||
private FbEvent event;
|
private List<FbEvent> events;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor with WeakReference to the main activity, to update it's text fields.
|
* Constructor with WeakReference to the main activity, to update it's text fields.
|
||||||
|
@ -41,6 +44,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||||
FbScraper(WeakReference<MainActivity> main, String input_url) {
|
FbScraper(WeakReference<MainActivity> main, String input_url) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
this.input_url = input_url;
|
this.input_url = input_url;
|
||||||
|
this.events = createEventList(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -222,8 +226,8 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
event = new FbEvent(url, name, start_date, end_date, description, location, image_url);
|
FbEvent event = new FbEvent(url, name, start_date, end_date, description, location, image_url);
|
||||||
|
this.events.add(event);
|
||||||
|
|
||||||
} catch (URISyntaxException | MalformedURLException e) {
|
} catch (URISyntaxException | MalformedURLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -257,8 +261,8 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||||
super.onPostExecute(aVoid);
|
super.onPostExecute(aVoid);
|
||||||
|
|
||||||
if (main != null) {
|
if (main != null) {
|
||||||
if (this.event != null) {
|
if (! this.events.isEmpty()) {
|
||||||
main.get().update(event);
|
main.get().update(events);
|
||||||
} else {
|
} else {
|
||||||
main.get().error(error);
|
main.get().error(error);
|
||||||
main.get().clear(false);
|
main.get().clear(false);
|
||||||
|
|
|
@ -17,6 +17,8 @@ import android.widget.ImageView;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.view.menu.MenuBuilder;
|
import androidx.appcompat.view.menu.MenuBuilder;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.google.android.material.appbar.AppBarLayout;
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||||
|
@ -25,8 +27,10 @@ import com.google.android.material.textfield.TextInputLayout;
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static com.akdev.nofbeventscraper.FbEvent.createEventList;
|
||||||
import static com.akdev.nofbeventscraper.FbEvent.dateTimeToEpoch;
|
import static com.akdev.nofbeventscraper.FbEvent.dateTimeToEpoch;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
@ -35,55 +39,60 @@ public class MainActivity extends AppCompatActivity {
|
||||||
protected Button paste_button;
|
protected Button paste_button;
|
||||||
|
|
||||||
protected TextInputEditText edit_text_uri_input;
|
protected TextInputEditText edit_text_uri_input;
|
||||||
protected TextInputEditText edit_text_event_name;
|
|
||||||
protected TextInputEditText edit_text_event_start;
|
|
||||||
protected TextInputEditText edit_text_event_end;
|
|
||||||
protected TextInputEditText edit_text_event_location;
|
|
||||||
protected TextInputEditText edit_text_event_description;
|
|
||||||
|
|
||||||
protected TextInputLayout layout_uri_input;
|
protected TextInputLayout layout_uri_input;
|
||||||
protected TextInputLayout layout_event_location;
|
|
||||||
|
|
||||||
protected ImageView image_view_toolbar;
|
protected ImageView image_view_toolbar;
|
||||||
protected CollapsingToolbarLayout layout_toolbar;
|
protected CollapsingToolbarLayout layout_toolbar;
|
||||||
|
|
||||||
protected FbScraper scraper;
|
protected FbScraper scraper;
|
||||||
protected FbEvent event;
|
protected List<FbEvent> events;
|
||||||
|
EventAdapter adapter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
|
||||||
setSupportActionBar(toolbar);
|
|
||||||
|
|
||||||
ok_button = (Button) findViewById(R.id.ok_button);
|
|
||||||
paste_button = (Button) findViewById(R.id.paste_button);
|
|
||||||
|
|
||||||
edit_text_uri_input = (TextInputEditText) findViewById(R.id.edit_text_uri_input);
|
edit_text_uri_input = (TextInputEditText) findViewById(R.id.edit_text_uri_input);
|
||||||
edit_text_event_name = (TextInputEditText) findViewById(R.id.edit_text_event_name);
|
|
||||||
edit_text_event_start = (TextInputEditText) findViewById(R.id.edit_text_event_start);
|
|
||||||
edit_text_event_end = (TextInputEditText) findViewById(R.id.edit_text_event_end);
|
|
||||||
edit_text_event_location = (TextInputEditText) findViewById(R.id.edit_text_event_location);
|
|
||||||
edit_text_event_description = (TextInputEditText) findViewById(R.id.edit_text_event_description);
|
|
||||||
|
|
||||||
layout_uri_input = (TextInputLayout) findViewById(R.id.layout_uri_input);
|
layout_uri_input = (TextInputLayout) findViewById(R.id.layout_uri_input);
|
||||||
layout_event_location = (TextInputLayout) findViewById(R.id.layout_event_location);
|
// Lookup the recyclerview in activity layout
|
||||||
|
RecyclerView recycler_view = (RecyclerView) findViewById(R.id.recycler_view);
|
||||||
|
|
||||||
|
// Initialize contacts
|
||||||
|
events = createEventList(3);
|
||||||
|
|
||||||
|
// Create adapter passing in the sample user data
|
||||||
|
adapter = new EventAdapter(events);
|
||||||
|
// Attach the adapter to the recyclerview to populate items
|
||||||
|
recycler_view.setAdapter(adapter);
|
||||||
|
// Set layout manager to position the items
|
||||||
|
recycler_view.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
||||||
|
|
||||||
|
// That's all!
|
||||||
|
/*Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
//ok_button = (Button) findViewById(R.id.ok_button);
|
||||||
|
paste_button = (Button) findViewById(R.id.paste_button);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
layout_toolbar = (CollapsingToolbarLayout) findViewById(R.id.layout_toolbar);
|
layout_toolbar = (CollapsingToolbarLayout) findViewById(R.id.layout_toolbar);
|
||||||
image_view_toolbar = (ImageView) findViewById(R.id.image_view);
|
image_view_toolbar = (ImageView) findViewById(R.id.image_view);*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default view settings
|
* Default view settings
|
||||||
*/
|
*/
|
||||||
ok_button.setEnabled(false);
|
//ok_button.setEnabled(false);
|
||||||
layout_event_location.setEndIconVisible(false);
|
//layout_event_location.setEndIconVisible(false);
|
||||||
image_view_toolbar.setImageResource(R.drawable.ic_banner_foreground);
|
//image_view_toolbar.setImageResource(R.drawable.ic_banner_foreground);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Display title only when toolbar is collapsed
|
* Display title only when toolbar is collapsed
|
||||||
*/
|
*/
|
||||||
AppBarLayout app_bar_layout = (AppBarLayout) findViewById(R.id.app_bar);
|
/*AppBarLayout app_bar_layout = (AppBarLayout) findViewById(R.id.app_bar);
|
||||||
app_bar_layout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
app_bar_layout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
||||||
boolean show = true;
|
boolean show = true;
|
||||||
int scroll_range = -1;
|
int scroll_range = -1;
|
||||||
|
@ -106,7 +115,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
/*
|
/*
|
||||||
* Paste button: get last entry from clipboard
|
* Paste button: get last entry from clipboard
|
||||||
*/
|
*/
|
||||||
paste_button.setOnClickListener(new View.OnClickListener() {
|
/*paste_button.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
|
@ -141,7 +150,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
/*
|
/*
|
||||||
* Maps button: launch maps intent
|
* Maps button: launch maps intent
|
||||||
*/
|
*/
|
||||||
layout_event_location.setEndIconOnClickListener(new View.OnClickListener() {
|
/*layout_event_location.setEndIconOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
String map_search = "geo:0,0?q=" + edit_text_event_location.getText();
|
String map_search = "geo:0,0?q=" + edit_text_event_location.getText();
|
||||||
|
@ -152,12 +161,12 @@ public class MainActivity extends AppCompatActivity {
|
||||||
startActivity(map_intent);
|
startActivity(map_intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add to calendar button: launch calendar application
|
* Add to calendar button: launch calendar application
|
||||||
*/
|
*/
|
||||||
ok_button.setOnClickListener(new View.OnClickListener() {
|
/*ok_button.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
|
@ -179,7 +188,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enter button in uri input: start scraping
|
* Enter button in uri input: start scraping
|
||||||
|
@ -249,7 +258,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
edit_text_uri_input.setText("");
|
edit_text_uri_input.setText("");
|
||||||
layout_uri_input.setError(null);
|
layout_uri_input.setError(null);
|
||||||
}
|
}
|
||||||
edit_text_event_name.setText("");
|
/*edit_text_event_name.setText("");
|
||||||
edit_text_event_start.setText("");
|
edit_text_event_start.setText("");
|
||||||
edit_text_event_end.setText("");
|
edit_text_event_end.setText("");
|
||||||
edit_text_event_location.setText("");
|
edit_text_event_location.setText("");
|
||||||
|
@ -259,7 +268,9 @@ public class MainActivity extends AppCompatActivity {
|
||||||
edit_text_event_start.setError(null);
|
edit_text_event_start.setError(null);
|
||||||
edit_text_event_end.setError(null);
|
edit_text_event_end.setError(null);
|
||||||
edit_text_event_location.setError(null);
|
edit_text_event_location.setError(null);
|
||||||
edit_text_event_description.setError(null);
|
edit_text_event_description.setError(null);*/
|
||||||
|
|
||||||
|
this.events.clear();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
scraper.cancel(true);
|
scraper.cancel(true);
|
||||||
|
@ -269,62 +280,33 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ok_button.setEnabled(false);
|
/*ok_button.setEnabled(false);
|
||||||
layout_event_location.setEndIconVisible(false);
|
layout_event_location.setEndIconVisible(false);
|
||||||
image_view_toolbar.setImageResource(R.drawable.ic_banner_foreground);
|
image_view_toolbar.setImageResource(R.drawable.ic_banner_foreground);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the text fields with the event information provided.
|
* Updates the text fields with the event information provided.
|
||||||
* If something is missing, the corresponding test field will show an error.
|
* If something is missing, the corresponding test field will show an error.
|
||||||
*
|
*
|
||||||
* @param scraped_event the event information that was scraped by FbScraper
|
* @param events the event information that was scraped by FbScraper
|
||||||
*/
|
*/
|
||||||
public void update(FbEvent scraped_event) {
|
public void update(List<FbEvent> events) {
|
||||||
|
|
||||||
this.event = scraped_event;
|
this.events.addAll(0, events);
|
||||||
|
|
||||||
edit_text_uri_input.setText(event.url);
|
adapter.notifyItemInserted(0);
|
||||||
|
|
||||||
if (event.name.equals("")) {
|
/*edit_text_uri_input.setText(event.url);
|
||||||
edit_text_event_name.setError(getString(R.string.error_no_name));
|
|
||||||
} else {
|
|
||||||
edit_text_event_name.setText(event.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.start_date == null) {
|
|
||||||
edit_text_event_start.setError(getString(R.string.error_no_start_date));
|
|
||||||
} else {
|
|
||||||
String str = FbEvent.dateTimeToString(event.start_date);
|
|
||||||
edit_text_event_start.setText(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.end_date == null) {
|
|
||||||
edit_text_event_end.setError(getString(R.string.error_no_end_date));
|
|
||||||
} else {
|
|
||||||
String str = FbEvent.dateTimeToString(event.end_date);
|
|
||||||
edit_text_event_end.setText(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.location.equals("")) {
|
|
||||||
edit_text_event_location.setError(getString(R.string.error_no_location));
|
|
||||||
} else {
|
|
||||||
edit_text_event_location.setText(event.location);
|
|
||||||
layout_event_location.setEndIconVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.description.equals("")) {
|
|
||||||
edit_text_event_description.setError(getString(R.string.error_no_description));
|
|
||||||
} else {
|
|
||||||
edit_text_event_description.setText(event.description);
|
|
||||||
}
|
|
||||||
|
|
||||||
Picasso.get()
|
Picasso.get()
|
||||||
.load(event.image_url)
|
.load(event.image_url)
|
||||||
.placeholder(R.drawable.ic_banner_foreground)
|
.placeholder(R.drawable.ic_banner_foreground)
|
||||||
.into(image_view_toolbar);
|
.into(image_view_toolbar);
|
||||||
|
|
||||||
ok_button.setEnabled(true);
|
ok_button.setEnabled(true);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
||||||
|
<include layout="@layout/content_main" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<!--<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/coordinator_layout"
|
android:id="@+id/coordinator_layout"
|
||||||
|
@ -12,10 +21,11 @@
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/app_bar"
|
android:id="@+id/app_bar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="180dp"
|
android:layout_height="150dp"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||||
android:id="@+id/layout_toolbar"
|
android:id="@+id/layout_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -27,7 +37,12 @@
|
||||||
app:layout_scrollFlags="scroll|exitUntilCollapsed"
|
app:layout_scrollFlags="scroll|exitUntilCollapsed"
|
||||||
app:toolbarId="@+id/toolbar">
|
app:toolbarId="@+id/toolbar">
|
||||||
|
|
||||||
<!-- android:src="@drawable/ic_banner_foreground"-->
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||||
|
app:title="NoFb Event Scraper" />
|
||||||
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
@ -38,13 +53,7 @@
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
app:layout_collapseMode="parallax" />
|
app:layout_collapseMode="parallax" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/actionBarSize"
|
|
||||||
app:layout_collapseMode="pin"
|
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
|
||||||
app:title="NoFb Event Scraper" />
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||||
|
|
||||||
|
@ -63,7 +72,8 @@
|
||||||
android:tooltipText="@string/tooltip_paste"
|
android:tooltipText="@string/tooltip_paste"
|
||||||
tools:ignore="UnusedAttribute" />
|
tools:ignore="UnusedAttribute" />
|
||||||
|
|
||||||
<include layout="@layout/content_main" />
|
|
||||||
|
<include layout="@layout/content_main" />
|
||||||
|
|
||||||
<com.google.android.material.bottomappbar.BottomAppBar
|
<com.google.android.material.bottomappbar.BottomAppBar
|
||||||
android:id="@+id/bottom_appbar"
|
android:id="@+id/bottom_appbar"
|
||||||
|
@ -92,4 +102,4 @@
|
||||||
|
|
||||||
</com.google.android.material.bottomappbar.BottomAppBar>
|
</com.google.android.material.bottomappbar.BottomAppBar>
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>-->
|
||||||
|
|
|
@ -1,5 +1,50 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.core.widget.NestedScrollView
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context=".MainActivity"
|
||||||
|
tools:showIn="@layout/activity_main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_margin="16dp">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/layout_uri_input"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
|
app:endIconCheckable="false"
|
||||||
|
app:endIconDrawable="@drawable/ic_backspace_black"
|
||||||
|
app:errorIconDrawable="@drawable/ic_backspace_black"
|
||||||
|
app:endIconMode="custom"
|
||||||
|
|
||||||
|
app:helperText="@string/helper_add_link"
|
||||||
|
app:helperTextEnabled="true">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/edit_text_uri_input"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:autoLink="web"
|
||||||
|
android:cursorVisible="true"
|
||||||
|
android:hint="@string/hint_add_link"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColorLink="@color/material_on_background_emphasis_high_type" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView android:id="@+id/recycler_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!--<androidx.core.widget.NestedScrollView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
@ -141,4 +186,4 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>-->
|
|
@ -0,0 +1,112 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_margin="16dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linear_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:layout_marginBottom="64dp"
|
||||||
|
|
||||||
|
android:divider="@drawable/divider"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:showDividers="middle">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/edit_text_event_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:focusable="false"
|
||||||
|
android:cursorVisible="false"
|
||||||
|
android:hint="@string/hint_event_name"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColorLink="@color/material_on_background_emphasis_high_type" />
|
||||||
|
</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_height="match_parent">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/edit_text_event_start"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:focusable="false"
|
||||||
|
android:cursorVisible="false"
|
||||||
|
android:hint="@string/hint_event_start"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
|
android:singleLine="true" />
|
||||||
|
</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_height="match_parent">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/edit_text_event_end"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:focusable="false"
|
||||||
|
android:cursorVisible="false"
|
||||||
|
android:hint="@string/hint_event_end"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
|
android:singleLine="true" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/layout_event_location"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
|
android:layout_width="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/edit_text_event_location"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:focusable="false"
|
||||||
|
android:cursorVisible="false"
|
||||||
|
android:hint="@string/hint_event_location"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
|
android:singleLine="true" />
|
||||||
|
</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_height="match_parent">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/edit_text_event_description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:autoLink="web"
|
||||||
|
android:focusable="false"
|
||||||
|
android:cursorVisible="false"
|
||||||
|
android:hint="@string/hint_event_description"
|
||||||
|
android:inputType="textNoSuggestions|textMultiLine"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:textColorLink="@color/material_on_background_emphasis_high_type" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
Loading…
Reference in New Issue