-
Notifications
You must be signed in to change notification settings - Fork 607
Addon: Slider
Sliding Menu - navigation pattern, using in YouTube, Evernote and other cool apps.
Slider implement this pattern. Specially for HoloEverywhere.
<dependency>
<groupId>org.holoeverywhere</groupId>
<artifactId>addon-slider</artifactId>
<version>${holoeverywhere.version}</version>
<type>apklib</type>
</dependency>
Import project addons/slider and add as dependency/module to your application.
You can easily set icons for slidermenu items using setIcon(Drawabale) method:
sliderMenu.add("label", Fragment2.class, SliderMenu.GREEN).setIcon(R.drawable.myicon);
Get reference to the currently visible and active fragment from the activity when using slider addon in combination with tabber.
You can provide tag for fragments like this:
sliderMenu.add("tab2", Fragment2.class, SliderMenu.GREEN).setTag("mynavigation-2");
Also you can get current page number by sliderMenu.getCurrentPage().
You have no way for obtaining current fragment directly, but you can combine this two methods and find fragment via fragment manager:
getSupportFragmentManager().findFragmentByTag("mynavigation-" + sliderMenu.getCurrentPage());
Get reference to the TabsTabsSwipeFragment.java
from the activity/other fragments and dynamically disable/enable swiping.
In your code:
getSupportFragmentManager(). findFragmentByTag("mynavigation-2").getChildFragmentManager().findFragmentById(tagFragmentId);
In your Activity:
private int tagFragmentId;
public void setTagFragmentId(int i) {
Log.i(TAG, "fetched setTagFragmentId: " + i);
tagFragmentId= i;
}
In your tab fragment(which is a child of TabsTabsSwipeFragment
):
@Override
public void onViewCreated(View view, Bundle savedInstanceState)
((mainActivity) getSupportActivity()).setTagFragmentId(this
.getId());
}