diff --git a/src/main/java/org/kde/kdeconnect/UserInterface/MaxWidthImageButton.java b/src/main/java/org/kde/kdeconnect/UserInterface/MaxWidthImageButton.java index 203d5852..8a070879 100644 --- a/src/main/java/org/kde/kdeconnect/UserInterface/MaxWidthImageButton.java +++ b/src/main/java/org/kde/kdeconnect/UserInterface/MaxWidthImageButton.java @@ -6,8 +6,12 @@ import android.util.AttributeSet; import android.widget.ImageButton; import android.widget.LinearLayout; +import org.kde.kdeconnect_tp.R; + public class MaxWidthImageButton extends ImageButton { + int mMaxWidth = Integer.MAX_VALUE; + public MaxWidthImageButton(Context context) { super(context); @@ -15,14 +19,16 @@ public class MaxWidthImageButton extends ImageButton { public MaxWidthImageButton(Context context, AttributeSet attrs) { super(context, attrs); + + TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.MaxWidthImageButton); + mMaxWidth = a.getDimensionPixelSize(R.styleable.MaxWidthImageButton_maxWidth, Integer.MAX_VALUE); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - int maxWidth = getMaxWidth(); super.onMeasure(widthMeasureSpec, heightMeasureSpec); - if(getMeasuredWidth() > maxWidth){ - setMeasuredDimension(maxWidth, getMeasuredHeight()); + if(getMeasuredWidth() > mMaxWidth){ + setMeasuredDimension(mMaxWidth, getMeasuredHeight()); } } } diff --git a/src/main/res/layout/mpris_control.xml b/src/main/res/layout/mpris_control.xml index 19c46438..3c36f3ea 100644 --- a/src/main/res/layout/mpris_control.xml +++ b/src/main/res/layout/mpris_control.xml @@ -1,6 +1,7 @@ + + + + + \ No newline at end of file