forked from github/szkolny
[Gradle] Extract agendacalendarview dependency.
This commit is contained in:
parent
0615593d94
commit
d78dad5090
1
agendacalendarview/.gitignore
vendored
1
agendacalendarview/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/build
|
@ -1,54 +0,0 @@
|
||||
apply plugin: 'com.android.library'
|
||||
//apply plugin: 'me.tatarka.retrolambda'
|
||||
|
||||
android {
|
||||
compileSdkVersion setup.compileSdk
|
||||
|
||||
android {
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion setup.targetSdk
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debugMinify {
|
||||
debuggable = true
|
||||
minifyEnabled = true
|
||||
proguardFiles 'proguard-android.txt'
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main {
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
//apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
// Google libraries
|
||||
implementation "androidx.appcompat:appcompat:${versions.appcompat}"
|
||||
implementation "androidx.recyclerview:recyclerview:${versions.recyclerView}"
|
||||
implementation "com.google.android.material:material:${versions.material}"
|
||||
|
||||
// other libraries
|
||||
//implementation 'se.emilsjolander:stickylistheaders:2.7.0'
|
||||
implementation 'com.github.edisonw:StickyListHeaders:master-SNAPSHOT@aar'
|
||||
implementation 'io.reactivex:rxjava:1.1.1'
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.github.tibolte.agendacalendarview">
|
||||
</manifest>
|
@ -1,264 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Handler;
|
||||
import androidx.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.agenda.AgendaAdapter;
|
||||
import com.github.tibolte.agendacalendarview.agenda.AgendaView;
|
||||
import com.github.tibolte.agendacalendarview.calendar.CalendarView;
|
||||
import com.github.tibolte.agendacalendarview.models.BaseCalendarEvent;
|
||||
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
|
||||
import com.github.tibolte.agendacalendarview.models.DayItem;
|
||||
import com.github.tibolte.agendacalendarview.models.IDayItem;
|
||||
import com.github.tibolte.agendacalendarview.models.IWeekItem;
|
||||
import com.github.tibolte.agendacalendarview.models.WeekItem;
|
||||
import com.github.tibolte.agendacalendarview.render.DefaultEventRenderer;
|
||||
import com.github.tibolte.agendacalendarview.render.EventRenderer;
|
||||
import com.github.tibolte.agendacalendarview.utils.BusProvider;
|
||||
import com.github.tibolte.agendacalendarview.utils.Events;
|
||||
import com.github.tibolte.agendacalendarview.utils.ListViewScrollTracker;
|
||||
import com.github.tibolte.agendacalendarview.widgets.FloatingActionButton;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import se.emilsjolander.stickylistheaders.StickyListHeadersListView;
|
||||
|
||||
/**
|
||||
* View holding the agenda and calendar view together.
|
||||
*/
|
||||
public class AgendaCalendarView extends FrameLayout implements StickyListHeadersListView.OnStickyHeaderChangedListener {
|
||||
|
||||
private static final String LOG_TAG = AgendaCalendarView.class.getSimpleName();
|
||||
|
||||
private CalendarView mCalendarView;
|
||||
private AgendaView mAgendaView;
|
||||
private FloatingActionButton mFloatingActionButton;
|
||||
|
||||
private int mAgendaCurrentDayTextColor, mCalendarHeaderColor, mCalendarHeaderTextColor, mCalendarBackgroundColor, mCalendarDayTextColor, mCalendarPastDayTextColor, mCalendarCurrentDayColor, mFabColor;
|
||||
private CalendarPickerController mCalendarPickerController;
|
||||
|
||||
public AgendaView getAgendaView() {
|
||||
return mAgendaView;
|
||||
}
|
||||
|
||||
private ListViewScrollTracker mAgendaListViewScrollTracker;
|
||||
private AbsListView.OnScrollListener mAgendaScrollListener = new AbsListView.OnScrollListener() {
|
||||
int mCurrentAngle;
|
||||
int mMaxAngle = 85;
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
int scrollY = mAgendaListViewScrollTracker.calculateScrollY(firstVisibleItem, visibleItemCount);
|
||||
if (scrollY != 0) {
|
||||
mFloatingActionButton.show();
|
||||
}
|
||||
//Log.d(LOG_TAG, String.format("Agenda listView scrollY: %d", scrollY));
|
||||
/*int toAngle = scrollY / 100;
|
||||
if (toAngle > mMaxAngle) {
|
||||
toAngle = mMaxAngle;
|
||||
} else if (toAngle < -mMaxAngle) {
|
||||
toAngle = -mMaxAngle;
|
||||
}
|
||||
RotateAnimation rotate = new RotateAnimation(mCurrentAngle, toAngle, mFloatingActionButton.getWidth() / 2, mFloatingActionButton.getHeight() / 2);
|
||||
rotate.setFillAfter(true);
|
||||
mCurrentAngle = toAngle;
|
||||
mFloatingActionButton.startAnimation(rotate);*/
|
||||
}
|
||||
};
|
||||
|
||||
// region Constructors
|
||||
|
||||
public AgendaCalendarView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AgendaCalendarView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ColorOptionsView, 0, 0);
|
||||
mAgendaCurrentDayTextColor = a.getColor(R.styleable.ColorOptionsView_agendaCurrentDayTextColor, getResources().getColor(R.color.theme_primary));
|
||||
mCalendarHeaderColor = a.getColor(R.styleable.ColorOptionsView_calendarHeaderColor, getResources().getColor(R.color.theme_primary_dark));
|
||||
mCalendarHeaderTextColor = a.getColor(R.styleable.ColorOptionsView_calendarHeaderTextColor, getResources().getColor(R.color.theme_text_icons));
|
||||
mCalendarBackgroundColor = a.getColor(R.styleable.ColorOptionsView_calendarColor, getResources().getColor(R.color.theme_primary));
|
||||
mCalendarDayTextColor = a.getColor(R.styleable.ColorOptionsView_calendarDayTextColor, getResources().getColor(R.color.theme_text_icons));
|
||||
mCalendarCurrentDayColor = a.getColor(R.styleable.ColorOptionsView_calendarCurrentDayTextColor, getResources().getColor(R.color.calendar_text_current_day));
|
||||
mCalendarPastDayTextColor = a.getColor(R.styleable.ColorOptionsView_calendarPastDayTextColor, getResources().getColor(R.color.theme_light_primary));
|
||||
mFabColor = a.getColor(R.styleable.ColorOptionsView_fabColor, getResources().getColor(R.color.theme_accent));
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
inflater.inflate(R.layout.view_agendacalendar, this, true);
|
||||
|
||||
setAlpha(0f);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Class - View
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mCalendarView = (CalendarView) findViewById(R.id.calendar_view);
|
||||
mAgendaView = (AgendaView) findViewById(R.id.agenda_view);
|
||||
mFloatingActionButton = (FloatingActionButton) findViewById(R.id.floating_action_button);
|
||||
ColorStateList csl = new ColorStateList(new int[][]{new int[0]}, new int[]{mFabColor});
|
||||
mFloatingActionButton.setBackgroundTintList(csl);
|
||||
|
||||
LinearLayout mDayNamesHeader = mCalendarView.findViewById(R.id.cal_day_names);
|
||||
mDayNamesHeader.setBackgroundColor(mCalendarHeaderColor);
|
||||
for (int i = 0; i < mDayNamesHeader.getChildCount(); i++) {
|
||||
TextView txtDay = (TextView) mDayNamesHeader.getChildAt(i);
|
||||
txtDay.setTextColor(mCalendarHeaderTextColor);
|
||||
}
|
||||
mCalendarView.findViewById(R.id.list_week).setBackgroundColor(mCalendarBackgroundColor);
|
||||
|
||||
mAgendaView.getAgendaListView().setOnItemClickListener((AdapterView<?> parent, View view, int position, long id) -> {
|
||||
mCalendarPickerController.onEventSelected(CalendarManager.getInstance().getEvents().get(position));
|
||||
});
|
||||
|
||||
BusProvider.getInstance().toObserverable()
|
||||
.subscribe(event -> {
|
||||
if (event instanceof Events.DayClickedEvent) {
|
||||
if (mCalendarPickerController != null)
|
||||
mCalendarPickerController.onDaySelected(((Events.DayClickedEvent) event).getDay());
|
||||
} else if (event instanceof Events.EventsFetched) {
|
||||
ObjectAnimator alphaAnimation = ObjectAnimator.ofFloat(this, "alpha", getAlpha(), 1f).setDuration(500);
|
||||
alphaAnimation.addListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
long fabAnimationDelay = 500;
|
||||
// Just after setting the alpha from this view to 1, we hide the fab.
|
||||
// It will reappear as soon as the user is scrolling the Agenda view.
|
||||
new Handler().postDelayed(() -> {
|
||||
mFloatingActionButton.hide();
|
||||
mAgendaListViewScrollTracker = new ListViewScrollTracker(mAgendaView.getAgendaListView());
|
||||
mAgendaView.getAgendaListView().setOnScrollListener(mAgendaScrollListener);
|
||||
mFloatingActionButton.setOnClickListener((v) -> {
|
||||
mAgendaView.translateList(0);
|
||||
mAgendaView.getAgendaListView().smoothScrollBy(0, 0);
|
||||
//mAgendaView.getAgendaListView().getWrappedList().smoothScrollBy(0, 0);
|
||||
mAgendaView.getAgendaListView().scrollToCurrentDate(CalendarManager.getInstance().getToday());
|
||||
new Handler().postDelayed(() -> mFloatingActionButton.hide(), fabAnimationDelay);
|
||||
});
|
||||
}, fabAnimationDelay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
|
||||
}
|
||||
});
|
||||
alphaAnimation.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Interface - StickyListHeadersListView.OnStickyHeaderChangedListener
|
||||
|
||||
@Override
|
||||
public void onStickyHeaderChanged(StickyListHeadersListView stickyListHeadersListView, View header, int position, long headerId) {
|
||||
//Log.d(LOG_TAG, String.format("onStickyHeaderChanged, position = %d, headerId = %d", position, headerId));
|
||||
|
||||
if (CalendarManager.getInstance().getEvents().size() > 0) {
|
||||
CalendarEvent event = CalendarManager.getInstance().getEvents().get(position);
|
||||
if (event != null) {
|
||||
mCalendarView.scrollToDate(event);
|
||||
mCalendarPickerController.onScrollToDate(event.getInstanceDay());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Public methods
|
||||
|
||||
public void init(List<CalendarEvent> eventList, Calendar minDate, Calendar maxDate, Locale locale, CalendarPickerController calendarPickerController, EventRenderer<?> ... renderers) {
|
||||
mCalendarPickerController = calendarPickerController;
|
||||
|
||||
CalendarManager.getInstance(getContext()).buildCal(minDate, maxDate, locale, new DayItem(), new WeekItem());
|
||||
|
||||
// Feed our views with weeks list and events
|
||||
mCalendarView.init(CalendarManager.getInstance(getContext()), mCalendarDayTextColor, mCalendarCurrentDayColor, mCalendarPastDayTextColor, eventList);
|
||||
|
||||
// Load agenda events and scroll to current day
|
||||
AgendaAdapter agendaAdapter = new AgendaAdapter(mAgendaCurrentDayTextColor);
|
||||
mAgendaView.getAgendaListView().setAdapter(agendaAdapter);
|
||||
mAgendaView.getAgendaListView().setOnStickyHeaderChangedListener(this);
|
||||
|
||||
CalendarManager.getInstance().loadEvents(eventList, new BaseCalendarEvent());
|
||||
BusProvider.getInstance().send(new Events.EventsFetched());
|
||||
Log.d(LOG_TAG, "CalendarEventTask finished, event count "+eventList.size());
|
||||
|
||||
// add default event renderer
|
||||
addEventRenderer(new DefaultEventRenderer());
|
||||
for (EventRenderer<?> renderer: renderers) {
|
||||
addEventRenderer(renderer);
|
||||
}
|
||||
}
|
||||
|
||||
public void init(Locale locale, List<IWeekItem> lWeeks, List<IDayItem> lDays, List<CalendarEvent> lEvents, CalendarPickerController calendarPickerController) {
|
||||
mCalendarPickerController = calendarPickerController;
|
||||
|
||||
CalendarManager.getInstance(getContext()).loadCal(locale, lWeeks, lDays, lEvents);
|
||||
|
||||
// Feed our views with weeks list and events
|
||||
mCalendarView.init(CalendarManager.getInstance(getContext()), mCalendarDayTextColor, mCalendarCurrentDayColor, mCalendarPastDayTextColor, lEvents);
|
||||
|
||||
// Load agenda events and scroll to current day
|
||||
AgendaAdapter agendaAdapter = new AgendaAdapter(mAgendaCurrentDayTextColor);
|
||||
mAgendaView.getAgendaListView().setAdapter(agendaAdapter);
|
||||
mAgendaView.getAgendaListView().setOnStickyHeaderChangedListener(this);
|
||||
|
||||
// notify that actually everything is loaded
|
||||
BusProvider.getInstance().send(new Events.EventsFetched());
|
||||
Log.d(LOG_TAG, "CalendarEventTask finished");
|
||||
|
||||
// add default event renderer
|
||||
addEventRenderer(new DefaultEventRenderer());
|
||||
}
|
||||
|
||||
public void addEventRenderer(@NonNull final EventRenderer<?> renderer) {
|
||||
AgendaAdapter adapter = (AgendaAdapter) mAgendaView.getAgendaListView().getAdapter();
|
||||
adapter.addEventRenderer(renderer);
|
||||
}
|
||||
|
||||
public void enableFloatingIndicator(boolean enable) {
|
||||
mFloatingActionButton.setVisibility(enable ? VISIBLE : GONE);
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,267 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
|
||||
import com.github.tibolte.agendacalendarview.models.IDayItem;
|
||||
import com.github.tibolte.agendacalendarview.models.IWeekItem;
|
||||
import com.github.tibolte.agendacalendarview.utils.DateHelper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* This class manages information about the calendar. (Events, weather info...)
|
||||
* Holds reference to the days list of the calendar.
|
||||
* As the app is using several views, we want to keep everything in one place.
|
||||
*/
|
||||
public class CalendarManager {
|
||||
|
||||
private static final String LOG_TAG = CalendarManager.class.getSimpleName();
|
||||
|
||||
private static CalendarManager mInstance;
|
||||
|
||||
private Context mContext;
|
||||
private Locale mLocale;
|
||||
private Calendar mToday = Calendar.getInstance();
|
||||
private SimpleDateFormat mWeekdayFormatter;
|
||||
private SimpleDateFormat mMonthHalfNameFormat;
|
||||
|
||||
/// instances of classes provided from outside
|
||||
private IDayItem mCleanDay;
|
||||
private IWeekItem mCleanWeek;
|
||||
|
||||
/**
|
||||
* List of days used by the calendar
|
||||
*/
|
||||
private List<IDayItem> mDays = new ArrayList<>();
|
||||
/**
|
||||
* List of weeks used by the calendar
|
||||
*/
|
||||
private List<IWeekItem> mWeeks = new ArrayList<>();
|
||||
/**
|
||||
* List of events instances
|
||||
*/
|
||||
private List<CalendarEvent> mEvents = new ArrayList<>();
|
||||
|
||||
// region Constructors
|
||||
|
||||
public CalendarManager(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
public static CalendarManager getInstance(Context context) {
|
||||
if (mInstance == null) {
|
||||
mInstance = new CalendarManager(context);
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
public static CalendarManager getInstance() {
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Getters/Setters
|
||||
|
||||
public Locale getLocale() {
|
||||
return mLocale;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return mContext;
|
||||
}
|
||||
|
||||
public Calendar getToday() {
|
||||
return mToday;
|
||||
}
|
||||
|
||||
public void setToday(Calendar today) {
|
||||
this.mToday = today;
|
||||
}
|
||||
|
||||
public List<IWeekItem> getWeeks() {
|
||||
return mWeeks;
|
||||
}
|
||||
|
||||
public List<CalendarEvent> getEvents() {
|
||||
return mEvents;
|
||||
}
|
||||
|
||||
public List<IDayItem> getDays() {
|
||||
return mDays;
|
||||
}
|
||||
|
||||
public SimpleDateFormat getWeekdayFormatter() {
|
||||
return mWeekdayFormatter;
|
||||
}
|
||||
|
||||
public SimpleDateFormat getMonthHalfNameFormat() {
|
||||
return mMonthHalfNameFormat;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Public methods
|
||||
|
||||
public void buildCal(Calendar minDate, Calendar maxDate, Locale locale, IDayItem cleanDay, IWeekItem cleanWeek) {
|
||||
if (minDate == null || maxDate == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"minDate and maxDate must be non-null.");
|
||||
}
|
||||
if (minDate.after(maxDate)) {
|
||||
throw new IllegalArgumentException(
|
||||
"minDate must be before maxDate.");
|
||||
}
|
||||
if (locale == null) {
|
||||
throw new IllegalArgumentException("Locale is null.");
|
||||
}
|
||||
|
||||
setLocale(locale);
|
||||
|
||||
mDays.clear();
|
||||
mWeeks.clear();
|
||||
mEvents.clear();
|
||||
|
||||
mCleanDay = cleanDay;
|
||||
mCleanWeek = cleanWeek;
|
||||
|
||||
Calendar mMinCal = Calendar.getInstance(mLocale);
|
||||
Calendar mMaxCal = Calendar.getInstance(mLocale);
|
||||
Calendar mWeekCounter = Calendar.getInstance(mLocale);
|
||||
|
||||
mMinCal.setTime(minDate.getTime());
|
||||
mMaxCal.setTime(maxDate.getTime());
|
||||
|
||||
// maxDate is exclusive, here we bump back to the previous day, as maxDate if December 1st, 2020,
|
||||
// we don't include that month in our list
|
||||
mMaxCal.add(Calendar.MINUTE, -1);
|
||||
|
||||
// Now iterate we iterate between mMinCal and mMaxCal so we build our list of weeks
|
||||
mWeekCounter.setTime(mMinCal.getTime());
|
||||
int maxMonth = mMaxCal.get(Calendar.MONTH);
|
||||
int maxYear = mMaxCal.get(Calendar.YEAR);
|
||||
|
||||
int currentMonth = mWeekCounter.get(Calendar.MONTH);
|
||||
int currentYear = mWeekCounter.get(Calendar.YEAR);
|
||||
|
||||
// Loop through the weeks
|
||||
while ((currentMonth <= maxMonth // Up to, including the month.
|
||||
|| currentYear < maxYear) // Up to the year.
|
||||
&& currentYear < maxYear + 1) { // But not > next yr.
|
||||
|
||||
Date date = mWeekCounter.getTime();
|
||||
// Build our week list
|
||||
int currentWeekOfYear = mWeekCounter.get(Calendar.WEEK_OF_YEAR);
|
||||
|
||||
IWeekItem weekItem = cleanWeek.copy();
|
||||
weekItem.setWeekInYear(currentWeekOfYear);
|
||||
weekItem.setYear(currentYear);
|
||||
weekItem.setDate(date);
|
||||
weekItem.setMonth(currentMonth);
|
||||
weekItem.setLabel(mMonthHalfNameFormat.format(date));
|
||||
List<IDayItem> dayItems = getDayCells(mWeekCounter); // gather days for the built week
|
||||
weekItem.setDayItems(dayItems);
|
||||
mWeeks.add(weekItem);
|
||||
|
||||
//Log.d(LOG_TAG, String.format("Adding week: %s", weekItem));
|
||||
|
||||
mWeekCounter.add(Calendar.WEEK_OF_YEAR, 1);
|
||||
|
||||
currentMonth = mWeekCounter.get(Calendar.MONTH);
|
||||
currentYear = mWeekCounter.get(Calendar.YEAR);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadEvents(List<CalendarEvent> eventList, CalendarEvent noEvent) {
|
||||
|
||||
for (IWeekItem weekItem : getWeeks()) {
|
||||
for (IDayItem dayItem : weekItem.getDayItems()) {
|
||||
boolean isEventForDay = false;
|
||||
boolean isShowBadgeForDay = false;
|
||||
for (CalendarEvent event : eventList) {
|
||||
if (DateHelper.isBetweenInclusive(dayItem.getDate(), event.getStartTime(), event.getEndTime())) {
|
||||
CalendarEvent copy = event.copy();
|
||||
|
||||
if (copy.getShowBadge()) {
|
||||
isShowBadgeForDay = true;
|
||||
}
|
||||
|
||||
Calendar dayInstance = Calendar.getInstance();
|
||||
dayInstance.setTime(dayItem.getDate());
|
||||
copy.setInstanceDay(dayInstance);
|
||||
copy.setDayReference(dayItem);
|
||||
copy.setWeekReference(weekItem);
|
||||
// add instances in chronological order
|
||||
getEvents().add(copy);
|
||||
isEventForDay = true;
|
||||
}
|
||||
}
|
||||
if (!isEventForDay) {
|
||||
Calendar dayInstance = Calendar.getInstance();
|
||||
dayInstance.setTime(dayItem.getDate());
|
||||
CalendarEvent copy = noEvent.copy();
|
||||
|
||||
copy.setInstanceDay(dayInstance);
|
||||
copy.setDayReference(dayItem);
|
||||
copy.setWeekReference(weekItem);
|
||||
copy.setLocation("");
|
||||
copy.setTitle(getContext().getResources().getString(R.string.agenda_event_no_events));
|
||||
copy.setPlaceholder(true);
|
||||
getEvents().add(copy);
|
||||
}
|
||||
dayItem.setShowBadge(isShowBadgeForDay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void loadCal (Locale locale, List<IWeekItem> lWeeks, List<IDayItem> lDays, List<CalendarEvent> lEvents) {
|
||||
mWeeks = lWeeks;
|
||||
mDays = lDays;
|
||||
mEvents = lEvents;
|
||||
setLocale(locale);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Private methods
|
||||
|
||||
private List<IDayItem> getDayCells(Calendar startCal) {
|
||||
Calendar cal = Calendar.getInstance(mLocale);
|
||||
cal.setTime(startCal.getTime());
|
||||
List<IDayItem> dayItems = new ArrayList<>();
|
||||
|
||||
int firstDayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
|
||||
int offset = cal.getFirstDayOfWeek() - firstDayOfWeek;
|
||||
if (offset > 0) {
|
||||
offset -= 7;
|
||||
}
|
||||
cal.add(Calendar.DATE, offset);
|
||||
|
||||
//Log.d(LOG_TAG, String.format("Buiding row week starting at %s", cal.getTime()));
|
||||
for (int c = 0; c < 7; c++) {
|
||||
IDayItem dayItem = mCleanDay.copy();
|
||||
dayItem.buildDayItemFromCal(cal);
|
||||
dayItems.add(dayItem);
|
||||
cal.add(Calendar.DATE, 1);
|
||||
}
|
||||
|
||||
mDays.addAll(dayItems);
|
||||
return dayItems;
|
||||
}
|
||||
|
||||
private void setLocale(Locale locale) {
|
||||
this.mLocale = locale;
|
||||
setToday(Calendar.getInstance(mLocale));
|
||||
mWeekdayFormatter = new SimpleDateFormat(getContext().getString(R.string.day_name_format), mLocale);
|
||||
mMonthHalfNameFormat = new SimpleDateFormat(getContext().getString(R.string.month_half_name_format), locale);
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
|
||||
import com.github.tibolte.agendacalendarview.models.IDayItem;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
public interface CalendarPickerController {
|
||||
void onDaySelected(IDayItem dayItem);
|
||||
|
||||
void onEventSelected(CalendarEvent event);
|
||||
|
||||
void onScrollToDate(Calendar calendar);
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.agenda;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
|
||||
import com.github.tibolte.agendacalendarview.render.DefaultEventRenderer;
|
||||
import com.github.tibolte.agendacalendarview.render.EventRenderer;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter;
|
||||
|
||||
/**
|
||||
* Adapter for the agenda, implements StickyListHeadersAdapter.
|
||||
* Days as sections and CalendarEvents as list items.
|
||||
*/
|
||||
public class AgendaAdapter extends BaseAdapter implements StickyListHeadersAdapter {
|
||||
|
||||
private List<CalendarEvent> mEvents = new ArrayList<>();
|
||||
private List<EventRenderer<?>> mRenderers = new ArrayList<>();
|
||||
private int mCurrentDayColor;
|
||||
|
||||
// region Constructor
|
||||
|
||||
public AgendaAdapter(int currentDayTextColor) {
|
||||
this.mCurrentDayColor = currentDayTextColor;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Public methods
|
||||
|
||||
public void updateEvents(List<CalendarEvent> events) {
|
||||
this.mEvents.clear();
|
||||
this.mEvents.addAll(events);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Interface - StickyListHeadersAdapter
|
||||
|
||||
@Override
|
||||
public View getHeaderView(int position, View convertView, ViewGroup parent) {
|
||||
AgendaHeaderView agendaHeaderView = (AgendaHeaderView) convertView;
|
||||
if (agendaHeaderView == null) {
|
||||
agendaHeaderView = AgendaHeaderView.inflate(parent);
|
||||
}
|
||||
agendaHeaderView.setDay(getItem(position).getInstanceDay(), mCurrentDayColor, getItem(position).getDayReference().getShowBadge());
|
||||
return agendaHeaderView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getHeaderId(int position) {
|
||||
return mEvents.get(position).getInstanceDay().getTimeInMillis();
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Class - BaseAdapter
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mEvents.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CalendarEvent getItem(int position) {
|
||||
return mEvents.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
EventRenderer eventRenderer = new DefaultEventRenderer();
|
||||
final CalendarEvent event = getItem(position);
|
||||
|
||||
// Search for the correct event renderer
|
||||
for (EventRenderer renderer : mRenderers) {
|
||||
if(event.getClass().isAssignableFrom(renderer.getRenderType())) {
|
||||
eventRenderer = renderer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
convertView = LayoutInflater.from(parent.getContext())
|
||||
.inflate(eventRenderer.getEventLayout(), parent, false);
|
||||
eventRenderer.render(convertView, event);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
public void addEventRenderer(@NonNull final EventRenderer<?> renderer) {
|
||||
mRenderers.add(renderer);
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.agenda;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
/**
|
||||
* List item view for the StickyHeaderListView of the agenda view
|
||||
*/
|
||||
public class AgendaEventView extends LinearLayout {
|
||||
public static AgendaEventView inflate(ViewGroup parent) {
|
||||
return (AgendaEventView) LayoutInflater.from(parent.getContext()).inflate(R.layout.view_agenda_event, parent, false);
|
||||
}
|
||||
|
||||
// region Constructors
|
||||
|
||||
public AgendaEventView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AgendaEventView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public AgendaEventView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
setPadding(getResources().getDimensionPixelSize(R.dimen.agenda_event_view_padding_left),
|
||||
getResources().getDimensionPixelSize(R.dimen.agenda_event_view_padding_top),
|
||||
getResources().getDimensionPixelSize(R.dimen.agenda_event_view_padding_right),
|
||||
getResources().getDimensionPixelSize(R.dimen.agenda_event_view_padding_bottom));
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.agenda;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.CalendarManager;
|
||||
import com.github.tibolte.agendacalendarview.R;
|
||||
import com.github.tibolte.agendacalendarview.utils.DateHelper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Header view for the StickyHeaderListView of the agenda view
|
||||
*/
|
||||
public class AgendaHeaderView extends LinearLayout {
|
||||
|
||||
public static AgendaHeaderView inflate(ViewGroup parent) {
|
||||
return (AgendaHeaderView) LayoutInflater.from(parent.getContext()).inflate(R.layout.view_agenda_header, parent, false);
|
||||
}
|
||||
|
||||
// region Constructors
|
||||
|
||||
public AgendaHeaderView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AgendaHeaderView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public AgendaHeaderView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Public methods
|
||||
|
||||
public void setDay(Calendar day, int currentDayTextColor, boolean showBadge) {
|
||||
TextView txtDayOfMonth = (TextView) findViewById(R.id.view_agenda_day_of_month);
|
||||
TextView txtDayOfWeek = (TextView) findViewById(R.id.view_agenda_day_of_week);
|
||||
TextView txtDay = (TextView) findViewById(R.id.view_agenda_day_text);
|
||||
View circleView = findViewById(R.id.view_day_circle_selected);
|
||||
|
||||
Calendar today = CalendarManager.getInstance().getToday();
|
||||
|
||||
SimpleDateFormat dayWeekFormatter = new SimpleDateFormat(getContext().getString(R.string.day_name_format), CalendarManager.getInstance().getLocale());
|
||||
SimpleDateFormat dayWeekLongFormatter = new SimpleDateFormat("EEEE", CalendarManager.getInstance().getLocale());
|
||||
|
||||
txtDayOfMonth.setTextColor(getResources().getColor(R.color.calendar_text_default));
|
||||
txtDayOfWeek.setTextColor(getResources().getColor(R.color.calendar_text_default));
|
||||
|
||||
if (DateHelper.sameDate(day, today)) {
|
||||
txtDayOfMonth.setTextColor(currentDayTextColor);
|
||||
circleView.setVisibility(VISIBLE);
|
||||
GradientDrawable drawable = (GradientDrawable) circleView.getBackground();
|
||||
drawable.setStroke((int) (2 * Resources.getSystem().getDisplayMetrics().density), currentDayTextColor);
|
||||
} else if (showBadge) {
|
||||
circleView.setVisibility(VISIBLE);
|
||||
GradientDrawable drawable = (GradientDrawable) circleView.getBackground();
|
||||
drawable.setStroke((int) (2 * Resources.getSystem().getDisplayMetrics().density), 0xffff0000);
|
||||
}
|
||||
else {
|
||||
circleView.setVisibility(INVISIBLE);
|
||||
}
|
||||
|
||||
txtDayOfMonth.setText(String.valueOf(day.get(Calendar.DAY_OF_MONTH)));
|
||||
txtDayOfWeek.setText(dayWeekFormatter.format(day.getTime()));
|
||||
//txtDay.setText(dayWeekLongFormatter.format(day.getTime()));
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.agenda;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.CalendarManager;
|
||||
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
|
||||
import com.github.tibolte.agendacalendarview.utils.DateHelper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import se.emilsjolander.stickylistheaders.StickyListHeadersListView;
|
||||
|
||||
/**
|
||||
* StickyListHeadersListView to scroll chronologically through events.
|
||||
*/
|
||||
public class AgendaListView extends StickyListHeadersListView {
|
||||
|
||||
// region Constructors
|
||||
|
||||
public AgendaListView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AgendaListView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public AgendaListView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Public methods
|
||||
|
||||
public void scrollToCurrentDate(Calendar today) {
|
||||
List<CalendarEvent> events = CalendarManager.getInstance().getEvents();
|
||||
|
||||
int toIndex = 0;
|
||||
for (int i = 0; i < events.size(); i++) {
|
||||
if (DateHelper.sameDate(today, events.get(i).getInstanceDay())) {
|
||||
toIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
final int finalToIndex = toIndex;
|
||||
post(()->setSelection(finalToIndex));
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.agenda;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.CalendarManager;
|
||||
import com.github.tibolte.agendacalendarview.R;
|
||||
import com.github.tibolte.agendacalendarview.utils.BusProvider;
|
||||
import com.github.tibolte.agendacalendarview.utils.Events;
|
||||
|
||||
public class AgendaView extends FrameLayout {
|
||||
|
||||
private AgendaListView mAgendaListView;
|
||||
private View mShadowView;
|
||||
|
||||
// region Constructors
|
||||
|
||||
public AgendaView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AgendaView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
inflater.inflate(R.layout.view_agenda, this, true);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Class - View
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
||||
mAgendaListView = (AgendaListView) findViewById(R.id.agenda_listview);
|
||||
mShadowView = findViewById(R.id.view_shadow);
|
||||
|
||||
BusProvider.getInstance().toObserverable()
|
||||
.subscribe(event -> {
|
||||
if (event instanceof Events.DayClickedEvent) {
|
||||
Events.DayClickedEvent clickedEvent = (Events.DayClickedEvent) event;
|
||||
getAgendaListView().scrollToCurrentDate(clickedEvent.getCalendar());
|
||||
} else if (event instanceof Events.CalendarScrolledEvent) {
|
||||
int offset = (int) (3 * getResources().getDimension(R.dimen.day_cell_height));
|
||||
translateList(offset);
|
||||
} else if (event instanceof Events.EventsFetched) {
|
||||
if (getAgendaListView().getAdapter() != null)
|
||||
((AgendaAdapter) getAgendaListView().getAdapter()).updateEvents(CalendarManager.getInstance().getEvents());
|
||||
|
||||
getViewTreeObserver().addOnGlobalLayoutListener(
|
||||
new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
if (getWidth() != 0 && getHeight() != 0) {
|
||||
// display only two visible rows on the calendar view
|
||||
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) getLayoutParams();
|
||||
int height = getHeight();
|
||||
int margin = (int) (getContext().getResources().getDimension(R.dimen.calendar_header_height) + 2 * getContext().getResources().getDimension(R.dimen.day_cell_height));
|
||||
layoutParams.height = height;
|
||||
layoutParams.setMargins(0, margin, 0, 0);
|
||||
setLayoutParams(layoutParams);
|
||||
|
||||
getAgendaListView().scrollToCurrentDate(CalendarManager.getInstance().getToday());
|
||||
|
||||
getViewTreeObserver().removeGlobalOnLayoutListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
} else if (event instanceof Events.ForecastFetched) {
|
||||
((AgendaAdapter) getAgendaListView().getAdapter()).updateEvents(CalendarManager.getInstance().getEvents());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||
int eventaction = event.getAction();
|
||||
|
||||
switch (eventaction) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
// if the user touches the listView, we put it back to the top
|
||||
translateList(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return super.dispatchTouchEvent(event);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Public methods
|
||||
|
||||
public AgendaListView getAgendaListView() {
|
||||
return mAgendaListView;
|
||||
}
|
||||
|
||||
public void translateList(int targetY) {
|
||||
if (targetY != getTranslationY()) {
|
||||
ObjectAnimator mover = ObjectAnimator.ofFloat(this, "translationY", targetY);
|
||||
mover.setDuration(150);
|
||||
mover.addListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
//mShadowView.setVisibility(GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (targetY == 0) {
|
||||
BusProvider.getInstance().send(new Events.AgendaListViewTouchedEvent());
|
||||
}
|
||||
//mShadowView.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
|
||||
}
|
||||
});
|
||||
mover.start();
|
||||
}
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,279 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.calendar;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.CalendarManager;
|
||||
import com.github.tibolte.agendacalendarview.R;
|
||||
import com.github.tibolte.agendacalendarview.calendar.weekslist.WeekListView;
|
||||
import com.github.tibolte.agendacalendarview.calendar.weekslist.WeeksAdapter;
|
||||
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
|
||||
import com.github.tibolte.agendacalendarview.models.IDayItem;
|
||||
import com.github.tibolte.agendacalendarview.models.IWeekItem;
|
||||
import com.github.tibolte.agendacalendarview.utils.BusProvider;
|
||||
import com.github.tibolte.agendacalendarview.utils.DateHelper;
|
||||
import com.github.tibolte.agendacalendarview.utils.Events;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* The calendar view is a freely scrolling view that allows the user to browse between days of the
|
||||
* year.
|
||||
*/
|
||||
public class CalendarView extends LinearLayout {
|
||||
|
||||
private static final String LOG_TAG = CalendarView.class.getSimpleName();
|
||||
|
||||
/**
|
||||
* Top of the calendar view layout, the week days list
|
||||
*/
|
||||
private LinearLayout mDayNamesHeader;
|
||||
/**
|
||||
* Part of the calendar view layout always visible, the weeks list
|
||||
*/
|
||||
private WeekListView mListViewWeeks;
|
||||
/**
|
||||
* The adapter for the weeks list
|
||||
*/
|
||||
private WeeksAdapter mWeeksAdapter;
|
||||
/**
|
||||
* The current highlighted day in blue
|
||||
*/
|
||||
private IDayItem mSelectedDay;
|
||||
/**
|
||||
* The current row displayed at top of the list
|
||||
*/
|
||||
private int mCurrentListPosition;
|
||||
|
||||
// region Constructors
|
||||
|
||||
public CalendarView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public CalendarView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
inflater.inflate(R.layout.view_calendar, this, true);
|
||||
|
||||
setOrientation(VERTICAL);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
public IDayItem getSelectedDay() {
|
||||
return mSelectedDay;
|
||||
}
|
||||
|
||||
public void setSelectedDay(IDayItem mSelectedDay) {
|
||||
this.mSelectedDay = mSelectedDay;
|
||||
}
|
||||
|
||||
public WeekListView getListViewWeeks() {
|
||||
return mListViewWeeks;
|
||||
}
|
||||
|
||||
// region Class - View
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
||||
mDayNamesHeader = (LinearLayout) findViewById(R.id.cal_day_names);
|
||||
mListViewWeeks = (WeekListView) findViewById(R.id.list_week);
|
||||
mListViewWeeks.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
mListViewWeeks.setHasFixedSize(true);
|
||||
mListViewWeeks.setItemAnimator(null);
|
||||
mListViewWeeks.setSnapEnabled(true);
|
||||
|
||||
// display only two visible rows on the calendar view
|
||||
getViewTreeObserver().addOnGlobalLayoutListener(
|
||||
new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
if (getWidth() != 0 && getHeight() != 0) {
|
||||
collapseCalendarView();
|
||||
getViewTreeObserver().removeGlobalOnLayoutListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
|
||||
BusProvider.getInstance().toObserverable()
|
||||
.subscribe(event -> {
|
||||
if (event instanceof Events.CalendarScrolledEvent) {
|
||||
expandCalendarView();
|
||||
} else if (event instanceof Events.AgendaListViewTouchedEvent) {
|
||||
collapseCalendarView();
|
||||
} else if (event instanceof Events.DayClickedEvent) {
|
||||
Events.DayClickedEvent clickedEvent = (Events.DayClickedEvent) event;
|
||||
updateSelectedDay(clickedEvent.getCalendar(), clickedEvent.getDay());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Public methods
|
||||
|
||||
public void init(CalendarManager calendarManager, int dayTextColor, int currentDayTextColor, int pastDayTextColor, List<CalendarEvent> eventList) {
|
||||
Calendar today = calendarManager.getToday();
|
||||
Locale locale = calendarManager.getLocale();
|
||||
SimpleDateFormat weekDayFormatter = calendarManager.getWeekdayFormatter();
|
||||
List<IWeekItem> weeks = calendarManager.getWeeks();
|
||||
|
||||
setUpHeader(today, weekDayFormatter, locale);
|
||||
setUpAdapter(today, weeks, dayTextColor, currentDayTextColor, pastDayTextColor, eventList);
|
||||
scrollToDate(today, weeks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the Agenda list view changes section.
|
||||
*
|
||||
* @param calendarEvent The event for the selected position in the agenda listview.
|
||||
*/
|
||||
public void scrollToDate(final CalendarEvent calendarEvent) {
|
||||
mListViewWeeks.post(()->scrollToPosition(updateSelectedDay(calendarEvent.getInstanceDay(), calendarEvent.getDayReference())));
|
||||
}
|
||||
|
||||
public void scrollToDate(Calendar today, List<IWeekItem> weeks) {
|
||||
Integer currentWeekIndex = null;
|
||||
|
||||
for (int c = 0; c < weeks.size(); c++) {
|
||||
if (DateHelper.sameWeek(today, weeks.get(c))) {
|
||||
currentWeekIndex = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentWeekIndex != null) {
|
||||
final Integer finalCurrentWeekIndex = currentWeekIndex;
|
||||
mListViewWeeks.post(() -> scrollToPosition(finalCurrentWeekIndex));
|
||||
}
|
||||
}
|
||||
|
||||
public void setBackgroundColor(int color) {
|
||||
mListViewWeeks.setBackgroundColor(color);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Private methods
|
||||
|
||||
private void scrollToPosition(int targetPosition) {
|
||||
LinearLayoutManager layoutManager = ((LinearLayoutManager) mListViewWeeks.getLayoutManager());
|
||||
layoutManager.scrollToPosition(targetPosition);
|
||||
}
|
||||
|
||||
private void updateItemAtPosition(int position) {
|
||||
WeeksAdapter weeksAdapter = (WeeksAdapter) mListViewWeeks.getAdapter();
|
||||
weeksAdapter.notifyItemChanged(position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new adapter if necessary and sets up its parameters.
|
||||
*/
|
||||
private void setUpAdapter(Calendar today, List<IWeekItem> weeks, int dayTextColor, int currentDayTextColor, int pastDayTextColor, List<CalendarEvent> events) {
|
||||
BusProvider.getInstance().toObserverable()
|
||||
.subscribe(event -> {
|
||||
if (event instanceof Events.EventsFetched) {
|
||||
//Log.d("CalendarView", "events size "+events.size());
|
||||
if (mWeeksAdapter == null) {
|
||||
//Log.d(LOG_TAG, "Setting adapter with today's calendar: " + today.toString());
|
||||
mWeeksAdapter = new WeeksAdapter(getContext(), today, dayTextColor, currentDayTextColor, pastDayTextColor, events);
|
||||
mListViewWeeks.setAdapter(mWeeksAdapter);
|
||||
}
|
||||
mWeeksAdapter.updateWeeksItems(weeks);
|
||||
}});
|
||||
|
||||
}
|
||||
|
||||
private void setUpHeader(Calendar today, SimpleDateFormat weekDayFormatter, Locale locale) {
|
||||
int daysPerWeek = 7;
|
||||
String[] dayLabels = new String[daysPerWeek];
|
||||
Calendar cal = Calendar.getInstance(CalendarManager.getInstance(getContext()).getLocale());
|
||||
cal.setTime(today.getTime());
|
||||
int firstDayOfWeek = cal.getFirstDayOfWeek();
|
||||
for (int count = 0; count < 7; count++) {
|
||||
cal.set(Calendar.DAY_OF_WEEK, firstDayOfWeek + count);
|
||||
if (locale.getLanguage().equals("en")) {
|
||||
dayLabels[count] = weekDayFormatter.format(cal.getTime()).toUpperCase(locale);
|
||||
} else {
|
||||
dayLabels[count] = weekDayFormatter.format(cal.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < mDayNamesHeader.getChildCount(); i++) {
|
||||
TextView txtDay = (TextView) mDayNamesHeader.getChildAt(i);
|
||||
txtDay.setText(dayLabels[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void expandCalendarView() {
|
||||
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) getLayoutParams();
|
||||
layoutParams.height = (int) (getResources().getDimension(R.dimen.calendar_header_height) + 5 * getResources().getDimension(R.dimen.day_cell_height));
|
||||
setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
private void collapseCalendarView() {
|
||||
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) getLayoutParams();
|
||||
layoutParams.height = (int) (getResources().getDimension(R.dimen.calendar_header_height) + 2 * getResources().getDimension(R.dimen.day_cell_height));
|
||||
setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a selected cell day item.
|
||||
*
|
||||
* @param calendar The Calendar instance of the day selected.
|
||||
* @param dayItem The DayItem information held by the cell item.
|
||||
* @return The selected row of the weeks list, to be updated.
|
||||
*/
|
||||
private int updateSelectedDay(Calendar calendar, IDayItem dayItem) {
|
||||
Integer currentWeekIndex = null;
|
||||
|
||||
// update highlighted/selected day
|
||||
if (!dayItem.equals(getSelectedDay())) {
|
||||
dayItem.setSelected(true);
|
||||
if (getSelectedDay() != null) {
|
||||
getSelectedDay().setSelected(false);
|
||||
}
|
||||
setSelectedDay(dayItem);
|
||||
}
|
||||
|
||||
for (int c = 0; c < CalendarManager.getInstance().getWeeks().size(); c++) {
|
||||
if (DateHelper.sameWeek(calendar, CalendarManager.getInstance().getWeeks().get(c))) {
|
||||
currentWeekIndex = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentWeekIndex != null) {
|
||||
// highlighted day has changed, update the rows concerned
|
||||
if (currentWeekIndex != mCurrentListPosition) {
|
||||
updateItemAtPosition(mCurrentListPosition);
|
||||
}
|
||||
mCurrentListPosition = currentWeekIndex;
|
||||
updateItemAtPosition(currentWeekIndex);
|
||||
}
|
||||
|
||||
return mCurrentListPosition;
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,144 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.calendar.weekslist;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.utils.BusProvider;
|
||||
import com.github.tibolte.agendacalendarview.utils.Events;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
public class WeekListView extends RecyclerView {
|
||||
private boolean mUserScrolling = false;
|
||||
private boolean mScrolling = false;
|
||||
|
||||
// region Constructors
|
||||
|
||||
public WeekListView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public WeekListView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public WeekListView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Public methods
|
||||
|
||||
/**
|
||||
* Enable snapping behaviour for this recyclerView
|
||||
*
|
||||
* @param enabled enable or disable the snapping behaviour
|
||||
*/
|
||||
public void setSnapEnabled(boolean enabled) {
|
||||
if (enabled) {
|
||||
addOnScrollListener(mScrollListener);
|
||||
} else {
|
||||
removeOnScrollListener(mScrollListener);
|
||||
}
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Private methods
|
||||
|
||||
private OnScrollListener mScrollListener = new OnScrollListener() {
|
||||
@Override
|
||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
final WeeksAdapter weeksAdapter = (WeeksAdapter) getAdapter();
|
||||
|
||||
switch (newState) {
|
||||
case SCROLL_STATE_IDLE:
|
||||
if (mUserScrolling) {
|
||||
scrollToView(getCenterView());
|
||||
postDelayed(() -> weeksAdapter.setDragging(false), 700); // Wait for recyclerView to settle
|
||||
}
|
||||
|
||||
mUserScrolling = false;
|
||||
mScrolling = false;
|
||||
break;
|
||||
// If scroll is caused by a touch (scroll touch, not any touch)
|
||||
case SCROLL_STATE_DRAGGING:
|
||||
BusProvider.getInstance().send(new Events.CalendarScrolledEvent());
|
||||
// If scroll was initiated already, this is not a user scrolling, but probably a tap, else set userScrolling
|
||||
if (!mScrolling) {
|
||||
mUserScrolling = true;
|
||||
}
|
||||
weeksAdapter.setDragging(true);
|
||||
break;
|
||||
case SCROLL_STATE_SETTLING:
|
||||
// The user's finger is not touching the list anymore, no need
|
||||
// for any alpha animation then
|
||||
weeksAdapter.setAlphaSet(true);
|
||||
mScrolling = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private View getChildClosestToPosition(int y) {
|
||||
if (getChildCount() <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int itemHeight = getChildAt(0).getMeasuredHeight();
|
||||
|
||||
int closestY = 9999;
|
||||
View closestChild = null;
|
||||
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
View child = getChildAt(i);
|
||||
|
||||
int childCenterY = ((int) child.getY() + (itemHeight / 2));
|
||||
int yDistance = childCenterY - y;
|
||||
|
||||
// If child center is closer than previous closest, set it as closest
|
||||
if (Math.abs(yDistance) < Math.abs(closestY)) {
|
||||
closestY = yDistance;
|
||||
closestChild = child;
|
||||
}
|
||||
}
|
||||
|
||||
return closestChild;
|
||||
}
|
||||
|
||||
private View getCenterView() {
|
||||
return getChildClosestToPosition(getMeasuredHeight() / 2);
|
||||
}
|
||||
|
||||
private void scrollToView(View child) {
|
||||
if (child == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
stopScroll();
|
||||
|
||||
int scrollDistance = getScrollDistance(child);
|
||||
|
||||
if (scrollDistance != 0) {
|
||||
smoothScrollBy(0, scrollDistance);
|
||||
}
|
||||
}
|
||||
|
||||
private int getScrollDistance(View child) {
|
||||
int itemHeight = getChildAt(0).getMeasuredHeight();
|
||||
int centerY = getMeasuredHeight() / 2;
|
||||
|
||||
int childCenterY = ((int) child.getY() + (itemHeight / 2));
|
||||
|
||||
return childCenterY - centerY;
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,321 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.calendar.weekslist;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.CalendarManager;
|
||||
import com.github.tibolte.agendacalendarview.R;
|
||||
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
|
||||
import com.github.tibolte.agendacalendarview.models.IDayItem;
|
||||
import com.github.tibolte.agendacalendarview.models.IWeekItem;
|
||||
import com.github.tibolte.agendacalendarview.utils.BusProvider;
|
||||
import com.github.tibolte.agendacalendarview.utils.DateHelper;
|
||||
import com.github.tibolte.agendacalendarview.utils.Events;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
public class WeeksAdapter extends RecyclerView.Adapter<WeeksAdapter.WeekViewHolder> {
|
||||
|
||||
public static final long FADE_DURATION = 250;
|
||||
|
||||
private Context mContext;
|
||||
private Calendar mToday;
|
||||
private List<IWeekItem> mWeeksList = new ArrayList<>();
|
||||
private List<CalendarEvent> mEventList = new ArrayList<>();
|
||||
private boolean mDragging;
|
||||
private boolean mAlphaSet;
|
||||
private int mDayTextColor, mPastDayTextColor, mCurrentDayColor;
|
||||
|
||||
// region Constructor
|
||||
|
||||
public WeeksAdapter(Context context, Calendar today, int dayTextColor, int currentDayTextColor, int pastDayTextColor, List<CalendarEvent> events) {
|
||||
this.mToday = today;
|
||||
this.mContext = context;
|
||||
this.mDayTextColor = dayTextColor;
|
||||
this.mCurrentDayColor = currentDayTextColor;
|
||||
this.mPastDayTextColor = pastDayTextColor;
|
||||
this.mEventList = events;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
public void updateWeeksItems(List<IWeekItem> weekItems) {
|
||||
this.mWeeksList.clear();
|
||||
this.mWeeksList.addAll(weekItems);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
// region Getters/setters
|
||||
|
||||
public List<IWeekItem> getWeeksList() {
|
||||
return mWeeksList;
|
||||
}
|
||||
|
||||
public boolean isDragging() {
|
||||
return mDragging;
|
||||
}
|
||||
|
||||
public void setDragging(boolean dragging) {
|
||||
if (dragging != this.mDragging) {
|
||||
this.mDragging = dragging;
|
||||
notifyItemRangeChanged(0, mWeeksList.size());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAlphaSet() {
|
||||
return mAlphaSet;
|
||||
}
|
||||
|
||||
public void setAlphaSet(boolean alphaSet) {
|
||||
mAlphaSet = alphaSet;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region RecyclerView.Adapter<WeeksAdapter.WeekViewHolder> methods
|
||||
|
||||
@Override
|
||||
public WeekViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_week, parent, false);
|
||||
return new WeekViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(WeekViewHolder weekViewHolder, int position) {
|
||||
IWeekItem weekItem = mWeeksList.get(position);
|
||||
weekViewHolder.bindWeek(weekItem, mToday);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mWeeksList.size();
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Class - WeekViewHolder
|
||||
|
||||
public class WeekViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
/**
|
||||
* List of layout containers for each day
|
||||
*/
|
||||
private List<LinearLayout> mCells;
|
||||
private TextView mTxtMonth;
|
||||
private FrameLayout mMonthBackground;
|
||||
|
||||
public WeekViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mTxtMonth = (TextView) itemView.findViewById(R.id.month_label);
|
||||
mMonthBackground = (FrameLayout) itemView.findViewById(R.id.month_background);
|
||||
LinearLayout daysContainer = (LinearLayout) itemView.findViewById(R.id.week_days_container);
|
||||
setUpChildren(daysContainer);
|
||||
}
|
||||
|
||||
public void bindWeek(IWeekItem weekItem, Calendar today) {
|
||||
setUpMonthOverlay();
|
||||
|
||||
List<IDayItem> dayItems = weekItem.getDayItems();
|
||||
|
||||
for (int c = 0; c < dayItems.size(); c++) {
|
||||
final IDayItem dayItem = dayItems.get(c);
|
||||
LinearLayout cellItem = mCells.get(c);
|
||||
TextView txtDay = (TextView) cellItem.findViewById(R.id.view_day_day_label);
|
||||
TextView txtMonth = (TextView) cellItem.findViewById(R.id.view_day_month_label);
|
||||
View circleView = cellItem.findViewById(R.id.view_day_circle_selected);
|
||||
View eventIndicator1 = cellItem.findViewById(R.id.view_day_event_indicator1);
|
||||
View eventIndicator2 = cellItem.findViewById(R.id.view_day_event_indicator2);
|
||||
View eventIndicator3 = cellItem.findViewById(R.id.view_day_event_indicator3);
|
||||
cellItem.setOnClickListener(v->BusProvider.getInstance().send(new Events.DayClickedEvent(dayItem)));
|
||||
|
||||
eventIndicator1.setVisibility(View.INVISIBLE);
|
||||
eventIndicator2.setVisibility(View.INVISIBLE);
|
||||
eventIndicator3.setVisibility(View.INVISIBLE);
|
||||
|
||||
Calendar dayItemCalendar = Calendar.getInstance();
|
||||
dayItemCalendar.setTime(dayItem.getDate());
|
||||
int eventCount = 0;
|
||||
for (CalendarEvent event: mEventList) {
|
||||
if (event.getStartTime().get(Calendar.YEAR) == dayItemCalendar.get(Calendar.YEAR)
|
||||
&& event.getStartTime().get(Calendar.MONTH) == dayItemCalendar.get(Calendar.MONTH)
|
||||
&& event.getStartTime().get(Calendar.DAY_OF_MONTH) == dayItemCalendar.get(Calendar.DAY_OF_MONTH)) {
|
||||
eventCount++;
|
||||
if (eventCount == 1) {
|
||||
eventIndicator1.setVisibility(View.VISIBLE);
|
||||
eventIndicator1.getBackground().setColorFilter(new PorterDuffColorFilter(event.getColor(),PorterDuff.Mode.MULTIPLY));
|
||||
}
|
||||
if (eventCount == 2) {
|
||||
eventIndicator2.setVisibility(View.VISIBLE);
|
||||
eventIndicator2.getBackground().setColorFilter(new PorterDuffColorFilter(event.getColor(),PorterDuff.Mode.MULTIPLY));
|
||||
}
|
||||
if (eventCount == 3) {
|
||||
eventIndicator3.setVisibility(View.VISIBLE);
|
||||
eventIndicator3.getBackground().setColorFilter(new PorterDuffColorFilter(event.getColor(),PorterDuff.Mode.MULTIPLY));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Log.d("CalendarView", "Event count for day "+dayItem.getValue()+" is "+eventCount);
|
||||
|
||||
txtMonth.setVisibility(View.GONE);
|
||||
txtDay.setTextColor(mDayTextColor);
|
||||
txtMonth.setTextColor(mDayTextColor);
|
||||
circleView.setVisibility(View.GONE);
|
||||
|
||||
txtDay.setTypeface(null, Typeface.NORMAL);
|
||||
txtMonth.setTypeface(null, Typeface.NORMAL);
|
||||
|
||||
// Display the day
|
||||
txtDay.setText(Integer.toString(dayItem.getValue()));
|
||||
|
||||
// Highlight first day of the month
|
||||
if (dayItem.isFirstDayOfTheMonth() && !dayItem.isSelected()) {
|
||||
txtMonth.setVisibility(View.VISIBLE);
|
||||
txtMonth.setText(dayItem.getMonth());
|
||||
txtDay.setTypeface(null, Typeface.BOLD);
|
||||
txtMonth.setTypeface(null, Typeface.BOLD);
|
||||
}
|
||||
|
||||
// Check if this day is in the past
|
||||
if (today.getTime().after(dayItem.getDate()) && !DateHelper.sameDate(today, dayItem.getDate())) {
|
||||
txtDay.setTextColor(mPastDayTextColor);
|
||||
txtMonth.setTextColor(mPastDayTextColor);
|
||||
}
|
||||
|
||||
// Highlight the cell if this day is today
|
||||
if (dayItem.isToday() && !dayItem.isSelected()) {
|
||||
txtDay.setTextColor(mCurrentDayColor);
|
||||
}
|
||||
|
||||
if (dayItem.getShowBadge()) {
|
||||
circleView.setVisibility(View.VISIBLE);
|
||||
GradientDrawable drawable = (GradientDrawable) circleView.getBackground();
|
||||
drawable.setStroke((int) (2 * Resources.getSystem().getDisplayMetrics().density), 0xffff0000);
|
||||
}
|
||||
|
||||
// Show a circle if the day is selected
|
||||
if (dayItem.isSelected()) {
|
||||
txtDay.setTextColor(mDayTextColor);
|
||||
circleView.setVisibility(View.VISIBLE);
|
||||
GradientDrawable drawable = (GradientDrawable) circleView.getBackground();
|
||||
drawable.setStroke((int) (1 * Resources.getSystem().getDisplayMetrics().density), mDayTextColor);
|
||||
}
|
||||
|
||||
// Check if the month label has to be displayed
|
||||
if (dayItem.getValue() == 15) {
|
||||
mTxtMonth.setVisibility(View.VISIBLE);
|
||||
SimpleDateFormat monthDateFormat = new SimpleDateFormat(mContext.getResources().getString(R.string.month_name_format), CalendarManager.getInstance().getLocale());
|
||||
String month = monthDateFormat.format(weekItem.getDate()).toUpperCase();
|
||||
if (today.get(Calendar.YEAR) != weekItem.getYear()) {
|
||||
month = month + String.format(" %d", weekItem.getYear());
|
||||
}
|
||||
mTxtMonth.setText(month);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setUpChildren(LinearLayout daysContainer) {
|
||||
mCells = new ArrayList<>();
|
||||
for (int i = 0; i < daysContainer.getChildCount(); i++) {
|
||||
mCells.add((LinearLayout) daysContainer.getChildAt(i));
|
||||
}
|
||||
}
|
||||
|
||||
private void setUpMonthOverlay() {
|
||||
mTxtMonth.setVisibility(View.GONE);
|
||||
|
||||
if (isDragging()) {
|
||||
AnimatorSet animatorSetFadeIn = new AnimatorSet();
|
||||
animatorSetFadeIn.setDuration(FADE_DURATION);
|
||||
ObjectAnimator animatorTxtAlphaIn = ObjectAnimator.ofFloat(mTxtMonth, "alpha", mTxtMonth.getAlpha(), 1f);
|
||||
ObjectAnimator animatorBackgroundAlphaIn = ObjectAnimator.ofFloat(mMonthBackground, "alpha", mMonthBackground.getAlpha(), 1f);
|
||||
animatorSetFadeIn.playTogether(
|
||||
animatorTxtAlphaIn
|
||||
//animatorBackgroundAlphaIn
|
||||
);
|
||||
animatorSetFadeIn.addListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
setAlphaSet(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
|
||||
}
|
||||
});
|
||||
animatorSetFadeIn.start();
|
||||
} else {
|
||||
AnimatorSet animatorSetFadeOut = new AnimatorSet();
|
||||
animatorSetFadeOut.setDuration(FADE_DURATION);
|
||||
ObjectAnimator animatorTxtAlphaOut = ObjectAnimator.ofFloat(mTxtMonth, "alpha", mTxtMonth.getAlpha(), 0f);
|
||||
ObjectAnimator animatorBackgroundAlphaOut = ObjectAnimator.ofFloat(mMonthBackground, "alpha", mMonthBackground.getAlpha(), 0f);
|
||||
animatorSetFadeOut.playTogether(
|
||||
animatorTxtAlphaOut
|
||||
//animatorBackgroundAlphaOut
|
||||
);
|
||||
animatorSetFadeOut.addListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
setAlphaSet(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
|
||||
}
|
||||
});
|
||||
animatorSetFadeOut.start();
|
||||
}
|
||||
|
||||
if (isAlphaSet()) {
|
||||
//mMonthBackground.setAlpha(1f);
|
||||
mTxtMonth.setAlpha(1f);
|
||||
} else {
|
||||
//mMonthBackground.setAlpha(0f);
|
||||
mTxtMonth.setAlpha(0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,345 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.models;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Event model class containing the information to be displayed on the agenda view.
|
||||
*/
|
||||
public class BaseCalendarEvent implements CalendarEvent {
|
||||
|
||||
/**
|
||||
* Id of the event.
|
||||
*/
|
||||
private long mId;
|
||||
/**
|
||||
* Color to be displayed in the agenda view.
|
||||
*/
|
||||
private int mColor;
|
||||
/**
|
||||
* Text color displayed on the background color
|
||||
*/
|
||||
private int mTextColor;
|
||||
/**
|
||||
* Title of the event.
|
||||
*/
|
||||
private String mTitle;
|
||||
/**
|
||||
* Description of the event.
|
||||
*/
|
||||
private String mDescription;
|
||||
/**
|
||||
* Where the event takes place.
|
||||
*/
|
||||
private String mLocation;
|
||||
/**
|
||||
* Calendar instance helping sorting the events per section in the agenda view.
|
||||
*/
|
||||
private Calendar mInstanceDay;
|
||||
/**
|
||||
* Start time of the event.
|
||||
*/
|
||||
private Calendar mStartTime;
|
||||
/**
|
||||
* End time of the event.
|
||||
*/
|
||||
private Calendar mEndTime;
|
||||
/**
|
||||
* Indicates if the event lasts all day.
|
||||
*/
|
||||
private boolean mAllDay;
|
||||
/**
|
||||
* Tells if this BaseCalendarEvent instance is used as a placeholder in the agenda view, if there's
|
||||
* no event for that day.
|
||||
*/
|
||||
private boolean mPlaceHolder;
|
||||
/**
|
||||
* Tells if this BaseCalendarEvent instance is used as a forecast information holder in the agenda
|
||||
* view.
|
||||
*/
|
||||
private boolean mWeather;
|
||||
/**
|
||||
* Duration of the event.
|
||||
*/
|
||||
private String mDuration;
|
||||
/**
|
||||
* References to a DayItem instance for that event, used to link interaction between the
|
||||
* calendar view and the agenda view.
|
||||
*/
|
||||
private IDayItem mDayReference;
|
||||
/**
|
||||
* References to a WeekItem instance for that event, used to link interaction between the
|
||||
* calendar view and the agenda view.
|
||||
*/
|
||||
private IWeekItem mWeekReference;
|
||||
/**
|
||||
* Weather icon string returned by the Dark Sky API.
|
||||
*/
|
||||
private String mWeatherIcon;
|
||||
/**
|
||||
* Temperature value returned by the Dark Sky API.
|
||||
*/
|
||||
private double mTemperature;
|
||||
|
||||
private boolean mShowBadge;
|
||||
|
||||
// region Constructor
|
||||
|
||||
/**
|
||||
* Initializes the event
|
||||
*
|
||||
* @param id The id of the event.
|
||||
* @param color The color of the event.
|
||||
* @param textColor The color of the event description text.
|
||||
* @param title The title of the event.
|
||||
* @param description The description of the event.
|
||||
* @param location The location of the event.
|
||||
* @param dateStart The start date of the event.
|
||||
* @param dateEnd The end date of the event.
|
||||
* @param allDay Int that can be equal to 0 or 1.
|
||||
* @param duration The duration of the event in RFC2445 format.
|
||||
*/
|
||||
public BaseCalendarEvent(long id, int color, int textColor, String title, String description, String location, long dateStart, long dateEnd, int allDay, String duration) {
|
||||
this.mId = id;
|
||||
this.mColor = color;
|
||||
this.mTextColor = textColor;
|
||||
this.mAllDay = (allDay == 1);
|
||||
this.mDuration = duration;
|
||||
this.mTitle = title;
|
||||
this.mDescription = description;
|
||||
this.mLocation = location;
|
||||
|
||||
this.mStartTime = Calendar.getInstance();
|
||||
this.mStartTime.setTimeInMillis(dateStart);
|
||||
this.mEndTime = Calendar.getInstance();
|
||||
this.mEndTime.setTimeInMillis(dateEnd);
|
||||
}
|
||||
|
||||
public BaseCalendarEvent() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the event
|
||||
* @param title The title of the event.
|
||||
* @param description The description of the event.
|
||||
* @param location The location of the event.
|
||||
* @param color The color of the event (for display in the app).
|
||||
* @param textColor The color of the event description text.
|
||||
* @param startTime The start time of the event.
|
||||
* @param endTime The end time of the event.
|
||||
* @param allDay Indicates if the event lasts the whole day.
|
||||
*/
|
||||
public BaseCalendarEvent(String title, String description, String location, int color, int textColor, Calendar startTime, Calendar endTime, boolean allDay) {
|
||||
this.mTitle = title;
|
||||
this.mDescription = description;
|
||||
this.mLocation = location;
|
||||
this.mColor = color;
|
||||
this.mTextColor = textColor;
|
||||
this.mStartTime = startTime;
|
||||
this.mEndTime = endTime;
|
||||
this.mAllDay = allDay;
|
||||
}
|
||||
|
||||
public BaseCalendarEvent(String title, String description, String location, int color, int textColor, Calendar startTime, Calendar endTime, boolean allDay, long id, boolean showBadge) {
|
||||
this.mTitle = title;
|
||||
this.mDescription = description;
|
||||
this.mLocation = location;
|
||||
this.mColor = color;
|
||||
this.mTextColor = textColor;
|
||||
this.mStartTime = startTime;
|
||||
this.mEndTime = endTime;
|
||||
this.mAllDay = allDay;
|
||||
this.mId = id;
|
||||
this.mShowBadge = showBadge;
|
||||
}
|
||||
|
||||
public BaseCalendarEvent(BaseCalendarEvent calendarEvent) {
|
||||
this.mId = calendarEvent.getId();
|
||||
this.mColor = calendarEvent.getColor();
|
||||
this.mTextColor = calendarEvent.getTextColor();
|
||||
this.mAllDay = calendarEvent.isAllDay();
|
||||
this.mDuration = calendarEvent.getDuration();
|
||||
this.mTitle = calendarEvent.getTitle();
|
||||
this.mDescription = calendarEvent.getDescription();
|
||||
this.mLocation = calendarEvent.getLocation();
|
||||
this.mStartTime = calendarEvent.getStartTime();
|
||||
this.mEndTime = calendarEvent.getEndTime();
|
||||
this.mShowBadge = calendarEvent.getShowBadge();
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Getters/Setters
|
||||
|
||||
public int getColor() {
|
||||
return mColor;
|
||||
}
|
||||
|
||||
public void setColor(int mColor) {
|
||||
this.mColor = mColor;
|
||||
}
|
||||
|
||||
public int getTextColor() {
|
||||
return mTextColor;
|
||||
}
|
||||
|
||||
public void setTextColor(int mTextColor) {
|
||||
this.mTextColor = mTextColor;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return mDescription;
|
||||
}
|
||||
|
||||
public boolean isAllDay() {
|
||||
return mAllDay;
|
||||
}
|
||||
|
||||
public void setAllDay(boolean allDay) {
|
||||
this.mAllDay = allDay;
|
||||
}
|
||||
|
||||
public void setDescription(String mDescription) {
|
||||
this.mDescription = mDescription;
|
||||
}
|
||||
|
||||
public Calendar getInstanceDay() {
|
||||
return mInstanceDay;
|
||||
}
|
||||
|
||||
public void setInstanceDay(Calendar mInstanceDay) {
|
||||
this.mInstanceDay = mInstanceDay;
|
||||
this.mInstanceDay.set(Calendar.HOUR, 0);
|
||||
this.mInstanceDay.set(Calendar.MINUTE, 0);
|
||||
this.mInstanceDay.set(Calendar.SECOND, 0);
|
||||
this.mInstanceDay.set(Calendar.MILLISECOND, 0);
|
||||
this.mInstanceDay.set(Calendar.AM_PM, 0);
|
||||
}
|
||||
|
||||
public Calendar getEndTime() {
|
||||
return mEndTime;
|
||||
}
|
||||
|
||||
public void setEndTime(Calendar mEndTime) {
|
||||
this.mEndTime = mEndTime;
|
||||
}
|
||||
public void setPlaceholder(boolean placeholder) {
|
||||
mPlaceHolder = placeholder;
|
||||
}
|
||||
public boolean isPlaceholder() {
|
||||
return mPlaceHolder;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return mId;
|
||||
}
|
||||
|
||||
public void setId(long mId) {
|
||||
this.mId = mId;
|
||||
}
|
||||
|
||||
public boolean getShowBadge() {
|
||||
return mShowBadge;
|
||||
}
|
||||
|
||||
public void setShowBadge(boolean mShowBadge) {
|
||||
this.mShowBadge = mShowBadge;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return mLocation;
|
||||
}
|
||||
|
||||
public void setLocation(String mLocation) {
|
||||
this.mLocation = mLocation;
|
||||
}
|
||||
|
||||
public Calendar getStartTime() {
|
||||
return mStartTime;
|
||||
}
|
||||
|
||||
public void setStartTime(Calendar mStartTime) {
|
||||
this.mStartTime = mStartTime;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return mTitle;
|
||||
}
|
||||
|
||||
public void setTitle(String mTitle) {
|
||||
this.mTitle = mTitle;
|
||||
}
|
||||
|
||||
public String getDuration() {
|
||||
return mDuration;
|
||||
}
|
||||
|
||||
public void setDuration(String duration) {
|
||||
this.mDuration = duration;
|
||||
}
|
||||
|
||||
public boolean isPlaceHolder() {
|
||||
return mPlaceHolder;
|
||||
}
|
||||
|
||||
public void setPlaceHolder(boolean mPlaceHolder) {
|
||||
this.mPlaceHolder = mPlaceHolder;
|
||||
}
|
||||
|
||||
public boolean isWeather() {
|
||||
return mWeather;
|
||||
}
|
||||
|
||||
public void setWeather(boolean mWeather) {
|
||||
this.mWeather = mWeather;
|
||||
}
|
||||
|
||||
public IDayItem getDayReference() {
|
||||
return mDayReference;
|
||||
}
|
||||
|
||||
public void setDayReference(IDayItem mDayReference) {
|
||||
this.mDayReference = mDayReference;
|
||||
}
|
||||
|
||||
public IWeekItem getWeekReference() {
|
||||
return mWeekReference;
|
||||
}
|
||||
|
||||
public void setWeekReference(IWeekItem mWeekReference) {
|
||||
this.mWeekReference = mWeekReference;
|
||||
}
|
||||
|
||||
public String getWeatherIcon() {
|
||||
return mWeatherIcon;
|
||||
}
|
||||
|
||||
public void setWeatherIcon(String mWeatherIcon) {
|
||||
this.mWeatherIcon = mWeatherIcon;
|
||||
}
|
||||
|
||||
public double getTemperature() {
|
||||
return mTemperature;
|
||||
}
|
||||
|
||||
public void setTemperature(double mTemperature) {
|
||||
this.mTemperature = mTemperature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CalendarEvent copy() {
|
||||
return new BaseCalendarEvent(this);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BaseCalendarEvent{"
|
||||
+ "title='"
|
||||
+ mTitle
|
||||
+ ", instanceDay= "
|
||||
+ mInstanceDay.getTime()
|
||||
+ "}";
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.models;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
public interface CalendarEvent {
|
||||
|
||||
|
||||
void setPlaceholder(boolean placeholder);
|
||||
|
||||
boolean isPlaceholder();
|
||||
|
||||
public String getLocation();
|
||||
|
||||
public void setLocation(String mLocation);
|
||||
|
||||
long getId();
|
||||
|
||||
void setId(long mId);
|
||||
|
||||
boolean getShowBadge();
|
||||
|
||||
void setShowBadge(boolean mShowBadge);
|
||||
|
||||
int getTextColor();
|
||||
|
||||
void setTextColor(int mTextColor);
|
||||
|
||||
String getDescription();
|
||||
|
||||
void setDescription(String mDescription);
|
||||
|
||||
boolean isAllDay();
|
||||
|
||||
void setAllDay(boolean allDay);
|
||||
|
||||
Calendar getStartTime();
|
||||
|
||||
void setStartTime(Calendar mStartTime);
|
||||
|
||||
Calendar getEndTime();
|
||||
|
||||
void setEndTime(Calendar mEndTime);
|
||||
|
||||
String getTitle();
|
||||
|
||||
void setTitle(String mTitle);
|
||||
|
||||
Calendar getInstanceDay();
|
||||
|
||||
void setInstanceDay(Calendar mInstanceDay);
|
||||
|
||||
IDayItem getDayReference();
|
||||
|
||||
void setDayReference(IDayItem mDayReference);
|
||||
|
||||
IWeekItem getWeekReference();
|
||||
|
||||
void setWeekReference(IWeekItem mWeekReference);
|
||||
|
||||
CalendarEvent copy();
|
||||
|
||||
int getColor();
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.models;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.CalendarManager;
|
||||
import com.github.tibolte.agendacalendarview.utils.DateHelper;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Day model class.
|
||||
*/
|
||||
public class DayItem implements IDayItem {
|
||||
private Date mDate;
|
||||
private int mValue;
|
||||
private int mDayOfTheWeek;
|
||||
private boolean mToday;
|
||||
private boolean mFirstDayOfTheMonth;
|
||||
private boolean mSelected;
|
||||
private String mMonth;
|
||||
private boolean mShowBadge;
|
||||
|
||||
// region Constructor
|
||||
|
||||
public DayItem(Date date, int value, boolean today, String month) {
|
||||
this.mDate = date;
|
||||
this.mValue = value;
|
||||
this.mToday = today;
|
||||
this.mMonth = month;
|
||||
}
|
||||
// only for cleanDay
|
||||
public DayItem() {
|
||||
|
||||
}
|
||||
public DayItem(DayItem original) {
|
||||
|
||||
this.mDate = original.getDate();
|
||||
this.mValue = original.getValue();
|
||||
this.mToday = original.isToday();
|
||||
this.mDayOfTheWeek = original.getDayOftheWeek();
|
||||
this.mFirstDayOfTheMonth = original.isFirstDayOfTheMonth();
|
||||
this.mSelected = original.isSelected();
|
||||
this.mMonth = original.getMonth();
|
||||
this.mShowBadge = original.mShowBadge;
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Getters/Setters
|
||||
|
||||
public Date getDate() {
|
||||
return mDate;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.mDate = date;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return mValue;
|
||||
}
|
||||
|
||||
public void setValue(int value) {
|
||||
this.mValue = value;
|
||||
}
|
||||
|
||||
public boolean isToday() {
|
||||
return mToday;
|
||||
}
|
||||
|
||||
public void setToday(boolean today) {
|
||||
this.mToday = today;
|
||||
}
|
||||
|
||||
public boolean isSelected() {
|
||||
return mSelected;
|
||||
}
|
||||
|
||||
public void setSelected(boolean selected) {
|
||||
this.mSelected = selected;
|
||||
}
|
||||
|
||||
public boolean isFirstDayOfTheMonth() {
|
||||
return mFirstDayOfTheMonth;
|
||||
}
|
||||
|
||||
public void setFirstDayOfTheMonth(boolean firstDayOfTheMonth) {
|
||||
this.mFirstDayOfTheMonth = firstDayOfTheMonth;
|
||||
}
|
||||
|
||||
public String getMonth() {
|
||||
return mMonth;
|
||||
}
|
||||
|
||||
public void setMonth(String month) {
|
||||
this.mMonth = month;
|
||||
}
|
||||
|
||||
public int getDayOftheWeek() {
|
||||
return mDayOfTheWeek;
|
||||
}
|
||||
|
||||
public void setDayOftheWeek(int mDayOftheWeek) {
|
||||
this.mDayOfTheWeek = mDayOftheWeek;
|
||||
}
|
||||
|
||||
public void setShowBadge(boolean showBadge) {
|
||||
this.mShowBadge = showBadge;
|
||||
}
|
||||
|
||||
public boolean getShowBadge() {
|
||||
return this.mShowBadge;
|
||||
}
|
||||
|
||||
// region Public methods
|
||||
|
||||
public void buildDayItemFromCal(Calendar calendar) {
|
||||
Date date = calendar.getTime();
|
||||
this.mDate = date;
|
||||
|
||||
this.mValue = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
this.mToday = DateHelper.sameDate(calendar, CalendarManager.getInstance().getToday());
|
||||
this.mMonth = CalendarManager.getInstance().getMonthHalfNameFormat().format(date);
|
||||
if (this.mValue == 1) {
|
||||
this.mFirstDayOfTheMonth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DayItem{"
|
||||
+ "Date='"
|
||||
+ mDate.toString()
|
||||
+ ", value="
|
||||
+ mValue
|
||||
+ '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDayItem copy() {
|
||||
return new DayItem(this);
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.models;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public interface IDayItem {
|
||||
|
||||
// region Getters/Setters
|
||||
|
||||
Date getDate();
|
||||
|
||||
void setDate(Date date);
|
||||
|
||||
int getValue();
|
||||
|
||||
void setValue(int value);
|
||||
|
||||
boolean isToday();
|
||||
|
||||
void setToday(boolean today);
|
||||
|
||||
boolean isSelected();
|
||||
|
||||
void setSelected(boolean selected);
|
||||
|
||||
boolean isFirstDayOfTheMonth();
|
||||
|
||||
void setFirstDayOfTheMonth(boolean firstDayOfTheMonth);
|
||||
|
||||
String getMonth();
|
||||
|
||||
void setMonth(String month);
|
||||
|
||||
int getDayOftheWeek();
|
||||
|
||||
void setDayOftheWeek(int mDayOftheWeek);
|
||||
|
||||
// endregion
|
||||
|
||||
void buildDayItemFromCal(Calendar calendar);
|
||||
|
||||
String toString();
|
||||
|
||||
IDayItem copy();
|
||||
|
||||
void setShowBadge(boolean showBadge);
|
||||
|
||||
boolean getShowBadge();
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.models;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface IWeekItem {
|
||||
|
||||
|
||||
int getWeekInYear();
|
||||
|
||||
void setWeekInYear(int weekInYear);
|
||||
|
||||
int getYear();
|
||||
|
||||
void setYear(int year);
|
||||
|
||||
int getMonth();
|
||||
|
||||
void setMonth(int month);
|
||||
|
||||
Date getDate();
|
||||
|
||||
void setDate(Date date);
|
||||
|
||||
String getLabel();
|
||||
|
||||
void setLabel(String label);
|
||||
|
||||
List<IDayItem> getDayItems();
|
||||
|
||||
void setDayItems(List<IDayItem> dayItems);
|
||||
|
||||
IWeekItem copy();
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.models;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Week model class.
|
||||
*/
|
||||
public class WeekItem implements IWeekItem {
|
||||
private int mWeekInYear;
|
||||
private int mYear;
|
||||
private int mMonth;
|
||||
private Date mDate;
|
||||
private String mLabel;
|
||||
private List<IDayItem> mDayItems;
|
||||
|
||||
// region Constructor
|
||||
|
||||
public WeekItem(int weekInYear, int year, Date date, String label, int month) {
|
||||
this.mWeekInYear = weekInYear;
|
||||
this.mYear = year;
|
||||
this.mDate = date;
|
||||
this.mLabel = label;
|
||||
this.mMonth = month;
|
||||
}
|
||||
public WeekItem(WeekItem original) {
|
||||
this.mWeekInYear = original.getWeekInYear();
|
||||
this.mYear = original.getYear();
|
||||
this.mMonth = original.getMonth();
|
||||
this.mDate = original.getDate();
|
||||
this.mLabel = original.getLabel();
|
||||
this.mDayItems = original.getDayItems();
|
||||
}
|
||||
|
||||
public WeekItem(){
|
||||
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Getters/Setters
|
||||
|
||||
public int getWeekInYear() {
|
||||
return mWeekInYear;
|
||||
}
|
||||
|
||||
public void setWeekInYear(int weekInYear) {
|
||||
this.mWeekInYear = weekInYear;
|
||||
}
|
||||
|
||||
public int getYear() {
|
||||
return mYear;
|
||||
}
|
||||
|
||||
public void setYear(int year) {
|
||||
this.mYear = year;
|
||||
}
|
||||
|
||||
public int getMonth() {
|
||||
return mMonth;
|
||||
}
|
||||
|
||||
public void setMonth(int month) {
|
||||
this.mMonth = month;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return mDate;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.mDate = date;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return mLabel;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.mLabel = label;
|
||||
}
|
||||
|
||||
public List<IDayItem> getDayItems() {
|
||||
return mDayItems;
|
||||
}
|
||||
|
||||
public void setDayItems(List<IDayItem> dayItems) {
|
||||
this.mDayItems = dayItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWeekItem copy() {
|
||||
return new WeekItem(this);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WeekItem{"
|
||||
+ "label='"
|
||||
+ mLabel
|
||||
+ '\''
|
||||
+ ", weekInYear="
|
||||
+ mWeekInYear
|
||||
+ ", year="
|
||||
+ mYear
|
||||
+ '}';
|
||||
}
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.render;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.R;
|
||||
import com.github.tibolte.agendacalendarview.models.BaseCalendarEvent;
|
||||
import com.google.android.material.internal.ViewUtils;
|
||||
|
||||
/**
|
||||
* Class helping to inflate our default layout in the AgendaAdapter
|
||||
*/
|
||||
public class DefaultEventRenderer extends EventRenderer<BaseCalendarEvent> {
|
||||
|
||||
public static int themeAttributeToColor(int themeAttributeId,
|
||||
Context context,
|
||||
int fallbackColorId) {
|
||||
TypedValue outValue = new TypedValue();
|
||||
Resources.Theme theme = context.getTheme();
|
||||
boolean wasResolved =
|
||||
theme.resolveAttribute(
|
||||
themeAttributeId, outValue, true);
|
||||
if (wasResolved) {
|
||||
return ContextCompat.getColor(
|
||||
context, outValue.resourceId);
|
||||
} else {
|
||||
// fallback colour handling
|
||||
return fallbackColorId;
|
||||
}
|
||||
}
|
||||
|
||||
// region class - EventRenderer
|
||||
|
||||
@Override
|
||||
public void render(@NonNull View view, @NonNull BaseCalendarEvent event) {
|
||||
CardView card = view.findViewById(R.id.view_agenda_event_card_view);
|
||||
TextView txtTitle = view.findViewById(R.id.view_agenda_event_title);
|
||||
TextView txtLocation = view.findViewById(R.id.view_agenda_event_location);
|
||||
LinearLayout descriptionContainer = view.findViewById(R.id.view_agenda_event_description_container);
|
||||
LinearLayout locationContainer = view.findViewById(R.id.view_agenda_event_location_container);
|
||||
|
||||
descriptionContainer.setVisibility(View.VISIBLE);
|
||||
|
||||
txtTitle.setText(event.getTitle());
|
||||
txtLocation.setText(event.getLocation());
|
||||
if (event.getLocation().length() > 0) {
|
||||
locationContainer.setVisibility(View.VISIBLE);
|
||||
txtLocation.setText(event.getLocation());
|
||||
} else {
|
||||
locationContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (!event.isPlaceholder()/*!event.getTitle().equals(view.getResources().getString(R.string.agenda_event_no_events))*/) {
|
||||
txtTitle.setTextColor(event.getTextColor());
|
||||
card.setCardBackgroundColor(event.getColor());
|
||||
txtLocation.setTextColor(event.getTextColor());
|
||||
}
|
||||
else {
|
||||
card.setCardBackgroundColor(Color.TRANSPARENT);
|
||||
card.setCardElevation(0);
|
||||
card.setBackgroundColor(Color.TRANSPARENT);
|
||||
card.setRadius(0);
|
||||
card.setBackgroundDrawable(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEventLayout() {
|
||||
return R.layout.view_agenda_event;
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.render;
|
||||
|
||||
import androidx.annotation.LayoutRes;
|
||||
import android.view.View;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
|
||||
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
|
||||
/**
|
||||
* Base class for helping layout rendering
|
||||
*/
|
||||
public abstract class EventRenderer<T extends CalendarEvent> {
|
||||
public abstract void render(final View view, final T event);
|
||||
|
||||
@LayoutRes
|
||||
public abstract int getEventLayout();
|
||||
|
||||
public Class<T> getRenderType() {
|
||||
ParameterizedType type = (ParameterizedType) getClass().getGenericSuperclass();
|
||||
return (Class<T>) type.getActualTypeArguments()[0];
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.utils;
|
||||
|
||||
import rx.Observable;
|
||||
import rx.subjects.PublishSubject;
|
||||
import rx.subjects.SerializedSubject;
|
||||
import rx.subjects.Subject;
|
||||
|
||||
public class BusProvider {
|
||||
|
||||
public static BusProvider mInstance;
|
||||
|
||||
private final Subject<Object, Object> mBus = new SerializedSubject<>(PublishSubject.create());
|
||||
|
||||
// region Constructors
|
||||
|
||||
public static BusProvider getInstance() {
|
||||
if (mInstance == null) {
|
||||
mInstance = new BusProvider();
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Public methods
|
||||
|
||||
public void send(Object object) {
|
||||
mBus.onNext(object);
|
||||
}
|
||||
|
||||
public Observable<Object> toObserverable() {
|
||||
return mBus;
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.utils;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.CalendarManager;
|
||||
import com.github.tibolte.agendacalendarview.R;
|
||||
import com.github.tibolte.agendacalendarview.models.IWeekItem;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Class containing helper functions for dates
|
||||
*/
|
||||
public class DateHelper {
|
||||
|
||||
// region Public methods
|
||||
|
||||
/**
|
||||
* Check if two Calendar instances have the same time (by month, year and day of month)
|
||||
*
|
||||
* @param cal The first Calendar instance.
|
||||
* @param selectedDate The second Calendar instance.
|
||||
* @return True if both instances have the same time.
|
||||
*/
|
||||
public static boolean sameDate(Calendar cal, Calendar selectedDate) {
|
||||
return cal.get(Calendar.MONTH) == selectedDate.get(Calendar.MONTH)
|
||||
&& cal.get(Calendar.YEAR) == selectedDate.get(Calendar.YEAR)
|
||||
&& cal.get(Calendar.DAY_OF_MONTH) == selectedDate.get(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a Date instance and a Calendar instance have the same time (by month, year and day
|
||||
* of month)
|
||||
*
|
||||
* @param cal The Calendar instance.
|
||||
* @param selectedDate The Date instance.
|
||||
* @return True if both have the same time.
|
||||
*/
|
||||
public static boolean sameDate(Calendar cal, Date selectedDate) {
|
||||
Calendar selectedCal = Calendar.getInstance();
|
||||
selectedCal.setTime(selectedDate);
|
||||
return cal.get(Calendar.MONTH) == selectedCal.get(Calendar.MONTH)
|
||||
&& cal.get(Calendar.YEAR) == selectedCal.get(Calendar.YEAR)
|
||||
&& cal.get(Calendar.DAY_OF_MONTH) == selectedCal.get(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a Date instance is between two Calendar instances' dates (inclusively) in time.
|
||||
*
|
||||
* @param selectedDate The date to verify.
|
||||
* @param startCal The start time.
|
||||
* @param endCal The end time.
|
||||
* @return True if the verified date is between the two specified dates.
|
||||
*/
|
||||
public static boolean isBetweenInclusive(Date selectedDate, Calendar startCal, Calendar endCal) {
|
||||
Calendar selectedCal = Calendar.getInstance();
|
||||
selectedCal.setTime(selectedDate);
|
||||
// Check if we deal with the same day regarding startCal and endCal
|
||||
return sameDate(selectedCal, startCal) || selectedCal.after(startCal) && selectedCal.before(endCal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Calendar instance's date is in the same week, as the WeekItem instance.
|
||||
*
|
||||
* @param cal The Calendar instance to verify.
|
||||
* @param week The WeekItem instance to compare to.
|
||||
* @return True if both instances are in the same week.
|
||||
*/
|
||||
public static boolean sameWeek(Calendar cal, IWeekItem week) {
|
||||
return (cal.get(Calendar.WEEK_OF_YEAR) == week.getWeekInYear() && cal.get(Calendar.YEAR) == week.getYear());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a millisecond duration to a string format
|
||||
*
|
||||
* @param millis A duration to convert to a string form
|
||||
* @return A string of the form "Xd" or either "XhXm".
|
||||
*/
|
||||
public static String getDuration(Context context, long millis) {
|
||||
if (millis < 0) {
|
||||
throw new IllegalArgumentException("Duration must be greater than zero!");
|
||||
}
|
||||
|
||||
long days = TimeUnit.MILLISECONDS.toDays(millis);
|
||||
millis -= TimeUnit.DAYS.toMillis(days);
|
||||
long hours = TimeUnit.MILLISECONDS.toHours(millis);
|
||||
millis -= TimeUnit.HOURS.toMillis(hours);
|
||||
long minutes = TimeUnit.MILLISECONDS.toMinutes(millis);
|
||||
|
||||
StringBuilder sb = new StringBuilder(64);
|
||||
if (days > 0) {
|
||||
sb.append(days);
|
||||
sb.append(context.getResources().getString(R.string.agenda_event_day_duration));
|
||||
return (sb.toString());
|
||||
} else {
|
||||
if (hours > 0) {
|
||||
sb.append(hours);
|
||||
sb.append("h");
|
||||
}
|
||||
if (minutes > 0) {
|
||||
sb.append(minutes);
|
||||
sb.append("m");
|
||||
}
|
||||
}
|
||||
|
||||
return (sb.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for displaying the date in any section of the agenda view.
|
||||
*
|
||||
* @param calendar The date of the section.
|
||||
* @param locale The locale used by the Sunrise calendar.
|
||||
* @return The formatted date without the year included.
|
||||
*/
|
||||
public static String getYearLessLocalizedDate(Calendar calendar, Locale locale) {
|
||||
SimpleDateFormat sdf = (SimpleDateFormat) SimpleDateFormat.getDateInstance(DateFormat.FULL, CalendarManager.getInstance().getLocale());
|
||||
String pattern = sdf.toPattern();
|
||||
|
||||
String yearLessPattern = pattern.replaceAll("\\W?[Yy]+\\W?", "");
|
||||
SimpleDateFormat yearLessSDF = new SimpleDateFormat(yearLessPattern, locale);
|
||||
String yearLessDate = yearLessSDF.format(calendar.getTime()).toUpperCase();
|
||||
if (yearLessDate.endsWith(",")) {
|
||||
yearLessDate = yearLessDate.substring(0, yearLessDate.length() - 1);
|
||||
}
|
||||
return yearLessDate;
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.utils;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.models.IDayItem;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Events emitted by the bus provider.
|
||||
*/
|
||||
public class Events {
|
||||
|
||||
public static class DayClickedEvent {
|
||||
|
||||
public Calendar mCalendar;
|
||||
public IDayItem mDayItem;
|
||||
|
||||
public DayClickedEvent(IDayItem dayItem) {
|
||||
this.mCalendar = Calendar.getInstance();
|
||||
this.mCalendar.setTime(dayItem.getDate());
|
||||
this.mDayItem = dayItem;
|
||||
}
|
||||
|
||||
public Calendar getCalendar() {
|
||||
return mCalendar;
|
||||
}
|
||||
|
||||
public IDayItem getDay() {
|
||||
return mDayItem;
|
||||
}
|
||||
}
|
||||
|
||||
public static class CalendarScrolledEvent {
|
||||
}
|
||||
|
||||
public static class AgendaListViewTouchedEvent {
|
||||
}
|
||||
|
||||
public static class EventsFetched {
|
||||
}
|
||||
|
||||
public static class ForecastFetched {
|
||||
}
|
||||
}
|
@ -1,114 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.utils;
|
||||
|
||||
import com.github.tibolte.agendacalendarview.agenda.AgendaListView;
|
||||
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Helper class calculating the scrolling distance in the AgendaListView.
|
||||
*/
|
||||
public class ListViewScrollTracker {
|
||||
private AgendaListView mListView;
|
||||
private SparseArray<Integer> mPositions;
|
||||
private SparseArray<Integer> mListViewItemHeights = new SparseArray<>();
|
||||
private int mFirstVisiblePosition;
|
||||
private int mReferencePosition = -1; // Position of the current date in the Agenda listView
|
||||
|
||||
// region Constructor and Accessor(s)
|
||||
|
||||
public ListViewScrollTracker(AgendaListView listView) {
|
||||
mListView = listView;
|
||||
}
|
||||
|
||||
public int getReferencePosition() {
|
||||
return mReferencePosition;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Public methods
|
||||
|
||||
/**
|
||||
* Call from an AbsListView.OnScrollListener to calculate the incremental offset (change in
|
||||
* scroll offset
|
||||
* since the last calculation).
|
||||
*
|
||||
* @param firstVisiblePosition First visible item position in the list.
|
||||
* @param visibleItemCount Number of visible items in the list.
|
||||
* @return The incremental offset, or 0 if it wasn't possible to calculate the offset.
|
||||
*/
|
||||
public int calculateIncrementalOffset(int firstVisiblePosition, int visibleItemCount) {
|
||||
// Remember previous positions, if any
|
||||
SparseArray<Integer> previousPositions = mPositions;
|
||||
|
||||
// Store new positions
|
||||
mPositions = new SparseArray<>();
|
||||
for (int i = 0; i < visibleItemCount; i++) {
|
||||
mPositions.put(firstVisiblePosition + i, mListView.getListChildAt(i).getTop());
|
||||
}
|
||||
|
||||
if (previousPositions != null) {
|
||||
// Find position which exists in both mPositions and previousPositions, then return the difference
|
||||
// of the new and old Y values.
|
||||
for (int i = 0; i < previousPositions.size(); i++) {
|
||||
int previousPosition = previousPositions.keyAt(i);
|
||||
int previousTop = previousPositions.get(previousPosition);
|
||||
Integer newTop = mPositions.get(previousPosition);
|
||||
if (newTop != null) {
|
||||
return newTop - previousTop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0; // No view's position was in both previousPositions and mPositions
|
||||
}
|
||||
|
||||
/**
|
||||
* Call from an AbsListView.OnScrollListener to calculate the scrollY (Here
|
||||
* we definite as the distance in pixels compared to the position representing the current
|
||||
* date).
|
||||
*
|
||||
* @param firstVisiblePosition First visible item position in the list.
|
||||
* @param visibleItemCount Number of visible items in the list.
|
||||
* @return Distance in pixels compared to current day position (negative if firstVisiblePosition less than mReferencePosition)
|
||||
*/
|
||||
public int calculateScrollY(int firstVisiblePosition, int visibleItemCount) {
|
||||
mFirstVisiblePosition = firstVisiblePosition;
|
||||
if (mReferencePosition < 0) {
|
||||
mReferencePosition = mFirstVisiblePosition;
|
||||
}
|
||||
|
||||
if (visibleItemCount > 0) {
|
||||
View c = mListView.getListChildAt(0); // this is the first visible row
|
||||
int scrollY = -c.getTop();
|
||||
mListViewItemHeights.put(firstVisiblePosition, c.getMeasuredHeight());
|
||||
|
||||
if (mFirstVisiblePosition >= mReferencePosition) {
|
||||
for (int i = mReferencePosition; i < firstVisiblePosition; ++i) {
|
||||
if (mListViewItemHeights.get(i) == null) {
|
||||
mListViewItemHeights.put(i, c.getMeasuredHeight());
|
||||
}
|
||||
scrollY += mListViewItemHeights.get(i); // add all heights of the views that are gone
|
||||
}
|
||||
return scrollY;
|
||||
} else {
|
||||
for (int i = mReferencePosition - 1; i >= firstVisiblePosition; --i) {
|
||||
if (mListViewItemHeights.get(i) == null) {
|
||||
mListViewItemHeights.put(i, c.getMeasuredHeight());
|
||||
}
|
||||
scrollY -= mListViewItemHeights.get(i);
|
||||
}
|
||||
return scrollY;
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
mPositions = null;
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
package com.github.tibolte.agendacalendarview.widgets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
/**
|
||||
* Floating action button helping to scroll back to the current date.
|
||||
*/
|
||||
public class FloatingActionButton extends com.google.android.material.floatingactionbutton.FloatingActionButton {
|
||||
private static final int TRANSLATE_DURATION_MILLIS = 200;
|
||||
|
||||
private boolean mVisible = true;
|
||||
|
||||
private final Interpolator mInterpolator = new AccelerateDecelerateInterpolator();
|
||||
|
||||
// region Constructors
|
||||
|
||||
public FloatingActionButton(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public FloatingActionButton(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public FloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Overrides
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
show(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
hide(true);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Public methods
|
||||
|
||||
public void show(boolean animate) {
|
||||
toggle(true, animate, false);
|
||||
}
|
||||
|
||||
public void hide(boolean animate) {
|
||||
toggle(false, animate, false);
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return mVisible;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Private methods
|
||||
|
||||
private void toggle(final boolean visible, final boolean animate, boolean force) {
|
||||
if (mVisible != visible || force) {
|
||||
mVisible = visible;
|
||||
int height = getHeight();
|
||||
if (height == 0 && !force) {
|
||||
ViewTreeObserver vto = getViewTreeObserver();
|
||||
if (vto.isAlive()) {
|
||||
vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
||||
@Override
|
||||
public boolean onPreDraw() {
|
||||
ViewTreeObserver currentVto = getViewTreeObserver();
|
||||
if (currentVto.isAlive()) {
|
||||
currentVto.removeOnPreDrawListener(this);
|
||||
}
|
||||
toggle(visible, animate, true);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
int translationY = visible ? 0 : height + getMarginBottom();
|
||||
if (animate) {
|
||||
animate().setInterpolator(mInterpolator)
|
||||
.setDuration(TRANSLATE_DURATION_MILLIS)
|
||||
.translationY(translationY);
|
||||
} else {
|
||||
setTranslationY(translationY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getMarginBottom() {
|
||||
int marginBottom = 0;
|
||||
final ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
|
||||
marginBottom = ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin;
|
||||
}
|
||||
return marginBottom;
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<stroke android:width="2dp" android:color="@color/theme_primary"/>
|
||||
|
||||
<solid android:color="@android:color/transparent" />
|
||||
|
||||
</shape>
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="#ffffff" />
|
||||
</shape>
|
@ -1,7 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path android:fillColor="#fff" android:pathData="M7,10H12V15H7M19,19H5V8H19M19,3H18V1H16V3H8V1H6V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3Z" />
|
||||
</vector>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<stroke android:width="1dp" android:color="@color/theme_text_icons"/>
|
||||
|
||||
<solid android:color="@android:color/transparent" />
|
||||
</shape>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:startColor="#88444444"
|
||||
android:endColor="#00000000" />
|
||||
</shape>
|
@ -1,48 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/week_days_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<include layout="@layout/view_day_cell" />
|
||||
|
||||
<include layout="@layout/view_day_cell" />
|
||||
|
||||
<include layout="@layout/view_day_cell" />
|
||||
|
||||
<include layout="@layout/view_day_cell" />
|
||||
|
||||
<include layout="@layout/view_day_cell" />
|
||||
|
||||
<include layout="@layout/view_day_cell" />
|
||||
|
||||
<include layout="@layout/view_day_cell" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/month_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/day_cell_height"
|
||||
android:alpha="0"
|
||||
android:background="@color/calendar_month_transparent_background" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/month_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:alpha="0"
|
||||
tools:alpha="1"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="17sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="MAJ" />
|
||||
|
||||
</RelativeLayout>
|
@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5dp"
|
||||
android:background="@drawable/shadow"
|
||||
android:visibility="visible"/>
|
||||
|
||||
<com.github.tibolte.agendacalendarview.agenda.AgendaListView
|
||||
android:id="@+id/agenda_listview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:animationCache="false"
|
||||
android:divider="@color/agenda_list_header_divider"
|
||||
android:dividerHeight="1dp"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
android:scrollingCache="false" />
|
||||
|
||||
</merge>
|
@ -1,53 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.github.tibolte.agendacalendarview.agenda.AgendaEventView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/view_agenda_event_card_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:cardBackgroundColor="@color/blue_selected"
|
||||
app:cardCornerRadius="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/view_agenda_event_description_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/view_agenda_event_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:textSize="16sp"
|
||||
tools:text="sprawdzian - Biotechnologia" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/view_agenda_event_location_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/view_agenda_event_location"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/calendar_text_default"
|
||||
android:textSize="12sp"
|
||||
tools:text="9:05, biologia, Beata Pudełko, 1B3T" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</com.github.tibolte.agendacalendarview.agenda.AgendaEventView>
|
@ -1,64 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.github.tibolte.agendacalendarview.agenda.AgendaHeaderView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/view_agenda_day_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="18sp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginTop="5dp">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_day_circle_selected"
|
||||
android:layout_width="@dimen/circle_day_size"
|
||||
android:layout_height="@dimen/circle_day_size"
|
||||
android:background="@drawable/agenda_day_circle"
|
||||
android:visibility="invisible"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/view_agenda_day_of_month"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:textSize="20sp"
|
||||
tools:text="24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/view_agenda_day_of_week"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textSize="12sp"
|
||||
android:visibility="visible"
|
||||
tools:text="śr." />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
||||
|
||||
</com.github.tibolte.agendacalendarview.agenda.AgendaHeaderView>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge 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">
|
||||
|
||||
<com.github.tibolte.agendacalendarview.calendar.CalendarView
|
||||
android:id="@+id/calendar_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<com.github.tibolte.agendacalendarview.agenda.AgendaView
|
||||
android:id="@+id/agenda_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</com.github.tibolte.agendacalendarview.agenda.AgendaView>
|
||||
|
||||
<com.github.tibolte.agendacalendarview.widgets.FloatingActionButton
|
||||
android:id="@+id/floating_action_button"
|
||||
style="@style/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="center" />
|
||||
|
||||
</merge>
|
@ -1,48 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:parentTag="LinearLayout"
|
||||
tools:orientation="vertical">
|
||||
|
||||
<!-- Day names labels -->
|
||||
<LinearLayout
|
||||
android:id="@+id/cal_day_names"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/calendar_header_height"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<include layout="@layout/view_day_calendar_header" />
|
||||
|
||||
<include layout="@layout/view_day_calendar_header" />
|
||||
|
||||
<include layout="@layout/view_day_calendar_header" />
|
||||
|
||||
<include layout="@layout/view_day_calendar_header" />
|
||||
|
||||
<include layout="@layout/view_day_calendar_header" />
|
||||
|
||||
<include layout="@layout/view_day_calendar_header" />
|
||||
|
||||
<include layout="@layout/view_day_calendar_header" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:background="#ff7f7f7f" />
|
||||
|
||||
<com.github.tibolte.agendacalendarview.calendar.weekslist.WeekListView
|
||||
android:id="@+id/list_week"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:cacheColorHint="@android:color/transparent"
|
||||
android:divider="@color/calendar_divider_color"
|
||||
android:dividerHeight="1dp"
|
||||
android:drawSelectorOnTop="false"
|
||||
android:listSelector="@android:color/transparent"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none" />
|
||||
|
||||
</merge>
|
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:textColor="@android:color/white"
|
||||
tools:text="pon." />
|
@ -1,85 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="@dimen/day_cell_height"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/view_day_month_label"
|
||||
style="@style/CalendarCellText"
|
||||
android:visibility="gone"
|
||||
tools:text="maj" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_day_circle_selected"
|
||||
android:layout_width="@dimen/circle_selected_size"
|
||||
android:layout_height="@dimen/circle_selected_size"
|
||||
android:background="@drawable/selected_day_color_circle"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/view_day_day_label"
|
||||
style="@style/CalendarCellText"
|
||||
android:layout_gravity="center"
|
||||
tools:text="1" />
|
||||
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_day_event_indicator3"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:background="@drawable/event_color_circle"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_day_event_indicator2"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:background="@drawable/event_color_circle"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_day_event_indicator1"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:background="@drawable/event_color_circle"
|
||||
android:visibility="invisible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
@ -1,12 +0,0 @@
|
||||
<resources>
|
||||
<!-- Agenda -->
|
||||
<string name="today">Today</string>
|
||||
<string name="tomorrow">Tomorrow</string>
|
||||
<string name="agenda_event_day_duration">d</string>
|
||||
<string name="agenda_event_all_day">All day</string>
|
||||
<string name="agenda_event_no_events">No events</string>
|
||||
|
||||
<!-- Weather -->
|
||||
<string name="month_name_format">LLLL</string>
|
||||
<string name="month_half_name_format">MMM</string>
|
||||
</resources>
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="ColorOptionsView">
|
||||
<attr name="agendaCurrentDayTextColor" format="color" />
|
||||
<attr name="calendarHeaderColor" format="color" />
|
||||
<attr name="calendarHeaderTextColor" format="color" />
|
||||
<attr name="calendarColor" format="color" />
|
||||
<attr name="calendarDayTextColor" format="color" />
|
||||
<attr name="calendarPastDayTextColor" format="color" />
|
||||
<attr name="calendarCurrentDayTextColor" format="color" />
|
||||
<attr name="fabColor" format="color" />
|
||||
</declare-styleable>
|
||||
</resources>
|
@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Colors for Calendar view -->
|
||||
<color name="calendar_text_current_day">#000000</color>
|
||||
<color name="calendar_text_default">#9C9CA0</color>
|
||||
<color name="calendar_month_transparent_background">#CCFFFFFF</color>
|
||||
<color name="calendar_divider_color">#F3F3F3</color>
|
||||
|
||||
<!-- Colors for Agenda view -->
|
||||
<!--<color name="agenda_list_header_divider">#666666</color>-->
|
||||
<color name="agenda_list_header_divider">#00000000</color>
|
||||
|
||||
<!-- General -->
|
||||
<color name="blue_selected">#2196F3</color>
|
||||
<color name="theme_primary_dark">#1976D2</color>
|
||||
<color name="theme_primary">#2196F3</color>
|
||||
<color name="theme_light_primary">#BBDEFB</color>
|
||||
<color name="theme_accent">#4caf50</color>
|
||||
<color name="theme_text_icons">#FFFFFF</color>
|
||||
|
||||
</resources>
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Calendar values -->
|
||||
<dimen name="calendar_header_height">20dp</dimen>
|
||||
<dimen name="day_cell_height">52dp</dimen>
|
||||
<dimen name="text_day_size">14dp</dimen>
|
||||
<dimen name="circle_selected_size">32dp</dimen>
|
||||
|
||||
<!-- Agenda values -->
|
||||
<dimen name="circle_day_size">60dp</dimen>
|
||||
|
||||
<!-- Floating action button values -->
|
||||
<!--<dimen name="fab_size">56dp</dimen>-->
|
||||
|
||||
<dimen name="agenda_event_view_padding_left">70dp</dimen>
|
||||
<dimen name="agenda_event_view_padding_top">5dp</dimen>
|
||||
<dimen name="agenda_event_view_padding_right">15dp</dimen>
|
||||
<dimen name="agenda_event_view_padding_bottom">5dp</dimen>
|
||||
</resources>
|
@ -1,14 +0,0 @@
|
||||
<resources>
|
||||
<!-- Calendar -->
|
||||
<string name="month_name_format">LLLL</string>
|
||||
<string name="day_name_format" translatable="false">E</string>
|
||||
|
||||
<!-- Agenda -->
|
||||
<string name="today">Dziś</string>
|
||||
<string name="tomorrow">Jutro</string>
|
||||
<string name="agenda_event_day_duration">d</string>
|
||||
<string name="agenda_event_all_day">Cały dzień</string>
|
||||
<string name="agenda_event_no_events">Brak wydarzeń</string>
|
||||
|
||||
<string name="month_half_name_format">MMM</string>
|
||||
</resources>
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Calendar styles -->
|
||||
<style name="CalendarCellText">
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:textColor">@color/calendar_text_default</item>
|
||||
<item name="android:textStyle">normal</item>
|
||||
<item name="android:textSize">@dimen/text_day_size</item>
|
||||
</style>
|
||||
|
||||
<!-- Agenda styles -->
|
||||
|
||||
<!-- FAB -->
|
||||
<style name="fab">
|
||||
<item name="android:src">@drawable/fab_arrow</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_gravity">bottom|start</item>
|
||||
<item name="android:layout_margin">16dp</item>
|
||||
<item name="elevation">8dp</item>
|
||||
<item name="fabSize">normal</item>
|
||||
<item name="pressedTranslationZ">6dp</item>
|
||||
</style>
|
||||
</resources>
|
@ -163,11 +163,9 @@ dependencies {
|
||||
implementation "org.greenrobot:eventbus:3.1.1"
|
||||
implementation "org.jsoup:jsoup:1.12.1"
|
||||
implementation "pl.droidsonroids.gif:android-gif-drawable:1.2.15"
|
||||
//implementation "se.emilsjolander:stickylistheaders:2.7.0"
|
||||
implementation 'com.github.edisonw:StickyListHeaders:master-SNAPSHOT@aar'
|
||||
implementation "uk.co.samuelwall:material-tap-target-prompt:2.14.0"
|
||||
|
||||
implementation project(":agendacalendarview")
|
||||
implementation "eu.szkolny:agendacalendarview:1799f8ef47"
|
||||
implementation "eu.szkolny:cafebar:5bf0c618de"
|
||||
implementation "eu.szkolny:material-about-library:0534abf316"
|
||||
implementation "eu.szkolny:mhttp:af4b62e6e9"
|
||||
|
@ -3,7 +3,7 @@ include ':wear'
|
||||
include ':codegen'
|
||||
include ':annotation'
|
||||
rootProject.name='Szkolny.eu'
|
||||
include ':app', ':agendacalendarview', ':szkolny-font'
|
||||
include ':app', ':szkolny-font'
|
||||
/*
|
||||
include ':Navigation'
|
||||
project(':Navigation').projectDir = new File(settingsDir, '../Navigation/navlib')*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user