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 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()); }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case Constants.RequestCode.REQUEST_CODE_CHAGE_TEXT_TITLE: if (resultCode == Activity.RESULT_OK && data != null) { String content = data.getStringExtra(Constants.StringConstant.PARAMS_DATA); int color = data.getIntExtra(Constants.StringConstant.PARAMS_DATA1, Color.WHITE); config.setCountdownContent(content); config.setWidgetCountdownColor(color); tvCountdownContent.setText(content); tvCountdownContent.setTextColor(color); tvCountdown.setTextColor(color); } break; default: break; } }