Java Code Examples for org.joda.time.DateTime#Property

The following examples show how to use org.joda.time.DateTime#Property . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private void setUpTodayDateTv(Context context, RemoteViews views) {

        if (mUserLoggedIn) {
            DateTime dateActuelle = dateTime;
            DateTime.Property pDoW = dateActuelle.dayOfWeek();
            DateTime.Property pDoM = dateActuelle.dayOfMonth();
            DateTime.Property pMoY = dateActuelle.monthOfYear();
            Locale locale = context.getResources().getConfiguration().locale;
            String dateActuelleStr = context.getString(R.string.horaire, pDoW.getAsText(locale),
                    pDoM.getAsText(locale), pMoY.getAsText(locale));
            views.setViewVisibility(todayNameTvId, View.GONE);
            views.setTextViewText(todayNameTvId, dateActuelleStr);
            views.setViewVisibility(todayNameTvId, View.VISIBLE);
        } else {
            views.setViewVisibility(todayNameTvId, View.GONE);
        }
    }
 
Example 2
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    int textColor = Integer.parseInt(mTextColorSpinner.getSelectedItem().toString());
    DateTime dateActuelle = new DateTime();
    DateTime.Property pDoW = dateActuelle.dayOfWeek();
    DateTime.Property pDoM = dateActuelle.dayOfMonth();
    DateTime.Property pMoY = dateActuelle.monthOfYear();
    Locale locale = TodayWidgetConfigureActivity.this.getResources().getConfiguration()
            .locale;
    String dateActuelleStr = TodayWidgetConfigureActivity.this.getString(R.string.horaire,
            pDoW.getAsText(locale),
            pDoM.getAsText(locale), pMoY.getAsText(locale));

    mWidgetTodaysNameTv.setText(dateActuelleStr);
    mWidgetTodaysNameTv.setTextColor(textColor);

    prevBtn.setColorFilter(textColor);
    nextBtn.setColorFilter(textColor);

    syncBtn.setColorFilter(textColor);
    syncBtn.setBackgroundColor(Color.TRANSPARENT);
    syncBtn.setVisibility(View.VISIBLE);
}
 
Example 3
public void setItemList(List<Seances> itemListSeance, List<Event> itemListEvent) {

        listSeances = new ArrayList<>();
        ArrayList<IHoraireRows> listRowItems = new ArrayList<IHoraireRows>();
        String tempDate = "";
        DateTime today = new DateTime();

        listRowItems.addAll(itemListEvent);
        listRowItems.addAll(itemListSeance);

        Collections.sort(listRowItems, new HoraireComparator());

        for(IHoraireRows rows : listRowItems) {

            DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
            DateTime seanceDay = formatter.parseDateTime(rows.getDateDebut().substring(0, 10));

//            if(today.isAfter(seanceDay) && !DateUtils.isToday(seanceDay.getMillis()) ) {
//                continue;
//            }

            if(!rows.getDateDebut().substring(0,10).equals(tempDate)) {

                tempDate = rows.getDateDebut().substring(0,10);

                DateTime.Property pDoW = seanceDay.dayOfWeek();
                DateTime.Property pDoM = seanceDay.dayOfMonth();
                DateTime.Property pMoY = seanceDay.monthOfYear();

                this.listSeances.add(new TodayDataRowItem(TodayDataRowItem.viewType.VIEW_TYPE_TITLE_SEANCE, context.getString(R.string.date_text, pDoW.getAsText(Locale.getDefault()), pDoM.get(), pMoY.getAsText(Locale.getDefault()))));
            }

            if(rows.getClass().equals(Event.class)){
                this.listSeances.add(new TodayDataRowItem(TodayDataRowItem.viewType.VIEW_TYPE_ETS_EVENT, rows));
            } else if(rows.getClass().equals(Seances.class)){
                this.listSeances.add(new TodayDataRowItem(TodayDataRowItem.viewType.VIEW_TYPE_SEANCE, rows));
            }
        }

    }
 
Example 4
@Override
public Object instantiateItem(ViewGroup container, int row, int col) {
    final View view = inflater.inflate(R.layout.item_seance_gridviewpager, container, false);

    final TextView tvDate = (TextView) view.findViewById(R.id.tv_date);
    final TextView tvStartHour = (TextView) view.findViewById(R.id.tv_start_hour);
    final TextView tvStartMinute = (TextView) view.findViewById(R.id.tv_start_minute);
    final TextView tvEndHour = (TextView) view.findViewById(R.id.tv_end_hour);
    final TextView tvEndMinute = (TextView) view.findViewById(R.id.tv_end_minute);
    final TextView tvActivityName = (TextView) view.findViewById(R.id.tv_activity_name);
    final TextView tvCourseGroupId = (TextView) view.findViewById(R.id.tv_course_group_id);
    final TextView tvLocal = (TextView) view.findViewById(R.id.tv_local);
    final ProgressLayout progressLayout = (ProgressLayout) view.findViewById(R.id.progressLayout);

    Seances seance = mSeances.get(col);

    DateTime startDateTime = DateTime.parse(seance.dateDebut);
    DateTime endDateTime = DateTime.parse(seance.dateFin);

    String startHour = String.format("%d", startDateTime.getHourOfDay());
    String startMinute = String.format("%02d", startDateTime.getMinuteOfHour());
    String endHour = String.format("%d", endDateTime.getHourOfDay());
    String endMinute = String.format("%02d", endDateTime.getMinuteOfHour());

    DateTime dateTime = new DateTime();

    if (ShapeWear.getShape() == ShapeWear.ScreenShape.RECTANGLE) {
        progressLayout.setSquareDisplay(true);
    } else {
        progressLayout.setSquareDisplay(false);
    }

    //currently during the course
    if (dateTime.isBefore(endDateTime) && dateTime.isAfter(startDateTime)) {
        progressLayout.setBoundsCourse(startDateTime, endDateTime);
        progressLayout.setAutoProgress(true);
        progressLayout.start();
    } else {
        progressLayout.setCurrentProgress(100);
    }


    DateTime.Property pDoW = startDateTime.dayOfWeek();
    DateTime.Property pDoM = startDateTime.dayOfMonth();
    DateTime.Property pMoY = startDateTime.monthOfYear();

    Locale currentLocale = mContext.getResources().getConfiguration().locale;

    tvDate.setText(
            mContext.getString(
                    R.string.horaire, pDoW.getAsText(currentLocale),
                    "" + pDoM.get(),
                    pMoY.getAsText(currentLocale)));


    tvStartHour.setText(startHour);
    tvStartMinute.setText(startMinute);
    tvEndHour.setText(endHour);
    tvEndMinute.setText(endMinute);
    tvActivityName.setText(seance.nomActivite);
    tvCourseGroupId.setText(seance.coursGroupe);
    tvLocal.setText(seance.local);

    container.addView(view);
    return view;
}
 
Example 5
@Override
void updateUI() {
    if (isAdded()) {
        dateTime = new DateTime();

        DateTime.Property pDoW = dateTime.dayOfWeek();
        DateTime.Property pDoM = dateTime.dayOfMonth();
        DateTime.Property pMoY = dateTime.monthOfYear();

        Locale locale = getResources().getConfiguration().locale;

        todaysTv.setText(getActivity().getString(R.string.horaire, pDoW.getAsText(locale), pDoM.getAsText(locale), pMoY.getAsText(locale)));
        databaseHelper = new DatabaseHelper(getActivity());
        listSeances = new ArrayList<Seances>();
        events = new ArrayList<Event>();
        try {
            SimpleDateFormat seancesFormatter = new SimpleDateFormat("yyyy-MM-dd", getResources().getConfiguration().locale);
            listSeances = (ArrayList<Seances>) databaseHelper.getDao(Seances.class).queryBuilder().where().like("dateDebut", seancesFormatter.format(dateTime.toDate()) + "%").query();
            Collections.sort(listSeances, new SeanceComparator());
            events = (ArrayList<Event>) databaseHelper.getDao(Event.class).queryBuilder().where().like("startDate", seancesFormatter.format(dateTime.toDate()) + "%").query();

        } catch (Exception e) {
            e.printStackTrace();
        }

        ArrayList<TodayDataRowItem> dataRowItems = new ArrayList<TodayDataRowItem>();
        if (!events.isEmpty()) {
            dataRowItems.add(new TodayDataRowItem(TodayDataRowItem.viewType.VIEW_TYPE_TITLE_EVENT));
            for (Event event : events) {
                dataRowItems.add(new TodayDataRowItem(TodayDataRowItem.viewType.VIEW_TYPE_EVENT, event));
            }
        }

        dataRowItems.add(new TodayDataRowItem(TodayDataRowItem.viewType.VIEW_TYPE_TITLE_SEANCE));
        if (listSeances.isEmpty()) {
            tvNoCourses.setVisibility(View.VISIBLE);
        } else {
            for (Seances seances : listSeances) {
                dataRowItems.add(new TodayDataRowItem(TodayDataRowItem.viewType.VIEW_TYPE_SEANCE, seances));
            }
            tvNoCourses.setVisibility(View.GONE);
        }
        adapter = new TodayAdapter(getActivity(), dataRowItems);
        todaysList.setAdapter(adapter);

    }
}