[UI] Refactor homework fragment and fix typos

This commit is contained in:
Kacper Ziubryniewicz 2019-09-27 23:27:15 +02:00
parent 6b93ea25c6
commit b844914654
31 changed files with 402 additions and 522 deletions

10
.idea/misc.xml generated
View File

@ -10,7 +10,7 @@
<option name="myDefaultNotNull" value="androidx.annotation.RecentlyNonNull" /> <option name="myDefaultNotNull" value="androidx.annotation.RecentlyNonNull" />
<option name="myNullables"> <option name="myNullables">
<value> <value>
<list size="10"> <list size="12">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" /> <item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
@ -21,12 +21,14 @@
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" /> <item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" /> <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" /> <item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
<item index="10" class="java.lang.String" itemvalue="android.annotation.Nullable" />
<item index="11" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
</list> </list>
</value> </value>
</option> </option>
<option name="myNotNulls"> <option name="myNotNulls">
<value> <value>
<list size="9"> <list size="11">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
@ -36,11 +38,13 @@
<item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" /> <item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" /> <item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" /> <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
<item index="9" class="java.lang.String" itemvalue="android.annotation.NonNull" />
<item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
</list> </list>
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@ -19,7 +19,6 @@ import android.provider.Settings;
import android.util.Base64; import android.util.Base64;
import android.util.Log; import android.util.Log;
import android.util.Pair; import android.util.Pair;
import android.widget.Toast;
import com.evernote.android.job.JobManager; import com.evernote.android.job.JobManager;
import com.google.android.gms.security.ProviderInstaller; import com.google.android.gms.security.ProviderInstaller;
@ -78,7 +77,6 @@ import pl.szczodrzynski.edziennik.datamodels.ProfileFull;
import pl.szczodrzynski.edziennik.models.AppConfig; import pl.szczodrzynski.edziennik.models.AppConfig;
import pl.szczodrzynski.edziennik.network.NetworkUtils; import pl.szczodrzynski.edziennik.network.NetworkUtils;
import pl.szczodrzynski.edziennik.network.TLSSocketFactory; import pl.szczodrzynski.edziennik.network.TLSSocketFactory;
import pl.szczodrzynski.edziennik.receivers.BootReceiver;
import pl.szczodrzynski.edziennik.receivers.JobsCreator; import pl.szczodrzynski.edziennik.receivers.JobsCreator;
import pl.szczodrzynski.edziennik.sync.SyncJob; import pl.szczodrzynski.edziennik.sync.SyncJob;
import pl.szczodrzynski.edziennik.utils.PermissionChecker; import pl.szczodrzynski.edziennik.utils.PermissionChecker;
@ -344,7 +342,7 @@ public class App extends androidx.multidex.MultiDexApplication {
.setIcon(Icon.createWithResource(this, R.mipmap.ic_shortcut_homework)) .setIcon(Icon.createWithResource(this, R.mipmap.ic_shortcut_homework))
//.setIcon(getDesktopIconFromIconics(SzkolnyFont.Icon.szf_file_document_edit)) //.setIcon(getDesktopIconFromIconics(SzkolnyFont.Icon.szf_file_document_edit))
.setIntent(new Intent(Intent.ACTION_MAIN, null, this, MainActivity.class) .setIntent(new Intent(Intent.ACTION_MAIN, null, this, MainActivity.class)
.putExtra("fragmentId", MainActivity.DRAWER_ITEM_HOMEWORKS)) .putExtra("fragmentId", MainActivity.DRAWER_ITEM_HOMEWORK))
.build(); .build();
ShortcutInfo shortcutMessages = new ShortcutInfo.Builder(mContext, "item_messages") ShortcutInfo shortcutMessages = new ShortcutInfo.Builder(mContext, "item_messages")

View File

@ -6,21 +6,14 @@ import android.content.Context
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.util.Log
import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat
import com.google.gson.JsonArray import com.google.gson.JsonArray
import com.google.gson.JsonNull
import com.google.gson.JsonObject import com.google.gson.JsonObject
import im.wangchao.mhttp.Response
import im.wangchao.mhttp.callback.JsonCallbackHandler
import im.wangchao.mhttp.callback.TextCallbackHandler
import im.wangchao.mhttp.internal.exception.ResponseFailException
import pl.szczodrzynski.edziennik.datamodels.Profile import pl.szczodrzynski.edziennik.datamodels.Profile
import pl.szczodrzynski.edziennik.datamodels.Teacher import pl.szczodrzynski.edziennik.datamodels.Teacher
import pl.szczodrzynski.navlib.R import pl.szczodrzynski.navlib.R
import pl.szczodrzynski.navlib.crc16 import pl.szczodrzynski.navlib.crc16
import pl.szczodrzynski.navlib.getColorFromRes import pl.szczodrzynski.navlib.getColorFromRes
import kotlin.contracts.contract
fun List<Teacher>.byId(id: Long) = firstOrNull { it.id == id } fun List<Teacher>.byId(id: Long) = firstOrNull { it.id == id }
fun List<Teacher>.byNameFirstLast(nameFirstLast: String) = firstOrNull { it.name + " " + it.surname == nameFirstLast } fun List<Teacher>.byNameFirstLast(nameFirstLast: String) = firstOrNull { it.name + " " + it.surname == nameFirstLast }

View File

@ -50,6 +50,7 @@ import pl.szczodrzynski.edziennik.datamodels.Profile
import pl.szczodrzynski.edziennik.datamodels.ProfileFull import pl.szczodrzynski.edziennik.datamodels.ProfileFull
import pl.szczodrzynski.edziennik.dialogs.ChangelogDialog import pl.szczodrzynski.edziennik.dialogs.ChangelogDialog
import pl.szczodrzynski.edziennik.fragments.* import pl.szczodrzynski.edziennik.fragments.*
import pl.szczodrzynski.edziennik.homework.HomeworkFragment
import pl.szczodrzynski.edziennik.login.LoginActivity import pl.szczodrzynski.edziennik.login.LoginActivity
import pl.szczodrzynski.edziennik.messages.MessagesDetailsFragment import pl.szczodrzynski.edziennik.messages.MessagesDetailsFragment
import pl.szczodrzynski.edziennik.messages.MessagesFragment import pl.szczodrzynski.edziennik.messages.MessagesFragment
@ -83,7 +84,7 @@ class MainActivity : AppCompatActivity() {
const val DRAWER_ITEM_AGENDA = 12 const val DRAWER_ITEM_AGENDA = 12
const val DRAWER_ITEM_GRADES = 13 const val DRAWER_ITEM_GRADES = 13
const val DRAWER_ITEM_MESSAGES = 17 const val DRAWER_ITEM_MESSAGES = 17
const val DRAWER_ITEM_HOMEWORKS = 14 const val DRAWER_ITEM_HOMEWORK = 14
const val DRAWER_ITEM_NOTICES = 15 const val DRAWER_ITEM_NOTICES = 15
const val DRAWER_ITEM_ATTENDANCES = 16 const val DRAWER_ITEM_ATTENDANCES = 16
const val DRAWER_ITEM_ANNOUNCEMENTS = 18 const val DRAWER_ITEM_ANNOUNCEMENTS = 18
@ -129,7 +130,7 @@ class MainActivity : AppCompatActivity() {
.withBadgeTypeId(TYPE_MESSAGE) .withBadgeTypeId(TYPE_MESSAGE)
.isInDrawer(true) .isInDrawer(true)
list += NavTarget(DRAWER_ITEM_HOMEWORKS, R.string.menu_homework, RegisterHomeworksFragment::class) list += NavTarget(DRAWER_ITEM_HOMEWORK, R.string.menu_homework, HomeworkFragment::class)
.withIcon(SzkolnyFont.Icon.szf_file_document_edit) .withIcon(SzkolnyFont.Icon.szf_file_document_edit)
.withBadgeTypeId(TYPE_HOMEWORK) .withBadgeTypeId(TYPE_HOMEWORK)
.isInDrawer(true) .isInDrawer(true)
@ -522,7 +523,7 @@ class MainActivity : AppCompatActivity() {
DRAWER_ITEM_TIMETABLE -> FEATURE_TIMETABLE DRAWER_ITEM_TIMETABLE -> FEATURE_TIMETABLE
DRAWER_ITEM_AGENDA -> FEATURE_AGENDA DRAWER_ITEM_AGENDA -> FEATURE_AGENDA
DRAWER_ITEM_GRADES -> FEATURE_GRADES DRAWER_ITEM_GRADES -> FEATURE_GRADES
DRAWER_ITEM_HOMEWORKS -> FEATURE_HOMEWORKS DRAWER_ITEM_HOMEWORK -> FEATURE_HOMEWORK
DRAWER_ITEM_NOTICES -> FEATURE_NOTICES DRAWER_ITEM_NOTICES -> FEATURE_NOTICES
DRAWER_ITEM_ATTENDANCES -> FEATURE_ATTENDANCES DRAWER_ITEM_ATTENDANCES -> FEATURE_ATTENDANCES
DRAWER_ITEM_MESSAGES -> when (MessagesFragment.pageSelection) { DRAWER_ITEM_MESSAGES -> when (MessagesFragment.pageSelection) {
@ -538,7 +539,7 @@ class MainActivity : AppCompatActivity() {
DRAWER_ITEM_TIMETABLE -> R.string.sync_feature_timetable DRAWER_ITEM_TIMETABLE -> R.string.sync_feature_timetable
DRAWER_ITEM_AGENDA -> R.string.sync_feature_agenda DRAWER_ITEM_AGENDA -> R.string.sync_feature_agenda
DRAWER_ITEM_GRADES -> R.string.sync_feature_grades DRAWER_ITEM_GRADES -> R.string.sync_feature_grades
DRAWER_ITEM_HOMEWORKS -> R.string.sync_feature_homeworks DRAWER_ITEM_HOMEWORK -> R.string.sync_feature_homework
DRAWER_ITEM_NOTICES -> R.string.sync_feature_notices DRAWER_ITEM_NOTICES -> R.string.sync_feature_notices
DRAWER_ITEM_ATTENDANCES -> R.string.sync_feature_attendances DRAWER_ITEM_ATTENDANCES -> R.string.sync_feature_attendances
DRAWER_ITEM_MESSAGES -> when (MessagesFragment.pageSelection) { DRAWER_ITEM_MESSAGES -> when (MessagesFragment.pageSelection) {
@ -740,6 +741,9 @@ class MainActivity : AppCompatActivity() {
drawer.close() drawer.close()
drawer.setSelection(target.id, fireOnClick = false) drawer.setSelection(target.id, fireOnClick = false)
navView.toolbar.setTitle(target.title ?: target.name) navView.toolbar.setTitle(target.title ?: target.name)
navView.bottomBar.fabEnable = false
navView.bottomBar.fabExtended = true
navView.bottomBar.setFabOnClickListener(null)
Log.d("NavDebug", "Navigating from ${navTarget.fragmentClass?.java?.simpleName} to ${target.fragmentClass?.java?.simpleName}") Log.d("NavDebug", "Navigating from ${navTarget.fragmentClass?.java?.simpleName} to ${target.fragmentClass?.java?.simpleName}")
@ -848,7 +852,13 @@ class MainActivity : AppCompatActivity() {
fun gainAttention() { fun gainAttention() {
b.navView.postDelayed({ b.navView.postDelayed({
navView.gainAttentionOnBottomBar() navView.gainAttentionOnBottomBar()
}, 1000) }, 2000)
}
fun collapseFab() {
b.navView.postDelayed({
navView.bottomBar.fabExtended = false
}, 2000)
} }
/* _____ _ _ /* _____ _ _

View File

@ -24,12 +24,12 @@ import pl.szczodrzynski.edziennik.models.Date;
import static pl.szczodrzynski.edziennik.utils.Utils.bs; import static pl.szczodrzynski.edziennik.utils.Utils.bs;
public class HomeworksAdapter extends RecyclerView.Adapter<HomeworksAdapter.ViewHolder> { public class HomeworkAdapter extends RecyclerView.Adapter<HomeworkAdapter.ViewHolder> {
private Context context; private Context context;
private List<EventFull> homeworkList; private List<EventFull> homeworkList;
//getting the context and product list with constructor //getting the context and product list with constructor
public HomeworksAdapter(Context mCtx, List<EventFull> homeworkList) { public HomeworkAdapter(Context mCtx, List<EventFull> homeworkList) {
this.context = mCtx; this.context = mCtx;
this.homeworkList = homeworkList; this.homeworkList = homeworkList;
} }
@ -39,7 +39,7 @@ public class HomeworksAdapter extends RecyclerView.Adapter<HomeworksAdapter.View
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
//inflating and returning our view holder //inflating and returning our view holder
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.row_homeworks_item, parent, false); View view = inflater.inflate(R.layout.row_homework_item, parent, false);
return new ViewHolder(view); return new ViewHolder(view);
} }
@ -73,33 +73,33 @@ public class HomeworksAdapter extends RecyclerView.Adapter<HomeworksAdapter.View
int diffDays = Date.diffDays(homework.eventDate, Date.getToday()); int diffDays = Date.diffDays(homework.eventDate, Date.getToday());
holder.homeworksItemHomeworkDate.setText(app.getString(R.string.date_relative_format, homework.eventDate.getFormattedString(), dayDiffString(context, diffDays))); holder.homeworkItemHomeworkDate.setText(app.getString(R.string.date_relative_format, homework.eventDate.getFormattedString(), dayDiffString(context, diffDays)));
holder.homeworksItemTopic.setText(homework.topic); holder.homeworkItemTopic.setText(homework.topic);
holder.homeworksItemSubjectTeacher.setText(context.getString(R.string.homeworks_subject_teacher_format, bs(homework.subjectLongName), bs(homework.teacherFullName))); holder.homeworkItemSubjectTeacher.setText(context.getString(R.string.homework_subject_teacher_format, bs(homework.subjectLongName), bs(homework.teacherFullName)));
holder.homeworksItemTeamDate.setText(context.getString(R.string.homeworks_team_date_format, bs(homework.teamName), Date.fromMillis(homework.addedDate).getFormattedStringShort())); holder.homeworkItemTeamDate.setText(context.getString(R.string.homework_team_date_format, bs(homework.teamName), Date.fromMillis(homework.addedDate).getFormattedStringShort()));
if (!homework.seen) { if (!homework.seen) {
holder.homeworksItemTopic.setBackground(context.getResources().getDrawable(R.drawable.bg_rounded_8dp)); holder.homeworkItemTopic.setBackground(context.getResources().getDrawable(R.drawable.bg_rounded_8dp));
holder.homeworksItemTopic.getBackground().setColorFilter(new PorterDuffColorFilter(0x692196f3, PorterDuff.Mode.MULTIPLY)); holder.homeworkItemTopic.getBackground().setColorFilter(new PorterDuffColorFilter(0x692196f3, PorterDuff.Mode.MULTIPLY));
homework.seen = true; homework.seen = true;
AsyncTask.execute(() -> { AsyncTask.execute(() -> {
app.db.metadataDao().setSeen(App.profileId, homework, true); app.db.metadataDao().setSeen(App.profileId, homework, true);
}); });
} }
else { else {
holder.homeworksItemTopic.setBackground(null); holder.homeworkItemTopic.setBackground(null);
} }
holder.homeworksItemEdit.setVisibility((homework.addedManually ? View.VISIBLE : View.GONE)); holder.homeworkItemEdit.setVisibility((homework.addedManually ? View.VISIBLE : View.GONE));
holder.homeworksItemEdit.setOnClickListener(v -> { holder.homeworkItemEdit.setOnClickListener(v -> {
new EventManualDialog(context).show(app, homework, null, null, EventManualDialog.DIALOG_HOMEWORK); new EventManualDialog(context).show(app, homework, null, null, EventManualDialog.DIALOG_HOMEWORK);
}); });
if (homework.sharedBy == null) { if (homework.sharedBy == null) {
holder.homeworksItemSharedBy.setVisibility(View.GONE); holder.homeworkItemSharedBy.setVisibility(View.GONE);
} }
else if (homework.sharedByName != null) { else if (homework.sharedByName != null) {
holder.homeworksItemSharedBy.setText(app.getString(R.string.event_shared_by_format, (homework.sharedBy.equals("self") ? app.getString(R.string.event_shared_by_self) : homework.sharedByName))); holder.homeworkItemSharedBy.setText(app.getString(R.string.event_shared_by_format, (homework.sharedBy.equals("self") ? app.getString(R.string.event_shared_by_self) : homework.sharedByName)));
} }
} }
@ -110,23 +110,23 @@ public class HomeworksAdapter extends RecyclerView.Adapter<HomeworksAdapter.View
class ViewHolder extends RecyclerView.ViewHolder { class ViewHolder extends RecyclerView.ViewHolder {
CardView homeworksItemCard; CardView homeworkItemCard;
TextView homeworksItemTopic; TextView homeworkItemTopic;
TextView homeworksItemHomeworkDate; TextView homeworkItemHomeworkDate;
TextView homeworksItemSharedBy; TextView homeworkItemSharedBy;
TextView homeworksItemSubjectTeacher; TextView homeworkItemSubjectTeacher;
TextView homeworksItemTeamDate; TextView homeworkItemTeamDate;
Button homeworksItemEdit; Button homeworkItemEdit;
ViewHolder(View itemView) { ViewHolder(View itemView) {
super(itemView); super(itemView);
homeworksItemCard = itemView.findViewById(R.id.homeworksItemCard); homeworkItemCard = itemView.findViewById(R.id.homeworkItemCard);
homeworksItemTopic = itemView.findViewById(R.id.homeworksItemTopic); homeworkItemTopic = itemView.findViewById(R.id.homeworkItemTopic);
homeworksItemHomeworkDate = itemView.findViewById(R.id.homeworksItemHomeworkDate); homeworkItemHomeworkDate = itemView.findViewById(R.id.homeworkItemHomeworkDate);
homeworksItemSharedBy = itemView.findViewById(R.id.homeworksItemSharedBy); homeworkItemSharedBy = itemView.findViewById(R.id.homeworkItemSharedBy);
homeworksItemSubjectTeacher = itemView.findViewById(R.id.homeworksItemSubjectTeacher); homeworkItemSubjectTeacher = itemView.findViewById(R.id.homeworkItemSubjectTeacher);
homeworksItemTeamDate = itemView.findViewById(R.id.homeworksItemTeamDate); homeworkItemTeamDate = itemView.findViewById(R.id.homeworkItemTeamDate);
homeworksItemEdit = itemView.findViewById(R.id.homeworksItemEdit); homeworkItemEdit = itemView.findViewById(R.id.homeworkItemEdit);
} }
} }
} }

View File

@ -86,7 +86,7 @@ import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATU
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_ANNOUNCEMENTS; import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_ANNOUNCEMENTS;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_ATTENDANCES; import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_ATTENDANCES;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_GRADES; import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_GRADES;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_HOMEWORKS; import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_HOMEWORK;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_INBOX; import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_INBOX;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_OUTBOX; import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_OUTBOX;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_NOTICES; import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_NOTICES;
@ -306,7 +306,7 @@ public class Edziennik {
app.notifier.add(new Notification(app.getContext(), text) app.notifier.add(new Notification(app.getContext(), text)
.withProfileData(profile.getId(), profile.getName()) .withProfileData(profile.getId(), profile.getName())
.withType(event.type == TYPE_HOMEWORK ? Notification.TYPE_NEW_HOMEWORK : Notification.TYPE_NEW_EVENT) .withType(event.type == TYPE_HOMEWORK ? Notification.TYPE_NEW_HOMEWORK : Notification.TYPE_NEW_EVENT)
.withFragmentRedirect(event.type == TYPE_HOMEWORK ? MainActivity.DRAWER_ITEM_HOMEWORKS : MainActivity.DRAWER_ITEM_AGENDA) .withFragmentRedirect(event.type == TYPE_HOMEWORK ? MainActivity.DRAWER_ITEM_HOMEWORK : MainActivity.DRAWER_ITEM_AGENDA)
.withLongExtra("eventId", event.id) .withLongExtra("eventId", event.id)
.withLongExtra("eventDate", event.eventDate.getValue()) .withLongExtra("eventDate", event.eventDate.getValue())
.withAddedDate(event.addedDate) .withAddedDate(event.addedDate)
@ -521,7 +521,7 @@ public class Edziennik {
app.notifier.add(new Notification(app.getContext(), app.getString(R.string.notification_shared_event_format, event.sharedByName, type != null ? type.name : "wydarzenie", event.eventDate == null ? "nieznana data" : event.eventDate.getFormattedString(), event.topic)) app.notifier.add(new Notification(app.getContext(), app.getString(R.string.notification_shared_event_format, event.sharedByName, type != null ? type.name : "wydarzenie", event.eventDate == null ? "nieznana data" : event.eventDate.getFormattedString(), event.topic))
.withProfileData(profile.getId(), profile.getName()) .withProfileData(profile.getId(), profile.getName())
.withType(event.type == TYPE_HOMEWORK ? Notification.TYPE_NEW_SHARED_HOMEWORK : Notification.TYPE_NEW_SHARED_EVENT) .withType(event.type == TYPE_HOMEWORK ? Notification.TYPE_NEW_SHARED_HOMEWORK : Notification.TYPE_NEW_SHARED_EVENT)
.withFragmentRedirect(event.type == TYPE_HOMEWORK ? MainActivity.DRAWER_ITEM_HOMEWORKS : MainActivity.DRAWER_ITEM_AGENDA) .withFragmentRedirect(event.type == TYPE_HOMEWORK ? MainActivity.DRAWER_ITEM_HOMEWORK : MainActivity.DRAWER_ITEM_AGENDA)
.withLongExtra("eventDate", event.eventDate.getValue()) .withLongExtra("eventDate", event.eventDate.getValue())
); );
} }
@ -858,7 +858,7 @@ public class Edziennik {
FEATURE_TIMETABLE, FEATURE_TIMETABLE,
FEATURE_AGENDA, FEATURE_AGENDA,
FEATURE_GRADES, FEATURE_GRADES,
FEATURE_HOMEWORKS, FEATURE_HOMEWORK,
FEATURE_NOTICES, FEATURE_NOTICES,
FEATURE_ATTENDANCES, FEATURE_ATTENDANCES,
FEATURE_MESSAGES_INBOX, FEATURE_MESSAGES_INBOX,

View File

@ -235,8 +235,8 @@ public class Iuczniowie implements EdziennikInterface {
targetEndpoints.add("Grades"); targetEndpoints.add("Grades");
targetEndpoints.add("PropositionGrades"); targetEndpoints.add("PropositionGrades");
break; break;
case FEATURE_HOMEWORKS: case FEATURE_HOMEWORK:
targetEndpoints.add("Homeworks"); targetEndpoints.add("Homework");
break; break;
case FEATURE_NOTICES: case FEATURE_NOTICES:
targetEndpoints.add("Notices"); targetEndpoints.add("Notices");

View File

@ -294,7 +294,7 @@ public class Librus implements EdziennikInterface {
targetEndpoints.add("Events"); targetEndpoints.add("Events");
targetEndpoints.add("CustomTypes"); targetEndpoints.add("CustomTypes");
targetEndpoints.add("Homeworks"); targetEndpoints.add("Homework");
targetEndpoints.add("LuckyNumbers"); targetEndpoints.add("LuckyNumbers");
targetEndpoints.add("Notices"); targetEndpoints.add("Notices");
targetEndpoints.add("AttendancesTypes"); targetEndpoints.add("AttendancesTypes");
@ -365,8 +365,8 @@ public class Librus implements EdziennikInterface {
targetEndpoints.add("TextGrades"); targetEndpoints.add("TextGrades");
targetEndpoints.add("BehaviourGrades"); targetEndpoints.add("BehaviourGrades");
break; break;
case FEATURE_HOMEWORKS: case FEATURE_HOMEWORK:
targetEndpoints.add("Homeworks"); targetEndpoints.add("Homework");
break; break;
case FEATURE_NOTICES: case FEATURE_NOTICES:
targetEndpoints.add("Notices"); targetEndpoints.add("Notices");
@ -518,8 +518,8 @@ public class Librus implements EdziennikInterface {
case "CustomTypes": case "CustomTypes":
getCustomTypes(); getCustomTypes();
break; break;
case "Homeworks": case "Homework":
getHomeworks(); getHomework();
break; break;
case "LuckyNumbers": case "LuckyNumbers":
getLuckyNumbers(); getLuckyNumbers();
@ -2722,21 +2722,21 @@ public class Librus implements EdziennikInterface {
}); });
} }
private void getHomeworks() { private void getHomework() {
if (!premium) { if (!premium) {
r("finish", "Homeworks"); r("finish", "Homework");
return; return;
} }
callback.onActionStarted(R.string.sync_action_syncing_homework); callback.onActionStarted(R.string.sync_action_syncing_homework);
apiRequest("HomeWorkAssignments", data -> { apiRequest("HomeWorkAssignments", data -> {
if (data == null) { if (data == null) {
r("finish", "Homeworks"); r("finish", "Homework");
return; return;
} }
JsonArray homeworks = data.get("HomeWorkAssignments").getAsJsonArray(); JsonArray homeworkList = data.get("HomeWorkAssignments").getAsJsonArray();
//d("Got Grades: "+events.toString()); //d("Got Grades: "+events.toString());
try { try {
for (JsonElement homeworkEl : homeworks) { for (JsonElement homeworkEl : homeworkList) {
JsonObject homework = homeworkEl.getAsJsonObject(); JsonObject homework = homeworkEl.getAsJsonObject();
JsonElement el; JsonElement el;
@ -2787,7 +2787,7 @@ public class Librus implements EdziennikInterface {
eventList.add(eventObject); eventList.add(eventObject);
metadataList.add(new Metadata(profileId, Metadata.TYPE_EVENT, eventObject.id, profile.getEmpty(), profile.getEmpty(), addedDate.getInMillis())); metadataList.add(new Metadata(profileId, Metadata.TYPE_EVENT, eventObject.id, profile.getEmpty(), profile.getEmpty(), addedDate.getInMillis()));
} }
r("finish", "Homeworks"); r("finish", "Homework");
} }
catch (Exception e) { catch (Exception e) {
finishWithError(new AppError(TAG, 2648, CODE_OTHER, e, data)); finishWithError(new AppError(TAG, 2648, CODE_OTHER, e, data));
@ -3377,7 +3377,7 @@ public class Librus implements EdziennikInterface {
configurableEndpoints.put("Grades", new Endpoint("Grades",true, false, profile.getChangedEndpoints())); configurableEndpoints.put("Grades", new Endpoint("Grades",true, false, profile.getChangedEndpoints()));
configurableEndpoints.put("PointGrades", new Endpoint("PointGrades",true, false, profile.getChangedEndpoints())); configurableEndpoints.put("PointGrades", new Endpoint("PointGrades",true, false, profile.getChangedEndpoints()));
configurableEndpoints.put("Events", new Endpoint("Events",true, false, profile.getChangedEndpoints())); configurableEndpoints.put("Events", new Endpoint("Events",true, false, profile.getChangedEndpoints()));
configurableEndpoints.put("Homeworks", new Endpoint("Homeworks",true, false, profile.getChangedEndpoints())); configurableEndpoints.put("Homework", new Endpoint("Homework",true, false, profile.getChangedEndpoints()));
configurableEndpoints.put("LuckyNumbers", new Endpoint("LuckyNumbers",true, false, profile.getChangedEndpoints())); configurableEndpoints.put("LuckyNumbers", new Endpoint("LuckyNumbers",true, false, profile.getChangedEndpoints()));
configurableEndpoints.put("Notices", new Endpoint("Notices",true, false, profile.getChangedEndpoints())); configurableEndpoints.put("Notices", new Endpoint("Notices",true, false, profile.getChangedEndpoints()));
configurableEndpoints.put("Attendances", new Endpoint("Attendances",true, false, profile.getChangedEndpoints())); configurableEndpoints.put("Attendances", new Endpoint("Attendances",true, false, profile.getChangedEndpoints()));

View File

@ -609,7 +609,7 @@ public class Mobidziennik implements EdziennikInterface {
processEvents(table); processEvents(table);
} }
if (i == 23) { if (i == 23) {
processHomeworks(table); processHomework(table);
} }
if (i == 24) { if (i == 24) {
processTimetable(table); processTimetable(table);
@ -1891,11 +1891,11 @@ public class Mobidziennik implements EdziennikInterface {
} }
} }
private void processHomeworks(String table) private void processHomework(String table)
{ {
String[] homeworks = table.split("\n"); String[] homeworkList = table.split("\n");
Date today = Date.getToday(); Date today = Date.getToday();
for (String homeworkStr: homeworks) for (String homeworkStr: homeworkList)
{ {
if (homeworkStr.isEmpty()) { if (homeworkStr.isEmpty()) {
continue; continue;

View File

@ -108,7 +108,7 @@ public class Vulcan implements EdziennikInterface {
private static final String ENDPOINT_GRADES = "mobile-api/Uczen.v3.Uczen/Oceny"; private static final String ENDPOINT_GRADES = "mobile-api/Uczen.v3.Uczen/Oceny";
private static final String ENDPOINT_GRADES_PROPOSITIONS = "mobile-api/Uczen.v3.Uczen/OcenyPodsumowanie"; private static final String ENDPOINT_GRADES_PROPOSITIONS = "mobile-api/Uczen.v3.Uczen/OcenyPodsumowanie";
private static final String ENDPOINT_EVENTS = "mobile-api/Uczen.v3.Uczen/Sprawdziany"; private static final String ENDPOINT_EVENTS = "mobile-api/Uczen.v3.Uczen/Sprawdziany";
private static final String ENDPOINT_HOMEWORKS = "mobile-api/Uczen.v3.Uczen/ZadaniaDomowe"; private static final String ENDPOINT_HOMEWORK = "mobile-api/Uczen.v3.Uczen/ZadaniaDomowe";
private static final String ENDPOINT_NOTICES = "mobile-api/Uczen.v3.Uczen/UwagiUcznia"; private static final String ENDPOINT_NOTICES = "mobile-api/Uczen.v3.Uczen/UwagiUcznia";
private static final String ENDPOINT_ATTENDANCES = "mobile-api/Uczen.v3.Uczen/Frekwencje"; private static final String ENDPOINT_ATTENDANCES = "mobile-api/Uczen.v3.Uczen/Frekwencje";
private static final String ENDPOINT_MESSAGES_RECEIVED = "mobile-api/Uczen.v3.Uczen/WiadomosciOdebrane"; private static final String ENDPOINT_MESSAGES_RECEIVED = "mobile-api/Uczen.v3.Uczen/WiadomosciOdebrane";
@ -259,7 +259,7 @@ public class Vulcan implements EdziennikInterface {
targetEndpoints.add("Grades"); targetEndpoints.add("Grades");
targetEndpoints.add("ProposedGrades"); targetEndpoints.add("ProposedGrades");
targetEndpoints.add("Events"); targetEndpoints.add("Events");
targetEndpoints.add("Homeworks"); targetEndpoints.add("Homework");
targetEndpoints.add("Notices"); targetEndpoints.add("Notices");
targetEndpoints.add("Attendances"); targetEndpoints.add("Attendances");
targetEndpoints.add("MessagesInbox"); targetEndpoints.add("MessagesInbox");
@ -297,8 +297,8 @@ public class Vulcan implements EdziennikInterface {
targetEndpoints.add("Grades"); targetEndpoints.add("Grades");
targetEndpoints.add("ProposedGrades"); targetEndpoints.add("ProposedGrades");
break; break;
case FEATURE_HOMEWORKS: case FEATURE_HOMEWORK:
targetEndpoints.add("Homeworks"); targetEndpoints.add("Homework");
break; break;
case FEATURE_NOTICES: case FEATURE_NOTICES:
targetEndpoints.add("Notices"); targetEndpoints.add("Notices");
@ -380,8 +380,8 @@ public class Vulcan implements EdziennikInterface {
case "Events": case "Events":
getEvents(); getEvents();
break; break;
case "Homeworks": case "Homework":
getHomeworks(); getHomework();
break; break;
case "Notices": case "Notices":
getNotices(); getNotices();
@ -1374,7 +1374,7 @@ public class Vulcan implements EdziennikInterface {
}); });
} }
private void getHomeworks() { private void getHomework() {
callback.onActionStarted(R.string.sync_action_syncing_homework); callback.onActionStarted(R.string.sync_action_syncing_homework);
JsonObject json = new JsonObject(); JsonObject json = new JsonObject();
json.addProperty("DataPoczatkowa", profile.getEmpty() ? getCurrentSemesterStartDate().getStringY_m_d() : oneMonthBack.getStringY_m_d()); json.addProperty("DataPoczatkowa", profile.getEmpty() ? getCurrentSemesterStartDate().getStringY_m_d() : oneMonthBack.getStringY_m_d());
@ -1382,10 +1382,10 @@ public class Vulcan implements EdziennikInterface {
json.addProperty("IdOddzial", studentClassId); json.addProperty("IdOddzial", studentClassId);
json.addProperty("IdUczen", studentId); json.addProperty("IdUczen", studentId);
json.addProperty("IdOkresKlasyfikacyjny", studentSemesterId); json.addProperty("IdOkresKlasyfikacyjny", studentSemesterId);
apiRequest(schoolSymbol+"/"+ENDPOINT_HOMEWORKS, json, result -> { apiRequest(schoolSymbol+"/"+ ENDPOINT_HOMEWORK, json, result -> {
JsonArray homeworks = result.getAsJsonArray("Data"); JsonArray homeworkList = result.getAsJsonArray("Data");
for (JsonElement homeworkEl: homeworks) { for (JsonElement homeworkEl: homeworkList) {
JsonObject homework = homeworkEl.getAsJsonObject(); JsonObject homework = homeworkEl.getAsJsonObject();
int id = homework.get("Id").getAsInt(); int id = homework.get("Id").getAsInt();
@ -1419,7 +1419,7 @@ public class Vulcan implements EdziennikInterface {
eventList.add(eventObject); eventList.add(eventObject);
metadataList.add(new Metadata(profileId, Metadata.TYPE_HOMEWORK, eventObject.id, profile.getEmpty(), profile.getEmpty(), System.currentTimeMillis())); metadataList.add(new Metadata(profileId, Metadata.TYPE_HOMEWORK, eventObject.id, profile.getEmpty(), profile.getEmpty(), System.currentTimeMillis()));
} }
r("finish", "Homeworks"); r("finish", "Homework");
}); });
} }

View File

@ -34,7 +34,7 @@ public interface EdziennikInterface {
int FEATURE_TIMETABLE = 1; int FEATURE_TIMETABLE = 1;
int FEATURE_AGENDA = 2; int FEATURE_AGENDA = 2;
int FEATURE_GRADES = 3; int FEATURE_GRADES = 3;
int FEATURE_HOMEWORKS = 4; int FEATURE_HOMEWORK = 4;
int FEATURE_NOTICES = 5; int FEATURE_NOTICES = 5;
int FEATURE_ATTENDANCES = 6; int FEATURE_ATTENDANCES = 6;
int FEATURE_MESSAGES_INBOX = 7; int FEATURE_MESSAGES_INBOX = 7;

View File

@ -4,7 +4,7 @@ const val FEATURE_ALL = 0
const val FEATURE_TIMETABLE = 1 const val FEATURE_TIMETABLE = 1
const val FEATURE_AGENDA = 2 const val FEATURE_AGENDA = 2
const val FEATURE_GRADES = 3 const val FEATURE_GRADES = 3
const val FEATURE_HOMEWORKS = 4 const val FEATURE_HOMEWORK = 4
const val FEATURE_NOTICES = 5 const val FEATURE_NOTICES = 5
const val FEATURE_ATTENDANCES = 6 const val FEATURE_ATTENDANCES = 6
const val FEATURE_MESSAGES_INBOX = 7 const val FEATURE_MESSAGES_INBOX = 7

View File

@ -202,7 +202,7 @@ public abstract class MetadataDao {
public abstract void deleteUnusedEvents(int profileId); public abstract void deleteUnusedEvents(int profileId);
@Query("DELETE FROM metadata WHERE profileId = :profileId AND thingType = "+TYPE_HOMEWORK+" AND thingId NOT IN (SELECT eventId FROM events WHERE profileId = :profileId AND eventType = -1);") @Query("DELETE FROM metadata WHERE profileId = :profileId AND thingType = "+TYPE_HOMEWORK+" AND thingId NOT IN (SELECT eventId FROM events WHERE profileId = :profileId AND eventType = -1);")
public abstract void deleteUnusedHomeworks(int profileId); public abstract void deleteUnusedHomework(int profileId);
@Query("DELETE FROM metadata WHERE profileId = :profileId AND thingType = "+TYPE_LESSON_CHANGE+" AND thingId NOT IN (SELECT lessonChangeId FROM lessonChanges WHERE profileId = :profileId);") @Query("DELETE FROM metadata WHERE profileId = :profileId AND thingType = "+TYPE_LESSON_CHANGE+" AND thingId NOT IN (SELECT lessonChangeId FROM lessonChanges WHERE profileId = :profileId);")
public abstract void deleteUnusedLessonChanges(int profileId); public abstract void deleteUnusedLessonChanges(int profileId);
@ -219,7 +219,7 @@ public abstract class MetadataDao {
deleteUnusedNotices(profileId); deleteUnusedNotices(profileId);
deleteUnusedAttendances(profileId); deleteUnusedAttendances(profileId);
deleteUnusedEvents(profileId); deleteUnusedEvents(profileId);
deleteUnusedHomeworks(profileId); deleteUnusedHomework(profileId);
deleteUnusedLessonChanges(profileId); deleteUnusedLessonChanges(profileId);
deleteUnusedAnnouncements(profileId); deleteUnusedAnnouncements(profileId);
deleteUnusedMessages(profileId); deleteUnusedMessages(profileId);

View File

@ -7,7 +7,7 @@ import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_AGENDA
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_ANNOUNCEMENTS import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_ANNOUNCEMENTS
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_ATTENDANCES import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_ATTENDANCES
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_GRADES import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_GRADES
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_HOMEWORKS import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_HOMEWORK
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_MESSAGES import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_MESSAGES
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_NOTICES import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_NOTICES
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_TIMETABLE import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_TIMETABLE
@ -50,7 +50,7 @@ class ProfileFull : Profile {
fragmentIds.add(DRAWER_ITEM_AGENDA) fragmentIds.add(DRAWER_ITEM_AGENDA)
fragmentIds.add(DRAWER_ITEM_GRADES) fragmentIds.add(DRAWER_ITEM_GRADES)
fragmentIds.add(DRAWER_ITEM_MESSAGES) fragmentIds.add(DRAWER_ITEM_MESSAGES)
fragmentIds.add(DRAWER_ITEM_HOMEWORKS) fragmentIds.add(DRAWER_ITEM_HOMEWORK)
fragmentIds.add(DRAWER_ITEM_NOTICES) fragmentIds.add(DRAWER_ITEM_NOTICES)
fragmentIds.add(DRAWER_ITEM_ATTENDANCES) fragmentIds.add(DRAWER_ITEM_ATTENDANCES)
return fragmentIds return fragmentIds
@ -61,7 +61,7 @@ class ProfileFull : Profile {
fragmentIds.add(DRAWER_ITEM_AGENDA) fragmentIds.add(DRAWER_ITEM_AGENDA)
fragmentIds.add(DRAWER_ITEM_GRADES) fragmentIds.add(DRAWER_ITEM_GRADES)
fragmentIds.add(DRAWER_ITEM_MESSAGES) fragmentIds.add(DRAWER_ITEM_MESSAGES)
fragmentIds.add(DRAWER_ITEM_HOMEWORKS) fragmentIds.add(DRAWER_ITEM_HOMEWORK)
fragmentIds.add(DRAWER_ITEM_NOTICES) fragmentIds.add(DRAWER_ITEM_NOTICES)
fragmentIds.add(DRAWER_ITEM_ATTENDANCES) fragmentIds.add(DRAWER_ITEM_ATTENDANCES)
fragmentIds.add(DRAWER_ITEM_ANNOUNCEMENTS) fragmentIds.add(DRAWER_ITEM_ANNOUNCEMENTS)

View File

@ -1,127 +0,0 @@
package pl.szczodrzynski.edziennik.fragments;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial;
import pl.szczodrzynski.edziennik.App;
import pl.szczodrzynski.edziennik.R;
import pl.szczodrzynski.edziennik.MainActivity;
import pl.szczodrzynski.edziennik.adapters.HomeworksAdapter;
import pl.szczodrzynski.edziennik.databinding.FragmentRegisterHomeworksBinding;
import pl.szczodrzynski.edziennik.datamodels.Metadata;
import pl.szczodrzynski.edziennik.dialogs.EventManualDialog;
import pl.szczodrzynski.edziennik.models.Date;
import pl.szczodrzynski.edziennik.utils.Themes;
import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem;
import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem;
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_HOMEWORK;
public class RegisterHomeworksFragment extends Fragment {
private App app = null;
private MainActivity activity = null;
private FragmentRegisterHomeworksBinding b = null;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
activity = (MainActivity) getActivity();
if (getActivity() == null || getContext() == null)
return null;
app = (App) activity.getApplication();
getContext().getTheme().applyStyle(Themes.INSTANCE.getAppTheme(), true);
if (app.profile == null)
return inflater.inflate(R.layout.fragment_loading, container, false);
// activity, context and profile is valid
b = DataBindingUtil.inflate(inflater, R.layout.fragment_register_homeworks, container, false);
b.refreshLayout.setParent(activity.getSwipeRefreshLayout());
return b.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
if (app == null || app.profile == null || activity == null || b == null || !isAdded())
return;
activity.getBottomSheet().prependItems(
new BottomSheetPrimaryItem(true)
.withTitle(R.string.menu_add_event)
.withDescription(R.string.menu_add_event_desc)
.withIcon(CommunityMaterial.Icon.cmd_calendar_plus)
.withOnClickListener(v3 -> {
activity.getBottomSheet().close();
new EventManualDialog(activity).show(app, null, null, null, EventManualDialog.DIALOG_HOMEWORK);
}),
new BottomSheetSeparatorItem(true),
new BottomSheetPrimaryItem(true)
.withTitle(R.string.menu_mark_as_read)
.withIcon(CommunityMaterial.Icon.cmd_eye_check)
.withOnClickListener(v3 -> {
activity.getBottomSheet().close();
AsyncTask.execute(() -> app.db.metadataDao().setAllSeen(App.profileId, Metadata.TYPE_HOMEWORK, true));
Toast.makeText(activity, R.string.main_menu_mark_as_read_success, Toast.LENGTH_SHORT).show();
})
);
activity.gainAttention();
/*b.refreshLayout.setOnRefreshListener(() -> {
activity.syncCurrentFeature(MainActivity.DRAWER_ITEM_HOMEWORKS, b.refreshLayout);
});*/
LinearLayoutManager linearLayoutCurrentManager = new LinearLayoutManager(getContext());
linearLayoutCurrentManager.setReverseLayout(false);
linearLayoutCurrentManager.setStackFromEnd(false);
LinearLayoutManager linearLayoutPastManager = new LinearLayoutManager(getContext());
linearLayoutPastManager.setReverseLayout(true);
linearLayoutPastManager.setStackFromEnd(true);
b.homeworksCurrentView.setHasFixedSize(true);
b.homeworksCurrentView.setLayoutManager(linearLayoutCurrentManager);
b.homeworksPastView.setHasFixedSize(true);
b.homeworksPastView.setLayoutManager(linearLayoutPastManager);
app.db.eventDao().getAllByType(App.profileId, TYPE_HOMEWORK, "eventDate >= '"+Date.getToday().getStringY_m_d()+"'").observe(this, currentList -> {
if (app == null || app.profile == null || activity == null || b == null || !isAdded())
return;
if (currentList != null && currentList.size() > 0) {
HomeworksAdapter adapter = new HomeworksAdapter(getContext(), currentList);
b.homeworksCurrentView.setAdapter(adapter);
b.homeworksCurrentView.setVisibility(View.VISIBLE);
b.homeworksCurrentNoData.setVisibility(View.GONE);
}
else {
b.homeworksCurrentView.setVisibility(View.GONE);
b.homeworksCurrentNoData.setVisibility(View.VISIBLE);
}
});
app.db.eventDao().getAllByType(App.profileId, TYPE_HOMEWORK, "eventDate < '"+Date.getToday().getStringY_m_d()+"'").observe(this, pastList -> {
if (app == null || app.profile == null || activity == null || b == null || !isAdded())
return;
if (pastList != null && pastList.size() > 0) {
HomeworksAdapter adapter = new HomeworksAdapter(getContext(), pastList);
b.homeworksPastView.setAdapter(adapter);
b.homeworksPastView.setVisibility(View.VISIBLE);
b.homeworksPastNoData.setVisibility(View.GONE);
}
else {
b.homeworksPastView.setVisibility(View.GONE);
b.homeworksPastNoData.setVisibility(View.VISIBLE);
}
});
}
}

View File

@ -350,7 +350,7 @@ public class SettingsNewFragment extends MaterialAboutFragment {
buttonIds.add(MainActivity.DRAWER_ITEM_AGENDA); buttonIds.add(MainActivity.DRAWER_ITEM_AGENDA);
buttonIds.add(MainActivity.DRAWER_ITEM_GRADES); buttonIds.add(MainActivity.DRAWER_ITEM_GRADES);
buttonIds.add(MainActivity.DRAWER_ITEM_MESSAGES); buttonIds.add(MainActivity.DRAWER_ITEM_MESSAGES);
buttonIds.add(MainActivity.DRAWER_ITEM_HOMEWORKS); buttonIds.add(MainActivity.DRAWER_ITEM_HOMEWORK);
buttonIds.add(MainActivity.DRAWER_ITEM_NOTICES); buttonIds.add(MainActivity.DRAWER_ITEM_NOTICES);
buttonIds.add(MainActivity.DRAWER_ITEM_ATTENDANCES); buttonIds.add(MainActivity.DRAWER_ITEM_ATTENDANCES);
buttonIds.add(MainActivity.DRAWER_ITEM_ANNOUNCEMENTS); buttonIds.add(MainActivity.DRAWER_ITEM_ANNOUNCEMENTS);
@ -1091,8 +1091,8 @@ public class SettingsNewFragment extends MaterialAboutFragment {
case "Events": case "Events":
stringRes = R.string.settings_sync_customize_endpoint_events; stringRes = R.string.settings_sync_customize_endpoint_events;
break; break;
case "Homeworks": case "Homework":
stringRes = R.string.settings_sync_customize_endpoint_homeworks; stringRes = R.string.settings_sync_customize_endpoint_homework;
break; break;
case "LuckyNumber": case "LuckyNumber":
case "LuckyNumbers": case "LuckyNumbers":

View File

@ -0,0 +1,8 @@
package pl.szczodrzynski.edziennik.homework
class HomeworkDate {
companion object {
val CURRENT = 0
val PAST = 1
}
}

View File

@ -0,0 +1,107 @@
package pl.szczodrzynski.edziennik.homework
import android.os.AsyncTask
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
import kotlinx.android.synthetic.main.activity_szkolny.*
import pl.szczodrzynski.edziennik.App
import pl.szczodrzynski.edziennik.MainActivity
import pl.szczodrzynski.edziennik.R
import pl.szczodrzynski.edziennik.databinding.FragmentHomeworkBinding
import pl.szczodrzynski.edziennik.datamodels.Metadata
import pl.szczodrzynski.edziennik.dialogs.EventManualDialog
import pl.szczodrzynski.edziennik.messages.MessagesFragment
import pl.szczodrzynski.edziennik.utils.Themes
import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem
class HomeworkFragment : Fragment() {
companion object {
var pageSelection = 0
}
private lateinit var app: App
private lateinit var activity: MainActivity
private lateinit var b: FragmentHomeworkBinding
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
activity = (getActivity() as MainActivity?) ?: return null
if (context == null)
return null
app = activity.application as App
context!!.theme.applyStyle(Themes.appTheme, true)
if (app.profile == null)
return inflater.inflate(R.layout.fragment_loading, container, false)
// activity, context and profile is valid
b = FragmentHomeworkBinding.inflate(inflater)
b.refreshLayout.setParent(activity.swipeRefreshLayout)
return b.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
// TODO check if app, activity, b can be null
if (app.profile == null || !isAdded)
return
activity.bottomSheet.prependItems(
BottomSheetPrimaryItem(true)
.withTitle(R.string.menu_add_event)
.withDescription(R.string.menu_add_event_desc)
.withIcon(CommunityMaterial.Icon.cmd_calendar_plus)
.withOnClickListener(View.OnClickListener {
activity.bottomSheet.close()
EventManualDialog(activity).show(app, null, null, null, EventManualDialog.DIALOG_HOMEWORK)
}),
BottomSheetSeparatorItem(true),
BottomSheetPrimaryItem(true)
.withTitle(R.string.menu_mark_as_read)
.withIcon(CommunityMaterial.Icon.cmd_eye_check)
.withOnClickListener(View.OnClickListener {
activity.bottomSheet.close()
AsyncTask.execute { app.db.metadataDao().setAllSeen(App.profileId, Metadata.TYPE_HOMEWORK, true) }
Toast.makeText(activity, R.string.main_menu_mark_as_read_success, Toast.LENGTH_SHORT).show()
}))
b.viewPager.adapter = MessagesFragment.Adapter(childFragmentManager).also { adapter ->
adapter.addFragment(HomeworkListFragment().also { fragment ->
fragment.arguments = Bundle().also { args ->
args.putInt("homeworkDate", HomeworkDate.CURRENT)
}
}, getString(R.string.homework_tab_current))
adapter.addFragment(HomeworkListFragment().also { fragment ->
fragment.arguments = Bundle().also { args ->
args.putInt("homeworkDate", HomeworkDate.PAST)
}
}, getString(R.string.homework_tab_past))
}
b.viewPager.currentItem = pageSelection
b.viewPager.clearOnPageChangeListeners()
b.viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrollStateChanged(state: Int) {}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
override fun onPageSelected(position: Int) {
pageSelection = position
}
})
b.tabLayout.setupWithViewPager(b.viewPager)
activity.navView.bottomBar.fabEnable = true
activity.navView.bottomBar.fabExtendedText = "Dodaj nowe"
activity.navView.bottomBar.fabIcon = CommunityMaterial.Icon2.cmd_plus
activity.navView.setFabOnClickListener(View.OnClickListener {
EventManualDialog(activity).show(app, null, null, null, EventManualDialog.DIALOG_HOMEWORK)
})
activity.gainAttention()
activity.collapseFab()
}
}

View File

@ -0,0 +1,79 @@
package pl.szczodrzynski.edziennik.homework
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import kotlinx.android.synthetic.main.activity_szkolny.*
import pl.szczodrzynski.edziennik.App
import pl.szczodrzynski.edziennik.MainActivity
import pl.szczodrzynski.edziennik.R
import pl.szczodrzynski.edziennik.adapters.HomeworkAdapter
import pl.szczodrzynski.edziennik.databinding.HomeworkListBinding
import pl.szczodrzynski.edziennik.datamodels.Event
import pl.szczodrzynski.edziennik.getInt
import pl.szczodrzynski.edziennik.models.Date
import pl.szczodrzynski.edziennik.utils.Themes
class HomeworkListFragment : Fragment() {
private lateinit var app: App
private lateinit var activity: MainActivity
private lateinit var b: HomeworkListBinding
private var homeworkDate = HomeworkDate.CURRENT
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
activity = (getActivity() as MainActivity?) ?: return null
if (context == null)
return null
app = activity.application as App
context!!.theme.applyStyle(Themes.appTheme, true)
if (app.profile == null)
return inflater.inflate(R.layout.fragment_loading, container, false)
// activity, context and profile is valid
b = HomeworkListBinding.inflate(inflater)
return b.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
// TODO check if app, activity, b can be null
if (app.profile == null || !isAdded)
return
if (arguments != null) {
homeworkDate = arguments.getInt("homeworkDate", HomeworkDate.CURRENT)
}
val layoutManager = LinearLayoutManager(context)
layoutManager.reverseLayout = false
layoutManager.stackFromEnd = false
b.homeworkView.setHasFixedSize(true)
b.homeworkView.layoutManager = layoutManager
val filter = when(homeworkDate) {
HomeworkDate.CURRENT -> "eventDate > '" + Date.getToday().stringY_m_d + "'"
else -> "eventDate <= '" + Date.getToday().stringY_m_d + "'"
}
app.db.eventDao()
.getAllByType(App.profileId, Event.TYPE_HOMEWORK, filter)
.observe(this, Observer { homeworkList ->
if (app.profile == null || !isAdded) return@Observer
if (homeworkList != null && homeworkList.size > 0) {
val adapter = HomeworkAdapter(context, homeworkList)
b.homeworkView.adapter = adapter
b.homeworkView.visibility = View.VISIBLE
b.homeworkNoData.visibility = View.GONE
} else {
b.homeworkView.visibility = View.GONE
b.homeworkNoData.visibility = View.VISIBLE
}
})
}
}

View File

@ -76,7 +76,6 @@ public class MessagesListFragment extends Fragment {
return inflater.inflate(R.layout.fragment_loading, container, false); return inflater.inflate(R.layout.fragment_loading, container, false);
// activity, context and profile is valid // activity, context and profile is valid
b = DataBindingUtil.inflate(inflater, R.layout.messages_list, container, false); b = DataBindingUtil.inflate(inflater, R.layout.messages_list, container, false);
b.refreshLayout.setParent(activity.getSwipeRefreshLayout());
return b.getRoot(); return b.getRoot();
} }

View File

@ -38,7 +38,7 @@ public class AppConfig {
miniDrawerButtonIds.add(MainActivity.DRAWER_ITEM_AGENDA); miniDrawerButtonIds.add(MainActivity.DRAWER_ITEM_AGENDA);
miniDrawerButtonIds.add(MainActivity.DRAWER_ITEM_GRADES); miniDrawerButtonIds.add(MainActivity.DRAWER_ITEM_GRADES);
miniDrawerButtonIds.add(MainActivity.DRAWER_ITEM_MESSAGES); miniDrawerButtonIds.add(MainActivity.DRAWER_ITEM_MESSAGES);
miniDrawerButtonIds.add(MainActivity.DRAWER_ITEM_HOMEWORKS); miniDrawerButtonIds.add(MainActivity.DRAWER_ITEM_HOMEWORK);
miniDrawerButtonIds.add(MainActivity.DRAWER_ITEM_SETTINGS); miniDrawerButtonIds.add(MainActivity.DRAWER_ITEM_SETTINGS);
fcmToken = ""; fcmToken = "";
fcmTokens = new TreeMap<>(); fcmTokens = new TreeMap<>();

View File

@ -280,7 +280,7 @@ public class MyFirebaseMessagingService extends FirebaseMessagingService {
app.notifier.add(new Notification(app.getContext(), app.getString((oldEvent == null ? R.string.notification_shared_event_format : R.string.notification_shared_event_modified_format), event.sharedByName, eventType == null ? "wydarzenie" : eventType.name, event.eventDate.getFormattedString(), event.topic)) app.notifier.add(new Notification(app.getContext(), app.getString((oldEvent == null ? R.string.notification_shared_event_format : R.string.notification_shared_event_modified_format), event.sharedByName, eventType == null ? "wydarzenie" : eventType.name, event.eventDate.getFormattedString(), event.topic))
.withProfileData(profile.getId(), profile.getName()) .withProfileData(profile.getId(), profile.getName())
.withType(event.type == TYPE_HOMEWORK ? Notification.TYPE_NEW_SHARED_HOMEWORK : Notification.TYPE_NEW_SHARED_EVENT) .withType(event.type == TYPE_HOMEWORK ? Notification.TYPE_NEW_SHARED_HOMEWORK : Notification.TYPE_NEW_SHARED_EVENT)
.withFragmentRedirect(event.type == TYPE_HOMEWORK ? MainActivity.DRAWER_ITEM_HOMEWORKS : MainActivity.DRAWER_ITEM_AGENDA) .withFragmentRedirect(event.type == TYPE_HOMEWORK ? MainActivity.DRAWER_ITEM_HOMEWORK : MainActivity.DRAWER_ITEM_AGENDA)
.withLongExtra("eventDate", event.eventDate.getValue()) .withLongExtra("eventDate", event.eventDate.getValue())
); );
d(TAG, "Finishing adding event " + event); d(TAG, "Finishing adding event " + event);
@ -299,7 +299,7 @@ public class MyFirebaseMessagingService extends FirebaseMessagingService {
app.notifier.add(new Notification(app.getContext(), app.getString(R.string.notification_shared_event_removed_format, oldEvent.sharedByName, oldEvent.typeName, oldEvent.eventDate.getFormattedString(), oldEvent.topic)) app.notifier.add(new Notification(app.getContext(), app.getString(R.string.notification_shared_event_removed_format, oldEvent.sharedByName, oldEvent.typeName, oldEvent.eventDate.getFormattedString(), oldEvent.topic))
.withProfileData(profile.getId(), profile.getName()) .withProfileData(profile.getId(), profile.getName())
.withType(oldEvent.type == TYPE_HOMEWORK ? Notification.TYPE_NEW_SHARED_HOMEWORK : Notification.TYPE_NEW_SHARED_EVENT) .withType(oldEvent.type == TYPE_HOMEWORK ? Notification.TYPE_NEW_SHARED_HOMEWORK : Notification.TYPE_NEW_SHARED_EVENT)
.withFragmentRedirect(oldEvent.type == TYPE_HOMEWORK ? MainActivity.DRAWER_ITEM_HOMEWORKS : MainActivity.DRAWER_ITEM_AGENDA) .withFragmentRedirect(oldEvent.type == TYPE_HOMEWORK ? MainActivity.DRAWER_ITEM_HOMEWORK : MainActivity.DRAWER_ITEM_AGENDA)
.withLongExtra("eventDate", oldEvent.eventDate.getValue()) .withLongExtra("eventDate", oldEvent.eventDate.getValue())
); );
app.db.eventDao().remove(oldEvent); app.db.eventDao().remove(oldEvent);

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorSurface_6dp"
app:tabIndicatorColor="?colorPrimary"
app:tabMode="auto"
app:tabSelectedTextColor="?colorPrimary"
app:tabTextColor="?android:textColorPrimary" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</LinearLayout>
</pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator>
</layout>

View File

@ -1,121 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:fontFamily="sans-serif-medium"
android:text="@string/homework_current_title"
android:textSize="20sp" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:layout_weight="2">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/homeworksCurrentView"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.recyclerview.widget.RecyclerView>
<LinearLayout
android:id="@+id/homeworksCurrentNoData"
android:layout_width="match_parent"
android:orientation="vertical"
android:gravity="center"
android:layout_height="match_parent"
android:visibility="gone"
tools:visibility="visible">
<com.mikepenz.iconics.view.IconicsImageView
android:layout_width="match_parent"
android:layout_height="92dp"
app:iiv_color="?android:textColorPrimary"
app:iiv_icon="szf-file-document-edit"
app:iiv_size="92dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:text="@string/homework_current_no_data"
android:textSize="18sp"
android:textStyle="italic" />
</LinearLayout>
</FrameLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:fontFamily="sans-serif-medium"
android:text="@string/homework_past_title"
android:textSize="20sp" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:layout_weight="3">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/homeworksPastView"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.recyclerview.widget.RecyclerView>
<LinearLayout
android:id="@+id/homeworksPastNoData"
android:layout_width="match_parent"
android:orientation="vertical"
android:gravity="center"
android:layout_height="match_parent"
android:visibility="gone"
tools:visibility="visible">
<com.mikepenz.iconics.view.IconicsImageView
android:layout_width="match_parent"
android:layout_height="92dp"
app:iiv_color="?android:textColorPrimary"
app:iiv_icon="szf-file-document-edit"
app:iiv_size="92dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:text="@string/homework_past_no_data"
android:textSize="18sp"
android:textStyle="italic" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
</pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator>
</layout>

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/homeworkView"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.recyclerview.widget.RecyclerView>
<LinearLayout
android:id="@+id/homeworkNoData"
android:layout_width="match_parent"
android:orientation="vertical"
android:gravity="center"
android:layout_height="match_parent"
android:visibility="gone"
tools:visibility="visible">
<com.mikepenz.iconics.view.IconicsImageView
android:layout_width="match_parent"
android:layout_height="92dp"
app:iiv_color="?android:textColorPrimary"
app:iiv_icon="szf-file-document-edit"
app:iiv_size="92dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:text="@string/homework_no_data"
android:textSize="18sp"
android:textStyle="italic" />
</LinearLayout>
</LinearLayout>
</layout>

View File

@ -5,11 +5,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/emailList" android:id="@+id/emailList"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -18,7 +13,6 @@
android:transitionGroup="false" android:transitionGroup="false"
tools:listitem="@layout/messages_item" tools:listitem="@layout/messages_item"
tools:targetApi="lollipop" /> tools:targetApi="lollipop" />
</pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator>
<ProgressBar <ProgressBar
android:id="@+id/progressBar" android:id="@+id/progressBar"

View File

@ -7,7 +7,7 @@
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/homeworksItemCard" android:id="@+id/homeworkItemCard"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" android:layout_margin="8dp"
@ -31,7 +31,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/homeworksItemHomeworkDate" android:id="@+id/homeworkItemHomeworkDate"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
@ -41,7 +41,7 @@
android:layout_marginEnd="16dp" /> android:layout_marginEnd="16dp" />
<com.mikepenz.iconics.view.IconicsTextView <com.mikepenz.iconics.view.IconicsTextView
android:id="@+id/homeworksItemSharedBy" android:id="@+id/homeworkItemSharedBy"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
@ -61,7 +61,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/homeworksItemTopic" android:id="@+id/homeworkItemTopic"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
@ -72,7 +72,7 @@
tools:text="topic???" /> tools:text="topic???" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/homeworksItemEdit" android:id="@+id/homeworkItemEdit"
style="@style/Widget.MaterialComponents.Button.OutlinedButton" style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -89,7 +89,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/homeworksItemSubjectTeacher" android:id="@+id/homeworkItemSubjectTeacher"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
@ -100,7 +100,7 @@
tools:text="subjectName, teacherName" /> tools:text="subjectName, teacherName" />
<TextView <TextView
android:id="@+id/homeworksItemTeamDate" android:id="@+id/homeworkItemTeamDate"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"

View File

@ -1,148 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_main"
app:startDestination="@+id/homeFragment">
<fragment
android:id="@+id/loadingFragment"
android:name="pl.szczodrzynski.edziennik.fragments.LoadingFragment"
android:label="LoadingFragment"
tools:layout="@layout/fragment_loading">
<action
android:id="@+id/action_loadingFragment_to_homeFragment"
app:destination="@id/homeFragment" />
</fragment>
<fragment
android:id="@+id/homeFragment"
android:name="pl.szczodrzynski.edziennik.fragments.HomeFragment"
android:label="fragment_home"
tools:layout="@layout/fragment_home">
<action
android:id="@+id/action_homeFragment_to_timetableFragment"
app:destination="@id/timetableFragment"
app:popUpTo="@+id/homeFragment" />
<action
android:id="@+id/action_homeFragment_to_gradesFragment"
app:destination="@id/gradesFragment"
app:popUpTo="@+id/homeFragment" />
<action
android:id="@+id/action_homeFragment_to_messagesFragment"
app:destination="@id/messagesFragment"
app:popUpTo="@+id/homeFragment" />
<action
android:id="@+id/action_homeFragment_to_agendaFragment"
app:destination="@id/agendaFragment"
app:popUpTo="@+id/homeFragment" />
<action
android:id="@+id/action_homeFragment_to_noticesFragment"
app:destination="@id/noticesFragment"
app:popUpTo="@+id/homeFragment" />
<action
android:id="@+id/action_homeFragment_to_announcementsFragment"
app:destination="@id/announcementsFragment"
app:popUpTo="@+id/homeFragment" />
<action
android:id="@+id/action_homeFragment_to_attendancesFragment"
app:destination="@id/attendancesFragment"
app:popUpTo="@+id/homeFragment" />
<action
android:id="@+id/action_homeFragment_to_homeworkFragment"
app:destination="@id/homeworkFragment"
app:popUpTo="@+id/homeFragment" />
<action
android:id="@+id/action_homeFragment_to_notificationsFragment"
app:destination="@id/notificationsFragment"
app:popUpTo="@+id/homeFragment" />
<action
android:id="@+id/action_homeFragment_to_settingsFragment"
app:destination="@id/settingsFragment"
app:popUpTo="@+id/homeFragment" />
<action
android:id="@+id/action_homeFragment_to_profileManagerFragment"
app:destination="@id/profileManagerFragment" />
<action
android:id="@+id/action_homeFragment_to_helpFragment"
app:destination="@id/helpFragment"
app:popUpTo="@+id/homeFragment" />
</fragment>
<fragment
android:id="@+id/gradesFragment"
android:name="pl.szczodrzynski.edziennik.fragments.RegisterGradesFragment"
android:label="fragment_register_grades"
tools:layout="@layout/fragment_register_grades">
<action
android:id="@+id/action_gradesFragment_to_gradesEditorFragment"
app:destination="@id/gradesEditorFragment" />
</fragment>
<fragment
android:id="@+id/gradesEditorFragment"
android:name="pl.szczodrzynski.edziennik.fragments.GradesEditorFragment"
android:label="fragment_grades_editor"
tools:layout="@layout/fragment_grades_editor" />
<fragment
android:id="@+id/timetableFragment"
android:name="pl.szczodrzynski.edziennik.fragments.RegisterTimetableFragment"
android:label="fragment_register_timetable"
tools:layout="@layout/fragment_register_timetable" />
<fragment
android:id="@+id/messagesFragment"
android:name="pl.szczodrzynski.edziennik.messages.MessagesListFragment"
android:label="messages_list"
tools:layout="@layout/messages_list">
<action
android:id="@+id/action_messagesFragment_to_messagesDetailsFragment"
app:destination="@id/messagesDetailsFragment" />
</fragment>
<fragment
android:id="@+id/messagesDetailsFragment"
android:name="pl.szczodrzynski.edziennik.messages.MessagesDetailsFragment"
android:label="messages_details"
tools:layout="@layout/messages_details" />
<fragment
android:id="@+id/agendaFragment"
android:name="pl.szczodrzynski.edziennik.fragments.RegisterAgendaDefaultFragment"
android:label="fragment_register_agenda_default"
tools:layout="@layout/fragment_register_agenda_default" />
<fragment
android:id="@+id/homeworkFragment"
android:name="pl.szczodrzynski.edziennik.fragments.RegisterHomeworksFragment"
android:label="fragment_register_homeworks"
tools:layout="@layout/fragment_register_homeworks" />
<fragment
android:id="@+id/noticesFragment"
android:name="pl.szczodrzynski.edziennik.fragments.RegisterNoticesFragment"
android:label="fragment_register_notices"
tools:layout="@layout/fragment_register_notices" />
<fragment
android:id="@+id/attendancesFragment"
android:name="pl.szczodrzynski.edziennik.fragments.RegisterAttendancesFragment"
android:label="fragment_register_attendances"
tools:layout="@layout/fragment_register_attendances" />
<fragment
android:id="@+id/announcementsFragment"
android:name="pl.szczodrzynski.edziennik.fragments.RegisterAnnouncementsFragment"
android:label="fragment_register_school_notices"
tools:layout="@layout/fragment_register_school_notices" />
<fragment
android:id="@+id/notificationsFragment"
android:name="pl.szczodrzynski.edziennik.fragments.RegisterNotificationsFragment"
android:label="fragment_register_notifications"
tools:layout="@layout/fragment_register_notifications" />
<fragment
android:id="@+id/settingsFragment"
android:name="pl.szczodrzynski.edziennik.fragments.SettingsNewFragment"
android:label="fragment_register_settings" />
<fragment
android:id="@+id/profileManagerFragment"
android:name="pl.szczodrzynski.edziennik.fragments.ProfileManagerFragment"
android:label="fragment_profile_manager"
tools:layout="@layout/fragment_profile_manager" />
<fragment
android:id="@+id/helpFragment"
android:name="pl.szczodrzynski.edziennik.fragments.HelpFragment"
android:label="fragment_help"
tools:layout="@layout/fragment_help" />
</navigation>

View File

@ -607,7 +607,7 @@
<string name="settings_sync_customize_endpoint_classrooms">Classrooms</string> <string name="settings_sync_customize_endpoint_classrooms">Classrooms</string>
<string name="settings_sync_customize_endpoint_events">Events/agenda</string> <string name="settings_sync_customize_endpoint_events">Events/agenda</string>
<string name="settings_sync_customize_endpoint_grades">Grades</string> <string name="settings_sync_customize_endpoint_grades">Grades</string>
<string name="settings_sync_customize_endpoint_homeworks">Homework</string> <string name="settings_sync_customize_endpoint_homework">Homework</string>
<string name="settings_sync_customize_endpoint_lucky_numbers">Lucky number</string> <string name="settings_sync_customize_endpoint_lucky_numbers">Lucky number</string>
<string name="settings_sync_customize_endpoint_messages_inbox">Messages - received</string> <string name="settings_sync_customize_endpoint_messages_inbox">Messages - received</string>
<string name="settings_sync_customize_endpoint_messages_outbox">Messages - sent</string> <string name="settings_sync_customize_endpoint_messages_outbox">Messages - sent</string>
@ -753,7 +753,7 @@
<string name="sync_feature_announcements">Syncing announcements…</string> <string name="sync_feature_announcements">Syncing announcements…</string>
<string name="sync_feature_attendances">Syncing attendances…</string> <string name="sync_feature_attendances">Syncing attendances…</string>
<string name="sync_feature_grades">Syncing grades…</string> <string name="sync_feature_grades">Syncing grades…</string>
<string name="sync_feature_homeworks">Syncing homeworks</string> <string name="sync_feature_homework">Syncing homework…</string>
<string name="sync_feature_messages_inbox">Syncing received messages…</string> <string name="sync_feature_messages_inbox">Syncing received messages…</string>
<string name="sync_feature_messages_outbox">Syncing sent messages…</string> <string name="sync_feature_messages_outbox">Syncing sent messages…</string>
<string name="sync_feature_notices">Syncing notices…</string> <string name="sync_feature_notices">Syncing notices…</string>

View File

@ -313,8 +313,8 @@
<string name="homework_edit">Edytuj</string> <string name="homework_edit">Edytuj</string>
<string name="homework_past_no_data">Brak poprzednich zadań domowych.</string> <string name="homework_past_no_data">Brak poprzednich zadań domowych.</string>
<string name="homework_past_title">Poprzednie zadania</string> <string name="homework_past_title">Poprzednie zadania</string>
<string name="homeworks_subject_teacher_format" translatable="false">%s, %s</string> <string name="homework_subject_teacher_format" translatable="false">%s, %s</string>
<string name="homeworks_team_date_format" translatable="false">%s %s</string> <string name="homework_team_date_format" translatable="false">%s %s</string>
<string name="i_agree">Zgadzam się</string> <string name="i_agree">Zgadzam się</string>
<string name="i_disagree">Nie zgadzam się</string> <string name="i_disagree">Nie zgadzam się</string>
<string name="incorrect_format">Nieprawidłowy format</string> <string name="incorrect_format">Nieprawidłowy format</string>
@ -652,7 +652,7 @@
<string name="settings_sync_customize_endpoint_classrooms">Sale lekcyjne</string> <string name="settings_sync_customize_endpoint_classrooms">Sale lekcyjne</string>
<string name="settings_sync_customize_endpoint_events">Wydarzenia/terminarz</string> <string name="settings_sync_customize_endpoint_events">Wydarzenia/terminarz</string>
<string name="settings_sync_customize_endpoint_grades">Oceny</string> <string name="settings_sync_customize_endpoint_grades">Oceny</string>
<string name="settings_sync_customize_endpoint_homeworks">Zadania domowe</string> <string name="settings_sync_customize_endpoint_homework">Zadania domowe</string>
<string name="settings_sync_customize_endpoint_lucky_numbers">Szczęśliwy numerek</string> <string name="settings_sync_customize_endpoint_lucky_numbers">Szczęśliwy numerek</string>
<string name="settings_sync_customize_endpoint_messages_inbox">Wiadomości odebrane</string> <string name="settings_sync_customize_endpoint_messages_inbox">Wiadomości odebrane</string>
<string name="settings_sync_customize_endpoint_messages_outbox">Wiadomości wysłane</string> <string name="settings_sync_customize_endpoint_messages_outbox">Wiadomości wysłane</string>
@ -800,7 +800,7 @@
<string name="sync_feature_announcements">Pobieram tablicę ogłoszeń…</string> <string name="sync_feature_announcements">Pobieram tablicę ogłoszeń…</string>
<string name="sync_feature_attendances">Pobieram obecności…</string> <string name="sync_feature_attendances">Pobieram obecności…</string>
<string name="sync_feature_grades">Pobieram oceny…</string> <string name="sync_feature_grades">Pobieram oceny…</string>
<string name="sync_feature_homeworks">Pobieram zadania domowe…</string> <string name="sync_feature_homework">Pobieram zadania domowe…</string>
<string name="sync_feature_messages_inbox">Pobieram wiadomości odebrane…</string> <string name="sync_feature_messages_inbox">Pobieram wiadomości odebrane…</string>
<string name="sync_feature_messages_outbox">Pobieram wiadomości wysłane…</string> <string name="sync_feature_messages_outbox">Pobieram wiadomości wysłane…</string>
<string name="sync_feature_notices">Pobieram uwagi…</string> <string name="sync_feature_notices">Pobieram uwagi…</string>
@ -909,4 +909,7 @@
<string name="settings_about_discord_subtext">Dołącz do naszego serwera Discord!</string> <string name="settings_about_discord_subtext">Dołącz do naszego serwera Discord!</string>
<string name="menu_debug">Debugowanie</string> <string name="menu_debug">Debugowanie</string>
<string name="sync_action_syncing_school_free_days">Pobieranie dni wolnych szkoły</string> <string name="sync_action_syncing_school_free_days">Pobieranie dni wolnych szkoły</string>
<string name="homework_tab_current">Aktualne</string>
<string name="homework_tab_past">Minione</string>
<string name="homework_no_data">Brak zadań domowych.</string>
</resources> </resources>

View File

@ -44,7 +44,7 @@ buildscript {
iconics : "4.0.1-b02", iconics : "4.0.1-b02",
font_cmd : "3.5.95.1-kotlin", font_cmd : "3.5.95.1-kotlin",
navlib : "84d6447887", navlib : "e4ad01dc87",
gifdrawable : "1.2.15" gifdrawable : "1.2.15"
] ]