Giter Club home page Giter Club logo

Comments (8)

hery84 avatar hery84 commented on August 9, 2024

Upgrade to V1.2.2 "added onOpenMenu and onCloseMenu event Listener to catch open and close event"...

dependencies {
        compile 'com.mxn.soul:flowingdrawer-core:1.2.2'
        compile 'com.nineoldandroids:library:2.4.0'
    }

regards.

from flowingdrawer.

moudjames23 avatar moudjames23 commented on August 9, 2024

Hello
I made ​​gradle day. I am new in android programming. The listener must be added to LeftDrawerLayout or at the fragment?
thank you in advance

from flowingdrawer.

hery84 avatar hery84 commented on August 9, 2024

From your MyMenuFragment

 public void onOpenMenu(){
      // Your code here
        Toast.makeText(getActivity(), "onOpenMenu", Toast.LENGTH_SHORT).show();
    }

public void onCloseMenu(){
     // Your code here
      Toast.makeText(getActivity(), "onCloseMenu", Toast.LENGTH_SHORT).show();
      ((MainActivity) getActivity()).closeMenu();
}

from flowingdrawer.

moudjames23 avatar moudjames23 commented on August 9, 2024

thanks very much bicho

from flowingdrawer.

moudjames23 avatar moudjames23 commented on August 9, 2024

Hi bicho ,
I come back again to you because I block me for several days.
I have a class in which Jeu.java is the flowingDrawer (15 elements) and a variable static int ' cpt ' . So I 'd like to know how to change the icon of an element of the menu according to the value of ' cpt ' since the method of onOpenMenu MyMenuFragment ?
For example if cpt = 4 when opening the menu is the icon of the element that will change the menu 4 .
I hope I 'm not too thank you in advance.

I'm french so I made a translation of this message on google translation .

from flowingdrawer.

hery84 avatar hery84 commented on August 9, 2024

Hi @moudjames23 , i'm from Mexico :D

Try this...

public class MyMenuFragment extends MenuFragment {

    private ImageView ivMenuUserProfilePhoto;
    Menu menuNav; // Declaring menuNav from Menu

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_menu, container, false);
        NavigationView navigationView = (NavigationView) view.findViewById(R.id.vNavigation);
        menuNav = navigationView.getMenu(); // assing menu items to menuNav
        ivMenuUserProfilePhoto = (ImageView) navigationView.getHeaderView(0).findViewById(R.id.ivMenuUserProfilePhoto);
        setupHeader();
        return  setupReveal(view) ;
    }

    private void setupHeader() {
        int avatarSize = getResources().getDimensionPixelSize(R.dimen.global_menu_avatar_size);
        String profilePhoto = getResources().getString(R.string.user_profile_photo);
        Picasso.with(getActivity())
                .load(profilePhoto)
                .placeholder(R.drawable.img_circle_placeholder)
                .resize(avatarSize, avatarSize)
                .centerCrop()
                .transform(new CircleTransformation())
                .into(ivMenuUserProfilePhoto);
    }

    public void onOpenMenu() {
        Toast.makeText(getActivity(), "onOpenMenu", Toast.LENGTH_SHORT).show();
        changeIcon(this.menuNav); // sending all items menu
    }
    public void onCloseMenu(){
        Toast.makeText(getActivity(), "onCloseMenu", Toast.LENGTH_SHORT).show();
    }

    public void changeIcon(Menu menuNav){
        // Your code here...
        // For example changing title and icon to "feed item"
        MenuItem feed= menuNav.findItem(R.id.menu_feed);
        feed.setTitle("bla");
        feed.setIcon(R.drawable.ic_heart_small_blue);

    }

}

from flowingdrawer.

moudjames23 avatar moudjames23 commented on August 9, 2024

hello bicho ,
Thank you so much it take to wonder.
sorry I delayed you're a bit stuck with the controls at the high school .
thank you very much

from flowingdrawer.

hery84 avatar hery84 commented on August 9, 2024

Your welcome!!! :D please close the issue.

from flowingdrawer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.