Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: Back Arrow Instead of Hamgurger Icon #25

Closed
stripathi669 opened this issue Jan 4, 2015 · 8 comments
Closed

Problem: Back Arrow Instead of Hamgurger Icon #25

stripathi669 opened this issue Jan 4, 2015 · 8 comments
Assignees

Comments

@stripathi669
Copy link

I am facing two issues implementing this the library.

  1. The hamburger Icon to open the the drawer doesn't show up normally. If I use set Navigation icon property of the toolbar, Back Arrow Icon shows up, irrespective of what Icon I choose. Though I can pull out the drawer, I can't open it using icon on the toolbar.
  2. I can't seem to be able to set profile background. Irrespective what drawable/bitmap I choose, the background

is a grey.

I have attached screenshots for both the issues.

screenshot_2015-01-04-12-43-11
screenshot_2015-01-04-12-41-21

@heinrichreimer
Copy link
Owner

For your first issue check the demo code that I'll release soon. I guess you're not using the ActionBarDrawerToggle.

Would be great if you post your code here where you set the profile background.

@stripathi669
Copy link
Author

Hey, Thanks. I will wait for the sample.

I have posted the section where is I create and assign profile, toolbar and background.

private void makeDrawer() {

    profile = new DrawerProfile()
            .setAvatar(getResources().getDrawable(R.drawable.photo))
            .setBackground(getResources().getDrawable(R.drawable.bamboo))
            .setName("Abraham Lincoln").setDescription("abraham.licoln@gmail.com")
            .setOnProfileClickListener(new DrawerProfile.OnProfileClickListener() {
                @Override
                public void onClick(final DrawerProfile drawerProfile) {
                    // Toast.makeText(MainActivity.this, "Clicked profile", Toast.LENGTH_SHORT).show();
                     }});
    drawerLayout.setStatusBarBackgroundColor( Color.parseColor("#388E3C"));
    Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_silent_hill);
    setSupportActionBar(toolbar);



    getSupportActionBar().setTitle("Silent Hill");

    drawer.addItem(
            new DrawerItem()
                    .setImage(getResources().getDrawable(R.drawable.ic_action_cache))
                    .setTextPrimary("Download Cards")
                    .setTextSecondary("Cache your cards for offline use.")
                    .setOnItemClickListener(new DrawerItem.OnItemClickListener() {
                        @Override
                        public void onClick(DrawerItem drawerItem, int id, int position) {
                            Toast.makeText(MainActivity.this, "Caching coming soon!", Toast.LENGTH_SHORT).show();
                        }
                    })
    );

 --- Code to add drawer items


    drawer.setProfile(  profile     );


}

@heinrichreimer
Copy link
Owner

OK, thank you.
Is R.drawable.bamboo a bitmap?
I'll look if I can reproduce this error and than how I can fix it.

@heinrichreimer
Copy link
Owner

BTW the demo is available now

@stripathi669
Copy link
Author

Yes, the R.drawable.bamboo is a bitmap. I have tried several other formats too.

I remember the option worked for me initially. However after sometime, it stopped showing up. I have tried to reverse all steps. But I can't seem to locate the problem.

Update: I updated the library to 1.3.2, and now the background is showing up again.
I think my both the issues have been resolved. The only issue remaining is that Nav drawer doesn't open when harmburger icon is clicked.

Thank you for the support.

@heinrichreimer
Copy link
Owner

Check onOptionsItemSelected() method in your activity/fragment. If you use ActionDrawerToggle you have to call its onOptionsItemSelected() method.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (drawerToggle.onOptionsItemSelected(item)) {
        return true;
    }
    // Check other manu items 
}

@stripathi669
Copy link
Author

Okay Thanks.
All issues resolved. Thank you so much.

@heinrichreimer
Copy link
Owner

No problem ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants