why setFadeOnClickListener doesn't work?
Created by: bigggge
Cannot hide panel when i click main content
compile 'com.sothree.slidinguppanel:library:3.3.0'
java
slidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
slidingUpPanelLayout.setPanelHeight(0);
slidingUpPanelLayout.setFadeOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LogUtils.d("FadeOnClick");
slidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
}
});
xml:
<?xml version="1.0" encoding="utf-8"?>
<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:id="@+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:umanoPanelHeight="68dp"
sothree:umanoShadowHeight="3dp">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.percent.PercentRelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/headerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_heightPercent="60%">
<ImageView
android:id="@+id/album_art"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#22000000" />
<include layout="@layout/view_toolbar"></include>
</FrameLayout>
<LinearLayout
android:id="@+id/detailView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/headerView"
android:layout_gravity="center_horizontal|center_vertical"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical"
android:paddingLeft="30dp"
android:paddingRight="30dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_gravity="left"
android:orientation="vertical">
<TextView
android:id="@+id/song_title"
style="@style/TextAppearance.AppCompat.Body1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="130dp"
android:ellipsize="end"
android:singleLine="true"
android:textSize="23sp" />
<TextView
android:id="@+id/song_artist_album"
style="@style/TextAppearance.AppCompat.Body1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:paddingTop="3dp"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:orientation="horizontal">
<ImageView
android:id="@+id/shuffle"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="center" />
<ImageView
android:id="@+id/menu"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:paddingLeft="5dp"
android:scaleType="center" />
</LinearLayout>
</RelativeLayout>
<SeekBar
android:id="@+id/song_progress"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxHeight="2dp"
android:paddingTop="10dp"
android:progress="30"
android:progressDrawable="?attr/progressDrawableWithBackground" />
<LinearLayout
android:id="@+id/song_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/song_elapsed_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left" />
<TextView
android:id="@+id/song_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:orientation="horizontal"
android:paddingTop="5dp">
<net.steamcrafted.materialiconlib.MaterialIconView
android:id="@+id/previous"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:layout_marginLeft="30dp"
android:layout_weight="0.6"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="center"
app:materialIcon="skip_previous"
app:materialIconColor="?attr/iconColor"
app:materialIconSize="35dp" />
<FrameLayout
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:layout_weight="1">
<android.support.design.widget.FloatingActionButton
android:id="@+id/playpausefloating"
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_gravity="center"
android:clickable="true"
android:scaleType="fitCenter"
app:backgroundTint="?attr/accentColor" />
</FrameLayout>
<net.steamcrafted.materialiconlib.MaterialIconView
android:id="@+id/next"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:layout_marginRight="30dp"
android:layout_weight="0.6"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="center"
app:materialIcon="skip_next"
app:materialIconColor="?attr/iconColor"
app:materialIconSize="35dp" />
</LinearLayout>
</LinearLayout>
</android.support.percent.PercentRelativeLayout>
</android.support.design.widget.CoordinatorLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="@dimen/normalPaddingX5">
<TextView
android:id="@+id/panel_close"
android:layout_width="match_parent"
android:layout_height="35dp"
android:gravity="bottom|right"
android:paddingRight="@dimen/normalPaddingX3"
android:text="@string/close"
android:textColor="?colorAccent"
android:textSize="15sp" />
<TextView
android:id="@+id/panel_song"
android:layout_width="match_parent"
android:layout_height="@dimen/panel_item_height"
android:gravity="center_vertical"
android:text="@string/panel_song"
android:textSize="16sp" />
<TextView
android:id="@+id/panel_artist"
android:layout_width="match_parent"
android:layout_height="@dimen/panel_item_height"
android:gravity="center_vertical"
android:text="@string/artist"
android:textSize="16sp" />
<TextView
android:id="@+id/panel_equalizer"
android:layout_width="match_parent"
android:layout_height="@dimen/panel_item_height"
android:gravity="center_vertical"
android:text="@string/equalizer"
android:textSize="16sp" />
<TextView
android:id="@+id/panel_share"
android:layout_width="match_parent"
android:layout_height="@dimen/panel_item_height"
android:gravity="center_vertical"
android:text="@string/share_song"
android:textSize="16sp" />
</LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>