Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 8c0986f3 authored by Marten Gajda's avatar Marten Gajda Committed by GitHub
Browse files

Fix layout in List view. (#988)

The last refactoring broke the layout of larger cards and cards of
closed tasks. This restores the correct look.
parent 16744b33
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import com.google.android.material.card.MaterialCardView;
import org.dmfs.android.bolts.color.colors.AttributeColor;
import org.dmfs.iterables.decorators.Sieved;
import org.dmfs.jems.single.elementary.Reduced;
import org.dmfs.provider.tasks.model.TaskAdapter;
import org.dmfs.tasks.R;
import org.dmfs.tasks.model.DescriptionItem;
import org.dmfs.tasks.model.TaskFieldAdapters;
@@ -135,10 +136,11 @@ public abstract class BaseTaskViewDescriptor implements ViewDescriptor

    protected void setDescription(View view, Cursor cursor)
    {
        boolean isClosed = TaskAdapter.IS_CLOSED.getFrom(cursor);
        TextView descriptionView = getView(view, android.R.id.text1);

        List<DescriptionItem> checkList = TaskFieldAdapters.DESCRIPTION_CHECKLIST.get(cursor);
        if (checkList.size() > 0 && !checkList.get(0).checkbox)
        if (checkList.size() > 0 && !checkList.get(0).checkbox && !isClosed)
        {
            String description = checkList.get(0).text;
            descriptionView.setVisibility(View.VISIBLE);
@@ -152,7 +154,7 @@ public abstract class BaseTaskViewDescriptor implements ViewDescriptor
        TextView checkboxItemCountView = getView(view, R.id.checkbox_item_count);
        Iterable<DescriptionItem> checkedItems = new Sieved<>(item -> item.checkbox, checkList);
        int checkboxItemCount = new Reduced<DescriptionItem, Integer>(() -> 0, (count, ignored) -> count + 1, checkedItems).value();
        if (checkboxItemCount == 0)
        if (checkboxItemCount == 0 || isClosed)
        {
            checkboxItemCountView.setVisibility(View.GONE);
        }
+83 −76
Original line number Diff line number Diff line
@@ -63,13 +63,33 @@
                    android:paddingHorizontal="10dp"
                    android:state_checkable="true">

                <LinearLayout
                        android:id="@+id/title_layout"
                        android:layout_alignParentLeft="true"
                        android:layout_alignParentTop="true"
                        android:orientation="horizontal"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">

                    <androidx.appcompat.widget.AppCompatTextView
                            android:id="@android:id/title"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:ellipsize="end"
                            android:layout_weight="1"
                            android:layout_gravity="center_vertical"
                            android:padding="2dip"
                            android:singleLine="true"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="?android:attr/textColorPrimaryInverse"
                            android:textIsSelectable="false" />

                    <LinearLayout
                            android:id="@+id/task_dates"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_centerVertical="true"
                        android:gravity="right"
                            android:layout_gravity="center_vertical"
                            android:gravity="end"
                            android:orientation="vertical"
                            android:padding="2dp">

@@ -136,20 +156,7 @@
                        </LinearLayout>
                    </LinearLayout>

                <androidx.appcompat.widget.AppCompatTextView
                        android:id="@android:id/title"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_toLeftOf="@id/task_dates"
                        android:layout_alignParentTop="true"
                        android:ellipsize="end"
                        android:gravity="center_vertical"
                        android:padding="2dip"
                        android:singleLine="true"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="?android:attr/textColorPrimaryInverse"
                        android:textIsSelectable="false" />
                </LinearLayout>

                <androidx.appcompat.widget.AppCompatTextView
                        android:id="@android:id/text1"
@@ -157,7 +164,7 @@
                        android:layout_height="wrap_content"
                        android:ellipsize="end"
                        android:maxLines="2"
                        android:layout_below="@android:id/title"
                        android:layout_below="@id/title_layout"
                        android:padding="2dip"
                        android:textAppearance="@style/TextAppearance.AppCompat.Small"
                        android:textColor="?android:attr/textColorSecondaryInverse"