forked from github/szkolny
[Attendance] Add free attendance type.
This commit is contained in:
parent
ade12e729f
commit
e607577407
@ -40,8 +40,8 @@ class EdudziennikWebAttendance(override val data: DataEdudziennik,
|
|||||||
"nieobecność" -> Attendance.TYPE_ABSENT
|
"nieobecność" -> Attendance.TYPE_ABSENT
|
||||||
"spóźnienie" -> Attendance.TYPE_BELATED
|
"spóźnienie" -> Attendance.TYPE_BELATED
|
||||||
"nieobecność usprawiedliwiona" -> Attendance.TYPE_ABSENT_EXCUSED
|
"nieobecność usprawiedliwiona" -> Attendance.TYPE_ABSENT_EXCUSED
|
||||||
"dzień wolny" -> Attendance.TYPE_RELEASED
|
"dzień wolny" -> Attendance.TYPE_FREE
|
||||||
"brak zajęć" -> Attendance.TYPE_RELEASED
|
"brak zajęć" -> Attendance.TYPE_FREE
|
||||||
"oddelegowany" -> Attendance.TYPE_RELEASED
|
"oddelegowany" -> Attendance.TYPE_RELEASED
|
||||||
else -> Attendance.TYPE_CUSTOM
|
else -> Attendance.TYPE_CUSTOM
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ public class Attendance {
|
|||||||
public static final int TYPE_BELATED = 4;
|
public static final int TYPE_BELATED = 4;
|
||||||
public static final int TYPE_BELATED_EXCUSED = 5;
|
public static final int TYPE_BELATED_EXCUSED = 5;
|
||||||
public static final int TYPE_CUSTOM = 6;
|
public static final int TYPE_CUSTOM = 6;
|
||||||
|
public static final int TYPE_FREE = 7;
|
||||||
@ColumnInfo(name = "attendanceType")
|
@ColumnInfo(name = "attendanceType")
|
||||||
public int type = TYPE_PRESENT;
|
public int type = TYPE_PRESENT;
|
||||||
|
|
||||||
|
@ -4,13 +4,14 @@ import android.content.Context;
|
|||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.PorterDuffColorFilter;
|
import android.graphics.PorterDuffColorFilter;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.App;
|
import pl.szczodrzynski.edziennik.App;
|
||||||
@ -21,6 +22,7 @@ import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.T
|
|||||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT_EXCUSED;
|
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT_EXCUSED;
|
||||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_BELATED;
|
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_BELATED;
|
||||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_BELATED_EXCUSED;
|
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_BELATED_EXCUSED;
|
||||||
|
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_FREE;
|
||||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_PRESENT;
|
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_PRESENT;
|
||||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_RELEASED;
|
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_RELEASED;
|
||||||
|
|
||||||
@ -56,6 +58,10 @@ public class AttendanceAdapter extends RecyclerView.Adapter<AttendanceAdapter.Vi
|
|||||||
holder.attendanceTime.setText(attendance.startTime.getStringHM());
|
holder.attendanceTime.setText(attendance.startTime.getStringHM());
|
||||||
|
|
||||||
switch (attendance.type) {
|
switch (attendance.type) {
|
||||||
|
case TYPE_FREE:
|
||||||
|
holder.attendanceType.getBackground().setColorFilter(new PorterDuffColorFilter(0xff166ee0, PorterDuff.Mode.MULTIPLY));
|
||||||
|
holder.attendanceType.setText(R.string.attendance_free_day);
|
||||||
|
break;
|
||||||
case TYPE_ABSENT:
|
case TYPE_ABSENT:
|
||||||
holder.attendanceType.getBackground().setColorFilter(new PorterDuffColorFilter(0xfff44336, PorterDuff.Mode.MULTIPLY));
|
holder.attendanceType.getBackground().setColorFilter(new PorterDuffColorFilter(0xfff44336, PorterDuff.Mode.MULTIPLY));
|
||||||
holder.attendanceType.setText(R.string.attendance_absent);
|
holder.attendanceType.setText(R.string.attendance_absent);
|
||||||
|
@ -83,6 +83,7 @@
|
|||||||
<string name="attendance_belated_excused" translatable="false">su</string>
|
<string name="attendance_belated_excused" translatable="false">su</string>
|
||||||
<string name="attendance_present" translatable="false">ob</string>
|
<string name="attendance_present" translatable="false">ob</string>
|
||||||
<string name="attendance_released" translatable="false">zw</string>
|
<string name="attendance_released" translatable="false">zw</string>
|
||||||
|
<string name="attendance_free_day" translatable="false">w</string>
|
||||||
<string name="attendances_absent">Nieobecności:</string>
|
<string name="attendances_absent">Nieobecności:</string>
|
||||||
<string name="attendances_absent_unexcused">W tym nieusprawiedliwione:</string>
|
<string name="attendances_absent_unexcused">W tym nieusprawiedliwione:</string>
|
||||||
<string name="attendances_belated">Spóźnienia:</string>
|
<string name="attendances_belated">Spóźnienia:</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user