mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-18 21:06:45 -06:00
Change description date in exam and fix styles (#98)
This commit is contained in:
parent
bfaa3d196b
commit
dd2c69601a
@ -58,7 +58,7 @@ public class ExamsWeek {
|
||||
.setType(snp.getRowDataChildValue(e, 2))
|
||||
.setDescription(snp.getRowDataChildValue(e, 3))
|
||||
.setTeacher(snp.getRowDataChildValue(e, 4).split(", ")[0])
|
||||
.setEntryDate(snp.getRowDataChildValue(e, 4).split(", ")[1])
|
||||
.setEntryDate(getFormattedDate(snp.getRowDataChildValue(e, 4).split(", ")[1]))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -104,8 +104,8 @@ public class ExamsWeekTest extends StudentAndParentTestCase {
|
||||
public void getExamEntryDateTest() throws Exception {
|
||||
List<ExamDay> dayList = onePerDay.getCurrent().getDays();
|
||||
|
||||
Assert.assertEquals("16.10.2017", dayList.get(0).getExamList().get(0).getEntryDate());
|
||||
Assert.assertEquals("17.10.2017", dayList.get(1).getExamList().get(0).getEntryDate());
|
||||
Assert.assertEquals("16.10.2017", dayList.get(2).getExamList().get(0).getEntryDate());
|
||||
Assert.assertEquals("2017-10-16", dayList.get(0).getExamList().get(0).getEntryDate());
|
||||
Assert.assertEquals("2017-10-17", dayList.get(1).getExamList().get(0).getEntryDate());
|
||||
Assert.assertEquals("2017-10-16", dayList.get(2).getExamList().get(0).getEntryDate());
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ android {
|
||||
}
|
||||
|
||||
greendao {
|
||||
schemaVersion 25
|
||||
schemaVersion 26
|
||||
generateTests = true
|
||||
}
|
||||
|
||||
|
@ -32,12 +32,14 @@
|
||||
android:name=".ui.login.LoginActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/title_activity_login"
|
||||
android:theme="@style/WulkanowyTheme.LoginTheme"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
<activity
|
||||
android:name=".ui.main.MainActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/activity_dashboard_text"
|
||||
android:launchMode="singleTop" />
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/WulkanowyTheme" />
|
||||
|
||||
<service
|
||||
android:name=".services.jobs.SyncJob"
|
||||
|
@ -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()));
|
||||
|
@ -118,7 +118,7 @@
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/exams_dialog_teacher_value"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/dialog_date_text"
|
||||
android:text="@string/exams_dialog_entry_date"
|
||||
android:textSize="17sp" />
|
||||
|
||||
<TextView
|
||||
|
@ -141,4 +141,5 @@
|
||||
<string name="widget_timetable_tomorrow">Jutro</string>
|
||||
<string name="exams_no_entries">Brak sprawdzianów w tym tygodniu</string>
|
||||
<string name="exams_type">Typ</string>
|
||||
<string name="exams_dialog_entry_date">Data wpisu</string>
|
||||
</resources>
|
||||
|
@ -136,4 +136,5 @@
|
||||
<string name="widget_timetable_tomorrow">Tomorrow</string>
|
||||
<string name="exams_no_entries">No exams in this week</string>
|
||||
<string name="exams_type">Type</string>
|
||||
<string name="exams_dialog_entry_date">Date of entry</string>
|
||||
</resources>
|
||||
|
@ -16,9 +16,22 @@
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
</style>
|
||||
|
||||
<style name="WulkanowyTheme.LoginTheme" parent="@style/Theme.AppCompat.Light">
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorPrimary</item>
|
||||
<item name="actionMenuTextColor">@android:color/primary_text_dark</item>
|
||||
<item name="android:textColorPrimary">@android:color/primary_text_light</item>
|
||||
<item name="android:textColorSecondary">@android:color/primary_text_light</item>
|
||||
<item name="android:textColorSecondaryInverse">@android:color/primary_text_dark</item>
|
||||
<item name="android:textColorTertiary">@android:color/primary_text_light</item>
|
||||
<item name="android:textColorTertiaryInverse">@android:color/primary_text_dark</item>
|
||||
<item name="titleTextColor">@android:color/primary_text_dark</item>
|
||||
<item name="subtitleTextColor">@android:color/primary_text_dark</item>
|
||||
<item name="android:colorBackground">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="WulkanowyTheme.SplashTheme" parent="WulkanowyTheme">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="android:windowBackground">@drawable/splash_background</item>
|
||||
</style>
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory android:title="@string/pref_view_header">
|
||||
<ListPreference
|
||||
android:defaultValue="2"
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/startup_tab_entries"
|
||||
android:entryValues="@array/startup_tab_value"
|
||||
android:key="startup_tab"
|
||||
|
Loading…
x
Reference in New Issue
Block a user