[UI/Lists] Add missing item dividers. Try to improve attendance & grades design.

This commit is contained in:
Kuba Szczodrzyński 2020-02-28 23:45:46 +01:00
parent d7d0c6f822
commit 1bfb3781ab
7 changed files with 100 additions and 92 deletions

View File

@ -105,7 +105,7 @@ public class GradeDetailsDialog {
b.setDevMode(App.Companion.getDevMode());
b.gradeName.setTextColor(ColorUtils.calculateLuminance(gradeColor) > 0.25 ? 0xff000000 : 0xffffffff);
b.gradeName.setTextColor(ColorUtils.calculateLuminance(gradeColor) > 0.3 ? 0xff000000 : 0xffffffff);
b.gradeName.getBackground().setColorFilter(new PorterDuffColorFilter(gradeColor, PorterDuff.Mode.MULTIPLY));
AsyncTask.execute(() -> {

View File

@ -36,6 +36,7 @@ import pl.szczodrzynski.edziennik.R;
import pl.szczodrzynski.edziennik.data.db.entity.Subject;
import pl.szczodrzynski.edziennik.data.db.full.AttendanceFull;
import pl.szczodrzynski.edziennik.databinding.FragmentAttendanceBinding;
import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration;
import pl.szczodrzynski.edziennik.utils.Themes;
import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem;
@ -178,6 +179,7 @@ public class AttendanceFragment extends Fragment {
b.attendanceView.setHasFixedSize(true);
b.attendanceView.setLayoutManager(linearLayoutManager);
b.attendanceView.addItemDecoration(new SimpleDividerItemDecoration(getContext()));
App.db.attendanceDao().getAll(App.Companion.getProfileId()).observe(this, attendance -> {
if (app == null || activity == null || b == null || !isAdded())

View File

@ -3,7 +3,6 @@ package pl.szczodrzynski.edziennik.ui.modules.grades;
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -65,8 +64,8 @@ public class GradesListAdapter extends RecyclerView.Adapter<GradesListAdapter.Vi
holder.gradesListName.setText(grade.name);
holder.gradesListName.setSelected(true);
holder.gradesListName.setTypeface(null, Typeface.BOLD);
holder.gradesListName.setTextColor(ColorUtils.calculateLuminance(gradeColor) > 0.25 ? 0xff000000 : 0xffffffff);
//holder.gradesListName.setTypeface(null, Typeface.BOLD);
holder.gradesListName.setTextColor(ColorUtils.calculateLuminance(gradeColor) > 0.3 ? 0xff000000 : 0xffffffff);
holder.gradesListName.getBackground().setColorFilter(new PorterDuffColorFilter(gradeColor, PorterDuff.Mode.MULTIPLY));
if (grade.description.trim().isEmpty()) {

View File

@ -14,7 +14,6 @@ import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import java.util.ArrayList;
@ -27,6 +26,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Message;
import pl.szczodrzynski.edziennik.data.db.full.MessageFull;
import pl.szczodrzynski.edziennik.data.db.full.MessageRecipientFull;
import pl.szczodrzynski.edziennik.databinding.MessagesListBinding;
import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration;
import pl.szczodrzynski.edziennik.utils.Themes;
import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
@ -164,7 +164,7 @@ public class MessagesListFragment extends Fragment {
viewParent = (ViewGroup) view.getParent();
b.emailList.setLayoutManager(new LinearLayoutManager(view.getContext()));
b.emailList.addItemDecoration(new DividerItemDecoration(view.getContext(), LinearLayoutManager.VERTICAL));
b.emailList.addItemDecoration(new SimpleDividerItemDecoration(view.getContext()));
b.emailList.setAdapter(messagesAdapter);
if (messageType == Message.TYPE_RECEIVED) {

View File

@ -45,14 +45,16 @@
android:layout_width="72dp"
android:layout_height="72dp"
android:background="@drawable/bg_rounded_16dp"
android:fontFamily="sans-serif-medium"
android:fontFamily="serif-monospace"
android:gravity="center"
android:padding="8dp"
android:text="@{grade.name}"
android:textIsSelectable="true"
android:textSize="36sp"
app:autoSizeMaxTextSize="36sp"
android:textStyle="bold"
app:autoSizeMaxTextSize="56sp"
app:autoSizeTextType="uniform"
tools:background="#ff0000"
tools:background="#ff4caf50"
tools:text="1-" />
<LinearLayout

View File

@ -13,8 +13,8 @@
android:layout_height="40dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginBottom="0dp"
android:background="@drawable/bg_rounded_8dp"
android:fontFamily="serif-monospace"
android:gravity="center"
android:textColor="@color/black"
android:textSize="24sp"
@ -51,8 +51,8 @@
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:ellipsize="end"
android:fontFamily="sans-serif-medium"
android:singleLine="true"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/attendanceDate"
app:layout_constraintStart_toEndOf="@+id/attendanceType"
app:layout_constraintTop_toBottomOf="@+id/attendanceLessonTopic"
@ -68,6 +68,7 @@
android:layout_marginRight="8dp"
android:ellipsize="end"
android:singleLine="true"
android:textAppearance="@style/NavView.TextView.Helper"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/attendanceDate"
app:layout_constraintStart_toEndOf="@+id/attendanceType"
@ -82,7 +83,7 @@
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="0dp"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textAppearance="@style/NavView.TextView.Helper"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/attendanceLessonTopic"
@ -95,7 +96,7 @@
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
tools:text="19.11.2018"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textAppearance="@style/NavView.TextView.Helper"
app:layout_constraintBottom_toBottomOf="@+id/attendanceLessonTopic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/attendanceLessonTopic" />

View File

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:orientation="horizontal"
android:paddingTop="8dp"
android:paddingBottom="8dp">
@ -15,15 +16,25 @@
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_rounded_8dp"
android:fontFamily="sans-serif-light"
android:fontFamily="serif-monospace"
android:gravity="center"
android:padding="2dp"
android:textSize="24sp"
app:autoSizeMaxTextSize="24sp"
android:textStyle="bold"
app:autoSizeMaxTextSize="32sp"
app:autoSizeTextType="uniform"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:background="#4caf50"
tools:text="5+" />
tools:text="NB" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/gradesListCategoryColumn"
@ -33,32 +44,25 @@
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:ellipsize="marquee"
android:focusableInTouchMode="false"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:layout_weight="1"
android:ellipsize="end"
android:singleLine="true"
tools:text="kraje hehe no jak zwykle jedynka z geografii. to jest baaardzo długi tekst ale szkoda że się nie scrolluje."
app:layout_constraintBottom_toTopOf="@+id/gradesListCategoryDescription"
app:layout_constraintEnd_toStartOf="@+id/gradesListAddedDate"
app:layout_constraintStart_toEndOf="@+id/gradesListName"
app:layout_constraintTop_toTopOf="@+id/gradesListName"
app:layout_constraintVertical_bias="1.0" />
tools:text="kraje hehe no jak zwykle jedynka z geografii. to jest baaardzo długi tekst ale szkoda że się nie scrolluje." />
<TextView
android:id="@+id/gradesListCategoryDescription"
android:layout_width="0dp"
android:id="@+id/gradesListAddedDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:ellipsize="end"
android:maxLines="1"
tools:text="Kartkówki - K1"
app:layout_constraintBottom_toBottomOf="@+id/gradesListName"
app:layout_constraintEnd_toStartOf="@+id/gradesListTeacher"
app:layout_constraintStart_toEndOf="@+id/gradesListWeight" />
android:textAppearance="@style/NavView.TextView.Helper"
tools:text="14.10.2015" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/gradesListWeight"
@ -67,34 +71,34 @@
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/gradesListCategoryDescription"
app:layout_constraintStart_toEndOf="@+id/gradesListName"
app:layout_constraintTop_toTopOf="@+id/gradesListCategoryDescription"
app:layout_constraintVertical_bias="1.0"
tools:text="waga 30"
tools:visibility="visible" />
<TextView
android:id="@+id/gradesListTeacher"
android:id="@+id/gradesListCategoryDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:textAppearance="@style/NavView.TextView.Small"
app:layout_constraintBottom_toBottomOf="@+id/gradesListCategoryDescription"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/gradesListCategoryDescription"
tools:text="Anna Jakaśtam-Cośtam" />
android:ellipsize="end"
android:maxWidth="200dp"
android:maxLines="1"
tools:text="Kartkówki - K1 123456789 12345678" />
<TextView
android:id="@+id/gradesListAddedDate"
android:layout_width="wrap_content"
android:id="@+id/gradesListTeacher"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
tools:text="14.10.2015"
android:textAppearance="@style/NavView.TextView.Small"
app:layout_constraintBottom_toBottomOf="@+id/gradesListCategoryColumn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/gradesListCategoryColumn" />
</androidx.constraintlayout.widget.ConstraintLayout>
android:layout_weight="1"
android:ellipsize="end"
android:gravity="end"
android:maxLines="1"
android:textAppearance="@style/NavView.TextView.Helper"
tools:text="Anna Jakaśtam-Cośtam" />
</LinearLayout>
</LinearLayout>
</LinearLayout>