Skip to content

Commit 4f24d61

Browse files
committed
put the play video button into the horizontal center
1 parent d24c87c commit 4f24d61

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "org.schabi.newpipe"
99
minSdkVersion 15
1010
targetSdkVersion 23
11-
versionCode 3
12-
versionName "0.4.0"
11+
versionCode 4
12+
versionName "0.4.1"
1313
}
1414
buildTypes {
1515
release {

app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import android.support.v7.app.ActionBar;
1313
import android.text.Html;
1414
import android.text.method.LinkMovementMethod;
15+
import android.util.DisplayMetrics;
1516
import android.util.Log;
1617
import android.view.LayoutInflater;
1718
import android.view.View;
@@ -271,7 +272,7 @@ public void onActivityCreated(Bundle savedInstanceBundle) {
271272
FloatingActionButton playVideoButton = (FloatingActionButton) getActivity().findViewById(R.id.playVideoButton);
272273

273274
if(PreferenceManager.getDefaultSharedPreferences(getActivity())
274-
.getBoolean(getString(R.string.leftHandLayout), false)) {
275+
.getBoolean(getString(R.string.leftHandLayout), false) && checkIfLandscape()) {
275276
RelativeLayout.LayoutParams oldLayout = (RelativeLayout.LayoutParams) playVideoButton.getLayoutParams();
276277
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
277278
RelativeLayout.LayoutParams.WRAP_CONTENT,
@@ -289,4 +290,10 @@ public void onClick(View v) {
289290
}
290291
});
291292
}
293+
294+
public boolean checkIfLandscape() {
295+
DisplayMetrics displayMetrics = new DisplayMetrics();
296+
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
297+
return displayMetrics.heightPixels < displayMetrics.widthPixels;
298+
}
292299
}

app/src/main/res/layout/fragment_videoitem_detail.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@
141141
</ScrollView>
142142
<android.support.design.widget.FloatingActionButton
143143
android:id="@+id/playVideoButton"
144-
android:layout_alignParentRight="true"
145144
android:layout_alignParentBottom="true"
145+
android:layout_centerHorizontal="true"
146146
android:layout_width="wrap_content"
147147
android:layout_height="wrap_content"
148148
app:backgroundTint="@color/primaryColorYoutube"

0 commit comments

Comments
 (0)