1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-25 12:32:31 +01:00

put progressbar on top of thumbnail and made it red

This commit is contained in:
Christian Schabesberger 2015-12-09 22:14:22 +01:00
parent 37d9be9095
commit 074963aee0
7 changed files with 235 additions and 86 deletions

View File

@ -25,7 +25,7 @@
<activity
android:name=".VideoItemDetailActivity"
android:label="@string/title_videoitem_detail"
android:theme="@style/DetailViewTheme">
android:theme="@style/AppTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".VideoItemListActivity" />

View File

@ -44,7 +44,6 @@ import java.util.Vector;
import org.schabi.newpipe.services.VideoExtractor;
import org.schabi.newpipe.services.ServiceList;
import org.schabi.newpipe.services.StreamingService;
import org.schabi.newpipe.views.DetailScrollView;
/**
@ -442,16 +441,6 @@ public class VideoItemDetailFragment extends Fragment {
}
});
DetailScrollView scrollView = (DetailScrollView) activity.findViewById(R.id.detailMainContent);
scrollView.setOnScrollViewListener(new DetailScrollView.OnScrollViewListener() {
// This is used to make the thumbnailView move half the speed than the content does
// while scrolling.
@Override
public void onScrollChanged(DetailScrollView v, int l, int t, int oldl, int oldt) {
//Log.d(TAG, Integer.toString(l) + " : " + Integer.toString(t));
}
});
}
}

View File

@ -1,56 +0,0 @@
package org.schabi.newpipe.views;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;
/**
* Created by the-scrabi on 02.12.15.
*
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* DetailScrollView.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class DetailScrollView extends ScrollView {
OnScrollViewListener mOnScrollViewListener = null;
public DetailScrollView(Context context) {
super(context);
}
public DetailScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public DetailScrollView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public interface OnScrollViewListener {
void onScrollChanged( DetailScrollView v, int l, int t, int oldl, int oldt );
}
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
mOnScrollViewListener.onScrollChanged(this, l, t, oldl, oldt);
super.onScrollChanged(l, t, oldl, oldt);
}
public void setOnScrollViewListener(OnScrollViewListener listener) {
mOnScrollViewListener = listener;
}
}

View File

@ -0,0 +1,226 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".VideoItemDetailFragment"
android:textIsSelectable="true"
style="?android:attr/textAppearanceLarge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/videoitem_detail"
android:background="@color/background_gray">
<ImageView android:id="@+id/detailThumbnailView"
android:contentDescription="@string/detailThumbnailViewDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="@android:color/black"
android:src="@drawable/dummy_thumbnail_dark"/>
<ScrollView
android:id="@+id/detailMainContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/detailVideoThumbnailWindowLayout"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="?attr/selectableItemBackground">
<ProgressBar android:id="@+id/detailProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminate="true"
android:indeterminateTint="@color/primaryColorDarkYoutube"
android:indeterminateTintMode="src_in"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/playVideoButton"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
app:backgroundTint="@color/primaryColorYoutube"
android:src="@drawable/ic_play_arrow_black"
android:layout_margin="20dp"/>
<Button
android:id="@+id/detailVideoThumbnailWindowBackgroundButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"/>
</RelativeLayout>
<RelativeLayout android:id="@+id/detailTextContentLayout"
android:visibility="invisible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:layout_below="@id/detailVideoThumbnailWindowLayout"
android:background="@color/background_gray">
<TextView android:id="@+id/detailVideoTitleView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold"
android:paddingBottom="3dp"
android:textSize="@dimen/text_video_title_size"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<ImageView android:id="@+id/detailUploaderThumbnailView"
android:contentDescription="@string/detailUploaderThumbnailViewDescription"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_below="@id/detailVideoTitleView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="@drawable/buddy" />
<TextView android:id="@+id/detailUploaderView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/detailUploaderThumbnailView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold"
android:textSize="@dimen/text_video_uploader_size"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView android:id="@+id/detailViewCountView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="3dp"
android:layout_below="@id/detailVideoTitleView"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:textSize="@dimen/text_video_views_size"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView android:id="@+id/detailThumbsDownCountView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/detailViewCountView"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:textSize="@dimen/text_video_like_size"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView android:id="@+id/detailThumbsDownImgView"
android:contentDescription="@string/detailThumbsDownImgViewDescription"
android:layout_width="30dp"
android:layout_height="15dp"
android:layout_below="@id/detailViewCountView"
android:layout_toLeftOf="@id/detailThumbsDownCountView"
android:layout_toStartOf="@id/detailThumbsDownCountView"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:src="@drawable/thumbs_down" />
<TextView android:id="@+id/detailThumbsUpCountView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/detailViewCountView"
android:layout_toLeftOf="@id/detailThumbsDownImgView"
android:layout_toStartOf="@id/detailThumbsDownImgView"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:textSize="@dimen/text_video_like_size"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<ImageView android:id="@+id/detailThumbsUpImgView"
android:contentDescription="@string/detailThumbsUpImgViewDescription"
android:layout_width="30dp"
android:layout_height="15dp"
android:layout_below="@id/detailViewCountView"
android:layout_toLeftOf="@id/detailThumbsUpCountView"
android:layout_toStartOf="@id/detailThumbsUpImgView"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:src="@drawable/thumbs_up" />
<TextView android:id="@+id/detailUploadDateView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/detailUploaderView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textSize="@dimen/text_video_upload_date_size"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView android:id="@+id/detailDescriptionView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/detailUploadDateView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
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>
</ScrollView>
</RelativeLayout>

View File

@ -11,12 +11,6 @@
android:id="@+id/videoitem_detail"
android:background="@color/background_gray">
<ProgressBar android:id="@+id/detailProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminate="true"/>
<ImageView android:id="@+id/detailThumbnailView"
android:contentDescription="@string/detailThumbnailViewDescription"
android:layout_width="match_parent"
@ -29,8 +23,7 @@
android:background="@android:color/black"
android:src="@drawable/dummy_thumbnail_dark"/>
<org.schabi.newpipe.views.DetailScrollView
<ScrollView
android:id="@+id/detailMainContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -46,6 +39,12 @@
android:layout_height="250dp"
android:background="?attr/selectableItemBackground">
<ProgressBar android:id="@+id/detailProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminate="true"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/playVideoButton"
android:visibility="invisible"
@ -221,5 +220,5 @@
android:text="@string/showSimilarVideosButtonText"/>
</RelativeLayout>
</RelativeLayout>
</org.schabi.newpipe.views.DetailScrollView>
</ScrollView>
</RelativeLayout>

View File

@ -9,11 +9,6 @@
<item name="android:colorAccent">@color/accentColorYoutube</item>
</style>
<style name="DetailViewTheme" parent="AppTheme" >
<item name="colorAccent">@color/primaryColorDarkYoutube</item>
<item name="android:colorAccent">@color/primaryColorDarkYoutube</item>
</style>
<style name="NewPipeActionbarTheme" parent="Widget.AppCompat.Light.ActionBar.Solid" >
<item name="android:displayOptions">showHome</item>
<item name="displayOptions">showHome</item>

View File

@ -8,10 +8,6 @@
<item name="colorAccent">@color/accentColorYoutube</item>
</style>
<style name="DetailViewTheme" parent="AppTheme" >
<item name="colorAccent">@color/primaryColorDarkYoutube</item>
</style>
<style name="NewPipeActionbarTheme" parent="Widget.AppCompat.Light.ActionBar.Solid" >
<item name="android:displayOptions">showHome</item>
<item name="displayOptions">showHome</item>