com.github.clans.fab.FloatingActionMenu Java Examples

The following examples show how to use com.github.clans.fab.FloatingActionMenu. 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: MainActivity.java    From MagicalCamera with Apache License 2.0 7 votes vote down vote up
private void setUIComponents() {
    imageView = (ImageView) findViewById(R.id.imageView);
    btntakephoto = (ImageButton) findViewById(R.id.btntakephoto);
    btnselectedphoto = (ImageButton) findViewById(R.id.btnselectedphoto);
    btnGoTo = (Button) findViewById(R.id.btnGoTo);
    texttitle = (TextView) findViewById(R.id.texttitle);
    saveImage = (ImageButton) findViewById(R.id.saveImage);
    floatingBtnRotate = (FloatingActionButton) findViewById(R.id.floatingBtnRotate);
    floatingBtnFacialRecognition = (FloatingActionButton) findViewById(R.id.floatingBtnFacialRecognition);
    floatingBtnPhotoInformation = (FloatingActionButton) findViewById(R.id.floatingBtnPhotoInformation);
    floatingBtnSeeString64 = (FloatingActionButton) findViewById(R.id.floatingBtnSeeString64);
    frame = (FrameLayout) findViewById(R.id.frame);
    principalLayout = findViewById(R.id.principalLayout);
    floatingBtnMenu = (FloatingActionMenu) findViewById(R.id.floatingBtnMenu);
    progressLoadingIndicator = (LinearLayout) findViewById(R.id.progressLoadingIndicator);

    floatingBtnMenu.setVisibility(View.GONE);
    saveImage.setVisibility(View.GONE);
    btnGoTo.setText(getString(R.string.go_to_fragment));
    texttitle.setText(getString(R.string.title_activity));
}
 
Example #2
Source File: FragmentSample.java    From MagicalCamera with Apache License 2.0 6 votes vote down vote up
private void setUIComponents(View rootView) {
    imageView = (ImageView) rootView.findViewById(R.id.imageView);
    btntakephoto = (ImageButton) rootView.findViewById(R.id.btntakephoto);
    btnselectedphoto = (ImageButton) rootView.findViewById(R.id.btnselectedphoto);
    btnGoTo = (Button) rootView.findViewById(R.id.btnGoTo);
    texttitle = (TextView) rootView.findViewById(R.id.texttitle);
    saveImage = (ImageButton) rootView.findViewById(R.id.saveImage);
    floatingBtnRotate = (FloatingActionButton) rootView.findViewById(R.id.floatingBtnRotate);
    floatingBtnFacialRecognition = (FloatingActionButton) rootView.findViewById(R.id.floatingBtnFacialRecognition);
    floatingBtnPhotoInformation = (FloatingActionButton) rootView.findViewById(R.id.floatingBtnPhotoInformation);
    floatingBtnSeeString64 = (FloatingActionButton) rootView.findViewById(R.id.floatingBtnSeeString64);
    frame = (FrameLayout) rootView.findViewById(R.id.frame);
    principalLayout = rootView.findViewById(R.id.principalLayout);
    floatingBtnMenu = (FloatingActionMenu) rootView.findViewById(R.id.floatingBtnMenu);


    floatingBtnMenu.setVisibility(View.GONE);
    saveImage.setVisibility(View.GONE);
    btnGoTo.setText(getString(R.string.go_to_activity));
    texttitle.setText(getString(R.string.title_fragment));
}
 
Example #3
Source File: Activity_Result_Combination.java    From MortgageCalculator with Apache License 2.0 5 votes vote down vote up
public void initViews(){
    viewPager = (ViewPager)findViewById(R.id.Result_Combination_Viewpager);
    typeOneText = (TextView)findViewById(R.id.Result_Combination_TypeOne_TextView);
    typeTwoText = (TextView)findViewById(R.id.Result_Combination_TypeTwo_TextView);
    cursorImageView = (ImageView)findViewById(R.id.Result_Combination_Cursor_ImageView);

    shareMenu = (FloatingActionMenu)findViewById(R.id.combination_menu);
    share2friendButton = (FloatingActionButton)findViewById(R.id.combination_menu_item1);
    share2timelineButton = (FloatingActionButton)findViewById(R.id.combination_menu_item2);
    adButton = (FloatingActionButton)findViewById(R.id.combination_menu_item3);
}
 
Example #4
Source File: NewsActivity.java    From SimpleNews with Apache License 2.0 5 votes vote down vote up
private void initNewsTypeIcon() {
    newsTypeButton = (FloatingActionMenu) findViewById(R.id.floating_action_menu);
    subactionButton1 = (FloatingActionButton) findViewById(R.id.menu_item_1);
    subactionButton2 = (FloatingActionButton) findViewById(R.id.menu_item_2);

    subactionButton1.setOnClickListener(new OnSubActionButtonClickListener());
    subactionButton2.setOnClickListener(new OnSubActionButtonClickListener());

    actionButtonIds = new int[]{R.drawable.ic_home, R.drawable.ic_fav, R.drawable.ic_seen};
    updateNewsIcon();
}
 
Example #5
Source File: NewsActivity.java    From SimpleNews with Apache License 2.0 5 votes vote down vote up
private void setColor(FloatingActionMenu menu, int primaryColor, int secondaryColor) {
    if (menu != null) {
        menu.setMenuButtonColorNormal(primaryColor);
        menu.setMenuButtonColorPressed(secondaryColor);
        menu.setMenuButtonColorRipple(secondaryColor);
    }
}
 
Example #6
Source File: HomeFragment.java    From CoordinatorLayoutExample with Apache License 2.0 5 votes vote down vote up
@Override
protected void initView(View view) {
    mRecyclerView = (RecyclerView) mView.findViewById(R.id.recyclerView);
    mMenu = (FloatingActionMenu) mView.findViewById(R.id.menu);
    mMenuItemCollect = (FloatingActionButton) mView.findViewById(R.id.menu_item_collect);
    mMenuItemComment = (FloatingActionButton) mView.findViewById(R.id.menu_item_comment);
    mMenuItemStar = (FloatingActionButton) mView.findViewById(R.id.menu_item_star);
    mMenu.setVisibility(View.GONE);

}
 
Example #7
Source File: ProfileManagerActivity.java    From ShadowsocksRR with Apache License 2.0 5 votes vote down vote up
@SuppressLint("RestrictedApi")
public void initFab() {
    menu = (FloatingActionMenu) findViewById(R.id.menu);
    menu.setClosedOnTouchOutside(true);
    AppCompatDrawableManager dm = AppCompatDrawableManager.get();
    FloatingActionButton manualAddFAB = (FloatingActionButton) findViewById(R.id.fab_manual_add);
    manualAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_content_create));
    manualAddFAB.setOnClickListener(this);
    final FloatingActionButton qrcodeAddFAB = (FloatingActionButton) findViewById(R.id.fab_qrcode_add);
    qrcodeAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_image_camera_alt));
    qrcodeAddFAB.setOnClickListener(this);
    FloatingActionButton nfcAddFAB = (FloatingActionButton) findViewById(R.id.fab_nfc_add);
    nfcAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_device_nfc));
    nfcAddFAB.setOnClickListener(this);
    FloatingActionButton importAddFAB = (FloatingActionButton) findViewById(R.id.fab_import_add);
    importAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_content_paste));
    importAddFAB.setOnClickListener(this);
    FloatingActionButton ssrsubAddFAB = (FloatingActionButton) findViewById(R.id.fab_ssr_sub);
    ssrsubAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_rss));
    ssrsubAddFAB.setOnClickListener(this);
    menu.setOnMenuToggleListener(new FloatingActionMenu.OnMenuToggleListener() {
        @Override
        public void onMenuToggle(boolean opened) {
            if (opened) {
                int visible = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA) ? View.VISIBLE : View.GONE;
                qrcodeAddFAB.setVisibility(visible);
            }
        }
    });
}
 
Example #8
Source File: Activity_Result.java    From MortgageCalculator with Apache License 2.0 5 votes vote down vote up
public void initViews(){
    viewPager = (ViewPager)findViewById(R.id.viewpager);
    typeOneText = (TextView)findViewById(R.id.typeOneTextView);
    typeTwoText = (TextView)findViewById(R.id.typeTwoTextView);
    cursorImageView = (ImageView)findViewById(R.id.ResultCursorImageView);

    shareMenu = (FloatingActionMenu)findViewById(R.id.menu);
    share2friendButton = (FloatingActionButton)findViewById(R.id.menu_item1);
    share2timelineButton = (FloatingActionButton)findViewById(R.id.menu_item2);
    adButton = (FloatingActionButton)findViewById(R.id.menu_item3);
}
 
Example #9
Source File: Activity_Result_Combination.java    From MortgageCalculator with Apache License 2.0 5 votes vote down vote up
public void initViews(){
    viewPager = (ViewPager)findViewById(R.id.Result_Combination_Viewpager);
    typeOneText = (TextView)findViewById(R.id.Result_Combination_TypeOne_TextView);
    typeTwoText = (TextView)findViewById(R.id.Result_Combination_TypeTwo_TextView);
    cursorImageView = (ImageView)findViewById(R.id.Result_Combination_Cursor_ImageView);

    shareMenu = (FloatingActionMenu)findViewById(R.id.combination_menu);
    share2friendButton = (FloatingActionButton)findViewById(R.id.combination_menu_item1);
    share2timelineButton = (FloatingActionButton)findViewById(R.id.combination_menu_item2);
}
 
Example #10
Source File: Activity_Result.java    From MortgageCalculator with Apache License 2.0 5 votes vote down vote up
public void initViews(){
    viewPager = (ViewPager)findViewById(R.id.viewpager);
    typeOneText = (TextView)findViewById(R.id.typeOneTextView);
    typeTwoText = (TextView)findViewById(R.id.typeTwoTextView);
    cursorImageView = (ImageView)findViewById(R.id.ResultCursorImageView);

    shareMenu = (FloatingActionMenu)findViewById(R.id.menu);
    share2friendButton = (FloatingActionButton)findViewById(R.id.menu_item1);
    share2timelineButton = (FloatingActionButton)findViewById(R.id.menu_item2);
}
 
Example #11
Source File: FloatingActionMenuBehavior.java    From Maying with Apache License 2.0 5 votes vote down vote up
@Override
public void onNestedScroll(CoordinatorLayout parent, FloatingActionMenu child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
    super.onNestedScroll(parent, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
    int dy = dyConsumed + dyUnconsumed;
    if (child.isMenuButtonHidden()) {
        if (dy < 0) {
            child.showMenuButton(true);
        }
    } else if (dy > 0) {
        child.hideMenuButton(true);
    }
}
 
Example #12
Source File: FloatingActionMenuBehavior.java    From ShadowsocksRR with Apache License 2.0 5 votes vote down vote up
@Override
public void onNestedScroll(CoordinatorLayout parent, FloatingActionMenu child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
    super.onNestedScroll(parent, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
    int dy = dyConsumed + dyUnconsumed;
    if (child.isMenuButtonHidden()) {
        if (dy < 0) {
            child.showMenuButton(true);
        }
    } else if (dy > 0) {
        child.hideMenuButton(true);
    }
}
 
Example #13
Source File: FloatingActionMenuBehavior.java    From ShadowsocksRR with Apache License 2.0 4 votes vote down vote up
@Override
public boolean layoutDependsOn(CoordinatorLayout parent, FloatingActionMenu child, View dependency) {
    return dependency instanceof Snackbar.SnackbarLayout;
}
 
Example #14
Source File: MainActivity.java    From QuickNote with Apache License 2.0 4 votes vote down vote up
public FloatingActionMenu getFabMenu() {
    return mFabMenu;
}
 
Example #15
Source File: FloatingActionMenuBehavior.java    From ShadowsocksRR with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionMenu child, View directTargetChild, View target, int nestedScrollAxes) {
    return true;
}
 
Example #16
Source File: MenusFragment.java    From FloatingActionButton with Apache License 2.0 4 votes vote down vote up
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    menus.add(menuDown);
    menus.add(menuRed);
    menus.add(menuYellow);
    menus.add(menuGreen);
    menus.add(menuBlue);
    menus.add(menuLabelsRight);

    menuYellow.setOnMenuToggleListener(new FloatingActionMenu.OnMenuToggleListener() {
        @Override
        public void onMenuToggle(boolean opened) {
            String text;
            if (opened) {
                text = "Menu opened";
            } else {
                text = "Menu closed";
            }
            Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
        }
    });

    fab1.setOnClickListener(clickListener);
    fab2.setOnClickListener(clickListener);
    fab3.setOnClickListener(clickListener);

    int delay = 400;
    for (final FloatingActionMenu menu : menus) {
        mUiHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                menu.showMenuButton(true);
            }
        }, delay);
        delay += 150;
    }

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            fabEdit.show(true);
        }
    }, delay + 150);

    menuRed.setOnMenuButtonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (menuRed.isOpened()) {
                Toast.makeText(getActivity(), menuRed.getMenuButtonLabelText(), Toast.LENGTH_SHORT).show();
            }

            menuRed.toggle(true);
        }
    });

    createCustomAnimation();
}
 
Example #17
Source File: MenusFragment.java    From FloatingActionButton with Apache License 2.0 4 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    menuRed = (FloatingActionMenu) view.findViewById(R.id.menu_red);
    menuYellow = (FloatingActionMenu) view.findViewById(R.id.menu_yellow);
    menuGreen = (FloatingActionMenu) view.findViewById(R.id.menu_green);
    menuBlue = (FloatingActionMenu) view.findViewById(R.id.menu_blue);
    menuDown = (FloatingActionMenu) view.findViewById(R.id.menu_down);
    menuLabelsRight = (FloatingActionMenu) view.findViewById(R.id.menu_labels_right);

    fab1 = (FloatingActionButton) view.findViewById(R.id.fab1);
    fab2 = (FloatingActionButton) view.findViewById(R.id.fab2);
    fab3 = (FloatingActionButton) view.findViewById(R.id.fab3);

    final FloatingActionButton programFab1 = new FloatingActionButton(getActivity());
    programFab1.setButtonSize(FloatingActionButton.SIZE_MINI);
    programFab1.setLabelText(getString(R.string.lorem_ipsum));
    programFab1.setImageResource(R.drawable.ic_edit);
    menuRed.addMenuButton(programFab1);
    programFab1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            programFab1.setLabelColors(ContextCompat.getColor(getActivity(), R.color.grey),
                    ContextCompat.getColor(getActivity(), R.color.light_grey),
                    ContextCompat.getColor(getActivity(), R.color.white_transparent));
            programFab1.setLabelTextColor(ContextCompat.getColor(getActivity(), R.color.black));
        }
    });

    ContextThemeWrapper context = new ContextThemeWrapper(getActivity(), R.style.MenuButtonsStyle);
    FloatingActionButton programFab2 = new FloatingActionButton(context);
    programFab2.setLabelText("Programmatically added button");
    programFab2.setImageResource(R.drawable.ic_edit);
    menuYellow.addMenuButton(programFab2);

    fab1.setEnabled(false);
    menuRed.setClosedOnTouchOutside(true);
    menuBlue.setIconAnimated(false);

    menuDown.hideMenuButton(false);
    menuRed.hideMenuButton(false);
    menuYellow.hideMenuButton(false);
    menuGreen.hideMenuButton(false);
    menuBlue.hideMenuButton(false);
    menuLabelsRight.hideMenuButton(false);

    fabEdit = (FloatingActionButton) view.findViewById(R.id.fab_edit);
    fabEdit.setShowAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.scale_up));
    fabEdit.setHideAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.scale_down));
}
 
Example #18
Source File: ResourceUtil.java    From TLint with Apache License 2.0 4 votes vote down vote up
public static void setFabMenuColor(Activity activity, FloatingActionMenu fab) {
    // 更新FAB的颜色
    fab.setMenuButtonColorNormal(getThemeColor(activity));
    fab.setMenuButtonColorPressed(getThemeColor(activity));
    fab.setMenuButtonColorRipple(getThemeColor(activity));
}
 
Example #19
Source File: FloatingActionMenuBehavior.java    From FileManager with Apache License 2.0 4 votes vote down vote up
@Override
public void onDependentViewRemoved(CoordinatorLayout parent, FloatingActionMenu child, View dependency) {
    float translationY = Math.max(0,dependency.getTranslationY() - dependency.getHeight());
    child.setTranslationY(translationY);
    super.onDependentViewRemoved(parent, child, dependency);
}
 
Example #20
Source File: FloatingActionMenuBehavior.java    From FileManager with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionMenu child, View dependency) {
    float translationY = Math.min(0,dependency.getTranslationY() - dependency.getHeight());
    child.setTranslationY(translationY);
    return true;
}
 
Example #21
Source File: FloatingActionMenuBehavior.java    From FileManager with Apache License 2.0 4 votes vote down vote up
@Override
public boolean layoutDependsOn(CoordinatorLayout parent, FloatingActionMenu child, View dependency) {
    return dependency instanceof Snackbar.SnackbarLayout;
}
 
Example #22
Source File: SnackBarBehavior.java    From FileManager with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionMenu child, View dependency) {
    float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight());
    child.setTranslationY(translationY);
    return true;
}
 
Example #23
Source File: SnackBarBehavior.java    From FileManager with Apache License 2.0 4 votes vote down vote up
@Override
public boolean layoutDependsOn(CoordinatorLayout parent, FloatingActionMenu child, View dependency) {
    return dependency instanceof Snackbar.SnackbarLayout;
}
 
Example #24
Source File: OCFileListFragment.java    From Cirrus_depricated with GNU General Public License v2.0 4 votes vote down vote up
public FloatingActionMenu getFab() {
    return fabMenu;
}
 
Example #25
Source File: OCFileListFragment.java    From Cirrus_depricated with GNU General Public License v2.0 4 votes vote down vote up
public FloatingActionMenu getFab() {
    return fabMenu;
}
 
Example #26
Source File: FloatingActionMenuBehavior.java    From Maying with Apache License 2.0 4 votes vote down vote up
@Override
public boolean layoutDependsOn(CoordinatorLayout parent, FloatingActionMenu child, View dependency) {
    return dependency instanceof Snackbar.SnackbarLayout;
}
 
Example #27
Source File: FloatingActionMenuBehavior.java    From Maying with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionMenu child, View directTargetChild, View target, int nestedScrollAxes) {
    return true;
}