From 72e08c04473be21e3c8257994bffc280d1aed35f Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Fri, 23 Oct 2015 23:08:01 +0200 Subject: [PATCH] fixed some layout bugs --- .../newpipe/VideoItemDetailFragment.java | 56 +++--- .../layout-land/fragment_videoitem_detail.xml | 21 ++- .../fragment_videoitem_detail.xml | 164 ++++++++++++++++++ .../res/layout/fragment_videoitem_detail.xml | 23 ++- 4 files changed, 222 insertions(+), 42 deletions(-) create mode 100644 app/src/main/res/layout-sw600dp/fragment_videoitem_detail.xml diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java b/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java index e4ea1f7f7..a578a6f01 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java @@ -242,16 +242,6 @@ public class VideoItemDetailFragment extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - try { - StreamingService streamingService = ServiceList.getService( - getArguments().getInt(STREAMING_SERVICE)); - extractorThread = new Thread(new ExtractorRunnable( - getArguments().getString(VIDEO_URL), streamingService.getExtractorClass(), this)); - autoPlayEnabled = getArguments().getBoolean(AUTO_PLAY); - extractorThread.start(); - } catch (Exception e) { - e.printStackTrace(); - } } @Override @@ -266,24 +256,38 @@ public class VideoItemDetailFragment extends Fragment { super.onActivityCreated(savedInstanceBundle); FloatingActionButton playVideoButton = (FloatingActionButton) getActivity().findViewById(R.id.playVideoButton); - if(PreferenceManager.getDefaultSharedPreferences(getActivity()) - .getBoolean(getString(R.string.leftHandLayout), false) && checkIfLandscape()) { - RelativeLayout.LayoutParams oldLayout = (RelativeLayout.LayoutParams) playVideoButton.getLayoutParams(); - RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); - layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); - layoutParams.setMargins(oldLayout.leftMargin, oldLayout.topMargin, oldLayout.rightMargin, oldLayout.rightMargin); - playVideoButton.setLayoutParams(layoutParams); - } + if(playVideoButton != null) { - playVideoButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - ActionBarHandler.getHandler().playVideo(); + try { + StreamingService streamingService = ServiceList.getService( + getArguments().getInt(STREAMING_SERVICE)); + extractorThread = new Thread(new ExtractorRunnable( + getArguments().getString(VIDEO_URL), streamingService.getExtractorClass(), this)); + autoPlayEnabled = getArguments().getBoolean(AUTO_PLAY); + extractorThread.start(); + } catch (Exception e) { + e.printStackTrace(); } - }); + + if (PreferenceManager.getDefaultSharedPreferences(getActivity()) + .getBoolean(getString(R.string.leftHandLayout), false) && checkIfLandscape()) { + RelativeLayout.LayoutParams oldLayout = (RelativeLayout.LayoutParams) playVideoButton.getLayoutParams(); + RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( + RelativeLayout.LayoutParams.WRAP_CONTENT, + RelativeLayout.LayoutParams.WRAP_CONTENT); + layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); + layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); + layoutParams.setMargins(oldLayout.leftMargin, oldLayout.topMargin, oldLayout.rightMargin, oldLayout.bottomMargin); + playVideoButton.setLayoutParams(layoutParams); + } + + playVideoButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ActionBarHandler.getHandler().playVideo(); + } + }); + } } public boolean checkIfLandscape() { diff --git a/app/src/main/res/layout-land/fragment_videoitem_detail.xml b/app/src/main/res/layout-land/fragment_videoitem_detail.xml index b420f96c6..1850c3c48 100644 --- a/app/src/main/res/layout-land/fragment_videoitem_detail.xml +++ b/app/src/main/res/layout-land/fragment_videoitem_detail.xml @@ -8,6 +8,12 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + + - - @@ -49,6 +50,7 @@ android:layout_height="100dp" android:paddingTop="25dp" android:paddingLeft="5dp" + android:paddingRight="5dp" android:layout_below="@id/detailVideoTitleView" android:layout_alignParentLeft="true" android:visibility="invisible" @@ -60,6 +62,7 @@ android:layout_below="@id/detailUploaderThumbnailView" android:layout_alignParentLeft="true" android:paddingLeft="6dp" + android:paddingRight="6dp" android:textAppearance="?android:attr/textAppearanceMedium" android:visibility="invisible" android:text="Herr von Gurken" /> @@ -123,6 +126,7 @@ android:layout_below="@id/detailUploaderView" android:layout_alignParentLeft="true" android:paddingLeft="6dp" + android:paddingRight="6dp" android:paddingTop="20dp" android:textAppearance="?android:attr/textAppearanceLarge" android:visibility="invisible" @@ -134,6 +138,7 @@ android:layout_below="@id/detailUploadDateView" android:layout_alignParentLeft="true" android:paddingLeft="6dp" + android:paddingRight="6dp" android:textAppearance="?android:attr/textAppearanceMedium" android:visibility="invisible" android:text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmodtempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. " @@ -155,5 +160,5 @@ android:layout_height="wrap_content" app:backgroundTint="@color/primaryColorYoutube" android:src="@drawable/ic_play_arrow_black" - android:layout_margin="15pt"/> + android:layout_margin="16dip"/> \ No newline at end of file diff --git a/app/src/main/res/layout-sw600dp/fragment_videoitem_detail.xml b/app/src/main/res/layout-sw600dp/fragment_videoitem_detail.xml new file mode 100644 index 000000000..1850c3c48 --- /dev/null +++ b/app/src/main/res/layout-sw600dp/fragment_videoitem_detail.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_videoitem_detail.xml b/app/src/main/res/layout/fragment_videoitem_detail.xml index 5c9f0b478..3d802b904 100644 --- a/app/src/main/res/layout/fragment_videoitem_detail.xml +++ b/app/src/main/res/layout/fragment_videoitem_detail.xml @@ -9,19 +9,19 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + + - - + android:layout_height="wrap_content"> @@ -71,6 +74,7 @@ android:layout_below="@id/detailVideoTitleView" android:layout_alignParentRight="true" android:paddingRight="16dp" + android:paddingLeft="16dp" android:textAppearance="?android:attr/textAppearanceLarge" android:visibility="invisible" android:text="drölf views" /> @@ -81,6 +85,7 @@ android:layout_below="@id/detailViewCountView" android:layout_alignParentRight="true" android:paddingRight="16dp" + android:paddingLeft="16dp" android:textAppearance="?android:attr/textAppearanceMedium" android:visibility="invisible" android:text="-5.000" /> @@ -116,6 +121,7 @@ android:layout_below="@id/detailUploaderView" android:layout_alignParentLeft="true" android:paddingLeft="6dp" + android:paddingRight="6dp" android:paddingTop="20dp" android:textAppearance="?android:attr/textAppearanceLarge" android:visibility="invisible" @@ -127,6 +133,7 @@ android:layout_below="@id/detailUploadDateView" android:layout_alignParentLeft="true" android:paddingLeft="6dp" + android:paddingRight="6dp" android:textAppearance="?android:attr/textAppearanceMedium" android:visibility="invisible" android:text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmodtempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. " @@ -147,5 +154,5 @@ android:layout_height="wrap_content" app:backgroundTint="@color/primaryColorYoutube" android:src="@drawable/ic_play_arrow_black" - android:layout_margin="15pt"/> + android:layout_margin="16dip"/> \ No newline at end of file