Search in sources :

Example 16 with DateTime

use of hirondelle.date4j.DateTime in project instructure-android by instructure.

the class CalendarListViewFragment method todayClick.

// /////////////////////////////////////////////////////
// Overflow menu helper methods            //
// /////////////////////////////////////////////////////
private void todayClick() {
    mRecyclerAdapter.setTodayPressed(true);
    DateTime today = DateTime.today(TimeZone.getDefault());
    mRecyclerAdapter.setSelectedDay(today);
    mCalendarFragment.moveToDateTime(today);
    mRecyclerAdapter.refreshForTodayPressed();
    if (mCalendarContainer.getVisibility() == View.GONE) {
        expandOrCollapseCalendar(mCalendarContainer, true);
    }
}
Also used : DateTime(hirondelle.date4j.DateTime)

Example 17 with DateTime

use of hirondelle.date4j.DateTime in project instructure-android by instructure.

the class CaldroidFragment method setDisableDatesFromString.

/**
 * Set disableDates from ArrayList of String with custom date format. For
 * example, if the date string is 06-Jan-2013, use date format dd-MMM-yyyy.
 * This method will refresh the calendar, it's not necessary to call
 * refreshView()
 *
 * @param disableDateStrings
 * @param dateFormat
 */
public void setDisableDatesFromString(ArrayList<String> disableDateStrings, String dateFormat) {
    if (disableDateStrings == null) {
        return;
    }
    disableDates.clear();
    for (String dateString : disableDateStrings) {
        DateTime dateTime = CalendarHelper.getDateTimeFromString(dateString, dateFormat);
        disableDates.add(dateTime);
    }
}
Also used : DateTime(hirondelle.date4j.DateTime)

Example 18 with DateTime

use of hirondelle.date4j.DateTime in project instructure-android by instructure.

the class CaldroidFragment method getDaysOfWeek.

/**
 * To display the week day title
 *
 * @return "SUN, MON, TUE, WED, THU, FRI, SAT"
 */
protected ArrayList<String> getDaysOfWeek() {
    ArrayList<String> list = new ArrayList<String>();
    SimpleDateFormat fmt = DateHelper.getShortDayFormat();
    // 17 Feb 2013 is Sunday
    DateTime sunday = new DateTime(2013, 2, 17, 0, 0, 0, 0);
    DateTime nextDay = sunday.plusDays(startDayOfWeek - SUNDAY);
    for (int i = 0; i < 7; i++) {
        Date date = CalendarHelper.convertDateTimeToDate(nextDay);
        list.add(fmt.format(date).toUpperCase());
        nextDay = nextDay.plusDays(1);
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) SimpleDateFormat(java.text.SimpleDateFormat) DateTime(hirondelle.date4j.DateTime) SuppressLint(android.annotation.SuppressLint) Date(java.util.Date)

Example 19 with DateTime

use of hirondelle.date4j.DateTime in project instructure-android by instructure.

the class CaldroidFragment method setBackgroundResourceForDates.

/**
 * Set backgroundForDateMap
 */
public void setBackgroundResourceForDates(HashMap<Date, Integer> backgroundForDateMap) {
    if (backgroundForDateMap == null || backgroundForDateMap.size() == 0) {
        return;
    }
    backgroundForDateTimeMap.clear();
    for (Date date : backgroundForDateMap.keySet()) {
        Integer resource = backgroundForDateMap.get(date);
        DateTime dateTime = CalendarHelper.convertDateToDateTime(date);
        backgroundForDateTimeMap.put(dateTime, resource);
    }
}
Also used : Date(java.util.Date) DateTime(hirondelle.date4j.DateTime)

Example 20 with DateTime

use of hirondelle.date4j.DateTime in project instructure-android by instructure.

the class CaldroidFragment method setTextColorForDates.

/**
 * Set textColorForDateMap
 *
 * @return
 */
public void setTextColorForDates(HashMap<Date, Integer> textColorForDateMap) {
    if (textColorForDateMap == null || textColorForDateMap.size() == 0) {
        return;
    }
    textColorForDateTimeMap.clear();
    for (Date date : textColorForDateMap.keySet()) {
        Integer resource = textColorForDateMap.get(date);
        DateTime dateTime = CalendarHelper.convertDateToDateTime(date);
        textColorForDateTimeMap.put(dateTime, resource);
    }
}
Also used : Date(java.util.Date) DateTime(hirondelle.date4j.DateTime)

Aggregations

DateTime (hirondelle.date4j.DateTime)52 Date (java.util.Date)17 SuppressLint (android.annotation.SuppressLint)8 ArrayList (java.util.ArrayList)6 Calendar (java.util.Calendar)6 DateWindow (com.instructure.candroid.model.DateWindow)4 Test (org.junit.Test)4 View (android.view.View)3 TextView (android.widget.TextView)3 DiscussionTopicHeader (com.instructure.canvasapi2.models.DiscussionTopicHeader)3 Dialog (android.app.Dialog)2 Drawable (android.graphics.drawable.Drawable)2 Bundle (android.os.Bundle)2 LayoutInflater (android.view.LayoutInflater)2 InfinitePagerAdapter (com.antonyt.infiniteviewpager.InfinitePagerAdapter)2 EventData (com.instructure.candroid.model.EventData)2 ScheduleItem (com.instructure.canvasapi2.models.ScheduleItem)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Resources (android.content.res.Resources)1 Button (android.widget.Button)1