com.melnykov.fab.FloatingActionButton Java Examples

The following examples show how to use com.melnykov.fab.FloatingActionButton. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AlbumFragment.java    From Muzesto with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(
            R.layout.fragment_recyclerview, container, false);

    recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
    fastScroller = (FastScroller) rootView.findViewById(R.id.fastscroller);
    FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
    fab.hide();
    ImageView backdrop = (ImageView) rootView.findViewById(R.id.white_backdrop);
    backdrop.setVisibility(View.VISIBLE);

    setLayoutManager();

    if (getActivity() != null)
        new loadAlbums().execute("");
    return rootView;
}
 
Example #2
Source File: ArtistFragment.java    From Muzesto with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(
            R.layout.fragment_recyclerview, container, false);

    recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
    fastScroller = (FastScroller) rootView.findViewById(R.id.fastscroller);
    FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
    fab.hide();
    ImageView backdrop = (ImageView) rootView.findViewById(R.id.white_backdrop);
    backdrop.setVisibility(View.VISIBLE);

    //audioVisualization = (AudioVisualization) rootView.findViewById(R.id.visualizer_view);

    setLayoutManager();

    if (getActivity() != null)
        new loadArtists().execute("");
    return rootView;
}
 
Example #3
Source File: MainActivity.java    From CameraColorPicker with Apache License 2.0 6 votes vote down vote up
/**
 * Make a subtle animation for a {@link com.melnykov.fab.FloatingActionButton} drawing attention to the button.
 *
 * @param fab   the {@link com.melnykov.fab.FloatingActionButton} to animate.
 * @param delay delay before the animation start.
 */
private void animateFab(final FloatingActionButton fab, int delay) {
    fab.postDelayed(new Runnable() {
        @Override
        public void run() {
            // Play a subtle animation
            final long duration = 300;

            final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(fab, View.SCALE_X, 1f, 1.2f, 1f);
            scaleXAnimator.setDuration(duration);
            scaleXAnimator.setRepeatCount(1);

            final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(fab, View.SCALE_Y, 1f, 1.2f, 1f);
            scaleYAnimator.setDuration(duration);
            scaleYAnimator.setRepeatCount(1);

            scaleXAnimator.start();
            scaleYAnimator.start();

            final AnimatorSet animatorSet = new AnimatorSet();
            animatorSet.play(scaleXAnimator).with(scaleYAnimator);
            animatorSet.start();
        }
    }, delay);
}
 
Example #4
Source File: SpringFloatingActionMenu.java    From SpringFloatingActionMenu with Apache License 2.0 6 votes vote down vote up
private ArrayList<ImageButton> generateFollowCircles() {

        int diameter = mFAB.getType() == FloatingActionButton.TYPE_NORMAL ?
                Utils.getDimension(mContext, R.dimen.fab_size_normal) :
                Utils.getDimension(mContext, R.dimen.fab_size_mini);

        ArrayList<ImageButton> circles = new ArrayList<>(mMenuItems.size());
        for (MenuItem item : mMenuItems) {
            ImageButton circle = new ImageButton(mContext);
            OvalShape ovalShape = new OvalShape();
            ShapeDrawable shapeDrawable = new ShapeDrawable(ovalShape);
            shapeDrawable.getPaint().setColor(getResources().getColor(item.getBgColor()));
            circle.setBackgroundDrawable(shapeDrawable);
            circle.setImageResource(item.getIcon());
            LayoutParams lp = new LayoutParams(diameter, diameter);
            circle.setLayoutParams(lp);
            circles.add(circle);
        }

        return circles;
    }
 
Example #5
Source File: SpringFloatingActionMenu.java    From SpringFloatingActionMenu with Apache License 2.0 6 votes vote down vote up
private View generateRevealCircle() {
    int diameter = mFAB.getType() == FloatingActionButton.TYPE_NORMAL ?
            Utils.getDimension(mContext, R.dimen.fab_size_normal) :
            Utils.getDimension(mContext, R.dimen.fab_size_mini);
    View view = new View(mContext);
    OvalShape ovalShape = new OvalShape();
    ShapeDrawable shapeDrawable = new ShapeDrawable(ovalShape);
    shapeDrawable.getPaint().setColor(ContextCompat.getColor(mContext, mRevealColor));
    view.setBackgroundDrawable(shapeDrawable);
    LayoutParams lp = new LayoutParams(diameter, diameter);
    view.setLayoutParams(lp);

    // Make view clickable to avoid clicks on any view located behind the menu
    view.setClickable(true);

    // note it is invisible, but will be visible while  animating
    view.setVisibility(View.INVISIBLE);
    return view;
}
 
Example #6
Source File: MainActivity.java    From CameraColorPicker with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mToolbar = (Toolbar) findViewById(R.id.activity_main_toolbar);
    mToolbar.setTitle(R.string.app_name);
    setSupportActionBar(mToolbar);

    mCurrentPageId = PAGE_ID_COLOR_ITEM_LIST;
    mColorItemListPage = new ColorItemListPage(this);
    mColorItemListPage.setListener(this);
    mPaletteListPage = new PaletteListPage(this);
    mPaletteListPage.setListener(this);

    mFab = (FloatingActionButton) findViewById(R.id.activity_main_fab);
    mFab.setOnClickListener(this);

    final MyPagerAdapter adapter = new MyPagerAdapter();
    mTabs = (PagerSlidingTabStrip) findViewById(R.id.activity_main_tabs);
    mViewPager = (ViewPager) findViewById(R.id.activity_main_view_pager);
    mViewPager.setAdapter(adapter);
    mTabs.setViewPager(mViewPager);
    mTabs.setOnPageChangeListener(this);

    mMainActivityFlavor = new MainActivityFlavor(this);
}
 
Example #7
Source File: WidgetPickerActivity.java    From AcDisplay with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    if (mConfig.isWallpaperShown()) setTheme(R.style.MaterialTheme_WidgetPicker_Wallpaper);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_widget_picker);

    mEmptyView = findViewById(R.id.empty);
    mFab = (FloatingActionButton) findViewById(R.id.fab);
    mFab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startAppWidgetDiscover();
        }
    });

    mAppWidgetManager = AppWidgetManager.getInstance(this);
    mHostContainer = (ViewGroup) findViewById(R.id.appwidget_container);
    mAppWidgetHost = new MyAppWidgetHost(this, HostWidget.HOST_ID);

    initSwitchBar();
    initSeekBars();
}
 
Example #8
Source File: FPOsmDroidView.java    From FancyPlaces with GNU General Public License v3.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fancy_places_osmview, container, false);

    mMapView = (OsmMapViewScrollWorkaround) v.findViewById(R.id.fp_map_view);
    mMapView.setTileSource(TileSourceFactory.MAPQUESTOSM);
    mMapView.setMultiTouchControls(true);
    mMapView.setTilesScaledToDpi(true);
    mMapView.setWorkaroundEnabled(true);

    mapHandler = new OsmMapHandler(mMapView, fancyPlaceSelectedCallback);
    mapHandler.setAdapter(parent.fancyPlaceArrayAdapter);

    locationHandler = ((FancyPlacesApplication) parent.getApplicationContext()).getLocationHandler();
    locationHandler.addOnLocationUpdatedListener(this);
    locationHandler.updateLocation(false);

    // add fab callback
    FloatingActionButton fab = (FloatingActionButton) v.findViewById(R.id.fp_map_fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            fancyPlaceSelectedCallback.onFancyPlaceSelected(0, OnFancyPlaceSelectedListener.INTENT_CREATE_NEW);
        }
    });


    return v;
}
 
Example #9
Source File: FPListView.java    From FancyPlaces with GNU General Public License v3.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fancy_places_list_view, container, false);

    // add places to list
    fancyPlacesList = (ListView) v.findViewById(R.id.fp_list_view);
    FloatingActionButton fab = (FloatingActionButton) v.findViewById(R.id.fp_list_fab);
    fab.attachToListView(fancyPlacesList);

    // set on click listener
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            fancyPlaceSelectedCallback.onFancyPlaceSelected(0, OnFancyPlaceSelectedListener.INTENT_CREATE_NEW);
        }
    });


    // set adapter
    fancyPlacesList.setAdapter(parent.fancyPlaceArrayAdapter);

    // add on mode change listener
    onListModeChangeListeners.add(parent.fancyPlaceArrayAdapter);
    changeListMode(IOnListModeChangeListener.MODE_NORMAL);

    return v;
}
 
Example #10
Source File: FabToolbar.java    From fab-toolbar with MIT License 5 votes vote down vote up
private void init() {
	screenWidth = getResources().getDisplayMetrics().widthPixels;

	inflate(getContext(), R.layout.fab_toolbar, this);
	button = (FloatingActionButton) findViewById(R.id.button);
	button.setOnClickListener(new ButtonClickListener());
	container = ((LinearLayout) findViewById(R.id.container));
}
 
Example #11
Source File: AbstractBrowserFragment.java    From SimpleExplorer with GNU General Public License v3.0 5 votes vote down vote up
protected void initFab(View rootView) {
    FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fabbutton);
    fab.attachToListView(mListView);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showMenu(view);
        }
    });
}
 
Example #12
Source File: RecylerViewFragment.java    From Material-Design-Example with Apache License 2.0 4 votes vote down vote up
private void loadViewComponents() {
    mRecyclerView = (RecyclerView) mViewRecyclerCardsView.findViewById(R.id.fragment_recyler_view_content_main);
    mFloatingActionButton = (FloatingActionButton) mViewRecyclerCardsView.findViewById(R.id.fragment_recyler_view_float_action_button);
}
 
Example #13
Source File: PickerFragment.java    From SimpleExplorer with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void initFab(View rootView) {
    FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fabbutton);
    fab.setVisibility(View.GONE);
}
 
Example #14
Source File: Events.java    From MultiImagePicker with MIT License 4 votes vote down vote up
public OnAttachFabEvent(FloatingActionButton fab) {
    this.fab = fab;
}
 
Example #15
Source File: PaletteLoader.java    From Mizuu with Apache License 2.0 4 votes vote down vote up
public void setFab(FloatingActionButton fab) {
    mFab = fab;
}
 
Example #16
Source File: PaletteLoader.java    From Mizuu with Apache License 2.0 4 votes vote down vote up
private FloatingActionButton getFab() {
    return mFab;
}
 
Example #17
Source File: SongsFragment.java    From Muzesto with GNU General Public License v3.0 4 votes vote down vote up
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        //requestPermissions();
        View rootView = inflater.inflate(
                R.layout.fragment_recyclerview, container, false);

        recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
        FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
        FastScroller fastScroller = (FastScroller) rootView.findViewById(R.id.fastscroller);
        fastScroller.setRecyclerView(recyclerView);
        audioVisualization = (AudioVisualization) rootView.findViewById(R.id.visualizer_view);
        backdrop = (ImageView) rootView.findViewById(R.id.white_backdrop);

        fab.attachToRecyclerView(recyclerView);
        fab.setColorNormal(getResources().getColor(R.color.colorAccent));
        fab.setColorPressed(getResources().getColor(R.color.widget_pause));
        fab.setColorRipple(getResources().getColor(R.color.window_background));

        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Handler handler = new Handler();
                handler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        MusicPlayer.shuffleAll(getActivity());
                    }
                }, 80);
            }
        });

        new loadSongs().execute("");
        ((BaseActivity) getActivity()).setMusicStateListenerListener(this);

//        if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED
//                && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.MODIFY_AUDIO_SETTINGS) == PackageManager.PERMISSION_GRANTED) {
//
//            requestPermissions();
//
//        }
//
//        requestPermissions();

        SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
        Boolean stateWave = sharedPrefs.getBoolean(getString(R.string.pref_switch_wave_key), true);

        if(stateWave)
            backdrop.setVisibility(View.GONE);
        else
            backdrop.setVisibility(View.VISIBLE);

        return rootView;
    }
 
Example #18
Source File: ContactsFragment.java    From OPFPush with Apache License 2.0 4 votes vote down vote up
private void initFAB(@NonNull final View view) {
    final FloatingActionButton addContactFab =
            (FloatingActionButton) view.findViewById(R.id.add_contact_fab);
    addContactFab.attachToListView(contactsListView);
    addContactFab.setOnClickListener(onFabClickListener());
}
 
Example #19
Source File: FabToolbar.java    From fab-toolbar with MIT License 4 votes vote down vote up
private boolean canAddViewToContainer(View child) {
	return container != null && !(child instanceof FloatingActionButton);
}
 
Example #20
Source File: TopicWebView.java    From pybbsMD with Apache License 2.0 4 votes vote down vote up
public void setFabReply(FloatingActionButton fabReply) {
    this.fabReply = fabReply;
}
 
Example #21
Source File: SpringFloatingActionMenu.java    From SpringFloatingActionMenu with Apache License 2.0 4 votes vote down vote up
public FloatingActionButton getFAB() {
    return mFAB;
}
 
Example #22
Source File: BloomStyleActivity.java    From SpringFloatingActionMenu with Apache License 2.0 4 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bloom);

        createFabFrameAnim();
        createFabReverseFrameAnim();

        final FloatingActionButton fab = new FloatingActionButton(this);
        fab.setType(FloatingActionButton.TYPE_NORMAL);
        fab.setImageDrawable(frameAnim);
//        fab.setImageResource(android.R.drawable.ic_dialog_email);
        fab.setColorPressedResId(R.color.colorPrimary);
        fab.setColorNormalResId(R.color.fab);
        fab.setColorRippleResId(R.color.text_color);
        fab.setShadow(true);
        springFloatingActionMenu = new SpringFloatingActionMenu.Builder(this)
                .fab(fab)
                .addMenuItem(R.color.photo, R.mipmap.ic_messaging_posttype_photo, "Photo", R.color.text_color,this)
                .addMenuItem(R.color.chat, R.mipmap.ic_messaging_posttype_chat, "Chat", R.color.text_color,this)
                .addMenuItem(R.color.quote, R.mipmap.ic_messaging_posttype_quote, "Quote", R.color.text_color,this)
                .addMenuItem(R.color.link, R.mipmap.ic_messaging_posttype_link, "Link", R.color.text_color,this)
                .addMenuItem(R.color.audio, R.mipmap.ic_messaging_posttype_audio, "Audio", R.color.text_color,this)
                .addMenuItem(R.color.text, R.mipmap.ic_messaging_posttype_text, "Text", R.color.text_color,this)
                .addMenuItem(R.color.video, R.mipmap.ic_messaging_posttype_video, "Video", R.color.text_color,this)
                .animationType(SpringFloatingActionMenu.ANIMATION_TYPE_BLOOM)
                .revealColor(R.color.colorPrimary)
                .gravity(Gravity.RIGHT | Gravity.BOTTOM)
                .onMenuActionListner(new OnMenuActionListener() {
                    @Override
                    public void onMenuOpen() {
                        fab.setImageDrawable(frameAnim);
                        frameReverseAnim.stop();
                        frameAnim.start();
                    }

                    @Override
                    public void onMenuClose() {
                        fab.setImageDrawable(frameReverseAnim);
                        frameAnim.stop();
                        frameReverseAnim.start();
                    }
                })
                .build();

        Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(mToolbar);
        setTitle("SpringFloatingActionMenu");
    }
 
Example #23
Source File: TumblrStyleActivity.java    From SpringFloatingActionMenu with Apache License 2.0 4 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tumblr);

        createFabFrameAnim();
        createFabReverseFrameAnim();

        findViewById(R.id.text_view).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(TumblrStyleActivity.this, "Click", Toast.LENGTH_SHORT).show();
            }
        });
        final FloatingActionButton fab = new FloatingActionButton(this);
        fab.setType(FloatingActionButton.TYPE_NORMAL);
        fab.setImageDrawable(frameAnim);
//        fab.setImageResource(android.R.drawable.ic_dialog_email);
        fab.setColorPressedResId(R.color.colorPrimary);
        fab.setColorNormalResId(R.color.fab);
        fab.setColorRippleResId(R.color.text_color);
        fab.setShadow(true);
        springFloatingActionMenu = new SpringFloatingActionMenu.Builder(this)
                .fab(fab)
                .addMenuItem(R.color.photo, R.mipmap.ic_messaging_posttype_photo, "Photo", R.color.text_color,this)
                .addMenuItem(R.color.chat, R.mipmap.ic_messaging_posttype_chat, "Chat", R.color.text_color,this)
                .addMenuItem(R.color.quote, R.mipmap.ic_messaging_posttype_quote, "Quote", R.color.text_color,this)
                .addMenuItem(R.color.link, R.mipmap.ic_messaging_posttype_link, "Link", R.color.text_color,this)
                .addMenuItem(R.color.audio, R.mipmap.ic_messaging_posttype_audio, "Audio", R.color.text_color,this)
                .addMenuItem(R.color.text, R.mipmap.ic_messaging_posttype_text, "Text", R.color.text_color,this)
                .addMenuItem(R.color.video, R.mipmap.ic_messaging_posttype_video, "Video", R.color.text_color,this)
                .animationType(SpringFloatingActionMenu.ANIMATION_TYPE_TUMBLR)
                .revealColor(R.color.colorPrimary)
                .gravity(Gravity.RIGHT | Gravity.BOTTOM)
                .onMenuActionListner(new OnMenuActionListener() {
                    @Override
                    public void onMenuOpen() {
                        fab.setImageDrawable(frameAnim);
                        frameReverseAnim.stop();
                        frameAnim.start();
                    }

                    @Override
                    public void onMenuClose() {
                        fab.setImageDrawable(frameReverseAnim);
                        frameAnim.stop();
                        frameReverseAnim.start();
                    }
                })
                .build();

        Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(mToolbar);
        setTitle("SpringFloatingActionMenu");
    }
 
Example #24
Source File: MainActivity.java    From CameraColorPicker with Apache License 2.0 2 votes vote down vote up
/**
 * Make a subtle animation for a {@link com.melnykov.fab.FloatingActionButton} drawing attention to the button.
 * Apply a default delay of 400ms.
 * <p/>
 * See also : {@link MainActivity#animateFab(FloatingActionButton, int)}
 *
 * @param fab the {@link com.melnykov.fab.FloatingActionButton} to animate.
 */
private void animateFab(final FloatingActionButton fab) {
    animateFab(fab, 400);
}
 
Example #25
Source File: BaseActivity.java    From Dashboard with MIT License 2 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(getLayoutResource());

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    if (toolbar != null) {
        setSupportActionBar(toolbar);

        YoYo.with(Techniques.RotateIn)
                .duration(600)
                .playOn(findViewById(R.id.imageView4));

        YoYo.with(Techniques.FadeIn)
                .duration(1800)
                .playOn(findViewById(R.id.imageView3));

        YoYo.with(Techniques.Shake)
                .delay(800)
                .interpolate(new AccelerateDecelerateInterpolator())
                .duration(2100)
                .playOn(findViewById(R.id.imageView3));

    }


    ScrollView scrollView = (ScrollView) findViewById(R.id.scroll);
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);

    fab.attachToScrollView((com.melnykov.fab.ObservableScrollView) scrollView);

    fab.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {


            //For example: Start Wallpaper Home Activity
            Intent intent = new Intent(v.getContext(), com.antonioleiva.materialeverywhere.HomeActivity.class);
            startActivity(intent);

        }
    });


}
 
Example #26
Source File: BaseActivity.java    From Dashboard with MIT License 2 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(getLayoutResource());

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    if (toolbar != null) {
        setSupportActionBar(toolbar);

        YoYo.with(Techniques.RotateIn)
                .duration(600)
                .playOn(findViewById(R.id.imageView4));

        YoYo.with(Techniques.FadeIn)
                .duration(1800)
                .playOn(findViewById(R.id.imageView3));

        YoYo.with(Techniques.Shake)
                .delay(800)
                .interpolate(new AccelerateDecelerateInterpolator())
                .duration(2100)
                .playOn(findViewById(R.id.imageView3));

    }


    ScrollView scrollView = (ScrollView) findViewById(R.id.scroll);
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);

    fab.attachToScrollView((com.melnykov.fab.ObservableScrollView) scrollView);

    fab.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {


            //For example: Start Wallpaper Home Activity
            Intent intent = new Intent(v.getContext(), com.antonioleiva.materialeverywhere.HomeActivity.class);
            startActivity(intent);

        }
    });


}