fixed some layout bugs

This commit is contained in:
Christian Schabesberger 2015-10-23 23:08:01 +02:00
parent 173eaa8cf8
commit 72e08c0447
4 changed files with 222 additions and 42 deletions

View File

@ -242,16 +242,6 @@ public class VideoItemDetailFragment extends Fragment {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(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 @Override
@ -266,24 +256,38 @@ public class VideoItemDetailFragment extends Fragment {
super.onActivityCreated(savedInstanceBundle); super.onActivityCreated(savedInstanceBundle);
FloatingActionButton playVideoButton = (FloatingActionButton) getActivity().findViewById(R.id.playVideoButton); FloatingActionButton playVideoButton = (FloatingActionButton) getActivity().findViewById(R.id.playVideoButton);
if(PreferenceManager.getDefaultSharedPreferences(getActivity()) if(playVideoButton != null) {
.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);
}
playVideoButton.setOnClickListener(new View.OnClickListener() { try {
@Override StreamingService streamingService = ServiceList.getService(
public void onClick(View v) { getArguments().getInt(STREAMING_SERVICE));
ActionBarHandler.getHandler().playVideo(); 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() { public boolean checkIfLandscape() {

View File

@ -8,6 +8,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ProgressBar android:id="@+id/detailProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminate="true"/>
<ScrollView <ScrollView
android:id="@+id/videoitem_detail" android:id="@+id/videoitem_detail"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -16,15 +22,9 @@
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:padding="16dp"> android:padding="16dp">
<ProgressBar android:id="@+id/detailProgressBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:indeterminate="true"/>
<ImageView android:id="@+id/detailThumbnailView" <ImageView android:id="@+id/detailThumbnailView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -40,6 +40,7 @@
android:layout_below="@id/detailThumbnailView" android:layout_below="@id/detailThumbnailView"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:paddingLeft="6dp" android:paddingLeft="6dp"
android:paddingRight="6dp"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Bla blabla !!!" android:text="Bla blabla !!!"
android:visibility="invisible"/> android:visibility="invisible"/>
@ -49,6 +50,7 @@
android:layout_height="100dp" android:layout_height="100dp"
android:paddingTop="25dp" android:paddingTop="25dp"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:paddingRight="5dp"
android:layout_below="@id/detailVideoTitleView" android:layout_below="@id/detailVideoTitleView"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:visibility="invisible" android:visibility="invisible"
@ -60,6 +62,7 @@
android:layout_below="@id/detailUploaderThumbnailView" android:layout_below="@id/detailUploaderThumbnailView"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:paddingLeft="6dp" android:paddingLeft="6dp"
android:paddingRight="6dp"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="invisible" android:visibility="invisible"
android:text="Herr von Gurken" /> android:text="Herr von Gurken" />
@ -123,6 +126,7 @@
android:layout_below="@id/detailUploaderView" android:layout_below="@id/detailUploaderView"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:paddingLeft="6dp" android:paddingLeft="6dp"
android:paddingRight="6dp"
android:paddingTop="20dp" android:paddingTop="20dp"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:visibility="invisible" android:visibility="invisible"
@ -134,6 +138,7 @@
android:layout_below="@id/detailUploadDateView" android:layout_below="@id/detailUploadDateView"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:paddingLeft="6dp" android:paddingLeft="6dp"
android:paddingRight="6dp"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="invisible" 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. " 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" android:layout_height="wrap_content"
app:backgroundTint="@color/primaryColorYoutube" app:backgroundTint="@color/primaryColorYoutube"
android:src="@drawable/ic_play_arrow_black" android:src="@drawable/ic_play_arrow_black"
android:layout_margin="15pt"/> android:layout_margin="16dip"/>
</RelativeLayout> </RelativeLayout>

View File

@ -0,0 +1,164 @@
<?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"
style="?android:attr/textAppearanceLarge"
tools:context=".VideoItemDetailFragment"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar android:id="@+id/detailProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminate="true"/>
<ScrollView
android:id="@+id/videoitem_detail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textIsSelectable="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<ImageView android:id="@+id/detailThumbnailView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:src="@drawable/dummi_thumbnail"
android:visibility="invisible"/>
<TextView android:id="@+id/detailVideoTitleView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/detailThumbnailView"
android:layout_alignParentLeft="true"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Bla blabla !!!"
android:visibility="invisible"/>
<ImageView android:id="@+id/detailUploaderThumbnailView"
android:layout_width="80dp"
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"
android:src="@drawable/budy" />
<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:paddingLeft="6dp"
android:paddingRight="6dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="invisible"
android:text="Herr von Gurken" />
<View android:id="@+id/textSeperationLine"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"
android:layout_below="@id/detailUploaderView"
android:paddingTop="20dp"
android:visibility="invisible"
android:layout_alignParentLeft="true" />
<TextView android:id="@+id/detailViewCountView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/detailVideoTitleView"
android:layout_alignParentRight="true"
android:paddingTop="70dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:visibility="invisible"
android:text="1.000.115 views" />
<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:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="invisible"
android:text="5.000" />
<ImageView android:id="@+id/detailThumbsDownImgView"
android:layout_width="40dp"
android:layout_height="20dp"
android:layout_below="@id/detailViewCountView"
android:layout_toLeftOf="@id/detailThumbsDownCountView"
android:visibility="invisible"
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:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="invisible"
android:text="111.111" />
<ImageView android:id="@+id/detailThumbsUpImgView"
android:layout_width="40dp"
android:layout_height="20dp"
android:layout_below="@id/detailViewCountView"
android:layout_toLeftOf="@id/detailThumbsUpCountView"
android:visibility="invisible"
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:paddingLeft="6dp"
android:paddingRight="6dp"
android:paddingTop="20dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:visibility="invisible"
android:text="Uploaded at: 45.64.1285" />
<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: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. "
/>
<View
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_below="@id/detailDescriptionView"/>
</RelativeLayout>
</ScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/playVideoButton"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:backgroundTint="@color/primaryColorYoutube"
android:src="@drawable/ic_play_arrow_black"
android:layout_margin="16dip"/>
</RelativeLayout>

View File

@ -9,19 +9,19 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ProgressBar android:id="@+id/detailProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminate="true"/>
<ScrollView <ScrollView
android:id="@+id/videoitem_detail" android:id="@+id/videoitem_detail"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="wrap_content">
<ProgressBar android:id="@+id/detailProgressBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:indeterminate="true"/>
<ImageView android:id="@+id/detailThumbnailView" <ImageView android:id="@+id/detailThumbnailView"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -39,6 +39,7 @@
android:layout_below="@id/detailThumbnailView" android:layout_below="@id/detailThumbnailView"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:paddingLeft="6dp" android:paddingLeft="6dp"
android:paddingRight="6dp"
android:paddingBottom="20dp" android:paddingBottom="20dp"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:visibility="invisible" android:visibility="invisible"
@ -49,6 +50,7 @@
android:layout_height="100dp" android:layout_height="100dp"
android:paddingTop="25dp" android:paddingTop="25dp"
android:paddingLeft="2dp" android:paddingLeft="2dp"
android:paddingRight="2dp"
android:layout_below="@id/detailVideoTitleView" android:layout_below="@id/detailVideoTitleView"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:visibility="invisible" android:visibility="invisible"
@ -60,6 +62,7 @@
android:layout_below="@id/detailUploaderThumbnailView" android:layout_below="@id/detailUploaderThumbnailView"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:paddingLeft="6dp" android:paddingLeft="6dp"
android:paddingRight="6dp"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="invisible" android:visibility="invisible"
android:text="Herr von Gurken" /> android:text="Herr von Gurken" />
@ -71,6 +74,7 @@
android:layout_below="@id/detailVideoTitleView" android:layout_below="@id/detailVideoTitleView"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingLeft="16dp"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:visibility="invisible" android:visibility="invisible"
android:text="drölf views" /> android:text="drölf views" />
@ -81,6 +85,7 @@
android:layout_below="@id/detailViewCountView" android:layout_below="@id/detailViewCountView"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingLeft="16dp"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="invisible" android:visibility="invisible"
android:text="-5.000" /> android:text="-5.000" />
@ -116,6 +121,7 @@
android:layout_below="@id/detailUploaderView" android:layout_below="@id/detailUploaderView"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:paddingLeft="6dp" android:paddingLeft="6dp"
android:paddingRight="6dp"
android:paddingTop="20dp" android:paddingTop="20dp"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:visibility="invisible" android:visibility="invisible"
@ -127,6 +133,7 @@
android:layout_below="@id/detailUploadDateView" android:layout_below="@id/detailUploadDateView"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:paddingLeft="6dp" android:paddingLeft="6dp"
android:paddingRight="6dp"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="invisible" 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. " 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" android:layout_height="wrap_content"
app:backgroundTint="@color/primaryColorYoutube" app:backgroundTint="@color/primaryColorYoutube"
android:src="@drawable/ic_play_arrow_black" android:src="@drawable/ic_play_arrow_black"
android:layout_margin="15pt"/> android:layout_margin="16dip"/>
</RelativeLayout> </RelativeLayout>