Commit eaec48c8 authored by Rufus's avatar Rufus

updates URL to pretalx

Deletes old and unused files
quickfix: sets info about speakers to invisible because the URL scheme from pretalx does not match with FRAB.
adds todos regarding mapping of buildings and rooms
replaces FOSDEM with GLT Logo
Removes dates so that they do not have to be updated
FHJ->TUG
parent ef706fd0
......@@ -38,9 +38,9 @@ public class GLTUrls {
return ROOMS_URL;
}
public static String getEvent(String slug, int year) {
/*public static String getEvent(String slug, int year) {
return String.format(Locale.US, EVENT_URL_FORMAT, year-2000, slug);
}
}*/
public static String getPerson(String slug, int year) {
return String.format(Locale.US, PERSON_URL_FORMAT, year-2000, slug);
......
......@@ -25,7 +25,7 @@ import at.linuxtage.companion.model.Person;
import at.linuxtage.companion.model.Track;
import at.linuxtage.companion.utils.DateUtils;
@Database(entities = {EventEntity.class, EventTitles.class, Person.class, EventToPerson.class, Link.class, Track.class, Day.class, Bookmark.class}, version = 2, exportSchema = false)
@Database(entities = {EventEntity.class, EventTitles.class, Person.class, EventToPerson.class, Link.class, Track.class, Day.class, Bookmark.class}, version = 3, exportSchema = false)
@TypeConverters({GlobalTypeConverters.class})
public abstract class AppDatabase extends RoomDatabase {
......@@ -39,7 +39,7 @@ public abstract class AppDatabase extends RoomDatabase {
// Events: make primary key and track_id not null
database.execSQL("CREATE TABLE tmp_"
+ EventEntity.TABLE_NAME
+ " (id INTEGER PRIMARY KEY NOT NULL, day_index INTEGER NOT NULL, start_time INTEGER, end_time INTEGER, room_name TEXT, slug TEXT, track_id INTEGER NOT NULL, abstract TEXT, description TEXT);");
+ " (id INTEGER PRIMARY KEY NOT NULL, day_index INTEGER NOT NULL, start_time INTEGER, end_time INTEGER, room_name TEXT, slug TEXT, url TEXT, track_id INTEGER NOT NULL, abstract TEXT, description TEXT);");
database.execSQL("INSERT INTO tmp_" + EventEntity.TABLE_NAME + " SELECT * FROM " + EventEntity.TABLE_NAME);
database.execSQL("DROP TABLE " + EventEntity.TABLE_NAME);
database.execSQL("ALTER TABLE tmp_" + EventEntity.TABLE_NAME + " RENAME TO " + EventEntity.TABLE_NAME);
......@@ -76,6 +76,22 @@ public abstract class AppDatabase extends RoomDatabase {
}
};
static final Migration MIGRATION_2_3 = new Migration(2, 3) {
@Override
public void migrate(SupportSQLiteDatabase database) {
// Events: add URL field
database.execSQL("DROP TABLE " + EventEntity.TABLE_NAME);
database.execSQL("CREATE TABLE "
+ EventEntity.TABLE_NAME
+ " (id INTEGER PRIMARY KEY NOT NULL, day_index INTEGER NOT NULL, start_time INTEGER, end_time INTEGER, room_name TEXT, slug TEXT, url TEXT, track_id INTEGER NOT NULL, abstract TEXT, description TEXT);");
database.execSQL("CREATE INDEX event_day_index_idx ON " + EventEntity.TABLE_NAME + " (day_index)");
database.execSQL("CREATE INDEX event_start_time_idx ON " + EventEntity.TABLE_NAME + " (start_time)");
database.execSQL("CREATE INDEX event_end_time_idx ON " + EventEntity.TABLE_NAME + " (end_time)");
database.execSQL("CREATE INDEX event_track_id_idx ON " + EventEntity.TABLE_NAME + " (track_id)");
}
};
private SharedPreferences sharedPreferences;
public SharedPreferences getSharedPreferences() {
......@@ -88,8 +104,9 @@ public abstract class AppDatabase extends RoomDatabase {
synchronized (AppDatabase.class) {
res = INSTANCE;
if (res == null) {
res = Room.databaseBuilder(context.getApplicationContext(), AppDatabase.class, "fosdem.sqlite")
res = Room.databaseBuilder(context.getApplicationContext(), AppDatabase.class, "glt.sqlite")
.addMigrations(MIGRATION_1_2)
.addMigrations(MIGRATION_2_3)
.setJournalMode(JournalMode.TRUNCATE)
.build();
res.sharedPreferences = context.getApplicationContext().getSharedPreferences(DB_PREFS_FILE, Context.MODE_PRIVATE);
......
......@@ -19,7 +19,7 @@ public abstract class BookmarksDao {
*
* @param minStartTime When greater than 0, only return the events starting after this time.
*/
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, et.title, et.subtitle, e.abstract, e.description"
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, e.url, et.title, et.subtitle, e.abstract, e.description"
+ ", GROUP_CONCAT(p.name, ', ') AS persons, e.day_index, d.date AS day_date, e.track_id, t.name AS track_name, t.type AS track_type"
+ " FROM bookmarks b"
+ " JOIN events e ON b.event_id = e.id"
......@@ -33,7 +33,7 @@ public abstract class BookmarksDao {
+ " ORDER BY e.start_time ASC")
public abstract LiveData<List<Event>> getBookmarks(long minStartTime);
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, et.title, et.subtitle, e.abstract, e.description"
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, e.url, et.title, et.subtitle, e.abstract, e.description"
+ ", GROUP_CONCAT(p.name, ', ') AS persons, e.day_index, d.date AS day_date, e.track_id, t.name AS track_name, t.type AS track_type"
+ " FROM bookmarks b"
+ " JOIN events e ON b.event_id = e.id"
......
......@@ -258,7 +258,7 @@ public abstract class ScheduleDao {
/**
* Returns the event with the specified id, or null if not found.
*/
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, et.title, et.subtitle, e.abstract, e.description"
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, e.url, et.title, et.subtitle, e.abstract, e.description"
+ ", GROUP_CONCAT(p.name, ', ') AS persons, e.day_index, d.date AS day_date, e.track_id, t.name AS track_name, t.type AS track_type"
+ " FROM events e"
+ " JOIN events_titles et ON e.id = et.`rowid`"
......@@ -275,7 +275,7 @@ public abstract class ScheduleDao {
/**
* Returns all found events whose id is part of the given list.
*/
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, et.title, et.subtitle, e.abstract, e.description"
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, e.url, et.title, et.subtitle, e.abstract, e.description"
+ ", GROUP_CONCAT(p.name, ', ') AS persons, e.day_index, d.date AS day_date, e.track_id, t.name AS track_name, t.type AS track_type"
+ ", b.event_id IS NOT NULL AS is_bookmarked"
+ " FROM events e"
......@@ -293,7 +293,7 @@ public abstract class ScheduleDao {
/**
* Returns the events for a specified track.
*/
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, et.title, et.subtitle, e.abstract, e.description"
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, e.url, et.title, et.subtitle, e.abstract, e.description"
+ ", GROUP_CONCAT(p.name, ', ') AS persons, e.day_index, d.date AS day_date, e.track_id, t.name AS track_name, t.type AS track_type"
+ ", b.event_id IS NOT NULL AS is_bookmarked"
+ " FROM events e"
......@@ -311,7 +311,7 @@ public abstract class ScheduleDao {
/**
* Returns a snapshot of the events for a specified track (without the bookmark status).
*/
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, et.title, et.subtitle, e.abstract, e.description"
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, e.url, et.title, et.subtitle, e.abstract, e.description"
+ ", GROUP_CONCAT(p.name, ', ') AS persons, e.day_index, d.date AS day_date, e.track_id, t.name AS track_name, t.type AS track_type"
+ " FROM events e"
+ " JOIN events_titles et ON e.id = et.`rowid`"
......@@ -327,7 +327,7 @@ public abstract class ScheduleDao {
/**
* Returns events starting in the specified interval, ordered by ascending start time.
*/
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, et.title, et.subtitle, e.abstract, e.description"
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, e.url, et.title, et.subtitle, e.abstract, e.description"
+ ", GROUP_CONCAT(p.name, ', ') AS persons, e.day_index, d.date AS day_date, e.track_id, t.name AS track_name, t.type AS track_type"
+ ", b.event_id IS NOT NULL AS is_bookmarked"
+ " FROM events e"
......@@ -345,7 +345,7 @@ public abstract class ScheduleDao {
/**
* Returns events in progress at the specified time, ordered by descending start time.
*/
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, et.title, et.subtitle, e.abstract, e.description"
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, e.url, et.title, et.subtitle, e.abstract, e.description"
+ ", GROUP_CONCAT(p.name, ', ') AS persons, e.day_index, d.date AS day_date, e.track_id, t.name AS track_name, t.type AS track_type"
+ ", b.event_id IS NOT NULL AS is_bookmarked"
+ " FROM events e"
......@@ -363,7 +363,7 @@ public abstract class ScheduleDao {
/**
* Returns the events presented by the specified person.
*/
@Query("SELECT e.id , e.start_time, e.end_time, e.room_name, e.slug, et.title, et.subtitle, e.abstract, e.description"
@Query("SELECT e.id , e.start_time, e.end_time, e.room_name, e.slug, e.url, et.title, et.subtitle, e.abstract, e.description"
+ ", GROUP_CONCAT(p.name, ', ') AS persons, e.day_index, d.date AS day_date, e.track_id, t.name AS track_name, t.type AS track_type"
+ ", b.event_id IS NOT NULL AS is_bookmarked"
+ " FROM events e"
......@@ -383,7 +383,7 @@ public abstract class ScheduleDao {
* Search through matching titles, subtitles, track names, person names. We need to use an union of 3 sub-queries because a "match" condition can not be
* accompanied by other conditions in a "where" statement.
*/
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, et.title, et.subtitle, e.abstract, e.description"
@Query("SELECT e.id, e.start_time, e.end_time, e.room_name, e.slug, e.url, et.title, et.subtitle, e.abstract, e.description"
+ ", GROUP_CONCAT(p.name, ', ') AS persons, e.day_index, d.date AS day_date, e.track_id, t.name AS track_name, t.type AS track_type"
+ ", b.event_id IS NOT NULL AS is_bookmarked"
+ " FROM events e"
......
......@@ -33,6 +33,7 @@ public class EventEntity {
@ColumnInfo(name = "room_name")
private final String roomName;
private final String slug;
private final String url;
@ColumnInfo(name = "track_id")
private final long trackId;
@ColumnInfo(name = "abstract")
......@@ -41,17 +42,18 @@ public class EventEntity {
public EventEntity(Event event) {
this(event.getId(), event.getDay().getIndex(), event.getStartTime(), event.getEndTime(), event.getRoomName(),
event.getSlug(), event.getTrack().getId(), event.getAbstractText(), event.getDescription());
event.getSlug(), event.getUrl(), event.getTrack().getId(), event.getAbstractText(), event.getDescription());
}
public EventEntity(long id, int dayIndex, Date startTime, Date endTime, String roomName,
String slug, long trackId, String abstractText, String description) {
String slug, String url, long trackId, String abstractText, String description) {
this.id = id;
this.dayIndex = dayIndex;
this.startTime = startTime;
this.endTime = endTime;
this.roomName = roomName;
this.slug = slug;
this.url= url;
this.trackId = trackId;
this.abstractText = abstractText;
this.description = description;
......@@ -81,6 +83,9 @@ public class EventEntity {
return slug;
}
public String getUrl() {
return url;
}
public long getTrackId() {
return trackId;
}
......
......@@ -232,7 +232,7 @@ public class EventDetailsFragment extends Fragment {
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra(CalendarContract.Events.TITLE, event.getTitle());
intent.putExtra(CalendarContract.Events.EVENT_LOCATION, "ULB - " + event.getRoomName());
intent.putExtra(CalendarContract.Events.EVENT_LOCATION, "TU Graz Inffeldgasse - " + event.getRoomName());
String description = event.getAbstractText();
if (TextUtils.isEmpty(description)) {
description = event.getDescription();
......
......@@ -4,7 +4,7 @@ import android.text.TextUtils;
public enum Building {
J, K, H, U, AW, Unknown;
//TODO mapping of Building to room for GLT
public static Building fromRoomName(String roomName) {
if (!TextUtils.isEmpty(roomName)) {
switch (Character.toUpperCase(roomName.charAt(0))) {
......
......@@ -27,6 +27,7 @@ public class Event implements Parcelable {
@ColumnInfo(name = "room_name")
private String roomName;
private String slug;
private String url;
private String title;
@ColumnInfo(name = "subtitle")
private String subTitle;
......@@ -105,10 +106,18 @@ public class Event implements Parcelable {
this.slug = slug;
}
public String getUrl() {
return GLTUrls.getEvent(slug, DateUtils.getYear(getDay().getDate().getTime()));
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
/*public String getUrl() {
return GLTUrls.getEvent(slug, DateUtils.getYear(getDay().getDate().getTime()));
}*/
public String getTitle() {
return title;
}
......
......@@ -16,15 +16,17 @@ public class Track implements Parcelable {
public static final String TABLE_NAME = "tracks";
public enum Type {
workshop(R.string.workshop, R.color.track_type_other, R.color.track_type_other_dark),
discussion(R.string.discussion, R.color.track_type_other, R.color.track_type_other_dark),
lecture(R.string.lecture, R.color.track_type_other, R.color.track_type_other_dark),
lightning_talk(R.string.lightning_talk, R.color.track_type_lightning_talk, R.color.track_type_lightning_talk_dark),
Workshop(R.string.workshop, R.color.track_type_other, R.color.track_type_other_dark),
Vortrag(R.string.lecture, R.color.track_type_main, R.color.track_type_main_dark),
Prüfung(R.string.certification_exam, R.color.track_type_certification_exam, R.color.track_type_certification_exam_dark),
discussion(R.string.discussion, R.color.track_type_developer_room, R.color.track_type_developer_room_dark),
exam(R.string.exam, R.color.track_type_certification_exam, R.color.track_type_certification_exam_dark),
other(R.string.other, R.color.track_type_other, R.color.track_type_other_dark),
keynote(R.string.keynote, R.color.track_type_keynote, R.color.track_type_keynote_dark),
lightningtalk(R.string.lightning_talk, R.color.track_type_lightning_talk, R.color.track_type_lightning_talk_dark),
certification(R.string.certification_exam, R.color.track_type_certification_exam, R.color.track_type_certification_exam_dark);
lightning_talk(R.string.lightning_talk, R.color.track_type_lightning_talk, R.color.track_type_lightning_talk_dark),
lightningtalk(R.string.lightning_talk, R.color.track_type_lightning_talk, R.color.track_type_lightning_talk_dark);
private final int nameResId;
private final int colorResId;
......
......@@ -114,6 +114,9 @@ public class EventsParser extends IterableAbstractPullParser<DetailedEvent> {
case "slug":
event.setSlug(parser.nextText());
break;
case "url":
event.setUrl(parser.nextText());
break;
case "title":
event.setTitle(parser.nextText());
break;
......
This diff is collapsed.
......@@ -118,7 +118,7 @@
android:saveEnabled="false"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textIsSelectable="true"
tools:text="Welcome to GLT 2015!"/>
tools:text="Welcome to GLT!"/>
<TextView
android:id="@+id/links_header"
......
......@@ -5,5 +5,4 @@
android:layout_height="@dimen/main_menu_header_height"
android:contentDescription="@string/app_name"
android:padding="@dimen/main_menu_padding"
android:scaleType="center"
app:srcCompat="@drawable/fosdem_title" />
\ No newline at end of file
......@@ -6,6 +6,7 @@
android:id="@+id/more_info"
android:icon="@drawable/ic_info_white_24dp"
android:title="@string/more_info"
android:visible="false"
app:showAsAction="ifRoom"/>
</menu>
\ No newline at end of file
......@@ -54,7 +54,7 @@
<!--<string name="main_track">Main track</string> -->
<!--<string name="developer_room">Developer room</string> -->
<string name="lightning_talk">Lightning Talk</string>
<!--<string name="certification_exam">Certification Exam</string> -->
<string name="certification_exam">Certification Exam</string>
<!-- Search -->
<string name="search_events">Veranstaltungen suchen</string>
......@@ -116,7 +116,7 @@
<!-- Others -->
<string name="room_map">Raumplan</string>
<string name="directions">Wegbeschreibung zur FH Joanneum</string>
<string name="directions">Wegbeschreibung zur TU Graz</string>
<string name="no_data">Keine Daten vorhanden.</string>
<string name="volunteer">Helfer</string>
<string name="about">Über</string>
......
......@@ -138,7 +138,7 @@
<!-- Others -->
<string name="room_map">Room map</string>
<string name="directions">Directions to FH Joanneum</string>
<string name="directions">Directions to TU Graz</string>
<string name="navigation">On-site navigation</string>
<string name="no_data">No data available.</string>
<string name="volunteer">Volunteer</string>
......@@ -153,4 +153,5 @@
\n- <a href="https://material.io/develop/android/">Material Components for Android</a><i> by The Android Open Source Project</i>
\n- <a href="https://github.com/chrisbanes/PhotoView">PhotoView</a><i> by Chris Banes, Marek Sebera and John Carlson</i></small></string>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment