@Override public void onPause() { super.onPause(); try { this.selectedDate = view.getDisplayedDate(); } catch (Exception e) { Log.i(TAG, "Catchable error in YearView", e); } }
@Override public void onResume() { super.onResume(); if (view == null) { view = (CustomYearDrawable) this.findViewById(R.id.year_view_custom); if (view == null) return; } int width = getWindowManager().getDefaultDisplay().getWidth(); int height = getWindowManager().getDefaultDisplay().getHeight(); if (width > height) { // Landscape view.initialise(selectedDate, CustomYearDrawable.LANDSCAPE); } else { // portrait view.initialise(selectedDate, CustomYearDrawable.PORTRAIT); } view.setOnTouchListener(this); }
/** Handles button Clicks */ @Override public void onClick(View clickedView) { int button = (int) ((Integer) clickedView.getTag()); switch (button) { case TODAY: view.setSelectedDate(new AcalDateTime()); view.invalidate(); break; case ADD: Bundle bundle = new Bundle(); bundle.putParcelable("DATE", this.selectedDate); Intent eventEditIntent = new Intent(this, EventEdit.class); eventEditIntent.putExtras(bundle); this.startActivity(eventEditIntent); break; case MONTH: this.finish(); break; default: Log.w(TAG, "Unrecognised button was pushed in MonthView."); } }