kopia lustrzana https://github.com/TeamNewPipe/NewPipe
made content scroll over thumbnail
rodzic
2e4e993967
commit
78b95f67eb
|
@ -84,6 +84,9 @@ public class VideoItemDetailFragment extends Fragment {
|
|||
private VideoInfo currentVideoInfo = null;
|
||||
private boolean showNextVideoItem = false;
|
||||
|
||||
|
||||
private View thumbnailWindow;
|
||||
|
||||
public interface OnInvokeCreateOptionsMenuListener {
|
||||
void createOptionsMenu();
|
||||
}
|
||||
|
@ -202,7 +205,7 @@ public class VideoItemDetailFragment extends Fragment {
|
|||
VideoInfoItemViewCreator videoItemViewCreator =
|
||||
new VideoInfoItemViewCreator(LayoutInflater.from(getActivity()));
|
||||
|
||||
ScrollView contentMainView = (ScrollView) activity.findViewById(R.id.detailMainContent);
|
||||
RelativeLayout textContentLayout = (RelativeLayout) activity.findViewById(R.id.detailTextContentLayout);
|
||||
ProgressBar progressBar = (ProgressBar) activity.findViewById(R.id.detailProgressBar);
|
||||
TextView videoTitleView = (TextView) activity.findViewById(R.id.detailVideoTitleView);
|
||||
TextView uploaderView = (TextView) activity.findViewById(R.id.detailUploaderView);
|
||||
|
@ -221,7 +224,7 @@ public class VideoItemDetailFragment extends Fragment {
|
|||
Button nextVideoButton = (Button) activity.findViewById(R.id.detailNextVideoButton);
|
||||
Button similarVideosButton = (Button) activity.findViewById(R.id.detailShowSimilarButton);
|
||||
|
||||
contentMainView.setVisibility(View.VISIBLE);
|
||||
textContentLayout.setVisibility(View.VISIBLE);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
if(!showNextVideoItem) {
|
||||
nextVideoRootFrame.setVisibility(View.GONE);
|
||||
|
@ -239,8 +242,6 @@ public class VideoItemDetailFragment extends Fragment {
|
|||
viewCountView.setText(
|
||||
String.format(
|
||||
res.getString(R.string.viewCountText), localisedViewCount));
|
||||
/*viewCountView.setText(localisedViewCount
|
||||
+ " " + activity.getString(R.string.viewSufix)); */
|
||||
|
||||
|
||||
thumbsUpView.setText(nf.format(info.like_count));
|
||||
|
@ -336,6 +337,7 @@ public class VideoItemDetailFragment extends Fragment {
|
|||
activity = (AppCompatActivity) getActivity();
|
||||
showNextVideoItem = PreferenceManager.getDefaultSharedPreferences(getActivity())
|
||||
.getBoolean(activity.getString(R.string.showNextVideo), true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -408,6 +410,19 @@ public class VideoItemDetailFragment extends Fragment {
|
|||
activity.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
ImageView thumbnailView = (ImageView) activity.findViewById(R.id.detailThumbnailView);
|
||||
thumbnailWindow = activity.findViewById(R.id.detailVideoThumbnailWindow);
|
||||
thumbnailView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
||||
// This is used to synchronize the thumbnailWindow inside the ScrollView with
|
||||
// the actual size of the thumbnail.
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||
Log.d(TAG, Integer.toString(right - left) + " : " + Integer.toString(bottom - top));
|
||||
RelativeLayout.LayoutParams newLayoutParams = new RelativeLayout.LayoutParams(right - left, bottom - top);
|
||||
thumbnailWindow.setLayoutParams(newLayoutParams);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
style="?android:attr/textAppearanceLarge"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/videoitem_detail">
|
||||
android:id="@+id/videoitem_detail"
|
||||
android:background="@color/background_gray">
|
||||
|
||||
<ProgressBar android:id="@+id/detailProgressBar"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -16,11 +17,23 @@
|
|||
android:layout_centerInParent="true"
|
||||
android:indeterminate="true"/>
|
||||
|
||||
<ImageView android:id="@+id/detailThumbnailView"
|
||||
android:contentDescription="@string/detailThumbnailViewDescription"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="centerInside"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@android:color/black"
|
||||
android:src="@drawable/dummy_thumbnail"/>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/detailMainContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="invisible">
|
||||
android:visibility="visible">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -30,25 +43,21 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView android:id="@+id/detailThumbnailView"
|
||||
android:contentDescription="@string/detailThumbnailViewDescription"
|
||||
<View android:id="@+id/detailVideoThumbnailWindow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="centerInside"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/dummy_thumbnail"/>
|
||||
android:layout_height="250dp"
|
||||
android:background="@android:color/transparent" />
|
||||
|
||||
<RelativeLayout
|
||||
<RelativeLayout android:id="@+id/detailTextContentLayout"
|
||||
android:visibility="invisible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/detailThumbnailView"
|
||||
android:layout_below="@id/detailVideoThumbnailWindow"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingLeft="5dp">
|
||||
android:paddingLeft="5dp"
|
||||
android:background="@color/background_gray">
|
||||
|
||||
<TextView android:id="@+id/detailVideoTitleView"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -151,59 +160,57 @@
|
|||
android:textSize="@dimen/text_video_description_size"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/detailNextVideoRootLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:layout_below="@id/detailDescriptionView" >
|
||||
|
||||
<TextView android:id="@+id/detailNextVideoTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="@dimen/text_video_upload_date_size"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@android:color/black"
|
||||
android:text="@string/nextVideoTitle"
|
||||
/>
|
||||
<FrameLayout
|
||||
android:id="@+id/detailNextVideoFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/detailNextVideoTitle"/>
|
||||
<Button
|
||||
android:id="@+id/detailNextVideoButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignTop="@id/detailNextVideoFrame"
|
||||
android:layout_alignBottom="@id/detailNextVideoFrame"
|
||||
android:background="?attr/selectableItemBackground"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<Button android:id="@+id/detailShowSimilarButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:layout_below="@id/detailNextVideoRootLayout"
|
||||
android:text="@string/showSimilarVideosButtonText"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/detailNextVideoRootLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:layout_below="@id/detailVideoInfo" >
|
||||
|
||||
<TextView android:id="@+id/detailNextVideoTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="@dimen/text_video_upload_date_size"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@android:color/black"
|
||||
android:text="@string/nextVideoTitle"
|
||||
/>
|
||||
|
||||
<RelativeLayout android:id="@+id/detailNextVidButtonAndContantLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/detailNextVideoTitle">
|
||||
<FrameLayout
|
||||
android:id="@+id/detailNextVideoFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<Button
|
||||
android:id="@+id/detailNextVideoButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignTop="@id/detailNextVideoFrame"
|
||||
android:layout_alignBottom="@id/detailNextVideoFrame"
|
||||
android:background="?attr/selectableItemBackground"/>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<Button android:id="@+id/detailShowSimilarButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:layout_below="@id/detailNextVideoRootLayout"
|
||||
android:text="@string/showSimilarVideosButtonText"/>
|
||||
</RelativeLayout>
|
||||
</ScrollView>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/playVideoButton"
|
||||
android:visibility="visible"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -211,4 +218,5 @@
|
|||
app:backgroundTint="@color/primaryColorYoutube"
|
||||
android:src="@drawable/ic_play_arrow_black"
|
||||
android:layout_margin="20dp"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -6,4 +6,5 @@
|
|||
<color name="durationBackground">#aa000000</color>
|
||||
<color name="durationText">#eeffffff</color>
|
||||
<color name="black_overlay">#66000000</color>
|
||||
<color name="background_gray">#EEEEEE</color>
|
||||
</resources>
|
Ładowanie…
Reference in New Issue