mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-31 14:15:14 +00:00
MPRIS controls now adapt to tablet resolutions
BUG: 339684
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package org.kde.kdeconnect.UserInterface;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class MaxWidthImageButton extends ImageButton {
|
||||
|
||||
public MaxWidthImageButton(Context context) {
|
||||
|
||||
super(context);
|
||||
}
|
||||
|
||||
public MaxWidthImageButton(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int maxWidth = getMaxWidth();
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
if(getMeasuredWidth() > maxWidth){
|
||||
setMeasuredDimension(maxWidth, getMeasuredHeight());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,17 +5,21 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/mpris_control_view"
|
||||
android:gravity="center">
|
||||
android:gravity="center"
|
||||
android:paddingLeft="50dip"
|
||||
android:paddingTop="5dip"
|
||||
android:paddingRight="50dip"
|
||||
android:paddingBottom="5dip">
|
||||
|
||||
<Spinner
|
||||
android:layout_width="200dip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/player_spinner"
|
||||
android:layout_gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:id="@+id/now_playing_textview"
|
||||
@@ -25,18 +29,22 @@
|
||||
android:layout_gravity="center"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:layout_width="200dip"
|
||||
<org.kde.kdeconnect.UserInterface.MaxWidthImageButton
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="75dip"
|
||||
android:maxWidth="300dip"
|
||||
android:id="@+id/play_button"
|
||||
android:src="@android:drawable/ic_media_play"
|
||||
android:contentDescription="@string/mpris_play"
|
||||
android:layout_gravity="center"
|
||||
/>
|
||||
android:layout_weight="0"
|
||||
android:clickable="false"
|
||||
android:adjustViewBounds="false"
|
||||
android:baselineAlignBottom="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="200dip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dip"
|
||||
android:layout_gravity="center"
|
||||
>
|
||||
@@ -81,17 +89,18 @@
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="200dip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dip"
|
||||
android:id="@+id/volume_layout"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="50dip"
|
||||
android:layout_height="50dip"
|
||||
android:layout_width="30dip"
|
||||
android:layout_height="30dip"
|
||||
android:maxWidth="30dip"
|
||||
android:layout_marginRight="10dip"
|
||||
android:id="@+id/imageView"
|
||||
android:layout_weight="1"
|
||||
android:layout_weight="0"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:contentDescription="@string/mpris_volume"
|
||||
android:src="@drawable/ic_volume"
|
||||
@@ -99,7 +108,7 @@
|
||||
|
||||
|
||||
<SeekBar
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/volume_seek"
|
||||
android:layout_weight="1"
|
||||
|
Reference in New Issue
Block a user