@Override public void restoreData(Intent intent) { long id = intent.getLongExtra(CallManager.BUNDLE_DETAILS, -1); advertisement = advertisementRepository.selectAdvertisementById(id); detailsView.initializeToolbar(advertisement.getFullAddress()); }
@Override public void initialize(Context context, ActivityDetailsBinding binding) { /* STORES CONTEXT */ this.context = context; /* STORES BINDING */ this.binding = binding; /* INITIALIZE VIEWS */ binding.setAdvertisement(advertisement); Picasso.with(context) .load(advertisement.getImageLarge()) .placeholder(R.mipmap.ic_image) .centerCrop() .fit() .into(binding.ivAdvertisement); binding.svActivityDetails.setScrollViewCallbacks(new ObservableScrollListener()); ScrollUtils.addOnGlobalLayoutListener(binding.getRoot(), new GlobalLayoutListener()); /* DEFINES VARIABLES USED TO CREATE TOOLBAR ANIMATION ON SCROLL */ flexibleSpaceHeight = context.getResources().getDimensionPixelSize(R.dimen.activity_details_image_height); toolbarColor = ContextCompat.getColor(context, R.color.color_primary); titleColor = ContextCompat.getColor(context, R.color.white); statusBarColor = ContextCompat.getColor(context, R.color.black); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { /* CREATES THE LINK TO THE TRANSITION ANIMATION */ ViewCompat.setTransitionName(binding.ivAdvertisement, CallManager.TRANSITION_IMAGE); ViewCompat.setTransitionName( binding.viewAdvertisementInfo.rlViewAdvertisementInfo, CallManager.TRANSITION_DETAILS); /* MAKES STATUS BAR TRANSPARENT */ detailsView.initializeStatusBar(); } }