Commit be160a33 authored by Fabius's avatar Fabius Committed by Toni Beier

Parser Klasse eingefuehrt um Doppelte Funktionen zu entfernen.

#25
parent 2ff1ba14
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,79 +65,6 @@ public class TimetableAdapter extends CategoryListViewAdapter<Course> { ...@@ -62,79 +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;
}
private 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;
}
@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);
......
...@@ -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);
......
...@@ -2,16 +2,14 @@ package de.bps.asist.module.timetable.model; ...@@ -2,16 +2,14 @@ package de.bps.asist.module.timetable.model;
import android.content.Context; import android.content.Context;
import com.j256.ormlite.field.DatabaseField;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collection;
import de.bps.asist.R;
import de.bps.asist.core.annotation.ASiSTDetail; 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
...@@ -147,68 +145,4 @@ public class CourseDescription implements Serializable { ...@@ -147,68 +145,4 @@ public class CourseDescription implements Serializable {
public void setDesc(String desc) { public void setDesc(String desc) {
this.desc = desc; this.desc = desc;
} }
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
private 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 String getTypes() {
return types;
}
public void setTypes(String types) {
this.types = types;
}
} }
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