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

Unverified Commit 03ce418d authored by Gitsaibot's avatar Gitsaibot Committed by GitHub
Browse files

Remove divider on top and focus on day in agendaListView (#825)

Remove divider on top and focus on day in listView
parent 9db47982
Loading
Loading
Loading
Loading
+39 −2
Original line number Diff line number Diff line
@@ -212,8 +212,8 @@ public class AgendaByDayAdapter extends BaseAdapter {
            // Build the text for the day of the week.
            // Should be yesterday/today/tomorrow (if applicable) + day of the week

            Time date = mTmpTime;
            long millis = date.setJulianDay(row.mDay);
            final Time date = mTmpTime;
            final long millis = date.setJulianDay(row.mDay);
            int flags = DateUtils.FORMAT_SHOW_WEEKDAY;
            mStringBuilder.setLength(0);

@@ -421,6 +421,9 @@ public class AgendaByDayAdapter extends BaseAdapter {
            }
        }
        mRowInfo = rowInfo;
        if (mTodayJulianDay >= dayAdapterInfo.start && mTodayJulianDay <=  dayAdapterInfo.end) {
            insertTodayRowIfNeeded();
        }
    }

    /**
@@ -449,6 +452,8 @@ public class AgendaByDayAdapter extends BaseAdapter {
        int minDay = 0;
        boolean idFound = false;
        int len = mRowInfo.size();
        int julianDay = Time.getJulianDay(millis, time.gmtoff);
        int dayIndex = -1;

        // Loop through the events and find the best match
        // 1. Event id and start time matches requested id and time
@@ -461,6 +466,10 @@ public class AgendaByDayAdapter extends BaseAdapter {
        for (int index = 0; index < len; index++) {
            RowInfo row = mRowInfo.get(index);
            if (row.mType == TYPE_DAY) {
                // if we don't find a better matching event we will use the day
                if (row.mDay == julianDay) {
                    dayIndex = index;
                }
                continue;
            }

@@ -505,6 +514,10 @@ public class AgendaByDayAdapter extends BaseAdapter {
        if (idFound) {
            return idFoundMinIndex;
        }
        // prefer an exact day match (might be the dummy today one)
        if (dayIndex != -1) {
            return dayIndex;
        }
        // Event which occurs at the searched time
        if (eventInTimeIndex != -1) {
            return eventInTimeIndex;
@@ -679,4 +692,28 @@ public class AgendaByDayAdapter extends BaseAdapter {
            mAllDay = allDay;
        }
    }

    public void insertTodayRowIfNeeded() {
        int len = mRowInfo.size();
        int lastDay = -1;
        int insertIndex = -1;

        for (int index = 0; index < len; index++) {
            RowInfo row = mRowInfo.get(index);
            if (row.mDay == mTodayJulianDay) {
                return;
            }
            if (row.mDay > mTodayJulianDay && lastDay < mTodayJulianDay) {
                insertIndex = index;
                break;
            }
            lastDay = row.mDay;
        }

        if (insertIndex != -1) {
            mRowInfo.add(insertIndex, new RowInfo(TYPE_DAY, mTodayJulianDay));
        } else {
            mRowInfo.add(new RowInfo(TYPE_DAY, mTodayJulianDay));
        }
    }
}
+0 −1
Original line number Diff line number Diff line
@@ -179,7 +179,6 @@ public class AgendaFragment extends Fragment implements CalendarController.Event
            // Set scroll listener so that the date on the ActionBar can be set while
            // the user scrolls the view
            lv.setOnScrollListener(this);
            lv.setHeaderSeparator(getResources().getColor(R.color.agenda_list_separator_color), 1);
            topListView = lv;
        } else {
            topListView = mAgendaListView;