From 4f24d61c4bb1f1bd4623fa07822d57dc935260d3 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Mon, 21 Sep 2015 23:53:10 +0200 Subject: [PATCH] put the play video button into the horizontal center --- .idea/misc.xml | 2 +- app/build.gradle | 4 ++-- .../java/org/schabi/newpipe/VideoItemDetailFragment.java | 9 ++++++++- app/src/main/res/layout/fragment_videoitem_detail.xml | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index fbb68289f..5d1998103 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -37,7 +37,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 511082f23..2ce9fefff 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "org.schabi.newpipe" minSdkVersion 15 targetSdkVersion 23 - versionCode 3 - versionName "0.4.0" + versionCode 4 + versionName "0.4.1" } buildTypes { release { diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java b/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java index 6a3ebacfa..41594b1e8 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java @@ -12,6 +12,7 @@ import android.support.v4.app.Fragment; import android.support.v7.app.ActionBar; import android.text.Html; import android.text.method.LinkMovementMethod; +import android.util.DisplayMetrics; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -271,7 +272,7 @@ public class VideoItemDetailFragment extends Fragment { FloatingActionButton playVideoButton = (FloatingActionButton) getActivity().findViewById(R.id.playVideoButton); if(PreferenceManager.getDefaultSharedPreferences(getActivity()) - .getBoolean(getString(R.string.leftHandLayout), false)) { + .getBoolean(getString(R.string.leftHandLayout), false) && checkIfLandscape()) { RelativeLayout.LayoutParams oldLayout = (RelativeLayout.LayoutParams) playVideoButton.getLayoutParams(); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, @@ -289,4 +290,10 @@ public class VideoItemDetailFragment extends Fragment { } }); } + + public boolean checkIfLandscape() { + DisplayMetrics displayMetrics = new DisplayMetrics(); + getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + return displayMetrics.heightPixels < displayMetrics.widthPixels; + } } \ 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 d58c52b10..5c9f0b478 100644 --- a/app/src/main/res/layout/fragment_videoitem_detail.xml +++ b/app/src/main/res/layout/fragment_videoitem_detail.xml @@ -141,8 +141,8 @@