com.mikepenz.materialdrawer.DrawerBuilder Java Examples

The following examples show how to use com.mikepenz.materialdrawer.DrawerBuilder. 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: HomeActivity.java    From wmn-safety with MIT License 5 votes vote down vote up
private void createNavDrawer(Toolbar toolbar) {
    result = new DrawerBuilder()
            .withActivity(this)
            .withAccountHeader(headerResult)
            .withToolbar(toolbar)
            .withSelectedItem(-1)
            .withHasStableIds(true)
            .addDrawerItems(
                    new PrimaryDrawerItem().withName("Trusted Contacts")
                            .withIdentifier(1).withIcon(R.drawable.ic_contact_phone_black_24dp),
                    new PrimaryDrawerItem().withName("Explore")
                            .withIdentifier(2).withIcon(R.drawable.ic_explore_black_24dp),
                    new DividerDrawerItem(),
                    new PrimaryDrawerItem().withName("Settings")
                            .withIdentifier(3).withIcon(R.drawable.ic_settings_black_24dp),
                    new PrimaryDrawerItem().withName("Help & Feedback")
                            .withIcon(R.drawable.ic_feedback_black_24dp)
                            .withIdentifier(5),
                    new PrimaryDrawerItem().withName("About")
                            .withIcon(R.drawable.ic_info_outline_black_24dp)
                            .withIdentifier(6),
                    new PrimaryDrawerItem().withName("Rate Us")
                            .withIcon(R.drawable.ic_star_black_24dp)
                            .withIdentifier(7)
            )
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    // add click listeners for nav drawer items
                    switch ((int) drawerItem.getIdentifier()) {
                        case 1:
                            startActivity(new Intent(mContext, TrustedContactsActivity.class));
                            break;
                        case 2:
                            startActivity(new Intent(mContext,ExploreActivity.class));
                            break;
                        case 3:
                            startActivity(new Intent(mContext, SettingsActivity.class));
                            break;
                        case 6:
                            startActivity(new Intent(mContext, AboutActivity.class));
                            break;
                        case 7:
                            Toast.makeText(mContext,"Coming soon on Play Store",Toast.LENGTH_SHORT).show();
                    }
                    return false;
                }
            })
            .build();
}
 
Example #2
Source File: DrawerManager.java    From FragmentNavigationPatternDemo with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new drawer for this application with predefined items
 *
 * @param activity
 * @param toolbar
 * @return
 */
public void buildDrawer(Activity activity, Toolbar toolbar) {

    //@formatter:off
    mDrawer = new DrawerBuilder()
                    .withActivity(activity)
                    .withToolbar(toolbar)
                    .withDrawerItems(getDrawerItems())
                    .withSelectedItemByPosition(getLastSelectedItemPosition())
                    .withAccountHeader(getAccountHeader(activity))
                    .addDrawerItems()
                    .build();
    //@formatter:on
}
 
Example #3
Source File: MainActivity.java    From Droid2JoyStick with Apache License 2.0 5 votes vote down vote up
private void setupNavigationDrawer() {
    ProfileDrawerItem section = new ProfileDrawerItem()
            .withSetSelected(false)
            .withSetSelected(false)
            .withEnabled(false);
    PrimaryDrawerItem joyType0DrawerItem = new PrimaryDrawerItem().withName("Basic Gamepad").withTag(KEY_BASIC_GAMEPAD_1).withLevel(2);
    PrimaryDrawerItem joyType1DrawerItem = new PrimaryDrawerItem().withName("Assault Horizon").withTag(KEY_ASSAULT_HORIZON).withLevel(2);
    PrimaryDrawerItem joyType2DrawerItem = new PrimaryDrawerItem().withName("Awesomenauts").withTag(KEY_AWESOMENAUTS).withLevel(2);
    PrimaryDrawerItem joyType3DrawerItem = new PrimaryDrawerItem().withName("BombSquad").withTag(KEY_BOMBSQUAD).withLevel(2);
    PrimaryDrawerItem joyType4DrawerItem = new PrimaryDrawerItem().withName("Final Fantasy XIII").withTag(KEY_FINAL_FANTASY_XIII).withLevel(2);
    SectionDrawerItem sectionDrawerItem = new SectionDrawerItem().withName("Joystick Type").withTextColorRes(R.color.colorAccent);
    PrimaryDrawerItem deviceDrawerItem = new PrimaryDrawerItem().withName("Device Connection").withTag(KEY_DEVICE_CONNECTION).withIcon(GoogleMaterial.Icon.gmd_devices);
    PrimaryDrawerItem settingsDrawerItem = new PrimaryDrawerItem().withName("Settings").withTag("settings").withIcon(GoogleMaterial.Icon.gmd_settings);

    ndMenu = new DrawerBuilder()
            .withActivity(this)
            .withToolbar(tbMain)
            .withCloseOnClick(true)
            .withFireOnInitialOnClick(true)
            .withSelectedItemByPosition(6)
            .withDelayDrawerClickEvent(300)
            .withDisplayBelowStatusBar(true)
            .withTranslucentStatusBar(false)
            .withOnDrawerItemClickListener(this)
            .addDrawerItems(section, deviceDrawerItem, settingsDrawerItem, sectionDrawerItem, joyType0DrawerItem, joyType1DrawerItem, joyType2DrawerItem, joyType3DrawerItem, joyType4DrawerItem)
            .build();
}
 
Example #4
Source File: MainActivity.java    From ShoppingList with Apache License 2.0 5 votes vote down vote up
private void buildDrawer() {
    result = new DrawerBuilder()
            .withActivity(this)
            .withToolbar(toolbar)
            .withHeader(R.layout.drawer_header)
            .withTranslucentStatusBar(false)
            .withActionBarDrawerToggle(true)
            .withActionBarDrawerToggleAnimated(false)
            .addDrawerItems(
                    new PrimaryDrawerItem().withName(R.string.nav_item_home).withTag(CONSTS.TAG_LIST).withIcon(R.drawable.ic_toc_black_),
                    new PrimaryDrawerItem().withName(R.string.nav_item_cached).withTag(CONSTS.TAG_CACHED).withIcon(R.drawable.ic_toc_black_),
                    new PrimaryDrawerItem().withName(R.string.nav_item_favorites).withTag(CONSTS.TAG_FAVORITES).withIcon(R.drawable.ic_star_rate_black)
            )
            .addStickyDrawerItems(
                    new SecondaryDrawerItem().withName(R.string.nav_item_about).withTag(CONSTS.TAG_ABOUT).withIcon(R.drawable.ic_action_about),
                    new SecondaryDrawerItem().withName(R.string.nav_item_settings).withTag(CONSTS.TAG_SETTINGS).withIcon(R.drawable.ic_action_settings)
            )
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    fragmentSelector(Integer.parseInt(drawerItem.getTag().toString()));
                    return false;
                }
            })
            .withSelectedItem(0)
            .build();
}
 
Example #5
Source File: MainActivity.java    From minx with MIT License 5 votes vote down vote up
private void setUpDrawer() {

        AccountHeader accountHeader = new AccountHeaderBuilder()
                .withActivity(MainActivity.this)
                .withHeaderBackground(R.drawable.minx_small)
                .withHeaderBackgroundScaleType(ImageView.ScaleType.FIT_CENTER)
                .withHeightDp(200)
                .build();

        result = new DrawerBuilder()
                .withHeaderDivider(true)
                .withActivity(this)
                .withAccountHeader(accountHeader)
                .withToolbar(toolbar)
                .addDrawerItems(
                        new PrimaryDrawerItem().withName(R.string.drawer_item_home),
                        new DividerDrawerItem(),
                        new SecondaryDrawerItem().withName(R.string.drawer_item_saved),
                        new SecondaryDrawerItem().withName(R.string.drawer_item_share),
                        new SecondaryDrawerItem().withName(R.string.drawer_item_settings),
                        new SecondaryDrawerItem().withName(R.string.drawer_item_about)
                )
                .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                    @Override
                    public boolean onItemClick(AdapterView<?> parent, View view, int position, long id, IDrawerItem drawerItem) {
                        // do something with the clicked item :D
                        Toast.makeText(MainActivity.this, "You clicked on item : " + position, Toast.LENGTH_SHORT).show();
                        loadFragment(position);
                        return false;
                    }
                })
                .build();
        getSupportActionBar().setDisplayHomeAsUpEnabled(false);
        result.getActionBarDrawerToggle().setDrawerIndicatorEnabled(true);

    }
 
Example #6
Source File: SheetMusicActivity.java    From MidiSheetMusic-Android with GNU General Public License v3.0 4 votes vote down vote up
void createViews() {
    layout = findViewById(R.id.sheet_content);

    SwitchDrawerItem scrollVertically = new SwitchDrawerItem()
            .withName(R.string.scroll_vertically)
            .withChecked(options.scrollVert)
            .withOnCheckedChangeListener((iDrawerItem, compoundButton, isChecked) -> {
                options.scrollVert = isChecked;
                createSheetMusic(options);
            });

    SwitchDrawerItem useColors = new SwitchDrawerItem()
            .withName(R.string.use_note_colors)
            .withChecked(options.useColors)
            .withOnCheckedChangeListener((iDrawerItem, compoundButton, isChecked) -> {
                options.useColors = isChecked;
                createSheetMusic(options);
            });

    SecondarySwitchDrawerItem showMeasures = new SecondarySwitchDrawerItem()
            .withName(R.string.show_measures)
            .withLevel(2)
            .withChecked(options.showMeasures)
            .withOnCheckedChangeListener((iDrawerItem, compoundButton, isChecked) -> {
                options.showMeasures = isChecked;
                createSheetMusic(options);
            });

    SecondaryDrawerItem loopStart = new SecondaryDrawerItem()
            .withIdentifier(ID_LOOP_START)
            .withBadge(Integer.toString(options.playMeasuresInLoopStart + 1))
            .withName(R.string.play_measures_in_loop_start)
            .withLevel(2);

    SecondaryDrawerItem loopEnd = new SecondaryDrawerItem()
            .withIdentifier(ID_LOOP_END)
            .withBadge(Integer.toString(options.playMeasuresInLoopEnd + 1))
            .withName(R.string.play_measures_in_loop_end)
            .withLevel(2);

    ExpandableSwitchDrawerItem loopSettings = new ExpandableSwitchDrawerItem()
            .withIdentifier(ID_LOOP_ENABLE)
            .withName(R.string.loop_on_measures)
            .withChecked(options.playMeasuresInLoop)
            .withOnCheckedChangeListener((iDrawerItem, compoundButton, isChecked) -> {
                options.playMeasuresInLoop = isChecked;
            })
            .withSubItems(showMeasures, loopStart, loopEnd);

    // Drawer
    drawer = new DrawerBuilder()
            .withActivity(this)
            .withInnerShadow(true)
            .addDrawerItems(
                    scrollVertically,
                    useColors,
                    loopSettings,
                    new DividerDrawerItem()
            )
            .inflateMenu(R.menu.sheet_menu)
            .withOnDrawerItemClickListener((view, i, item) -> drawerItemClickListener(item))
            .withDrawerGravity(Gravity.RIGHT)
            .build();

    // Make sure that the view extends over the navigation buttons area
    drawer.getDrawerLayout().setFitsSystemWindows(false);
    // Lock the drawer so swiping doesn't open it
    drawer.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

    player = new MidiPlayer(this);
    player.setDrawer(drawer);
    layout.addView(player);

    piano = new Piano(this);
    layout.addView(piano);
    player.SetPiano(piano);
    layout.requestLayout();

    player.setSheetUpdateRequestListener(() -> createSheetMusic(options));
    createSheetMusic(options);
}
 
Example #7
Source File: CurrencyListTabsActivity.java    From CryptoBuddy with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_currency_list_tabs);
    context = this;
    mToolbar = findViewById(R.id.toolbar_currency_list);
    setSupportActionBar(mToolbar);
    TabLayout tabLayout = findViewById(R.id.currency_list_tabs);
    mViewPager = findViewById(R.id.currency_list_tabs_container);
    libsBuilder = new LibsBuilder()
            //provide a style (optional) (LIGHT, DARK, LIGHT_DARK_TOOLBAR)
            .withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
            .withAboutIconShown(true)
            .withLicenseShown(true)
            .withVersionShown(true)
            .withAboutVersionShownName(true)
            .withAboutVersionShownCode(true)
            .withAboutVersionString("Version: " + BuildConfig.VERSION_NAME)
            .withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
            .withActivityTitle("CryptoBuddy")
            .withLibraries("easyrest", "materialabout", "androiddevicenames", "customtabs", "togglebuttongroup", "materialfavoritebutton");

    TextDrawable t = new TextDrawable(this);
    t.setText("ART");
    t.setTextAlign(Layout.Alignment.ALIGN_CENTER);
    t.setTextColor(Color.BLACK);
    t.setTextSize(10);
    AccountHeader headerResult = new AccountHeaderBuilder()
            .withActivity(this)
            .withHeaderBackground(t).build();
    drawer = new DrawerBuilder()
            .withActivity(this)
            .withToolbar(mToolbar)
            .withSelectedItem(1)
            .withAccountHeader(headerResult)
            .addDrawerItems(
                new PrimaryDrawerItem().withIdentifier(1).withName(R.string.Home).withIcon(FontAwesome.Icon.faw_home),
                new PrimaryDrawerItem().withIdentifier(2).withName(R.string.News).withIcon(FontAwesome.Icon.faw_newspaper),
                new PrimaryDrawerItem().withIdentifier(3).withName("About").withIcon(FontAwesome.Icon.faw_question_circle),
                new PrimaryDrawerItem().withIdentifier(4).withName("Open Source").withIcon(FontAwesome.Icon.faw_github_square),
                new PrimaryDrawerItem().withIdentifier(5).withName("Rate on Google Play").withIcon(FontAwesome.Icon.faw_thumbs_up)
            )
            .withTranslucentStatusBar(false)
            .build();
    drawer.setOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
        @Override
        public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
            switch (position) {
                case 1:
                    drawer.closeDrawer();
                    return true;
                case 2:
                    drawer.closeDrawer();
                    drawer.setSelection(1);
                    startActivity(new Intent(context, NewsListActivity.class));
                    return true;
                case 3:
                    drawer.closeDrawer();
                    drawer.setSelection(1);
                    startActivity(new Intent(context, AboutTheDevActivity.class));
                    return true;
                case 4:
                    drawer.closeDrawer();
                    drawer.setSelection(1);
                    libsBuilder.start(context);
                default:
                    return true;
            }
        }
    });

    mSectionsPagerAdapter = new SectionsPagerAdapterCurrencyList(getSupportFragmentManager());
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mViewPager.setOffscreenPageLimit(2);
    mViewPager.addOnPageChangeListener(this);
    tabLayout.setupWithViewPager(mViewPager);
    tabLayout.setSelectedTabIndicatorColor(Color.WHITE);
}
 
Example #8
Source File: MainActivity.java    From openapk with GNU General Public License v3.0 4 votes vote down vote up
public static Drawer setNavigationDrawer(final Context context, final Toolbar toolbar, final RecyclerView recyclerView, boolean badge, final AppAdapter appInstalledAdapter, final AppAdapter appSystemAdapter, final AppAdapter appDisabledAdapter, final AppAdapter appHiddenAdapter, final AppAdapter appFavoriteAdapter) {
    AppPreferences appPreferences = App.getAppPreferences();
    final Activity activity = (Activity) context;
    int header;

    // check for dark theme
    Integer badgeColor;
    BadgeStyle badgeStyle;
    if (appPreferences.getTheme().equals("0")) {
        badgeColor = ContextCompat.getColor(context, R.color.badge_light);
        badgeStyle = new BadgeStyle(badgeColor, badgeColor).withTextColor(context.getResources().getColor(R.color.text_light));
        header = R.drawable.header_day;
    } else {
        badgeColor = ContextCompat.getColor(context, R.color.badge_dark);
        badgeStyle = new BadgeStyle(badgeColor, badgeColor).withTextColor(context.getResources().getColor(R.color.text_dark));
        header = R.drawable.header_night;
    }

    AccountHeader headerResult = new AccountHeaderBuilder()
            .withActivity(activity)
            .withHeaderBackground(header)
            .build();

    DrawerBuilder drawerBuilder = new DrawerBuilder();
    drawerBuilder.withActivity(activity);
    drawerBuilder.withToolbar(toolbar);
    drawerBuilder.withAccountHeader(headerResult);
    drawerBuilder.withStatusBarColor(OtherUtils.dark(appPreferences.getPrimaryColor(), 0.8));

    if (badge) {
        String installedApps = Integer.toString(appInstalledAdapter.getItemCount());
        String systemApps = Integer.toString(appSystemAdapter.getItemCount());
        String disabledApps = Integer.toString(appDisabledAdapter.getItemCount());
        String hiddenApps = Integer.toString(appHiddenAdapter.getItemCount());
        String favoriteApps = Integer.toString(appFavoriteAdapter.getItemCount());
        drawerBuilder.addDrawerItems(
                new PrimaryDrawerItem().withName(context.getResources().getString(R.string.apps_installed)).withIcon(GoogleMaterial.Icon.gmd_phone_android).withBadge(installedApps).withBadgeStyle(badgeStyle).withIdentifier(0),
                new PrimaryDrawerItem().withName(context.getResources().getString(R.string.apps_system)).withIcon(GoogleMaterial.Icon.gmd_android).withBadge(systemApps).withBadgeStyle(badgeStyle).withIdentifier(1),
                new PrimaryDrawerItem().withName(context.getResources().getString(R.string.apps_disabled)).withIcon(GoogleMaterial.Icon.gmd_remove_circle_outline).withBadge(disabledApps).withBadgeStyle(badgeStyle).withIdentifier(2),
                new PrimaryDrawerItem().withName(context.getResources().getString(R.string.apps_hidden)).withIcon(GoogleMaterial.Icon.gmd_visibility_off).withBadge(hiddenApps).withBadgeStyle(badgeStyle).withIdentifier(3),
                new PrimaryDrawerItem().withName(context.getResources().getString(R.string.apps_favorite)).withIcon(GoogleMaterial.Icon.gmd_star).withBadge(favoriteApps).withBadgeStyle(badgeStyle).withIdentifier(4),
                new DividerDrawerItem(),
                new PrimaryDrawerItem().withName(context.getResources().getString(R.string.settings)).withIcon(GoogleMaterial.Icon.gmd_settings).withSelectable(false).withIdentifier(5),
                new PrimaryDrawerItem().withName(context.getResources().getString(R.string.about)).withIcon(GoogleMaterial.Icon.gmd_info).withSelectable(false).withIdentifier(6));
    } else {
        drawerBuilder.addDrawerItems(
                new PrimaryDrawerItem().withName(context.getResources().getString(R.string.apps_installed)).withIcon(GoogleMaterial.Icon.gmd_phone_android).withIdentifier(0),
                new PrimaryDrawerItem().withName(context.getResources().getString(R.string.apps_system)).withIcon(GoogleMaterial.Icon.gmd_android).withIdentifier(1),
                new PrimaryDrawerItem().withName(context.getResources().getString(R.string.apps_disabled)).withIcon(GoogleMaterial.Icon.gmd_remove_circle_outline).withIdentifier(2),
                new PrimaryDrawerItem().withName(context.getResources().getString(R.string.apps_hidden)).withIcon(GoogleMaterial.Icon.gmd_visibility_off).withIdentifier(3),
                new PrimaryDrawerItem().withName(context.getResources().getString(R.string.apps_favorite)).withIcon(GoogleMaterial.Icon.gmd_star).withIdentifier(4),
                new DividerDrawerItem(),
                new PrimaryDrawerItem().withName(context.getResources().getString(R.string.settings)).withIcon(GoogleMaterial.Icon.gmd_settings).withSelectable(false).withIdentifier(5),
                new PrimaryDrawerItem().withName(context.getResources().getString(R.string.about)).withIcon(GoogleMaterial.Icon.gmd_info).withSelectable(false).withIdentifier(6));
    }

    drawerBuilder.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
        @Override
        public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
            switch (drawerItem.getIdentifier()) {
                case 0:
                    recyclerView.setAdapter(appInstalledAdapter);
                    App.setCurrentAdapter(0);
                    OtherUtils.setToolbarTitle(context, context.getResources().getString(R.string.apps_installed));
                    break;
                case 1:
                    recyclerView.setAdapter(appSystemAdapter);
                    App.setCurrentAdapter(1);
                    OtherUtils.setToolbarTitle(context, context.getResources().getString(R.string.apps_system));
                    break;
                case 2:
                    recyclerView.setAdapter(appDisabledAdapter);
                    App.setCurrentAdapter(2);
                    OtherUtils.setToolbarTitle(context, context.getResources().getString(R.string.apps_disabled));
                    break;
                case 3:
                    recyclerView.setAdapter(appHiddenAdapter);
                    App.setCurrentAdapter(3);
                    OtherUtils.setToolbarTitle(context, context.getResources().getString(R.string.apps_hidden));
                    break;
                case 4:
                    recyclerView.setAdapter(appFavoriteAdapter);
                    App.setCurrentAdapter(4);
                    OtherUtils.setToolbarTitle(context, context.getResources().getString(R.string.apps_favorite));
                    break;
                case 5:
                    context.startActivity(new Intent(context, SettingsActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
                    break;
                case 6:
                    context.startActivity(new Intent(context, AboutActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
                    break;
                default:
                    break;
            }
            return false;
        }
    });
    return drawerBuilder.build();
}
 
Example #9
Source File: SearchActivity.java    From GithubApp with Apache License 2.0 4 votes vote down vote up
private void initViews() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    setTitle(R.string.search);

    mSearchView.setVoiceSearch(false);
    mSearchView.setSuggestions(getResources().getStringArray(R.array.query_suggestions));
    mSearchView.setOnQueryTextListener(mQueryListener);
    mSearchView.post(new Runnable() {
        @Override
        public void run() {
            mSearchView.showSearch(false);
        }
    });

    mDrawer = new DrawerBuilder()
            .withActivity(this)
            .withToolbar(toolbar)
            .withTranslucentStatusBar(false)
            .withDisplayBelowStatusBar(true)
            .withActionBarDrawerToggleAnimated(true)
            .withDrawerWidthRes(R.dimen.dimen_180)
            .addDrawerItems(
                    new PrimaryDrawerItem().withName("Java").withIcon(DevIcon.Icon.dev_java_plain),
                    new PrimaryDrawerItem().withName("Objective-C").withIcon(DevIcon.Icon.dev_apple_plain),
                    new PrimaryDrawerItem().withName("Swift").withIcon(R.drawable.ic_swift),
                    new PrimaryDrawerItem().withName("JavaScript").withIcon(DevIcon.Icon.dev_javascript_plain),
                    new PrimaryDrawerItem().withName("Python").withIcon(DevIcon.Icon.dev_python_plain),
                    new PrimaryDrawerItem().withName("HTML").withIcon(DevIcon.Icon.dev_html5_plain),
                    new PrimaryDrawerItem().withName("C#").withIcon(DevIcon.Icon.dev_csharp_plain_wordmark),
                    new PrimaryDrawerItem().withName("C++").withIcon(DevIcon.Icon.dev_cplusplus_plain_wordmark),
                    new PrimaryDrawerItem().withName("Ruby").withIcon(DevIcon.Icon.dev_ruby_plain)
            )
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    AppLog.d("onItemClick, position = " + position + ", item = " + ((Nameable)drawerItem).getName());

                    mCurrentLang = ((Nameable)drawerItem).getName().toString();
                    search(mCurrentKey, mCurrentLang);
                    mDrawer.closeDrawer();
                    return true;
                }
            })
            .build();

    mAdapter = new RepoListRecyclerAdapter(null);
    mAdapter.setOnRecyclerViewItemClickListener(mItemtClickListener);

    mRepoListView.setLayoutManager(new LinearLayoutManager(this));
    mRepoListView.addItemDecoration(new HorizontalDividerItemDecoration
            .Builder(this)
            .color(Color.TRANSPARENT)
            .size(getResources().getDimensionPixelSize(R.dimen.divider_height))
            .build());

    mRepoListView.setAdapter(mAdapter);

    // default is null
    mCurrentLang = "";
}
 
Example #10
Source File: DrawerActivity.java    From outlay with Apache License 2.0 4 votes vote down vote up
public void setupDrawer(User currentUser) {
    String email = TextUtils.isEmpty(currentUser.getEmail()) ? "Guest" : currentUser.getEmail();

    AccountHeader headerResult = new AccountHeaderBuilder()
            .withActivity(this)
            .withTextColor(getOutlayTheme().secondaryTextColor)
            .withAlternativeProfileHeaderSwitching(false)
            .withSelectionListEnabledForSingleProfile(false)
            .withProfileImagesClickable(false)
            .withCloseDrawerOnProfileListClick(false)
            .addProfiles(
                    new ProfileDrawerItem()
                            .withEmail(email)
            )
            .build();

    List<IDrawerItem> items = new ArrayList<>();
    if (currentUser.isAnonymous()) {
        items.add(new PrimaryDrawerItem().withName(app.outlay.R.string.menu_item_create_user).withIcon(MaterialDesignIconic.Icon.gmi_account_add).withIdentifier(ITEM_CREATE_USER));
    }

    items.add(new PrimaryDrawerItem().withName(app.outlay.R.string.menu_item_analysis).withIcon(MaterialDesignIconic.Icon.gmi_trending_up).withIdentifier(ITEM_ANALYSIS));
    items.add(new PrimaryDrawerItem().withName(app.outlay.R.string.menu_item_categories).withIcon(MaterialDesignIconic.Icon.gmi_apps).withIdentifier(ITEM_CATEGORIES));
    items.add(new PrimaryDrawerItem().withName(app.outlay.R.string.menu_item_feedback).withIcon(MaterialDesignIconic.Icon.gmi_email).withIdentifier(ITEM_FEEDBACK));
    items.add(new PrimaryDrawerItem().withName(R.string.menu_item_settings).withIcon(MaterialDesignIconic.Icon.gmi_settings).withIdentifier(ITEM_SETTINGS));
    items.add(new PrimaryDrawerItem().withName(app.outlay.R.string.menu_item_signout).withIcon(MaterialDesignIconic.Icon.gmi_sign_in).withIdentifier(ITEM_SING_OUT));


    mainDrawer = new DrawerBuilder()
            .withFullscreen(true)
            .withActivity(this)
            .withAccountHeader(headerResult)
            .withSelectedItem(-1)
            .addDrawerItems(items.toArray(new IDrawerItem[items.size()]))
            .withOnDrawerItemClickListener((view, i, iDrawerItem) -> {
                if (iDrawerItem != null) {
                    int id = (int) iDrawerItem.getIdentifier();
                    switch (id) {
                        case ITEM_CATEGORIES:
                            analytics().trackViewCategoriesList();
                            SingleFragmentActivity.start(this, CategoriesFragment.class);
                            break;
                        case ITEM_ANALYSIS:
                            analytics().trackAnalysisView();
                            SingleFragmentActivity.start(this, AnalysisFragment.class);
                            break;
                        case ITEM_SETTINGS:
                            SingleFragmentActivity.start(this, SettingsFragment.class);
                            break;
                        case ITEM_FEEDBACK:
                            analytics().trackFeedbackClick();
                            Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
                                    "mailto", Constants.CONTACT_EMAIL, null));
                            emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{Constants.CONTACT_EMAIL});
                            emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Outlay Feedback");
                            try {
                                startActivity(Intent.createChooser(emailIntent, getString(app.outlay.R.string.label_send_email)));
                            } catch (android.content.ActivityNotFoundException ex) {
                                Alert.error(getRootView(), getString(app.outlay.R.string.error_no_email_clients));
                            }
                            break;
                        case ITEM_ABOUT:
                            SingleFragmentActivity.start(this, AboutFragment.class);
                            break;
                        case ITEM_SING_OUT:
                            analytics().trackSingOut();
                            signOut();
                            break;
                        case ITEM_CREATE_USER:
                            createUser();
                            break;
                    }

                    mainDrawer.setSelection(-1);
                    mainDrawer.closeDrawer();
                }
                return false;
            })
            .build();
}
 
Example #11
Source File: MainActivity.java    From ETSMobile-Android2 with Apache License 2.0 4 votes vote down vote up
private void initDrawer() {
    boolean isUserLoggedIn = ApplicationManager.userCredentials != null;
    String studentName = "";
    String codeUniversel = "";
    ProfilManager profilManager = new ProfilManager(this);
    Etudiant etudiant = profilManager.getEtudiant();
    if (etudiant != null) {
        String prenom = etudiant.prenom != null ? etudiant.prenom.trim() : "";
        String nom = etudiant.nom != null ? etudiant.nom.trim() : "";
        studentName = prenom + " " + nom;
        codeUniversel = etudiant.codePerm != null ? etudiant.codePerm : "";
    }
    headerResult = new AccountHeaderBuilder()
            .withActivity(this)
            .withHeaderBackground(R.drawable.ets_background_grayscale)
            .withSelectionListEnabledForSingleProfile(false)
            .addProfiles(
                    new ProfileDrawerItem()
                            .withName(codeUniversel)
                            .withEmail(studentName)
                            .withSelectedTextColor(ContextCompat.getColor(this, R.color.red))
                            .withIcon(R.drawable.ic_user)
                            .withSelectable(isUserLoggedIn)
            ).withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {
                @Override
                public boolean onProfileChanged(View view, IProfile profile, boolean current) {
                    goToFragment(new ProfilFragment(), ProfilFragment.class.getName());
                    activityDrawer.deselect();
                    return false;
                }
            }).build();

    DrawerBuilder drawerBuilder = new DrawerBuilder()
            .withActivity(this)
            .withToolbar(toolbar)
            .withAccountHeader(headerResult)
            .withSelectedItem(isUserLoggedIn ? TODAY_ITEM : ABOUT_ITEM)
            .withDisplayBelowStatusBar(true)
            .withShowDrawerOnFirstLaunch(true)
            .addDrawerItems(
                    new ExpandableDrawerItem().withName(R.string.menu_section_1_moi).withSelectable(false).withSubItems(
                            new SecondaryDrawerItem().withName(R.string.menu_section_1_profil).withIdentifier(PROFILE_ITEM).withIcon(R.drawable.ic_ico_profil).withEnabled(isUserLoggedIn),
                            new SecondaryDrawerItem().withName(R.string.menu_section_1_ajd).withIdentifier(TODAY_ITEM).withIcon(R.drawable.ic_ico_aujourdhui).withEnabled(isUserLoggedIn),
                            new SecondaryDrawerItem().withName(R.string.menu_section_1_horaire).withIdentifier(SCHEDULE_ITEM).withIcon(R.drawable.ic_ico_schedule).withEnabled(isUserLoggedIn),
                            new SecondaryDrawerItem().withName(R.string.menu_section_1_notes).withIdentifier(COURSE_ITEM).withIcon(R.drawable.ic_ico_notes).withEnabled(isUserLoggedIn),
                            new SecondaryDrawerItem().withName(R.string.menu_section_2_moodle).withIdentifier(MOODLE_ITEM).withIcon(R.drawable.ic_moodle_icon_small).withEnabled(isUserLoggedIn),
                            new SecondaryDrawerItem().withName(R.string.menu_section_1_monETS).withIdentifier(MONETS_ITEM).withSelectable(false).withIcon(R.drawable.ic_monets).withEnabled(isUserLoggedIn),
                            new SecondaryDrawerItem().withName(R.string.menu_section_1_bandwith).withIdentifier(BANDWIDTH_ITEM).withIcon(R.drawable.ic_ico_internet),
                            new SecondaryDrawerItem().withName(R.string.menu_section_3_beta).withIdentifier(BETA_VERSION_ITEM).withIcon(R.drawable.ic_beta_24dp)
                    ),
                    new ExpandableDrawerItem().withName(R.string.menu_section_2_ets).withSelectable(false).withSubItems(
                            new SecondaryDrawerItem().withName(R.string.menu_section_2_news).withIdentifier(NEWS_ITEM).withIcon(R.drawable.ic_ico_news),
                            new SecondaryDrawerItem().withName(R.string.menu_section_2_bottin).withIdentifier(DIRECTORY_ITEM).withIcon(R.drawable.ic_ico_bottin),
                            new SecondaryDrawerItem().withName(R.string.menu_section_2_biblio).withIdentifier(LIBRARY_ITEM).withSelectable(false).withIcon(R.drawable.ic_ico_library),
                            new SecondaryDrawerItem().withName(R.string.menu_section_2_securite).withIdentifier(SECURITY_ITEM).withIcon(R.drawable.ic_ico_security)
                    ),
                    new ExpandableDrawerItem().withName(R.string.menu_section_3_applets).withSelectable(false).withSubItems(
                            new SecondaryDrawerItem().withName(R.string.menu_section_3_apps).withIdentifier(ACHIEVEMENTS_ITEM).withIcon(R.drawable.ic_star_60x60),
                            new SecondaryDrawerItem().withName(R.string.menu_section_3_about).withIdentifier(ABOUT_ITEM).withIcon(R.drawable.ic_logo_icon_final),
                            new SecondaryDrawerItem().withName(R.string.menu_section_3_faq).withIdentifier(FAQ_ITEM).withIcon(R.drawable.ic_ico_faq)
                    )
            );
    if (isUserLoggedIn)
        drawerBuilder.addStickyDrawerItems(new SecondaryDrawerItem().withName(R.string.action_logout).withIdentifier(LOGOUT).withTextColorRes(R.color.red));
    else
        drawerBuilder.addStickyDrawerItems(new SecondaryDrawerItem().withName(R.string.action_login).withIdentifier(LOGIN));

    drawerBuilder.withOnDrawerItemClickListener(drawerItemClickListener);

    activityDrawer = drawerBuilder.build();
    activityDrawer.getExpandableExtension().expand(1);

}
 
Example #12
Source File: UtilsUI.java    From Moticons with GNU General Public License v3.0 4 votes vote down vote up
public static Drawer showNavigationDrawer(final Context context, Toolbar toolbar, final MoticonAdapter moticonAdapter, final MoticonAdapter moticonPositiveAdapter, final MoticonAdapter moticonNegativeAdapter, final MoticonAdapter moticonFunnyAdapter, final MoticonAdapter moticonAnimalsAdapter, final MoticonAdapter moticonSpecialAdapter, final RecyclerView recyclerView) {
    Activity activity = (Activity) context;

    AccountHeader headerResult = new AccountHeaderBuilder()
            .withActivity(activity)
            .withHeaderBackground(R.drawable.header)
            .build();
    return new DrawerBuilder()
            .withActivity(activity)
            .withToolbar(toolbar)
            .withAccountHeader(headerResult)
            .withStatusBarColor(context.getResources().getColor(R.color.primary_dark))
            .addDrawerItems(
                    new PrimaryDrawerItem().withName(context.getResources().getString(R.string.app_name)).withIcon(R.mipmap.ic_launcher),
                    new DividerDrawerItem(),
                    new PrimaryDrawerItem().withName(context.getResources().getString(R.string.action_positive)).withIcon(FontAwesome.Icon.faw_thumbs_up).withBadge("(/^▽^)/"),
                    new PrimaryDrawerItem().withName(context.getResources().getString(R.string.action_negative)).withIcon(FontAwesome.Icon.faw_thumbs_down).withBadge("(>_<)"),
                    new PrimaryDrawerItem().withName(context.getResources().getString(R.string.action_funny)).withIcon(FontAwesome.Icon.faw_child).withBadge("¯\\_(ツ)_/¯"),
                    new PrimaryDrawerItem().withName(context.getResources().getString(R.string.action_animal)).withIcon(FontAwesome.Icon.faw_paw).withBadge("∪・ω・∪"),
                    new PrimaryDrawerItem().withName(context.getResources().getString(R.string.action_special)).withIcon(FontAwesome.Icon.faw_star).withBadge("ʕ•̬͡•ʕ•̫͡•♥"),
                    new DividerDrawerItem(),
                    new SecondaryDrawerItem().withName(context.getResources().getString(R.string.action_about)).withCheckable(false)
            )
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(AdapterView<?> adapterView, View view, int position, long id, IDrawerItem iDrawerItem) {
                    switch (position) {
                        case 0:
                            recyclerView.setAdapter(moticonAdapter);
                            break;
                        case 2:
                            recyclerView.setAdapter(moticonPositiveAdapter);
                            break;
                        case 3:
                            recyclerView.setAdapter(moticonNegativeAdapter);
                            break;
                        case 4:
                            recyclerView.setAdapter(moticonFunnyAdapter);
                            break;
                        case 5:
                            recyclerView.setAdapter(moticonAnimalsAdapter);
                            break;
                        case 6:
                            recyclerView.setAdapter(moticonSpecialAdapter);
                            break;
                        case 8:
                            context.startActivity(new Intent(context, AboutActivity.class));
                            break;
                        default:
                            break;
                    }

                    return false;
                }
            }).build();
}
 
Example #13
Source File: MainActivity.java    From PowerSwitch_Android with GNU General Public License v3.0 4 votes vote down vote up
private void initHistoryDrawer(Drawer navigationDrawer) {
    // parent HAS to be null, so it can be attached to navigationDrawer later on
    View historyView = LayoutInflater.from(this).inflate(R.layout.drawer_history, null, false);

    IconicsImageView clearHistory = (IconicsImageView) historyView.findViewById(R.id.buttonClear);
    clearHistory.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            new AsyncTask<Void, Void, Exception>() {

                @Override
                protected Exception doInBackground(Void... params) {
                    try {
                        DatabaseHandler.clearHistory();
                    } catch (Exception e) {
                        return e;
                    }

                    return null;
                }

                @Override
                protected void onPostExecute(Exception exception) {
                    updateHistory();

                    if (exception != null) {
                        StatusMessageHandler.showErrorMessage(getActivity(), exception);
                    }

                }
            }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
        }
    });

    layoutLoadingHistory = (LinearLayout) historyView.findViewById(R.id.layoutLoading);

    recyclerViewHistory = (RecyclerView) historyView.findViewById(R.id.recyclerview_history);
    historyItemArrayAdapter = new HistoryItemRecyclerViewAdapter(this, historyItems);
    historyItemArrayAdapter.setOnItemClickListener(new HistoryItemRecyclerViewAdapter.OnItemClickListener() {
        @Override
        public void onItemClick(View itemView, int position) {
            HistoryItem historyItem = historyItems.get(position);

            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM.yyyy - HH:mm:ss");
            new AlertDialog.Builder(getActivity())
                    .setTitle(R.string.details)
                    .setMessage(simpleDateFormat.format(historyItem.getTime().getTime()) + "\n\n" +
                            historyItem.getShortDescription() + "\n\n" +
                            historyItem.getLongDescription())
                    .setNeutralButton(R.string.close, null)
                    .show();
        }
    });
    recyclerViewHistory.setAdapter(historyItemArrayAdapter);
    StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL);
    recyclerViewHistory.setLayoutManager(layoutManager);

    historyDrawer = new DrawerBuilder()
            .withActivity(this)
            .withCustomView(historyView)
            .withHeaderPadding(true)
            .withDrawerGravity(Gravity.END)
            .append(navigationDrawer);
}
 
Example #14
Source File: MainActivity.java    From Faker with Apache License 2.0 4 votes vote down vote up
private void configureDrawer(Bundle savedInstanceState) {

        drawer = new DrawerBuilder()
                .withActivity(this)
                .withHeader(R.layout.header_drawer)
                .withToolbar(toolbar)
                .withTranslucentStatusBar(true)
                .addDrawerItems(
                        new PrimaryDrawerItem().withName("Random data").withIdentifier(RANDOM_WIDGETS_FRAGMENT),
                        new PrimaryDrawerItem().withName("Target views").withIdentifier(TARGET_VIEWS_FRAGMENT),
                        new PrimaryDrawerItem().withName("\"Specific\" random data").withIdentifier(PROFILE_FRAGMENT),
                        new SectionDrawerItem().withName("FAKER  COMPONENTS"),
                        new PrimaryDrawerItem()
                                .withName("Lorem")
                                .withIcon(GoogleMaterial.Icon.gmd_text_format)
                                .withIconTintingEnabled(true)
                                .withIdentifier(LOREM_FRAGMENT),
                        new PrimaryDrawerItem()
                                .withName("Name")
                                .withIcon(GoogleMaterial.Icon.gmd_person)
                                .withIconTintingEnabled(true)
                                .withIdentifier(NAME_FRAGMENT),
                        new PrimaryDrawerItem()
                                .withName("Number")
                                .withIcon(GoogleMaterial.Icon.gmd_filter_9_plus)
                                .withIconTintingEnabled(true)
                                .withIdentifier(NUMBER_FRAGMENT),
                        new PrimaryDrawerItem()
                                .withName("Phone")
                                .withIcon(GoogleMaterial.Icon.gmd_call)
                                .withIconTintingEnabled(true)
                                .withIdentifier(PHONE_FRAGMENT),
                        new PrimaryDrawerItem()
                                .withName("Internet")
                                .withIcon(GoogleMaterial.Icon.gmd_public)
                                .withIconTintingEnabled(true)
                                .withIdentifier(INTERNET_FRAGMENT),
                        new PrimaryDrawerItem()
                                .withName("Url")
                                .withIcon(GoogleMaterial.Icon.gmd_photo)
                                .withIconTintingEnabled(true)
                                .withIdentifier(URL_FRAGMENT),
                        new PrimaryDrawerItem()
                                .withName("Color")
                                .withIcon(GoogleMaterial.Icon.gmd_invert_colors)
                                .withIconTintingEnabled(true)
                                .withIdentifier(COLOR_FRAGMENT),
                        new PrimaryDrawerItem()
                                .withName("Address")
                                .withIcon(GoogleMaterial.Icon.gmd_home)
                                .withIconTintingEnabled(true)
                                .withIdentifier(ADDRESS_FRAGMENT)

                )
                .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                    @Override
                    public boolean onItemClick(AdapterView<?> adapterView, View view, int i, long l, IDrawerItem iDrawerItem) {
                        if (iDrawerItem != null) {
                            showFragment(iDrawerItem.getIdentifier());
                        }

                        return false;
                    }
                })
                .withSelectedItem(0)
                .withSavedInstance(savedInstanceState)
                .build();
    }
 
Example #15
Source File: MainActivity.java    From wifi_backend with GNU General Public License v3.0 4 votes vote down vote up
@AfterViews
protected void init() {
    toolbar.setTitle(R.string.app_title);

    drawer = new DrawerBuilder()
            .withActivity(this)
            .withToolbar(toolbar)
            .withFireOnInitialOnClick(drawerState == null)
            .withSavedInstance(drawerState)
            .addDrawerItems(
                    new PrimaryDrawerItem()
                            .withName(R.string.drawer_settings)
                            .withIcon(GoogleMaterial.Icon.gmd_settings)
                            .withIdentifier(SETTINGS),

                    new PrimaryDrawerItem()
                            .withName(R.string.drawer_advanced)
                            .withIcon(GoogleMaterial.Icon.gmd_settings_applications)
                            .withIdentifier(ADVANCED)
            )
            .addStickyDrawerItems(
                    new PrimaryDrawerItem()
                            .withName(R.string.drawer_libraries)
                            .withIcon(GoogleMaterial.Icon.gmd_info_outline)
                            .withSelectable(false)
                            .withIdentifier(LIBRARIES),

                    new PrimaryDrawerItem()
                            .withName(R.string.drawer_website)
                            .withIcon(GoogleMaterial.Icon.gmd_info)
                            .withSelectable(false)
                            .withIdentifier(WEBSITE)
            )
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    if (drawerItem != null) {
                        final int id = drawerItem.getIdentifier();

                        if(id == SETTINGS) {
                            setFragment(new MainSettingsFragment_());
                        } else if (id == ADVANCED) {
                            setFragment(new AdvancedSettingsFragment_());
                        } else if (id == LIBRARIES) {
                            new LibsBuilder()
                                    .withFields(R.string.class.getFields())
                                    .withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
                                    .start(MainActivity.this);
                        } else if (id == WEBSITE) {
                            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.WEBSITE)));
                        }
                    }

                    return false;
                }
            })
            .build();

    updateTitle();

    if(action == Action.request_permission) {
        drawer.setSelection(SETTINGS);
    }
}
 
Example #16
Source File: MainActivity.java    From Local-GSM-Backend with Apache License 2.0 4 votes vote down vote up
@AfterViews
protected void init() {
    toolbar.setTitle(R.string.app_name);

    drawer = new DrawerBuilder()
            .withActivity(this)
            .withSavedInstance(drawerState)
            .withToolbar(toolbar)
            .addDrawerItems(
                    new PrimaryDrawerItem()
                            .withName(R.string.fragment_update_database_title)
                            .withIcon(GoogleMaterial.Icon.gmd_folder)
                            .withIdentifier(DATABASE),

                    new PrimaryDrawerItem()
                            .withName(R.string.fragment_settings_title)
                            .withIcon(GoogleMaterial.Icon.gmd_settings)
                            .withIdentifier(SETTINGS),

                    new PrimaryDrawerItem()
                            .withName(R.string.fragment_settings_advanced_title)
                            .withIcon(GoogleMaterial.Icon.gmd_settings_applications)
                            .withIdentifier(SETTINGS_ADVANCED)
            )
            .addStickyDrawerItems(
                    new PrimaryDrawerItem()
                            .withName(R.string.activity_main_libraries)
                            .withIcon(GoogleMaterial.Icon.gmd_info_outline)
                            .withSelectable(false)
                            .withIdentifier(LIBRARIES),

                    new PrimaryDrawerItem()
                            .withName(R.string.activity_main_about)
                            .withIcon(GoogleMaterial.Icon.gmd_info)
                            .withSelectable(false)
                            .withIdentifier(ABOUT)
            )
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    if (drawerItem != null) {
                        final int id = drawerItem.getIdentifier();

                        if (id == SETTINGS) {
                            setFragment(new SettingsFragment_());
                        } else if (id == DATABASE) {
                            setFragment(new UpdateDatabaseFragment_());
                        } else if (id == LIBRARIES) {
                            new LibsBuilder()
                                    .withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
                                    .withFields(R.string.class.getFields())
                                    .start(MainActivity.this);
                        } else if (id == SETTINGS_ADVANCED) {
                            setFragment(new AdvancedSettingsFragment_());
                        } else if (id == ABOUT) {
                            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Config.ABOUT_URL)));
                        }
                    }

                    return false;
                }
            })
            .withFireOnInitialOnClick(drawerState == null)
            .build();

    updateTitle();
    if(action == Action.request_permission) {
        drawer.setSelection(SETTINGS);
    }

}