use of it.sephiroth.android.library.floatingmenu.FloatingActionItem in project android-floating-action-menu by sephiroth74.
the class ListFragment1 method initFloatingMenu.
private void initFloatingMenu(final int sectionNumber, final Bundle savedInstanceState) {
int currentItem = ((MainActivity2) getActivity()).mViewPager.getCurrentItem();
FloatingActionMenu.Builder builder = createMenu(sectionNumber);
FloatingActionItem item1 = new FloatingActionItem.Builder(getActivity(), 0, R.style.FloatingActionMenuItemStyle).withResId(R.drawable.ic_facebook).build();
FloatingActionItem item2 = new FloatingActionItem.Builder(getActivity(), 1, R.style.FloatingActionMenuItemStyle).withResId(R.drawable.ic_twitter).withDelay(sectionNumber == 3 ? 50 : 0).build();
FloatingActionItem item3 = new FloatingActionItem.Builder(getActivity(), 2, R.style.FloatingActionMenuItemStyle).withResId(R.drawable.ic_facebook).withDelay(sectionNumber == 3 ? 100 : 0).build();
FloatingActionItem item4 = new FloatingActionItem.Builder(getActivity(), 3, R.style.FloatingActionMenuItemStyle).withResId(R.drawable.ic_instagram).withDelay(sectionNumber == 3 ? 150 : 0).build();
if (sectionNumber == 0) {
builder.addItem(item1);
} else if (sectionNumber == 1) {
builder.addItem(item1).addItem(item2);
} else if (sectionNumber == 2) {
builder.addItem(item1).addItem(item2).addItem(item3);
} else if (sectionNumber == 3) {
builder.addItem(item1).addItem(item2).addItem(item3).addItem(item4);
}
mFloatingMenu = builder.build();
mFloatingMenu.setOnItemClickListener(this);
}
use of it.sephiroth.android.library.floatingmenu.FloatingActionItem in project android-floating-action-menu by sephiroth74.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate: " + savedInstanceState);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
List<String> objects = new ArrayList<>();
populateData(objects);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, android.R.id.text1, objects);
mListView.setAdapter(adapter);
mListView.setOnItemClickListener(this);
boolean visible = true;
if (null != savedInstanceState) {
visible = savedInstanceState.getBoolean("floating-menu-visible", true);
}
FloatingActionItem item1 = new FloatingActionItem.Builder(this, 0, R.style.FloatingActionMenuItemStyle).withResId(R.drawable.ic_facebook).withDelay(0).build();
FloatingActionItem item2 = new FloatingActionItem.Builder(this, 1, R.style.FloatingActionMenuItemStyle).withResId(R.drawable.ic_googleplus).withDelay(50).build();
FloatingActionItem item3 = new FloatingActionItem.Builder(this, 2, R.style.FloatingActionMenuItemStyle).withResId(R.drawable.ic_twitter).withDelay(100).build();
mFloatingMenu = new FloatingActionMenu.Builder(this, R.style.FloatingActionMenuStyle).addItem(item1).addItem(item2).addItem(item3).withScrollDelegate(new FloatingActionMenu.AbsListViewScrollDelegate(mListView)).withThreshold(R.dimen.float_action_threshold).withGap(R.dimen.float_action_item_gap).withVerticalPadding(R.dimen.float_action_v_padding).withGravity(FloatingActionMenu.Gravity.CENTER_HORIZONTAL | FloatingActionMenu.Gravity.BOTTOM).withDirection(FloatingActionMenu.Direction.Vertical).animationDuration(400).animationInterpolator(new OvershootInterpolator()).visible(visible).build();
mFloatingMenu.setOnItemClickListener(this);
}
Aggregations