Commit a1806031 authored by Toni Beier's avatar Toni Beier

Merge branch '25-stundenplan-anzeige-vorlesungstyp' into 'develop'

Resolve #25 "Stundenplan: Anzeige Vorlesungstyp"

Closes #25

See merge request OpenASiST/openasist4android_core!16
parents ec972afc b37add6a
...@@ -17,7 +17,7 @@ public class ASiSTConstants { ...@@ -17,7 +17,7 @@ public class ASiSTConstants {
public static final int NOTIFICATION_ID_UPDATE = 6951; public static final int NOTIFICATION_ID_UPDATE = 6951;
public static final String DB_NAME = "ASiST.db"; public static final String DB_NAME = "ASiST.db";
public static final int DB_VERSION = 8; // DB_Version 4 ab myTU Version public static final int DB_VERSION = 9; // DB_Version 4 ab myTU Version
public static final String FEEDBACK_LECTURER_MODE = "feedback.lecturer.mode"; public static final String FEEDBACK_LECTURER_MODE = "feedback.lecturer.mode";
......
...@@ -83,6 +83,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { ...@@ -83,6 +83,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
// nothing to do // nothing to do
} }
} }
if(oldVersion < 9)
{
database.execSQL("ALTER TABLE 'course' ADD COLUMN type INTEGER NOT NULL DEFAULT (0);");
}
} }
} }
package de.bps.asist.module.timetable;
import android.content.Context;
import de.bps.asist.R;
public class CourseParser {
public static String parseLectureType(Context context, int type){
String key = "n/a";
switch (type){
case 1:
key = context.getResources().getString(R.string.module_timetable_course_type_lecture);
break;
case 2:
key = context.getResources().getString(R.string.module_timetable_course_type_tutorial);
break;
case 3:
key = context.getResources().getString(R.string.module_timetable_course_type_intership);
break;
case 4:
key = context.getResources().getString(R.string.module_timetable_course_type_seminar);
break;
case 5:
key = context.getResources().getString(R.string.module_timetable_course_type_exercise);
break;
case 6:
key = context.getResources().getString(R.string.module_timetable_course_type_advanced_seminar);
break;
case 7:
key = context.getResources().getString(R.string.module_timetable_course_type_proseminar);
break;
case 8:
key = context.getResources().getString(R.string.module_timetable_course_type_oberseminar);
break;
case 9:
key = context.getResources().getString(R.string.module_timetable_course_type_excursion);
break;
case 10:
key = context.getResources().getString(R.string.module_timetable_course_type_colloquium);
break;
case 11:
key = context.getResources().getString(R.string.module_timetable_course_type_project);
break;
case 12:
key = context.getResources().getString(R.string.module_timetable_course_type_exam);
break;
case 0:
key = context.getResources().getString(R.string.module_timetable_course_type_other);
default:
break;
}
return key;
}
public static String parseDayOfWeek(Context context, int dayOfWeek) {
String key = "n/a";
switch (dayOfWeek) {
case 1:
key = context.getResources().getString(R.string.monday);
break;
case 2:
key = context.getResources().getString(R.string.tuesday);
break;
case 3:
key = context.getResources().getString(R.string.wednesday);
break;
case 4:
key = context.getResources().getString(R.string.thursday);
break;
case 5:
key = context.getResources().getString(R.string.friday);
break;
case 0:
key = context.getResources().getString(R.string.sonstige_veranstaltung);
default:
break;
}
return key;
}
}
...@@ -20,6 +20,9 @@ import de.bps.asist.module.timetable.model.Course; ...@@ -20,6 +20,9 @@ import de.bps.asist.module.timetable.model.Course;
import de.bps.asist.module.timetable.model.CourseMap; import de.bps.asist.module.timetable.model.CourseMap;
import de.bps.asist.module.timetable.model.CourseTime; import de.bps.asist.module.timetable.model.CourseTime;
import static de.bps.asist.module.timetable.CourseParser.parseDayOfWeek;
import static de.bps.asist.module.timetable.CourseParser.parseLectureType;
public class TimetableAdapter extends CategoryListViewAdapter<Course> { public class TimetableAdapter extends CategoryListViewAdapter<Course> {
private static final int[] keys = new int[]{R.string.monday, R.string.tuesday, R.string.wednesday, R.string.thursday, private static final int[] keys = new int[]{R.string.monday, R.string.tuesday, R.string.wednesday, R.string.thursday,
...@@ -62,32 +65,6 @@ public class TimetableAdapter extends CategoryListViewAdapter<Course> { ...@@ -62,32 +65,6 @@ public class TimetableAdapter extends CategoryListViewAdapter<Course> {
return map; return map;
} }
private static String parseDayOfWeek(Context context, int dayOfWeek) {
String key = "n/a";
switch (dayOfWeek) {
case 1:
key = context.getResources().getString(R.string.monday);
break;
case 2:
key = context.getResources().getString(R.string.tuesday);
break;
case 3:
key = context.getResources().getString(R.string.wednesday);
break;
case 4:
key = context.getResources().getString(R.string.thursday);
break;
case 5:
key = context.getResources().getString(R.string.friday);
break;
case 0:
key = context.getResources().getString(R.string.sonstige_veranstaltung);
default:
break;
}
return key;
}
@Override @Override
protected LinearLayout addItemView(final int position, final LayoutInflater inflater) { protected LinearLayout addItemView(final int position, final LayoutInflater inflater) {
final Course item = (Course) getItem(position); final Course item = (Course) getItem(position);
...@@ -96,10 +73,17 @@ public class TimetableAdapter extends CategoryListViewAdapter<Course> { ...@@ -96,10 +73,17 @@ public class TimetableAdapter extends CategoryListViewAdapter<Course> {
addTitle(item, row); addTitle(item, row);
addDescription(item, row); addDescription(item, row);
addTime(item, row); addTime(item, row);
addType(item, row);
addCallback(item, row, getCallback()); addCallback(item, row, getCallback());
return row; return row;
} }
private void addType(Course item, LinearLayout row) {
final String type = parseLectureType(getContext(),item.getType());
final TextView typeView = (TextView) row.findViewById(R.id.listItemType);
typeView.setText(type);
}
private void addTime(final Course course, final LinearLayout row) { private void addTime(final Course course, final LinearLayout row) {
final String time = getTime(course); final String time = getTime(course);
final TextView timeView = (TextView) row.findViewById(R.id.timeTableTimeView); final TextView timeView = (TextView) row.findViewById(R.id.timeTableTimeView);
......
...@@ -101,12 +101,6 @@ public class TimetableDetailActivity extends AsistModuleActivity<Course> impleme ...@@ -101,12 +101,6 @@ public class TimetableDetailActivity extends AsistModuleActivity<Course> impleme
} }
adapter = new CourseDetailAdapter(this, categories, courseDesc); adapter = new CourseDetailAdapter(this, categories, courseDesc);
listView.setAdapter(adapter); listView.setAdapter(adapter);
......
...@@ -68,7 +68,11 @@ public class Course extends AbstractDatabaseObject implements IListItem { ...@@ -68,7 +68,11 @@ public class Course extends AbstractDatabaseObject implements IListItem {
private String titleAndRoom; private String titleAndRoom;
private Integer type; @AsistColumnDescription(position = 2)
@AsistDescription
@ASiSTDetail(i18nKey = "timetable_lecturer_title", position = 6)
@DatabaseField
private Integer type;
public Course() { public Course() {
// //
......
...@@ -8,6 +8,8 @@ import de.bps.asist.core.annotation.ASiSTDetail; ...@@ -8,6 +8,8 @@ import de.bps.asist.core.annotation.ASiSTDetail;
import de.bps.asist.module.poi.PoiModule; import de.bps.asist.module.poi.PoiModule;
import de.bps.asist.module.poi.model.PoiItem; import de.bps.asist.module.poi.model.PoiItem;
import static de.bps.asist.module.timetable.CourseParser.parseLectureType;
/** /**
* Created by litho on 13.10.14. * Created by litho on 13.10.14.
* Convenience class for Course information * Convenience class for Course information
...@@ -32,12 +34,16 @@ public class CourseDescription implements Serializable { ...@@ -32,12 +34,16 @@ public class CourseDescription implements Serializable {
@ASiSTDetail(i18nKey = "module_course_detail_description", position = 5) @ASiSTDetail(i18nKey = "module_course_detail_description", position = 5)
private String desc; private String desc;
@ASiSTDetail(i18nKey = "timetable_lecture_type", position = 6)
private String types;
private PoiItem poi; private PoiItem poi;
private CourseTimespan timeSpan; private CourseTimespan timeSpan;
private Course course; private Course course;
private Integer type;
public CourseDescription(Context context, Course course) { public CourseDescription(Context context, Course course) {
...@@ -68,6 +74,8 @@ public class CourseDescription implements Serializable { ...@@ -68,6 +74,8 @@ public class CourseDescription implements Serializable {
} }
} }
timeSpan = course.getCourseTime(); timeSpan = course.getCourseTime();
type = course.getType();
types = parseLectureType(context,type);
} }
public String getLecturer() { public String getLecturer() {
...@@ -137,5 +145,4 @@ public class CourseDescription implements Serializable { ...@@ -137,5 +145,4 @@ public class CourseDescription implements Serializable {
public void setDesc(String desc) { public void setDesc(String desc) {
this.desc = desc; this.desc = desc;
} }
} }
...@@ -52,6 +52,14 @@ ...@@ -52,6 +52,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/descColor" android:textColor="@color/descColor"
android:text="Description"/> android:text="Description"/>
<TextView
android:id="@+id/listItemType"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/descColor"
android:textSize="@dimen/descTextSize"
android:text="@string/module_timetable_course_type_other"/>
</LinearLayout> </LinearLayout>
......
...@@ -191,6 +191,20 @@ ...@@ -191,6 +191,20 @@
<string name="generic_list_showmore">Show more</string> <string name="generic_list_showmore">Show more</string>
<!-- timetable --> <!-- timetable -->
<string name="module_timetable_course_type_other">other</string>
<string name="module_timetable_course_type_lecture">lecture</string>
<string name="module_timetable_course_type_tutorial">tutorial</string>
<string name="module_timetable_course_type_intership">intership</string>
<string name="module_timetable_course_type_seminar">seminar</string>
<string name="module_timetable_course_type_exercise">exercise</string>
<string name="module_timetable_course_type_advanced_seminar">advanced seminar</string>
<string name="module_timetable_course_type_proseminar">proseminar</string>
<string name="module_timetable_course_type_oberseminar">oberseminar</string>
<string name="module_timetable_course_type_excursion">excursion</string>
<string name="module_timetable_course_type_colloquium">colloquium</string>
<string name="module_timetable_course_type_project">project</string>
<string name="module_timetable_course_type_exam">exam</string>
<string name="timetable_lecture_type">type:</string>
<!-- Feedback Module --> <!-- Feedback Module -->
<string name="module_feedback_name">Lecture feedback</string> <string name="module_feedback_name">Lecture feedback</string>
......
...@@ -200,6 +200,21 @@ ...@@ -200,6 +200,21 @@
<!-- timetable --> <!-- timetable -->
<string name="module_timetable_course_code_not_found" formatted="false">Aktualisierung konnte nicht durchgeführt werden.\nImportieren Sie zuerst Ihren Stundenplan.</string> <string name="module_timetable_course_code_not_found" formatted="false">Aktualisierung konnte nicht durchgeführt werden.\nImportieren Sie zuerst Ihren Stundenplan.</string>
<string name="module_timetable_course_update_failure" formatted="false">Während der Aktualisierung des Stundplanes ist ein Fehler aufgetreten</string> <string name="module_timetable_course_update_failure" formatted="false">Während der Aktualisierung des Stundplanes ist ein Fehler aufgetreten</string>
<string name="module_timetable_course_type_other">Sonstiges</string>
<string name="module_timetable_course_type_lecture">Vorlesung</string>
<string name="module_timetable_course_type_tutorial">Tutorium</string>
<string name="module_timetable_course_type_intership">Praktikum</string>
<string name="module_timetable_course_type_seminar">Seminar</string>
<string name="module_timetable_course_type_exercise">Übung</string>
<string name="module_timetable_course_type_advanced_seminar">Hauptseminar</string>
<string name="module_timetable_course_type_proseminar">Proseminar</string>
<string name="module_timetable_course_type_oberseminar">Oberseminar</string>
<string name="module_timetable_course_type_excursion">Exkursion</string>
<string name="module_timetable_course_type_colloquium">Kolloquium</string>
<string name="module_timetable_course_type_project">Projekt</string>
<string name="module_timetable_course_type_exam">Klausur</string>
<string name="timetable_lecture_type">Art:</string>
<!-- Feedback Module --> <!-- Feedback Module -->
<string name="module_feedback_name">Vorlesungs-Feedback</string> <string name="module_feedback_name">Vorlesungs-Feedback</string>
......
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