Commit 4e42bed8 authored by Varun Patil's avatar Varun Patil

Add some animations

parent 5a98fc28
......@@ -291,7 +291,14 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
FragmentManager manager = getSupportFragmentManager();
if (fragment instanceof FeedFragment)
manager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
FragmentTransaction transaction = manager.beginTransaction();
/* Animate only for ProfileFragment */
if (fragment instanceof ProfileFragment) {
transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right);
}
transaction.replace(R.id.framelayout_for_fragment, fragment, fragment.getTag());
transaction.addToBackStack(fragment.getTag()).commit();
}
......
......@@ -204,6 +204,7 @@ public class BodyFragment extends Fragment {
EventFragment eventFragment = new EventFragment();
eventFragment.setArguments(bundle);
FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right);
ft.replace(R.id.framelayout_for_fragment, eventFragment, eventFragment.getTag());
ft.addToBackStack(eventFragment.getTag());
ft.commit();
......
......@@ -119,6 +119,7 @@ public class EventFragment extends BaseFragment {
Body body = bodyList.get(position);
BodyFragment bodyFragment = BodyFragment.newInstance(body);
FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right);
ft.replace(R.id.framelayout_for_fragment, bodyFragment, bodyFragment.getTag());
ft.addToBackStack(bodyFragment.getTag());
ft.commit();
......
......@@ -64,6 +64,7 @@ public class FeedFragment extends BaseFragment {
AddEventFragment addEventFragment = new AddEventFragment();
addEventFragment.setArguments(getArguments());
FragmentTransaction ft = getChildFragmentManager().beginTransaction();
ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right);
ft.replace(R.id.relative_layout, addEventFragment);
ft.addToBackStack("addEvent");
ft.commit();
......@@ -146,6 +147,7 @@ public class FeedFragment extends BaseFragment {
eventFragment.setArguments(bundle);
FragmentManager manager = getActivity().getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right);
transaction.replace(R.id.framelayout_for_fragment, eventFragment, eventFragment.getTag());
transaction.addToBackStack(eventFragment.getTag()).commit();
}
......
<?xml version="1.0" encoding="utf-8"?>
<set>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="x"
android:valueType="floatType"
android:valueFrom="1280"
android:valueTo="0"
android:duration="400"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="x"
android:valueType="floatType"
android:valueFrom="-1280"
android:valueTo="0"
android:duration="400"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="x"
android:valueType="floatType"
android:valueFrom="0"
android:valueTo="-1280"
android:duration="400"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="x"
android:valueType="floatType"
android:valueFrom="0"
android:valueTo="1280"
android:duration="400"/>
</set>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment