Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

Addon: Slider

Mehdi Fanai edited this page Jan 12, 2014 · 3 revisions

Sliding Menu - navigation pattern, using in YouTube, Evernote and other cool apps.
Slider implement this pattern. Specially for HoloEverywhere.

Maven

<dependency>
  <groupId>org.holoeverywhere</groupId>
  <artifactId>addon-slider</artifactId>
  <version>${holoeverywhere.version}</version>
  <type>apklib</type>
</dependency>

Non-maven users

Import project addons/slider and add as dependency/module to your application.

How to:

Set an icon for slider menu items.

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());
}