New now playing screen. Work in progress!
This commit is contained in:
parent
479a7d81cd
commit
1cde43af07
27 changed files with 889 additions and 571 deletions
|
|
@ -1,31 +0,0 @@
|
|||
package com.kabouzeid.gramophone.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class HeightFitSquareImageView extends ImageView {
|
||||
|
||||
public HeightFitSquareImageView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public HeightFitSquareImageView(@NonNull Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public HeightFitSquareImageView(@NonNull Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
//noinspection SuspiciousNameCombination
|
||||
super.onMeasure(heightMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
package com.kabouzeid.gramophone.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class HeightWidthFitSquareImageView extends ImageView {
|
||||
|
||||
public HeightWidthFitSquareImageView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public HeightWidthFitSquareImageView(@NonNull Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public HeightWidthFitSquareImageView(@NonNull Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
final int small = Math.min(widthMeasureSpec, heightMeasureSpec);
|
||||
super.onMeasure(small, small);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
package com.kabouzeid.gramophone.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class SquareIfPlaceImageView extends ImageView {
|
||||
private boolean forceSquare = false;
|
||||
|
||||
public SquareIfPlaceImageView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public SquareIfPlaceImageView(@NonNull Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public SquareIfPlaceImageView(@NonNull Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
final int small = Math.min(widthMeasureSpec, heightMeasureSpec);
|
||||
final int large = Math.max(widthMeasureSpec, heightMeasureSpec);
|
||||
|
||||
if (forceSquare) super.onMeasure(small, small);
|
||||
else if (View.MeasureSpec.getSize(large) > View.MeasureSpec.getSize(small) * 1.5)
|
||||
super.onMeasure(small, small);
|
||||
else super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
public void forceSquare(boolean force) {
|
||||
if (forceSquare != force) {
|
||||
forceSquare = force;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue