Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

Explicit dimension #96

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

package com.wunderlist.slidinglayer;

import java.util.Random;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
Expand All @@ -49,6 +47,8 @@
import android.widget.RelativeLayout;
import android.widget.Scroller;

import java.util.Random;


public class SlidingLayer extends FrameLayout {

Expand Down Expand Up @@ -1163,16 +1163,26 @@ public void setChangeStateOnTap(boolean changeStateOnTap) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

int width = getDefaultSize(0, widthMeasureSpec);
int height = getDefaultSize(0, heightMeasureSpec);
setMeasuredDimension(width, height);
int count = getChildCount();

int maxHeight = 0;
int maxWidth = 0;

for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
if (child.getVisibility() != GONE) {
measureChild(child, widthMeasureSpec, heightMeasureSpec);

maxHeight = Math.max(maxHeight, child.getMeasuredHeight());
maxWidth = Math.max(maxWidth, child.getMeasuredWidth());
}
}

setMeasuredDimension(maxWidth, maxHeight);

if (mLayerTransformer != null) {
mLayerTransformer.onMeasure(this, mScreenSide);
}

super.onMeasure(getChildMeasureSpec(widthMeasureSpec, 0, width),
getChildMeasureSpec(heightMeasureSpec, 0, height));
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Aug 12 11:01:33 CEST 2015
#Tue May 24 18:20:09 EEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip