11

Lets do something challanging. I have seen this animation for navigation Drawer : enter image description here

and I would like to implement this as it is a great effect. I tried to get the effect by creating a custom view and on touch i am getting at least 50% similar effect. i would like to implement my ondraw() and ontouch() methods from my custom view to navigation view. How is that done? Any one have any clue? Can anyone give any link which has simlar stuff.

I have tried this :

public class CustomNavigation extends DrawerLayout {

    public CustomNavigation(Context context) {
        super(context);
    }

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

    public CustomNavigation(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
//        invalidate();
    }
    public void start()
    {
        this.invalidate();
        Log.d("Parth", "start");
    }

    @Override
    public void onDraw(Canvas c) {
        Log.d("Parth", "ondraw");
//        super.onDraw(c);

    }

}

The on draw method isn't called. why is that so?

from the main activity i make an object of the class above and call the start method like this :

CustomNavigation drawer = (CustomNavigation) findViewById(R.id.drawer_layout);
drawer.start();

and this is just the initial stuff, i also want to implement these :

Parth Anjaria
  • 3,961
  • 3
  • 30
  • 62
  • Hi any one have idea how to achieve click on list-view item and open a detail page animation like above image, Help appreciated Thanks in Advance – KeTaN May 12 '16 at 06:43

2 Answers2

5

So finally after finding so much i found a library for this, and here is the link to it. I don't know why it was so hard to find. Or it was just my bad week anyways for those who wish to use it you'll can find the library here. and more over i will also give the implementation if you need it :

main_activity.xml

<?xml version="1.0" encoding="utf-8"?>
<com.mxn.soul.flowingdrawer_core.LeftDrawerLayout
    android:id="@+id/id_drawerlayout"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipChildren="false"

    >

    <!--content-->
    <android.support.design.widget.CoordinatorLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
    </android.support.design.widget.CoordinatorLayout>

    <!--menu-->
    <RelativeLayout
        android:layout_width="280dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:clipChildren="false"
        >
        <com.mxn.soul.flowingdrawer_core.FlowingView
            android:paddingRight="35dp"
            android:id="@+id/sv"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
        <FrameLayout
            android:id="@+id/id_container_menu"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentLeft="true"
            android:layout_marginRight="25dp"

            />
    </RelativeLayout>

</com.mxn.soul.flowingdrawer_core.LeftDrawerLayout>

Main_activity.java

public class MainActivity extends AppCompatActivity{

    private LeftDrawerLayout mLeftDrawerLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mLeftDrawerLayout = (LeftDrawerLayout) findViewById(R.id.id_drawerlayout);

        FragmentManager fm = getSupportFragmentManager();
        MyMenuFragment mMenuFragment = (MyMenuFragment) fm.findFragmentById(R.id.id_container_menu);
        FlowingView mFlowingView = (FlowingView) findViewById(R.id.sv);
        if (mMenuFragment == null) {
            fm.beginTransaction().add(R.id.id_container_menu, mMenuFragment = new MyMenuFragment()).commit();
        }
        mLeftDrawerLayout.setFluidView(mFlowingView);
        mLeftDrawerLayout.setMenuFragment(mMenuFragment);
    }


}

now the navigationview is considered as a fragment here so code for the fragment is here :

public class MyMenuFragment extends MenuFragment{
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment,container,false);

        return setupReveal(v);
    }
}

So this is pretty much it. You can thank this person for the wonderful work.

Parth Anjaria
  • 3,961
  • 3
  • 30
  • 62
  • Not launching...showing me this error. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mxn.soul.flowingdrawer/com.mxn.soul.flowingdrawer.MainActivity}: java.lang.IllegalArgumentException: Target must not be null. – Debasish Ghosh Oct 17 '17 at 12:57
  • Caused by: java.lang.IllegalArgumentException: Target must not be null. at com.squareup.picasso.RequestCreator.into(RequestCreator.java:607) at com.squareup.picasso.RequestCreator.into(RequestCreator.java:590) at com.mxn.soul.flowingdrawer.MenuListFragment.setupHeader(MenuListFragment.java:58) at com.mxn.soul.flowingdrawer.MenuListFragment.onCreateView(MenuListFragment.java:45) – Debasish Ghosh Oct 17 '17 at 12:59
1

Flabby animation

You can take help from this LINK

enter image description here enter image description here

A video example of this library is on this youtube video.

The demo app can be found on the play store.

Shoeb Siddique
  • 2,805
  • 1
  • 22
  • 42