Skip to content
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
31 changes: 0 additions & 31 deletions build.gradle

This file was deleted.

21 changes: 0 additions & 21 deletions demo/build.gradle

This file was deleted.

20 changes: 20 additions & 0 deletions demo/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
id("com.android.application")
}

android {
namespace = "com.sothree.slidinguppanel.demo"
compileSdk= 26
buildToolsVersion = "26.0.1"

defaultConfig {
minSdk= 14
compileSdk= 26
}
}

dependencies {
implementation("com.android.support:support-v4:26.0.2")
implementation("com.android.support:appcompat-v7:26.0.2")
implementation(project(":library"))
}
5 changes: 0 additions & 5 deletions demo/settings.gradle

This file was deleted.

2 changes: 0 additions & 2 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sothree.slidinguppanel.demo"
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="17"
android:versionName="3.4.0">

<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17"
tools:overrideLibrary="android.support.v7.appcompat,android.support.graphics.drawavle"
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)

lv.setAdapter(arrayAdapter);

mLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);
mLayout = findViewById(R.id.sliding_layout);
mLayout.addPanelSlideListener(new PanelSlideListener() {
@Override
public void onPanelSlide(View panel, float slideOffset) {
Expand Down Expand Up @@ -139,33 +139,30 @@ public boolean onPrepareOptionsMenu(Menu menu) {

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
case R.id.action_toggle: {
if (mLayout != null) {
if (mLayout.getPanelState() != PanelState.HIDDEN) {
mLayout.setPanelState(PanelState.HIDDEN);
item.setTitle(R.string.action_show);
} else {
mLayout.setPanelState(PanelState.COLLAPSED);
item.setTitle(R.string.action_hide);
}
if (item.getItemId()==R.id.action_toggle){
if (mLayout != null) {
if (mLayout.getPanelState() != PanelState.HIDDEN) {
mLayout.setPanelState(PanelState.HIDDEN);
item.setTitle(R.string.action_show);
} else {
mLayout.setPanelState(PanelState.COLLAPSED);
item.setTitle(R.string.action_hide);
}
return true;
}
case R.id.action_anchor: {
if (mLayout != null) {
if (mLayout.getAnchorPoint() == 1.0f) {
mLayout.setAnchorPoint(0.7f);
mLayout.setPanelState(PanelState.ANCHORED);
item.setTitle(R.string.action_anchor_disable);
} else {
mLayout.setAnchorPoint(1.0f);
mLayout.setPanelState(PanelState.COLLAPSED);
item.setTitle(R.string.action_anchor_enable);
}
return true;
}else if (item.getItemId()==R.id.action_anchor){
if (mLayout != null) {
if (mLayout.getAnchorPoint() == 1.0f) {
mLayout.setAnchorPoint(0.7f);
mLayout.setPanelState(PanelState.ANCHORED);
item.setTitle(R.string.action_anchor_disable);
} else {
mLayout.setAnchorPoint(1.0f);
mLayout.setPanelState(PanelState.COLLAPSED);
item.setTitle(R.string.action_anchor_enable);
}
return true;
}
return true;
}
return super.onOptionsItemSelected(item);
}
Expand Down
9 changes: 9 additions & 0 deletions demo/src/main/res/drawable/radius.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners android:radius="24dp"/>
<solid android:color="#FFFFFF"/>
</shape>
</item>
</selector>
7 changes: 4 additions & 3 deletions demo/src/main/res/layout/activity_demo.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<com.sothree.slidinguppanel.SlidingUpPanelLayout
<com.sothree.slidinguppanel.RoundedSlidingUpPanelLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:sothree="http://schemas.android.com/apk/res-auto"
Expand Down Expand Up @@ -41,9 +41,10 @@

<!-- SLIDING LAYOUT -->
<LinearLayout
android:elevation="14dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:background="@drawable/radius"
android:orientation="vertical"
android:clickable="true"
android:focusable="false"
Expand Down Expand Up @@ -93,4 +94,4 @@
<!--android:text="The standard Lorem Ipsum passage, used since the 1500Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Section 1.10.32 of written by Cicero in 45 t perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?1914 translation by H. RackhamBut I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete accouof the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."/>-->
<!--</ScrollView>-->
</LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
</com.sothree.slidinguppanel.RoundedSlidingUpPanelLayout>
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Aug 23 22:44:32 CEST 2016
#Mon Feb 23 19:18:50 CST 2026
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
zipStorePath=wrapper/dists
21 changes: 0 additions & 21 deletions library/build.gradle

This file was deleted.

20 changes: 20 additions & 0 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
id("com.android.library")
}

android {
namespace = "com.sothree.slidinguppanel"
compileSdk= 26
buildToolsVersion = "26.0.1"

defaultConfig {
minSdk= 14
compileSdk= 26
}
}

dependencies {
implementation("com.android.support:support-v4:26.0.2")
implementation("com.android.support:support-annotations:26.0.2")
implementation("com.android.support:recyclerview-v7:26.0.2")
}
1 change: 0 additions & 1 deletion library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sothree.slidinguppanel.library"
android:versionCode="17"
android:versionName="3.4.0">

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.sothree.slidinguppanel;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;

public class RoundedSlidingUpPanelLayout extends SlidingUpPanelLayout{
public RoundedSlidingUpPanelLayout(Context context) {
super(context);
}

public RoundedSlidingUpPanelLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}

public RoundedSlidingUpPanelLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}

@Override
protected Drawable getShadowDrawable() {
if (mIsSlidingUp) {
return getResources().getDrawable(R.drawable.rounded_above_shadow);
} else {
return getResources().getDrawable(R.drawable.rounded_below_shadow);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;

import com.sothree.slidinguppanel.library.R;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

Expand Down Expand Up @@ -122,7 +120,7 @@ public class SlidingUpPanelLayout extends ViewGroup {
/**
* True if the collapsed panel should be dragged up.
*/
private boolean mIsSlidingUp;
protected boolean mIsSlidingUp;

/**
* Panel overlays the windows instead of putting it underneath it.
Expand Down Expand Up @@ -331,9 +329,9 @@ public SlidingUpPanelLayout(Context context, AttributeSet attrs, int defStyle) {
// If the shadow height is zero, don't show the shadow
if (mShadowHeight > 0) {
if (mIsSlidingUp) {
mShadowDrawable = getResources().getDrawable(R.drawable.above_shadow);
mShadowDrawable = getShadowDrawable();
} else {
mShadowDrawable = getResources().getDrawable(R.drawable.below_shadow);
mShadowDrawable = getShadowDrawable();
}
} else {
mShadowDrawable = null;
Expand All @@ -347,6 +345,14 @@ public SlidingUpPanelLayout(Context context, AttributeSet attrs, int defStyle) {
mIsTouchEnabled = true;
}

protected Drawable getShadowDrawable() {
if (mIsSlidingUp) {
return getResources().getDrawable(R.drawable.above_shadow);
} else {
return getResources().getDrawable(R.drawable.below_shadow);
}
}

/**
* Set the Drag View after the view is inflated
*/
Expand Down Expand Up @@ -1099,7 +1105,7 @@ public PanelState getPanelState() {
public void setPanelState(PanelState state) {

// Abort any running animation, to allow state change
if(mDragHelper.getViewDragState() == ViewDragHelper.STATE_SETTLING){
if (mDragHelper.getViewDragState() == ViewDragHelper.STATE_SETTLING) {
Log.d(TAG, "View is settling. Aborting animation.");
mDragHelper.abort();
}
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/res/drawable/above_shadow.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#20000000"
android:endColor="@android:color/transparent"
Expand Down
3 changes: 2 additions & 1 deletion library/src/main/res/drawable/below_shadow.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="24dp"/>
<gradient
android:startColor="#20000000"
android:endColor="@android:color/transparent"
Expand Down
3 changes: 3 additions & 0 deletions library/src/main/res/drawable/rounded_above_shadow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
</selector>
4 changes: 4 additions & 0 deletions library/src/main/res/drawable/rounded_below_shadow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

</selector>
Loading