@Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { // Do something with the date chosen by the user Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, monthOfYear); calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); // Set expiration date to be 8:15am, so that the warning fires up in every case! // This prevents a notification not showing the given day, for example, // if warning days are set to 3, and a notification should show in 9am, and // the items expiration date is set in the afternoon... you get the point :D calendar.set(Calendar.HOUR_OF_DAY, 7); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); // save the item and change the date item.setExpirationDate(calendar.getTimeInMillis() / 1000); item.setEditTimestamp(Calendar.getInstance().getTimeInMillis()); item.save(); TransitionManager.beginDelayedTransition((ViewGroup) containerView, new ChangeText()); textExpiration .setText(application.dateFormat.format(new Date(item.getExpirationDate() * 1000))); }
@OnClick(R.id.image_quantity_delete) public void deleteQuantity(View view) { // show/hide the views TransitionManager.beginDelayedTransition((ViewGroup) containerView, new ChangeBounds()); imageQuantity.setVisibility(View.GONE); textQuantityLabel.setVisibility(View.GONE); textQuantity.setVisibility(View.GONE); imageQuantityDelete.setVisibility(View.GONE); spinnerQuantityType.setVisibility(View.GONE); textQuantityAdd.setVisibility(View.VISIBLE); // delete the actual quantity to the item item.setTypeOfQuantity(-1); item.setQuantity(""); item.setEditTimestamp(Calendar.getInstance().getTimeInMillis()); item.save(); // update the values updateQuantityValue(); updateQuantityType(); }
@Override public void onClick(View v) { roomEncrypted = true; Log.d(LOG_TAG, "Room encrypted: " + String.valueOf(roomEncrypted)); // mark element as 'active' TransitionManager.beginDelayedTransition(startingScene); roomEncryptionDisabled.setBackgroundColor(getResources().getColor(R.color.white)); roomEncryptionDisabledText.setTextColor(getResources().getColor(R.color.textheadline)); roomEncryptionActived.setBackgroundColor(getResources().getColor(R.color.darkblue)); roomEncryptionActivatedText.setTextColor(getResources().getColor(R.color.white)); // show password input roomPasswordContainer.setVisibility(View.VISIBLE); }
@Override public void onClick(View v) { roomEncrypted = false; Log.d(LOG_TAG, "Room encrypted: " + String.valueOf(roomEncrypted)); // mark element as 'active' TransitionManager.beginDelayedTransition(startingScene); roomEncryptionDisabled.setBackgroundColor(getResources().getColor(R.color.darkblue)); roomEncryptionDisabledText.setTextColor(getResources().getColor(R.color.white)); roomEncryptionActived.setBackgroundColor(getResources().getColor(R.color.white)); roomEncryptionActivatedText.setTextColor(getResources().getColor(R.color.textheadline)); // hide password input roomPasswordContainer.setVisibility(View.INVISIBLE); }
private void showQuantity() { // show/hide the views TransitionManager.beginDelayedTransition((ViewGroup) containerView, new ChangeBounds()); textQuantityAdd.setVisibility(View.GONE); imageQuantity.setVisibility(View.VISIBLE); textQuantityLabel.setVisibility(View.VISIBLE); textQuantity.setVisibility(View.VISIBLE); imageQuantityDelete.setVisibility(View.VISIBLE); spinnerQuantityType.setVisibility(View.VISIBLE); AnimationsController.fadeInAndScale(textQuantity); AnimationsController.fadeInAndScale(imageQuantityDelete); AnimationsController.fadeInAndScale(spinnerQuantityType); }
private void refreshViewState() { TransitionManager.beginDelayedTransition((ViewGroup) containerView, new ChangeBounds()); if (application.authState.isAuthenticated()) { textLoginDescription.setVisibility(View.GONE); buttonFacebook.setVisibility(View.GONE); buttonTwitter.setVisibility(View.GONE); buttonGplus.setVisibility(View.GONE); buttonLogout.setVisibility(View.VISIBLE); textLastSync.setVisibility(View.VISIBLE); textItemCount.setVisibility(View.VISIBLE); textNotesCount.setVisibility(View.VISIBLE); textRandomStat.setVisibility(View.VISIBLE); } else { // set the app profile image setProfileImage(null, R.mipmap.ic_launcher); textUsername.setText( application.getString(R.string.menu_login).toUpperCase(Locale.ENGLISH)); textLoginDescription.setVisibility(View.VISIBLE); buttonFacebook.setVisibility(View.VISIBLE); buttonTwitter.setVisibility(View.VISIBLE); buttonGplus.setVisibility(View.VISIBLE); buttonLogout.setVisibility(View.GONE); textLastSync.setVisibility(View.GONE); textItemCount.setVisibility(View.GONE); textNotesCount.setVisibility(View.GONE); textRandomStat.setVisibility(View.GONE); } }
/** * Starts an error-transition for the handed TextView. * @param errorTextView TextView we want to show an error. */ private void showError(TextView errorTextView) { TransitionManager.beginDelayedTransition(startingScene); errorTextView.setVisibility(View.VISIBLE); }
/** * Undos an error-transition for the handed TextView. * @param errorTextView TextView we want to show an error. */ private void hideError(TextView errorTextView) { TransitionManager.beginDelayedTransition(startingScene); errorTextView.setVisibility(View.INVISIBLE); }
@Override public void onCheckedChanged(final RadioGroup group, int checkedId) { switch (checkedId) { case R.id.select_scene_1: { // You can start an automatic transition with TransitionManager.go(). TransitionManager.go(mScene1); break; } case R.id.select_scene_2: { TransitionSet set = new TransitionSet(); Slide slide = new Slide(Gravity.LEFT); slide.addTarget(R.id.transition_title); set.addTransition(slide); set.addTransition(new ChangeBounds()); set.addTransition(new ChangeImageTransform()); set.setOrdering(TransitionSet.ORDERING_TOGETHER); set.setDuration(350); TransitionManager.go(mScene2, set); break; } case R.id.select_scene_3: { // You can also start a transition with a custom TransitionManager. mTransitionManagerForScene3.transitionTo(mScene3); break; } case R.id.select_scene_4: { // Alternatively, transition can be invoked dynamically without a Scene. // For this, we first call TransitionManager.beginDelayedTransition(). TransitionManager.beginDelayedTransition(mSceneRoot, new ChangeBounds()); // Then, we can just change view properties as usual. View square = mSceneRoot.findViewById(R.id.transition_square); ViewGroup.LayoutParams params = square.getLayoutParams(); int newSize = getResources().getDimensionPixelSize(R.dimen.square_size_expanded); params.width = newSize; params.height = newSize; square.setLayoutParams(params); square.invalidate(); break; } } }