diff --git a/build.gradle b/build.gradle
index 9d66dfce..8f5e97cb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,10 +2,11 @@
buildscript {
repositories {
mavenCentral()
+ jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.5.0'
+ classpath 'com.android.tools.build:gradle:2.1.0'
}
}
@@ -14,11 +15,12 @@ def isReleaseBuild() {
}
allprojects {
- version = VERSION_NAME
- group = GROUP
+// version = VERSION_NAME
+// group = GROUP
repositories {
mavenCentral()
+ jcenter()
}
}
diff --git a/demo/build.gradle b/demo/build.gradle
index f4d20ae5..91bf3983 100644
--- a/demo/build.gradle
+++ b/demo/build.gradle
@@ -1,8 +1,12 @@
apply plugin: 'com.android.application'
+repositories {
+ maven { url 'http://Manabu-GT.github.com/GlassView/mvn-repo' }
+}
+
android {
compileSdkVersion 23
- buildToolsVersion "23.0.2"
+ buildToolsVersion "23.0.3"
lintOptions {
abortOnError false
@@ -11,11 +15,16 @@ android {
defaultConfig {
minSdkVersion 11
targetSdkVersion 23
+
+ renderscriptTargetApi 21
+ renderscriptSupportModeEnabled true
}
}
+
dependencies {
- compile 'com.android.support:support-v4:23.1.1'
- compile 'com.android.support:appcompat-v7:23.1.1'
- compile project(':library')
+ compile 'com.android.support:support-v4:23.4.0'
+ compile 'com.android.support:appcompat-v7:23.4.0'
+
+ compile project(':library')
}
diff --git a/demo/res/layout/activity_demo.xml b/demo/res/layout/activity_demo.xml
new file mode 100644
index 00000000..7fd97367
--- /dev/null
+++ b/demo/res/layout/activity_demo.xml
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -->
+
+
+
+
+
+
+
+
+
diff --git a/demo/src/main/res/drawable-nodpi/androidbg.jpg b/demo/src/main/res/drawable-nodpi/androidbg.jpg
new file mode 100644
index 00000000..a6608d58
Binary files /dev/null and b/demo/src/main/res/drawable-nodpi/androidbg.jpg differ
diff --git a/demo/src/main/res/layout/activity_demo.xml b/demo/src/main/res/layout/activity_demo.xml
index b4d5a374..5596de23 100644
--- a/demo/src/main/res/layout/activity_demo.xml
+++ b/demo/src/main/res/layout/activity_demo.xml
@@ -9,6 +9,7 @@
sothree:umanoPanelHeight="68dp"
sothree:umanoShadowHeight="4dp"
sothree:umanoParallaxOffset="100dp"
+ sothree:umanoBlurBackground="true"
sothree:umanoDragView="@+id/dragView"
sothree:umanoOverlay="true"
sothree:umanoScrollableView="@+id/list">
@@ -17,7 +18,9 @@
+ android:orientation="vertical"
+ android:background="@drawable/androidbg"
+ >
-
+
+
+
+
+
+
+
+
diff --git a/library/build.gradle b/library/build.gradle
index 3f803a63..4a6cb092 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,14 +1,16 @@
apply plugin: 'com.android.library'
repositories {
+ maven { url 'http://Manabu-GT.github.com/GlassView/mvn-repo' }
mavenCentral()
}
dependencies {
- compile 'com.android.support:support-v4:23.1.1'
- compile 'com.android.support:support-annotations:23.1.1'
- compile 'com.android.support:recyclerview-v7:23.1.1'
+ compile 'com.android.support:support-v4:23.4.0'
+ compile 'com.android.support:support-annotations:23.4.0'
+ compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.nineoldandroids:library:2.4.0'
+ compile 'com.ms.square:glassview:0.1.0'
}
android {
@@ -19,4 +21,5 @@ android {
}
}
-apply from: '../maven_push.gradle'
\ No newline at end of file
+
+//apply from: '../maven_push.gradle'
\ No newline at end of file
diff --git a/library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java b/library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
index fa306f6d..19d9bc6b 100644
--- a/library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
+++ b/library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
@@ -6,23 +6,28 @@
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PixelFormat;
+import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.annotation.NonNull;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
+import android.util.Log;
+import android.view.Display;
import android.view.Gravity;
+import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
+import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
+import com.ms.square.android.glassview.GlassView;
import com.nineoldandroids.view.animation.AnimatorProxy;
import com.sothree.slidinguppanel.library.R;
@@ -43,6 +48,16 @@ public class SlidingUpPanelLayout extends ViewGroup {
*/
private static final float DEFAULT_ANCHOR_POINT = 1.0f; // In relative %
+ /**
+ * Default position of the panel
+ */
+ private static final boolean DEFAULT_PANEL_OFF_SCREEN = false;
+
+ /**
+ * No blur by default
+ */
+ private static final boolean DEFAULT_BLUR_BACKGROUND = false;
+
/**
* Default initial state for the component
*/
@@ -107,6 +122,16 @@ public class SlidingUpPanelLayout extends ViewGroup {
*/
private int mPanelHeight = -1;
+ /**
+ * True if we want to slide the visible panel off screen; false by default
+ */
+ private boolean mPanelOffScreen;
+
+ /**
+ * If true, view behind sliding panel will be blurred while sliding
+ */
+ private boolean mBlurBackground;
+
/**
* The size of the shadow in pixels.
*/
@@ -216,6 +241,10 @@ public enum PanelState {
private final ViewDragHelper mDragHelper;
+ private GlassView mBlurView;
+
+ private Context mContext;
+
/**
* Stores whether or not the pane was expanded the last time it was slideable.
* If expand/collapse operations are invoked this state is modified. Used by
@@ -270,6 +299,8 @@ public SlidingUpPanelLayout(Context context, AttributeSet attrs) {
public SlidingUpPanelLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+ mContext = context;
+
if (isInEditMode()) {
mShadowDrawable = null;
mDragHelper = null;
@@ -311,6 +342,10 @@ public SlidingUpPanelLayout(Context context, AttributeSet attrs, int defStyle) {
if (interpolatorResId != -1) {
scrollerInterpolator = AnimationUtils.loadInterpolator(context, interpolatorResId);
}
+
+ mPanelOffScreen = ta.getBoolean(R.styleable.SlidingUpPanelLayout_umanoPanelOffScreen, DEFAULT_PANEL_OFF_SCREEN);
+
+ mBlurBackground = ta.getBoolean(R.styleable.SlidingUpPanelLayout_umanoBlurBackground, DEFAULT_BLUR_BACKGROUND);
}
ta.recycle();
@@ -351,6 +386,20 @@ public SlidingUpPanelLayout(Context context, AttributeSet attrs, int defStyle) {
@Override
protected void onFinishInflate() {
super.onFinishInflate();
+
+ if (mPanelOffScreen) {
+ // Get scrollable view (always second child) and expand its size in order to put
+ // the panel above the screen
+ View slidingUpPanelLayout = getChildAt(1);
+ setExpandedPanelOffScreen(slidingUpPanelLayout);
+ }
+
+ if (mBlurBackground) {
+ // Add blur view as the last child of the slidingUpPanelLayout's first child, with
+ // both height and width math_parent to blur the whole screen
+ setBlurBackground();
+ }
+
if (mDragViewResId != -1) {
setDragView(findViewById(mDragViewResId));
}
@@ -359,6 +408,49 @@ protected void onFinishInflate() {
}
}
+ public void setBlurBackground() {
+ LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ View blurView = vi.inflate(R.layout.blur, null);
+
+ ViewGroup insertPoint = (ViewGroup) getChildAt(0);
+ insertPoint.addView(blurView, insertPoint.getChildCount(), new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+
+ mBlurView = (GlassView) findViewById(R.id.glass_view);
+ mBlurView.setBlurRadius(0f);
+ }
+
+ /**
+ * Expands the height of the SlidingUpPanelLayout by 'mPanelHeight' so that there's no
+ * empty space at the bottom when the view is expanded
+ *
+ * @param slidingUpPanelLayout (SlidingUpPanelLayout)
+ */
+ public void setExpandedPanelOffScreen(View slidingUpPanelLayout) {
+ if (slidingUpPanelLayout != null) {
+ // Get screen dimensions
+ int screenHeight;
+ int screenWidth;
+
+ if (Build.VERSION.SDK_INT >= 13) {
+ final Point size = new Point();
+ ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getSize(size);
+ screenHeight = size.y;
+ screenWidth = size.x;
+ } else {
+ Display display = ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
+ screenHeight = display.getHeight();
+ screenWidth = display.getWidth();
+ }
+
+ SlidingUpPanelLayout.LayoutParams params;
+ params = new SlidingUpPanelLayout.LayoutParams(screenWidth, screenHeight + mPanelHeight - getNotificationBarHeight());
+
+ slidingUpPanelLayout.setLayoutParams(params);
+ } else {
+ Log.e(TAG, "slidingUpPanelLayout is null in setExpandedPanelOffScreen");
+ }
+ }
+
public void setGravity(int gravity) {
if (gravity != Gravity.TOP && gravity != Gravity.BOTTOM) {
throw new IllegalArgumentException("gravity must be set to either top or bottom");
@@ -788,14 +880,22 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
child.measure(childWidthSpec, childHeightSpec);
- if (child == mSlideableView) {
- mSlideRange = mSlideableView.getMeasuredHeight() - mPanelHeight;
- }
+ mSlideRange = mSlideableView.getMeasuredHeight() - mPanelHeight;
}
setMeasuredDimension(widthSize, heightSize);
}
+ // Returns the height of the notification bar
+ private int getNotificationBarHeight() {
+ int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
+ if (resourceId > 0) {
+ return getResources().getDimensionPixelSize(resourceId);
+ } else {
+ return 0;
+ }
+ }
+
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
final int paddingLeft = getPaddingLeft();
@@ -1178,6 +1278,15 @@ protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
mCoveredFadePaint.setColor(color);
canvas.drawRect(mTmpRect, mCoveredFadePaint);
}
+
+ if (mBlurBackground && mSlideOffset > 0) {
+ mBlurView.setVisibility(View.VISIBLE);
+ mBlurView.setBlurRadius(mSlideOffset * 25);
+ } else if (mBlurView != null) {
+ mBlurView.setVisibility(View.INVISIBLE);
+ }
+
+
} else {
result = super.drawChild(canvas, child, drawingTime);
}
diff --git a/library/src/main/res/layout/blur.xml b/library/src/main/res/layout/blur.xml
new file mode 100644
index 00000000..c6c1487a
--- /dev/null
+++ b/library/src/main/res/layout/blur.xml
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/library/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml
index a3e8038d..ed8f973e 100644
--- a/library/src/main/res/values/attrs.xml
+++ b/library/src/main/res/values/attrs.xml
@@ -12,6 +12,8 @@
+
+
diff --git a/maven_push.gradle b/maven_push.gradle
index f5f4129c..dea29d1c 100644
--- a/maven_push.gradle
+++ b/maven_push.gradle
@@ -49,8 +49,8 @@ afterEvaluate { project ->
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME
- repository(url: getReleaseRepositoryUrl()) {
- authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
+ repository(url: sonatypeRepositoryUrl) {
+ authentication(userName: "", password: "")
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
@@ -111,4 +111,5 @@ afterEvaluate { project ->
archives androidSourcesJar
archives androidJavadocsJar
}
+
}