Search in sources :

Example 1 with CalendarDay

use of me.zhanghai.android.douya.calendar.info.CalendarDay in project Douya by DreaminginCodeZH.

the class CalendarFragment method onActivityCreated.

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    activity.setSupportActionBar(mToolbar);
    TintHelper.onSetSupportActionBar(mToolbar);
    // TODO
    CalendarDay calendarDay = CalendarDay.SAMPLE;
    mDateText.setText(calendarDay.getDateText(activity));
    mDayOfWeekText.setText(calendarDay.getDayOfWeekText(activity));
    mChineseCalendarDateText.setText(calendarDay.getChineseCalendarDateText());
    mDayOfMonthText.setText(calendarDay.getDayOfMonthText(activity));
    mDayOfMonthText.setTextColor(calendarDay.getThemedDayOfMonthColor(mDayOfMonthText.getContext()));
    mCommentText.setText(calendarDay.comment);
    mMovieLayout.setOnClickListener(view -> UriHandler.open(calendarDay.url, view.getContext()));
    mTitleText.setText(calendarDay.getTitleText(activity));
    mRatingBar.setRating(calendarDay.getRatingBarRating());
    mRatingText.setText(calendarDay.getRatingText(activity));
    mEventText.setText(calendarDay.getEventText(activity));
    ImageUtils.loadImage(mPosterImage, calendarDay.poster);
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) CalendarDay(me.zhanghai.android.douya.calendar.info.CalendarDay)

Example 2 with CalendarDay

use of me.zhanghai.android.douya.calendar.info.CalendarDay in project Douya by DreaminginCodeZH.

the class CalendarAppWidgetProvider method onUpdate.

@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
    CalendarDay calendarDay = CalendarDay.SAMPLE;
    RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.calendar_appwidget);
    views.setTextViewText(R.id.date, calendarDay.getDateText(context));
    views.setTextViewText(R.id.day_of_week, calendarDay.getDayOfWeekText(context));
    views.setTextViewText(R.id.chinese_calendar_date, calendarDay.getChineseCalendarDateText());
    views.setTextViewText(R.id.day_of_month, calendarDay.getDayOfMonthText(context));
    views.setTextColor(R.id.day_of_month, calendarDay.getDayOfMonthColor(context));
    views.setTextViewText(R.id.comment, calendarDay.comment);
    PendingIntent moviePendingIntent = PendingIntent.getActivity(context, calendarDay.url.hashCode(), UriHandlerActivity.makeIntent(calendarDay.url, context), PendingIntent.FLAG_UPDATE_CURRENT);
    views.setOnClickPendingIntent(R.id.movie, moviePendingIntent);
    views.setTextViewText(R.id.title, calendarDay.getTitleText(context));
    views.setProgressBar(R.id.rating, calendarDay.getRatingProgressBarMax(), calendarDay.getProgressRatingBarProgress(), false);
    views.setTextViewText(R.id.rating_text, calendarDay.getRatingText(context));
    views.setTextViewText(R.id.event, calendarDay.getEventText(context));
    GlideApp.with(context).asBitmap().load(calendarDay.poster).into(sPosterTarget.prepare(views, context, appWidgetIds));
    appWidgetManager.updateAppWidget(appWidgetIds, views);
}
Also used : RemoteViews(android.widget.RemoteViews) PendingIntent(android.app.PendingIntent) CalendarDay(me.zhanghai.android.douya.calendar.info.CalendarDay)

Aggregations

CalendarDay (me.zhanghai.android.douya.calendar.info.CalendarDay)2 PendingIntent (android.app.PendingIntent)1 RemoteViews (android.widget.RemoteViews)1 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)1