• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java WeekViewEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.alamkanak.weekview.WeekViewEvent的典型用法代码示例。如果您正苦于以下问题:Java WeekViewEvent类的具体用法?Java WeekViewEvent怎么用?Java WeekViewEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WeekViewEvent类属于com.alamkanak.weekview包,在下文中一共展示了WeekViewEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onMonthChange

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public List<? extends WeekViewEvent> onMonthChange(int newYear, int newMonth) {

    // Download events from network if it hasn't been done already. To understand how events are
    // downloaded using retrofit, visit http://square.github.io/retrofit
    if (!calledNetwork) {
        RestAdapter retrofit = new RestAdapter.Builder()
                .setEndpoint("https://api.myjson.com/bins")
                .build();
        MyJsonService service = retrofit.create(MyJsonService.class);
        service.listEvents(this);
        calledNetwork = true;
    }

    // Return only the events that matches newYear and newMonth.
    List<WeekViewEvent> matchedEvents = new ArrayList<WeekViewEvent>();
    for (WeekViewEvent event : events) {
        if (eventMatches(event, newYear, newMonth)) {
            matchedEvents.add(event);
        }
    }
    return matchedEvents;
}
 
开发者ID:sathishmscict,项目名称:Android-Week-View,代码行数:24,代码来源:AsynchronousActivity.java


示例2: onMonthChange

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public List<WeekViewEvent> onMonthChange(int newYear, int newMonth) {
    // Populate the week view with some events.
    List<WeekViewEvent> events = new ArrayList<WeekViewEvent>();

    Calendar startTime = Calendar.getInstance();
    startTime.set(Calendar.HOUR_OF_DAY, 3);
    startTime.set(Calendar.MINUTE, 0);
    startTime.set(Calendar.MONTH, newMonth-1);
    startTime.set(Calendar.YEAR, newYear);
    Calendar endTime = (Calendar) startTime.clone();
    endTime.add(Calendar.HOUR, 1);
    endTime.set(Calendar.MONTH, newMonth-1);
    WeekViewEvent event = new WeekViewEvent(1, getEventTitle(startTime), startTime, endTime);
    //event.setColor(getResources().getColor(R.color.event_color_01));
    events.add(event);

    return events;
}
 
开发者ID:ThisChessPlayer,项目名称:GroupScheduleCoordinator,代码行数:20,代码来源:GroupActivity.java


示例3: loadEventsInBackground

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
private void loadEventsInBackground(final int newYear, final int newMonth) {
    new Thread(() -> {
        // Populate the week view with the events of the month to display
        Calendar calendar = Calendar.getInstance();
        //Note the (-1), since the calendar starts with month 0, but we get months starting with 1
        calendar.set(newYear, newMonth - 1, 1);
        int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);

        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
        String startTime = format.format(calendar.getTime());

        calendar.set(newYear, newMonth - 1, daysInMonth);
        String endTime = format.format(calendar.getTime());

        //Convert to the proper type
        final List<WeekViewEvent> events = fetchEventList(roomApiCode, startTime, endTime);

        //Finish loading
        context.runOnUiThread(() -> {
            loadedEvents.put(calculateLoadedKey(newYear, newMonth), events);
            //Trigger onMonthChange() again
            mWeekView.notifyDatasetChanged();
        });
    }).start();
}
 
开发者ID:TCA-Team,项目名称:TumCampusApp,代码行数:26,代码来源:WeekViewFragment.java


示例4: onMonthChange

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public List<WeekViewEvent> onMonthChange(int newYear, int newMonth) {

    // Populate the week view with the events of the month to display
    List<WeekViewEvent> events = new ArrayList<>();

    Calendar calendar = Calendar.getInstance();

    //Note the (-1), since the calendar starts with month 0, but we get months starting with 1
    calendar.set(newYear, newMonth - 1, 1);
    int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);

    //Probably refactor this to a good SQL query
    for (int curDay = 1; curDay <= daysInMonth; curDay++) {
        calendar.set(Calendar.DAY_OF_MONTH, curDay);
        List<CalendarItem> calendarItems = calendarManager.getFromDbForDate(new Date(calendar.getTimeInMillis()));
        for (CalendarItem calendarItem: calendarItems) {
            events.add(new IntegratedCalendarEvent(calendarItem));
        }
    }

    return events;
}
 
开发者ID:TCA-Team,项目名称:TumCampusApp,代码行数:24,代码来源:CalendarActivity.java


示例5: getEvents

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
public ArrayList<WeekViewEvent> getEvents(int periodIndex) {
    ArrayList<WeekViewEvent> events = mEvents.get(periodIndex);
    if (events == null) {
        events = new ArrayList<>();
        mEvents.put(periodIndex, events);
    }
    return mEvents.get(periodIndex);
}
 
开发者ID:marunjar,项目名称:anewjkuapp,代码行数:9,代码来源:CalendarFragment2.java


示例6: onMonthChange

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public List<WeekViewEvent> onMonthChange(int newYear, int newMonth) {
    if (!isLoaded(newYear, newMonth)) {
        loadEventsInBackground(newYear, newMonth);
        return new ArrayList<>();
    }

    //Events already have been loaded.
    return loadedEvents.get(calculateLoadedKey(newYear, newMonth));
}
 
开发者ID:TCA-Team,项目名称:TumCampusApp,代码行数:11,代码来源:WeekViewFragment.java


示例7: fetchEventList

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
private List<WeekViewEvent> fetchEventList(String roomId, String startDate, String endDate) {
    List<WeekViewEvent> events = new ArrayList<>();
    try {
        Optional<List<RoomFinderSchedule>> result = Optional.of(TUMCabeClient.getInstance(context)
                                                                             .fetchSchedule(roomId, startDate, endDate));
        List<RoomFinderSchedule> schedules = result.get();

        //Convert to the proper type
        for (RoomFinderSchedule schedule : schedules) {
            Calendar startCal = Calendar.getInstance();
            startCal.setTime(Utils.getDateTime(schedule.getStart()));

            Calendar endCal = Calendar.getInstance();
            endCal.setTime(Utils.getDateTime(schedule.getEnd()));

            IntegratedCalendarEvent calendarEvent = new IntegratedCalendarEvent(schedule.getEvent_id(),
                                                                                schedule.getTitle(), startCal, endCal, "",
                                                                                IntegratedCalendarEvent.getDisplayColorFromColor(0xff28921f));

            events.add(calendarEvent);
        }

        return events;

    } catch (IOException | NullPointerException e) {
        Utils.log(e);
    }
    return events;
}
 
开发者ID:TCA-Team,项目名称:TumCampusApp,代码行数:30,代码来源:WeekViewFragment.java


示例8: onEventClick

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventClick(WeekViewEvent weekViewEvent, RectF rectF) {
    CalendarDetailsFragment detailsFragment = new CalendarDetailsFragment();
    Bundle bundle = new Bundle();
    CalendarItem item = calendarManager.getCalendarItemByStartAndEndTime(weekViewEvent.getStartTime(), weekViewEvent.getEndTime());
    bundle.putString(CALENDAR_ID_PARAM, item.getNr());
    detailsFragment.setArguments(bundle);
    detailsFragment.show(getSupportFragmentManager(), null);
}
 
开发者ID:TCA-Team,项目名称:TumCampusApp,代码行数:10,代码来源:CalendarActivity.java


示例9: onEventClick

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventClick(WeekViewEvent weekViewEvent, RectF rectF) {
    EventDetailBaseActivity.event = eventRealmResults.where()
            .equalTo("id", weekViewEvent.getId()).findFirst();
    startActivity(new Intent(DayViewActivity.this, EventDetailActivity.class));
}
 
开发者ID:adithya321,项目名称:Instincts-2k17,代码行数:7,代码来源:DayViewActivity.java


示例10: eventMatches

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
private boolean eventMatches(WeekViewEvent event, int year, int month) {
    return (event.getStartTime().get(Calendar.YEAR) == year &&
            event.getStartTime().get(Calendar.MONTH) == month - 1) ||
            (event.getEndTime().get(Calendar.YEAR) == year &&
                    event.getEndTime().get(Calendar.MONTH) == month - 1);
}
 
开发者ID:adithya321,项目名称:Instincts-2k17,代码行数:7,代码来源:DayViewActivity.java


示例11: onEventClick

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventClick(WeekViewEvent event, RectF eventRect) {
    Toast.makeText(this, "Clicked " + event.getName(), Toast.LENGTH_SHORT).show();
}
 
开发者ID:sathishmscict,项目名称:Android-Week-View,代码行数:5,代码来源:BaseActivity.java


示例12: onEventLongPress

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventLongPress(WeekViewEvent event, RectF eventRect) {
    Toast.makeText(this, "Long pressed event: " + event.getName(), Toast.LENGTH_SHORT).show();
}
 
开发者ID:sathishmscict,项目名称:Android-Week-View,代码行数:5,代码来源:BaseActivity.java


示例13: onEventClick

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventClick(WeekViewEvent event, RectF eventRect) {
    Toast.makeText(getContext(), "Go to Attendance", Toast.LENGTH_SHORT).show();
}
 
开发者ID:CoepPortal,项目名称:PortalApp,代码行数:5,代码来源:Schedule.java


示例14: onEventClick

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventClick(WeekViewEvent event, RectF eventRect) {
    Toast.makeText(CalendarActivity.this, "Clicked " + event.getName(), Toast.LENGTH_SHORT).show();
}
 
开发者ID:haogefeifei,项目名称:odoo-mobile-building,代码行数:5,代码来源:CalendarActivity.java


示例15: onEventLongPress

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventLongPress(WeekViewEvent event, RectF eventRect) {
    Toast.makeText(CalendarActivity.this, "Long pressed event: " + event.getName(), Toast.LENGTH_SHORT).show();
}
 
开发者ID:haogefeifei,项目名称:odoo-mobile-building,代码行数:5,代码来源:CalendarActivity.java


示例16: onEventClick

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventClick(WeekViewEvent weekViewEvent, RectF rectF) {
    AppUtils.showEventLocation(getContext(), weekViewEvent.getLocation());
}
 
开发者ID:marunjar,项目名称:anewjkuapp,代码行数:5,代码来源:CalendarFragment2.java


示例17: onEventLongPress

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventLongPress(WeekViewEvent event, RectF eventRect) {
    AppUtils.showEventInCalendar(getContext(), event.getId(), event.getStartTime().getTimeInMillis());
}
 
开发者ID:marunjar,项目名称:anewjkuapp,代码行数:5,代码来源:CalendarFragment2.java


示例18: onLoadFinished

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    ArrayList<WeekViewEvent> events = mWeekViewLoader.getEvents(loader.getId());
    events.clear();

    Account mAccount = AppUtils.getAccount(getContext());
    if (mAccount != null) {
        // fetch calendar colors
        final SparseIntArray mColors = new SparseIntArray();
        ContentResolver cr = getContext().getContentResolver();
        Cursor cursor = cr
                .query(CalendarContractWrapper.Calendars.CONTENT_URI(),
                        new String[]{
                                CalendarContractWrapper.Calendars._ID(),
                                CalendarContractWrapper.Calendars
                                        .CALENDAR_COLOR()}, null, null,
                        null);
        if (cursor != null) {
            while (cursor.moveToNext()) {
                int color = cursor.getInt(1);

                double lastContrast = ColorUtils.calculateContrast(color, mWeekView.getEventTextColor());
                //Log.d(TAG, String.format("color=%d %d %d, contrast=%f", Color.red(color), Color.green(color), Color.blue(color), lastContrast));

                while (lastContrast < 1.6) {
                    float[] hsv = new float[3];

                    Color.colorToHSV(color, hsv);
                    hsv[2] = Math.max(0f, hsv[2] - 0.033f); // darken
                    color = Color.HSVToColor(hsv);

                    lastContrast = ColorUtils.calculateContrast(color, mWeekView.getEventTextColor());
                    //Log.d(TAG, String.format("new color=%d %d %d, contrast=%f", Color.red(color), Color.green(color), Color.blue(color), lastContrast));

                    if (hsv[2] == 0) break;
                }

                mColors.put(cursor.getInt(0), color);
            }
            cursor.close();
        }


        if (data != null) {
            data.moveToFirst();
            data.moveToPrevious();
            while (data.moveToNext()) {

                boolean allDay = data.getInt(CalendarUtils.COLUMN_EVENT_ALL_DAY) == 1;

                Calendar startTime = Calendar.getInstance();
                if (allDay) {
                    startTime.setTimeZone(TimeZone.getTimeZone("UTC"));
                }
                startTime.setTimeInMillis(data.getLong(CalendarUtils.COLUMN_EVENT_DTSTART));

                Calendar endTime = Calendar.getInstance();
                if (allDay) {
                    endTime.setTimeZone(TimeZone.getTimeZone("UTC"));
                }
                endTime.setTimeInMillis(data.getLong(CalendarUtils.COLUMN_EVENT_DTEND));
                if (allDay && endTime.getTimeInMillis() % DateUtils.DAY_IN_MILLIS == 0) {
                    endTime.add(Calendar.MILLISECOND, -1);
                }

                WeekViewEvent event = new WeekViewEvent(data.getString(CalendarUtils.COLUMN_EVENT_ID),
                        data.getString(CalendarUtils.COLUMN_EVENT_TITLE),
                        data.getString(CalendarUtils.COLUMN_EVENT_LOCATION),
                        startTime,
                        endTime,
                        allDay);

                event.setColor(mColors.get(data.getInt(CalendarUtils.COLUMN_EVENT_CAL_ID)));

                events.add(event);
            }
        }
    }

    mWeekView.notifyDatasetChanged();
}
 
开发者ID:marunjar,项目名称:anewjkuapp,代码行数:82,代码来源:CalendarFragment2.java


示例19: onLoad

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public List<WeekViewEvent> onLoad(int periodIndex) {
    return getEvents(periodIndex);
}
 
开发者ID:marunjar,项目名称:anewjkuapp,代码行数:5,代码来源:CalendarFragment2.java


示例20: onEventLongPress

import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventLongPress(WeekViewEvent weekViewEvent, RectF rectF) {

}
 
开发者ID:adithya321,项目名称:Instincts-2k17,代码行数:5,代码来源:DayViewActivity.java



注:本文中的com.alamkanak.weekview.WeekViewEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RouteContext类代码示例发布时间:2022-05-22
下一篇:
Java Track类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap