forked from github/wulkanowy-mirror
Change description date in exam and fix styles (#98)
This commit is contained in:

committed by
Mikołaj Pich

parent
bfaa3d196b
commit
dd2c69601a
@ -17,7 +17,7 @@ import javax.inject.Singleton;
|
||||
import io.github.wulkanowy.api.Vulcan;
|
||||
import io.github.wulkanowy.data.db.dao.entities.DaoMaster;
|
||||
import io.github.wulkanowy.data.db.dao.migrations.Migration23;
|
||||
import io.github.wulkanowy.data.db.dao.migrations.Migration25;
|
||||
import io.github.wulkanowy.data.db.dao.migrations.Migration26;
|
||||
import io.github.wulkanowy.data.db.shared.SharedPrefContract;
|
||||
import io.github.wulkanowy.di.annotations.ApplicationContext;
|
||||
import io.github.wulkanowy.di.annotations.DatabaseInfo;
|
||||
@ -75,7 +75,7 @@ public class DbHelper extends DaoMaster.OpenHelper {
|
||||
private List<Migration> getMigrations() {
|
||||
List<Migration> migrations = new ArrayList<>();
|
||||
migrations.add(new Migration23());
|
||||
migrations.add(new Migration25());
|
||||
migrations.add(new Migration26());
|
||||
|
||||
// Sorting just to be safe, in case other people add migrations in the wrong order.
|
||||
Comparator<Migration> migrationComparator = new Comparator<Migration>() {
|
||||
|
@ -33,8 +33,8 @@ public class Exam implements Serializable {
|
||||
@Property(nameInDb = "teacher")
|
||||
private String teacher = "";
|
||||
|
||||
@Property(nameInDb = "date")
|
||||
private String date = "";
|
||||
@Property(nameInDb = "entry_date")
|
||||
private String entryDate = "";
|
||||
|
||||
private static final long serialVersionUID = 42L;
|
||||
|
||||
@ -50,16 +50,16 @@ public class Exam implements Serializable {
|
||||
@Generated(hash = 973692038)
|
||||
private transient ExamDao myDao;
|
||||
|
||||
@Generated(hash = 1455345431)
|
||||
public Exam(Long id, Long dayId, String subjectAndGroup, String type,
|
||||
String description, String teacher, String date) {
|
||||
@Generated(hash = 998653360)
|
||||
public Exam(Long id, Long dayId, String subjectAndGroup, String type, String description,
|
||||
String teacher, String entryDate) {
|
||||
this.id = id;
|
||||
this.dayId = dayId;
|
||||
this.subjectAndGroup = subjectAndGroup;
|
||||
this.type = type;
|
||||
this.description = description;
|
||||
this.teacher = teacher;
|
||||
this.date = date;
|
||||
this.entryDate = entryDate;
|
||||
}
|
||||
|
||||
@Generated(hash = 945526930)
|
||||
@ -120,12 +120,12 @@ public class Exam implements Serializable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return date;
|
||||
public String getEntryDate() {
|
||||
return entryDate;
|
||||
}
|
||||
|
||||
public Exam setDate(String date) {
|
||||
this.date = date;
|
||||
public Exam setEntryDate(String entryDate) {
|
||||
this.entryDate = entryDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -6,11 +6,11 @@ import io.github.wulkanowy.api.Vulcan;
|
||||
import io.github.wulkanowy.data.db.dao.DbHelper;
|
||||
import io.github.wulkanowy.data.db.shared.SharedPrefContract;
|
||||
|
||||
public class Migration25 implements DbHelper.Migration {
|
||||
public class Migration26 implements DbHelper.Migration {
|
||||
|
||||
@Override
|
||||
public Integer getVersion() {
|
||||
return 25;
|
||||
return 26;
|
||||
}
|
||||
|
||||
@Override
|
@ -57,7 +57,7 @@ public class SharedPrefRepository implements SharedPrefContract {
|
||||
|
||||
@Override
|
||||
public int getStartupTab() {
|
||||
return Integer.parseInt(settingsSharedPref.getString(SettingsFragment.SHARED_KEY_START_TAB, "2"));
|
||||
return Integer.parseInt(settingsSharedPref.getString(SettingsFragment.SHARED_KEY_START_TAB, "0"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,14 +1,9 @@
|
||||
package io.github.wulkanowy.data.sync;
|
||||
|
||||
import org.threeten.bp.LocalDate;
|
||||
import org.threeten.bp.format.DateTimeFormatter;
|
||||
import org.threeten.bp.format.TextStyle;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@ -22,7 +17,6 @@ import io.github.wulkanowy.data.db.dao.entities.Exam;
|
||||
import io.github.wulkanowy.data.db.dao.entities.ExamDao;
|
||||
import io.github.wulkanowy.data.db.dao.entities.Week;
|
||||
import io.github.wulkanowy.data.db.dao.entities.WeekDao;
|
||||
import io.github.wulkanowy.utils.AppConstant;
|
||||
import io.github.wulkanowy.utils.DataObjectConverter;
|
||||
import io.github.wulkanowy.utils.LogUtils;
|
||||
import io.github.wulkanowy.utils.TimeUtils;
|
||||
@ -122,7 +116,7 @@ public class ExamsSync {
|
||||
|
||||
private void prepareExam(List<io.github.wulkanowy.api.exams.Exam> examList,
|
||||
List<Exam> preparedExams, long dayId) {
|
||||
List<Exam> examsApiEntity = DataObjectConverter.examsToExamsEntitiy(examList);
|
||||
List<Exam> examsApiEntity = DataObjectConverter.examsToExamsEntity(examList);
|
||||
|
||||
for (Exam examApi : examsApiEntity) {
|
||||
Exam examDb = getExamFromDb(examApi, dayId);
|
||||
@ -139,7 +133,7 @@ public class ExamsSync {
|
||||
private Exam getExamFromDb(Exam examApi, long dayId) {
|
||||
return daoSession.getExamDao().queryBuilder()
|
||||
.where(ExamDao.Properties.DayId.eq(dayId),
|
||||
ExamDao.Properties.Date.eq(examApi.getDate()),
|
||||
ExamDao.Properties.EntryDate.eq(examApi.getEntryDate()),
|
||||
ExamDao.Properties.SubjectAndGroup.eq(examApi.getSubjectAndGroup()),
|
||||
ExamDao.Properties.Teacher.eq(examApi.getTeacher()))
|
||||
.unique();
|
||||
|
@ -31,7 +31,7 @@ public class ExamsDialogFragment extends DialogFragment {
|
||||
TextView teacher;
|
||||
|
||||
@BindView(R.id.exams_dialog_date_value)
|
||||
TextView date;
|
||||
TextView entryDate;
|
||||
|
||||
@BindView(R.id.exams_dialog_description_value)
|
||||
TextView description;
|
||||
@ -65,7 +65,7 @@ public class ExamsDialogFragment extends DialogFragment {
|
||||
subject.setText(exam.getSubjectAndGroup());
|
||||
teacher.setText(exam.getTeacher());
|
||||
type.setText(exam.getType());
|
||||
date.setText(exam.getDate());
|
||||
entryDate.setText(exam.getEntryDate());
|
||||
|
||||
if (!exam.getDescription().isEmpty()) {
|
||||
description.setText(exam.getDescription());
|
||||
|
@ -170,13 +170,13 @@ public final class DataObjectConverter {
|
||||
return lessonEntityList;
|
||||
}
|
||||
|
||||
public static List<Exam> examsToExamsEntitiy(List<io.github.wulkanowy.api.exams.Exam> examList) {
|
||||
public static List<Exam> examsToExamsEntity(List<io.github.wulkanowy.api.exams.Exam> examList) {
|
||||
List<Exam> examEntityList = new ArrayList<>();
|
||||
|
||||
for (io.github.wulkanowy.api.exams.Exam exam : examList) {
|
||||
examEntityList.add(new Exam()
|
||||
.setDescription(exam.getDescription())
|
||||
.setDate(exam.getEntryDate())
|
||||
.setEntryDate(exam.getEntryDate())
|
||||
.setSubjectAndGroup(exam.getSubjectAndGroup())
|
||||
.setTeacher(exam.getTeacher())
|
||||
.setType(exam.getType()));
|
||||
|
Reference in New Issue
Block a user