diff --git a/touch/build.gradle b/touch/build.gradle index 655e1ff8..8031977e 100644 --- a/touch/build.gradle +++ b/touch/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" + compileSdkVersion 26 + buildToolsVersion "26.0.1" defaultConfig { applicationId "de.nicidienase.chaosflix" minSdkVersion 22 - targetSdkVersion 25 + targetSdkVersion 26 versionCode 5 versionName "0.2.0" multiDexEnabled true @@ -40,17 +40,23 @@ android { lintOptions { abortOnError false } + dataBinding { + enabled = true + } } dependencies { implementation project(':common') - implementation 'com.android.support:support-v4:25.4.0' - implementation 'com.android.support:recyclerview-v7:25.4.0' - implementation 'com.android.support:cardview-v7:25.4.0' + implementation 'com.android.support:support-v4:26.1.0' + implementation 'com.android.support:recyclerview-v7:26.1.0' + implementation 'com.android.support:cardview-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' + implementation "android.arch.lifecycle:runtime:1.0.0" + implementation "android.arch.lifecycle:extensions:1.0.0-alpha9-1" + annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha9-1" compile fileTree(include: ['*.jar'], dir: 'libs') - compile 'com.android.support:design:25.4.0' + compile 'com.android.support:design:26.1.0' compile 'com.google.android.exoplayer:exoplayer:r2.5.2' compile 'com.squareup.picasso:picasso:2.5.2' diff --git a/touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/EventDetailsFragment.java b/touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/EventDetailsFragment.java index 3e98f0b1..58c1d970 100644 --- a/touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/EventDetailsFragment.java +++ b/touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/EventDetailsFragment.java @@ -3,9 +3,6 @@ package de.nicidienase.chaosflix.touch.fragments; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; -import android.support.design.widget.AppBarLayout; -import android.support.design.widget.CollapsingToolbarLayout; -import android.support.design.widget.FloatingActionButton; import android.support.v4.app.Fragment; import android.support.v7.widget.Toolbar; import android.transition.Transition; @@ -17,16 +14,13 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; import com.squareup.picasso.Callback; import com.squareup.picasso.Picasso; -import butterknife.BindView; -import butterknife.ButterKnife; import de.nicidienase.chaosflix.R; import de.nicidienase.chaosflix.common.entities.recording.Event; +import de.nicidienase.chaosflix.databinding.FragmentEventDetailsNewBinding; public class EventDetailsFragment extends Fragment { private static final String TAG = EventDetailsFragment.class.getSimpleName(); @@ -35,25 +29,6 @@ public class EventDetailsFragment extends Fragment { private OnEventDetailsFragmentInteractionListener mListener; private Event mEvent; - @BindView(R.id.collapsing_toolbar) - CollapsingToolbarLayout collapsingToolbar; - @BindView(R.id.anim_toolbar) - Toolbar mToolbar; - @BindView(R.id.appbar) - AppBarLayout mAppBarLayout; - @BindView(R.id.title_text) - TextView mTitleText; - @BindView(R.id.subtitle_text) - TextView mSubtitleText; - @BindView(R.id.speaker_text) - TextView mSpeakerText; - @BindView(R.id.thumb_image) - ImageView mThumbImage; - @BindView(R.id.description_text) - TextView mDescriptionText; - @BindView(R.id.play_fab) - FloatingActionButton mPlayButton; - private boolean appBarExpanded; public EventDetailsFragment() { @@ -93,51 +68,31 @@ public class EventDetailsFragment extends Fragment { @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - ButterKnife.bind(this,view); + FragmentEventDetailsNewBinding binding = FragmentEventDetailsNewBinding.bind(view); + binding.setEvent(mEvent); - mPlayButton.setOnClickListener(v -> { + binding.playFab.setOnClickListener(v -> { play(); }); - view.setTransitionName(getString(R.string.card)); - if(mListener != null) - mListener.setActionbar(mToolbar); - collapsingToolbar.setTitle(mEvent.getTitle()); -// mToolbar.setTitle(mEvent.getTitle()); - mTitleText.setText(mEvent.getTitle()); + mListener.setActionbar(binding.animToolbar); - mAppBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> { + binding.appbar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> { double v = (double) Math.abs(verticalOffset) / appBarLayout.getTotalScrollRange(); - Log.d(TAG,"Offset changed: " + v); if(appBarExpanded ^ v > 0.8){ -// invalidateOptionsMenu(); if(mListener != null) mListener.onToolbarStateChange(); appBarExpanded = v > 0.8; - collapsingToolbar.setTitleEnabled(appBarExpanded); + binding.collapsingToolbar.setTitleEnabled(appBarExpanded); } }); - if(mEvent.getSubtitle() != null && mEvent.getSubtitle().length() > 0){ - mSubtitleText.setText(mEvent.getSubtitle()); - } else { - mSubtitleText.setVisibility(View.GONE); - } - mSpeakerText.setText( - android.text.TextUtils.join(", ",mEvent.getPersons())); - StringBuilder sb = new StringBuilder(); - sb.append(mEvent.getDescription()) - .append("\n") - .append("\nreleased at: ").append(mEvent.getReleaseDate()) - .append("\nTags: ").append(android.text.TextUtils.join(", ", mEvent.getTags())); - mDescriptionText.setText(sb); - - mThumbImage.setTransitionName(getString(R.string.thumbnail)+mEvent.getApiID()); + binding.thumbImage.setTransitionName(getString(R.string.thumbnail)+mEvent.getApiID()); Picasso.with(getContext()) .load(mEvent.getThumbUrl()) .noFade() - .into(mThumbImage, new Callback() { + .into(binding.thumbImage, new Callback() { @Override public void onSuccess() { startPostponedEnterTransition(); diff --git a/touch/src/main/res/layout/fragment_event_details_new.xml b/touch/src/main/res/layout/fragment_event_details_new.xml index 95baa71b..ba7ccd0a 100644 --- a/touch/src/main/res/layout/fragment_event_details_new.xml +++ b/touch/src/main/res/layout/fragment_event_details_new.xml @@ -1,128 +1,139 @@ - + + + + + - - - - - - - - - - - - - - - - - + android:fitsSystemWindows="true"> - + + + + + + + + + + + + + + + + + app:layout_behavior="@string/appbar_scrolling_view_behavior"> - + - + - + - - - + - + + + - \ No newline at end of file + + + + + \ No newline at end of file