@Override public void onTimeSet(RadialPickerLayout view, int hourOfDay, int minute) { calendar.set(Calendar.HOUR_OF_DAY, hourOfDay); calendar.set(Calendar.MINUTE, minute); config.setCountdownTimestamp(calendar.getTimeInMillis()); tvCountdown.setTime(config.getCountdownTimestamp()); }
@Override public void onDateSet(DatePickerDialog datePickerDialog, int year, int month, int day) { calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month); calendar.set(Calendar.DAY_OF_MONTH, day); config.setCountdownTimestamp(calendar.getTimeInMillis()); tpd.setCloseOnSingleTapMinute(false); tpd.show(getFragmentManager(), TAG); tvCountdown.setTime(config.getCountdownTimestamp()); }
private void initUI() { ImageView ivBackground = (ImageView) mRootLayout.findViewById(R.id.iv_background); WallpaperUtils.showWallpaper(getActivity(), ivBackground, mDao.getCurrent()); tvCountdownContent = (TextView) mRootLayout.findViewById(R.id.tv_countdown_content); tvCountdown = (CountdownTextView) mRootLayout.findViewById(R.id.tv_countdown_time); tvCountdownContent.setText(config.getCountdownContent()); tvCountdown.setTime(config.getCountdownTimestamp()); tvCountdownContent.setTextColor(config.getWidgetCountdownColor()); tvCountdown.setTextColor(config.getWidgetCountdownColor()); tvCountdown.setOnClickListener(this); tvCountdownContent.setOnClickListener(this); mRootLayout.findViewById(R.id.tv_enable).setOnClickListener(this); mRootLayout.findViewById(R.id.tv_disable).setOnClickListener(this); }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.tv_enable: config.setWidgetCountdownEnable(true); getActivity().finish(); break; case R.id.tv_disable: config.setWidgetCountdownEnable(false); getActivity().finish(); break; case R.id.tv_countdown_content: Intent intent = new Intent(getActivity(), CommentActivity.class); intent.putExtra(Constants.StringConstant.PARAMS_DATA, config.getCountdownContent()); intent.putExtra(Constants.StringConstant.PARAMS_DATA1, config.getWidgetCountdownColor()); startActivityForResult(intent, Constants.RequestCode.REQUEST_CODE_CHAGE_TEXT_TITLE); break; case R.id.tv_countdown_time: calendar.setTimeInMillis(config.getCountdownTimestamp()); dpd = DatePickerDialog.newInstance( this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), false); tpd = TimePickerDialog.newInstance( this, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), false, false); dpd.setYearRange(Constants.CommonValue.FIRST_YEAR, Constants.CommonValue.LAST_YEAR); dpd.setCloseOnSingleTapDay(false); dpd.show(getFragmentManager(), TAG); break; default: break; } }