Question Detail

I have tried to get the pop-up page in the card view, but the pop-up layout is not shown on the cardView. itz opening beneath the floating button, and how to link the pop-up page's layout attributes with the main fragment activity


Thread Reply

Anonymous

- 1 years ago

Image result for AAH_FabulousFragment

It is very Cool Lib try this:

Add the jcenter repository to your project-level build.gradle file

allprojects {
	repositories {
		jcenter()
	}
}

Step 2. Add the dependency to your app-level build.gradle file:

dependencies {
	 compile 'com.allattentionhere:fabulousfilter:0.0.4'
}



IN ACTIVITY

FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(R.id.filter);
floatingActionButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        MemberList_FabFragment dialogFrag = MemberList_FabFragment.newInstance();
        dialogFrag.setParentFab(floatingActionButton);
        dialogFrag.show(getSupportFragmentManager(), dialogFrag.getTag());
    }
});


Create A Layout - R.layout.fragment_fab : 

<com.allattentionhere.fabulousfilter.AAH_FilterView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <RelativeLayout
        android:id="@+id/vb_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:background="@color/colorAccent"
        android:visibility="invisible"
        tools:ignore="MissingPrefix"
        tools:visibility="visible">

        <ImageButton
            android:id="@+id/btn_close"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:background="@android:color/transparent"
            android:padding="@dimen/divider_margin"
            android:src="@drawable/ic_close"
            android:text="Close"
            android:tint="@color/headtextcolor"/>
        <LinearLayout
            android:id="@+id/ll_buttons"
            android:layout_width="match_parent"
            android:layout_height="56dp"
            android:layout_alignParentBottom="true"
            android:background="@color/fadeRED"
            android:orientation="horizontal"
            android:weightSum="2">
        </LinearLayout>

    </RelativeLayout>

</com.allattentionhere.fabulousfilter.AAH_FilterView>


Create ANother Java File For Fragment : 

import android.app.Dialog;
import android.view.View;
import android.widget.RelativeLayout;

import com.allattentionhere.fabulousfilter.AAH_FabulousFragment;
import com.stayapt.R;


public class MemberList_FabFragment extends AAH_FabulousFragment {
  

    public static MemberList_FabFragment newInstance() {
        MemberList_FabFragment f = new MemberList_FabFragment();
        return f;
    }

    @Override

    public void setupDialog(Dialog dialog, int style) {
        View contentView = View.inflate(getContext(), R.layout.fragment_member_list__fab, null);
        RelativeLayout vb_content = (RelativeLayout) contentView.findViewById(R.id.vb_content);
      //  LinearLayout vb_buttons = (LinearLayout) contentView.findViewById(R.id.vb_buttons);
        contentView.findViewById(R.id.btn_close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                closeFilter("closed");
            }
        });

        //params to set
        setAnimationDuration(600); //optional; default 500ms
        setPeekHeight(300); // optional; default 400dp
        setCallbacks((Callbacks) getActivity()); //optional; to get back result
//        setAnimationListener((AnimationListener) getActivity()); //optional; to get animation callbacks
      //  setViewgroupStatic(vb_buttons); // optional; layout to stick at bottom on slide
        //setViewPager(vb_types); //optional; if you use viewpager that has scrollview
        setViewMain(vb_content); //necessary; main bottomsheet view
        setMainContentView(contentView); // necessary; call at end before super
        super.setupDialog(dialog, style); //call super at last
    }

}