Prework
This commit is contained in:
parent
4ec1b18b47
commit
1b702eae07
2 changed files with 44 additions and 7 deletions
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.kabouzeid.gramophone.views;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Karim Abou Zeid (kabouzeid)
|
||||||
|
*/
|
||||||
|
public class SquareFitImageView extends ImageView {
|
||||||
|
|
||||||
|
public SquareFitImageView(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SquareFitImageView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SquareFitImageView(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
final int newWidth = Math.min(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
//noinspection SuspiciousNameCombination
|
||||||
|
super.onMeasure(newWidth, newWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -3,14 +3,20 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:id="@+id/album_art"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/header_image_height"
|
android:layout_height="@dimen/header_image_height">
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@drawable/default_album_art"
|
<com.kabouzeid.gramophone.views.SquareFitImageView
|
||||||
android:transitionName="@string/transition_album_cover"
|
android:id="@+id/album_art"
|
||||||
tools:ignore="ContentDescription,UnusedAttribute" />
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/default_album_art"
|
||||||
|
android:transitionName="@string/transition_album_cover"
|
||||||
|
tools:ignore="ContentDescription,UnusedAttribute" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/list_background"
|
android:id="@+id/list_background"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue