@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = DataBindingUtil.setContentView(this, R.layout.activity_project_details); ButterKnife.bind(this); KickMaterialApp.component.inject(this); binding.setProject(projectDetailsField.observable()); supportPostponeEnterTransition(); handleArguments(); injectViewsAndSetUpToolbar(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); // Hide default toolbar title binding.scrollView.addCallbacks(this); minTitlesMarginTop = ViewUtils.dpToPx(32, getApplicationContext()); maxTitlesMarginTop = getResources().getDimensionPixelSize(R.dimen.titles_container_margin_top) - getResources().getDimensionPixelSize(R.dimen.status_bar_height); maxTitlesMarginLeft = ViewUtils.dpToPx(32, getApplicationContext()); maxTitlePaddingRight = ViewUtils.dpToPx(72, getApplicationContext()); maxParallaxValue = getResources().getDimensionPixelSize(R.dimen.project_details_photo_height) / 3; titleFontMaxSize = getResources().getDimensionPixelSize(R.dimen.font_21); titleFontMinSize = getResources().getDimensionPixelSize(R.dimen.font_16); imageHeight = getResources().getDimensionPixelSize(R.dimen.project_details_photo_height); imageWidth = (int) (imageHeight * ProjectsAdapter.IMAGE_RATIO); binding.detailsContainer.startAnimation( AnimationUtils.loadAnimation(ProjectDetailsActivity.this, R.anim.slide_from_bottom)); loadProjectData(); launchPostTransitionAnimations(); }
private void loadProjectData() { ViewUtils.setTextOrClear( binding.projectSubtitleTv, getString(R.string.project_details_made_by, project.getAuthorName())); if (LUtils.hasL()) { animateAlphaAfterTransition(binding.projectSubtitleTv); } binding.projectBackingProgress.setText( project.isFunded() ? R.string.funded : R.string.backing_in_progress); binding.projectItemBigProgressSb.setProgress((int) project.getPercentProgress()); ProjectsAdapter.setProjectDetailsInfo( binding.projectItemBigGatheredMoneyTv, binding.projectItemBigPledgedOfTv, binding.projectItemBigDaysLeft, binding.projectItemTimeLeftTypeTv, project); // TODO: animate elevation on scroll. ViewCompat.setElevation( binding.detailsContainer, ViewUtils.convertDpToPixel(4, ProjectDetailsActivity.this)); loadProjectPhoto(); }
@OnClick(R.id.read_more_btn) public void readMorePressed(View view) { int MAX_DESCRIPTION_LINES = 1000; binding.projectDescriptionTv.setMaxLines(MAX_DESCRIPTION_LINES); ViewUtils.showView(view, false); // showWebView(project.getProjectUrl()); }
@OnClick(R.id.play_video_btn) public void playVideo() { if (projectDetails == null) { ViewUtils.showToast("Getting project details failed. Retrying"); postProjectDetails(); } else { VideoActivity.showActivity(this, projectDetails); } }
private void showRewardList() { if (projectDetails == null) { ViewUtils.showToast("Getting rewards failed. Retrying"); postProjectDetails(); } else { RewardsListActivity.launch(this, projectDetails, binding.playVideoBtn); // showWebView(project.getPledgeUrl()); } }