当前位置: 首页>>代码示例>>Java>>正文


Java BadgeStyle类代码示例

本文整理汇总了Java中com.mikepenz.materialdrawer.holder.BadgeStyle的典型用法代码示例。如果您正苦于以下问题:Java BadgeStyle类的具体用法?Java BadgeStyle怎么用?Java BadgeStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BadgeStyle类属于com.mikepenz.materialdrawer.holder包,在下文中一共展示了BadgeStyle类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPharmacyModeChanged

import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
public void onPharmacyModeChanged(boolean enabled) {
    PrimaryDrawerItem item = (PrimaryDrawerItem) drawer.getDrawerItem(PHARMACIES);
    BadgeStyle bs = new BadgeStyle();
    if (enabled) {
        addCalendarItem();
        Drawable bg = new IconicsDrawable(home)
                .icon(GoogleMaterial.Icon.gmd_check)
                .color(home.getResources().getColor(R.color.dark_grey_text))
                .sizeDp(18);
        bs.withBadgeBackground(bg);
    } else {
        drawer.removeItem(CALENDAR);
        bs.withBadgeBackground(new ColorDrawable(Color.TRANSPARENT));
    }
    item.withBadgeStyle(bs);
    item.withBadge(" ");
    drawer.updateItem(item);
}
 
开发者ID:citiususc,项目名称:calendula,代码行数:19,代码来源:LeftDrawerMgr.java

示例2: getStatus

import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
private void getStatus() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            Status status;
            try {
                status = Status.getStatusByString(GetRequest.getRequest("https://status.magistify.nl/API/status", null));
            } catch (IOException e) {
                e.printStackTrace();
                return;
            }
            Log.d(TAG, "run: Status: " + status.getStatus());
            if (status == Status.OK) {
                statusItem.withBadgeStyle(new BadgeStyle(Color.rgb(0, 153, 0), Color.rgb(0, 153, 0)).withTextColor(Color.WHITE)).withBadge("✔");
            } else if (status == Status.SLOW) {
                statusItem.withBadgeStyle(new BadgeStyle(Color.rgb(255, 128, 0), Color.rgb(255, 128, 0)).withTextColor(Color.WHITE)).withBadge("~");
            } else if (status == Status.OFFLINE) {
                statusItem.withBadgeStyle(new BadgeStyle(Color.RED, Color.RED).withTextColor(Color.WHITE)).withBadge("✖");
            }
            activity.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    drawer.updateItem(statusItem);
                }
            });
        }
    }).start();
}
 
开发者ID:Z3r0byte,项目名称:Magis,代码行数:29,代码来源:NavigationDrawer.java

示例3: getPrimaryMenuItem

import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
public static IDrawerItem getPrimaryMenuItem(DrawerItem drawerItem) {
    PrimaryDrawerItem primaryDrawerItem = new PrimaryDrawerItem()
            .withName(drawerItem.name)
            .withIdentifier(drawerItem.id)
            .withIcon(drawerItem.icon);

    if (drawerItem.withBadge) {
        primaryDrawerItem
                .withBadgeStyle(new BadgeStyle()
                        .withTextColor(Color.WHITE)
                        .withColorRes(R.color.grey));
    }
    return primaryDrawerItem;
}
 
开发者ID:GreenSkinMonster,项目名称:hipda,代码行数:15,代码来源:DrawerHelper.java

示例4: getSecondaryMenuItem

import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
public static IDrawerItem getSecondaryMenuItem(DrawerItem drawerItem) {
    SecondaryDrawerItem secondaryDrawerItem = new SecondaryDrawerItem()
            .withName(drawerItem.name)
            .withIdentifier(drawerItem.id)
            .withIcon(drawerItem.icon);

    if (drawerItem.withBadge) {
        secondaryDrawerItem
                .withBadgeStyle(new BadgeStyle()
                        .withTextColor(Color.WHITE)
                        .withColorRes(R.color.grey));
    }
    return secondaryDrawerItem;
}
 
开发者ID:GreenSkinMonster,项目名称:hipda,代码行数:15,代码来源:DrawerHelper.java

示例5: initDrawer

import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
private void initDrawer(){
        new DrawerBuilder().withActivity(this).build();

        // Create the AccountHeader
        profileItem = new ProfileDrawerItem().withName(" ").withEmail(" ").withIcon(getResources().getDrawable(R.drawable.empty_profile));
        headerResult = new AccountHeaderBuilder()
                .withActivity(this)
                .withHeaderBackground(R.color.primary)
                .withSelectionListEnabledForSingleProfile(false)
                .addProfiles(
                        profileItem
                )
                .build();


        //create the drawer and remember the `Drawer` result object
        drawer = new DrawerBuilder()
                .withActivity(this)
                .withToolbar(mToolbar)
                .withAccountHeader(headerResult)
                .withItemAnimator(new AlphaCrossFadeAnimator())
                .addDrawerItems(
                        new SectionDrawerItem().withName(R.string.time_tracker).withDivider(false),
                        new PrimaryDrawerItem().withIdentifier(1).withName(R.string.last_30_days).withIcon(R.drawable.icon_histogram),
                        new SectionDrawerItem().withName(R.string.settings).withDivider(false),
                        new PrimaryDrawerItem().withIdentifier(2).withName(R.string.i_beacon).withIcon(R.drawable.icon_ibeacon).withBadge(AppPreferences.getBeaconDetectionState()? "On":"Off").withBadgeStyle(new BadgeStyle().withTextColor(ContextCompat.getColor(this, R.color.medium_grey_text_color))),
                        new PrimaryDrawerItem().withIdentifier(3).withName(R.string.geofence).withIcon(R.drawable.icon_geofence).withBadge(AppPreferences.getGeofenceDetectionState()? "On":"Off").withBadgeStyle(new BadgeStyle().withTextColor(ContextCompat.getColor(this, R.color.medium_grey_text_color))),
                        new DividerDrawerItem(),
                        new PrimaryDrawerItem().withIdentifier(4).withName(R.string.feedback),
//                        new PrimaryDrawerItem().withIdentifier(5).withName(R.string.terms_and_cond),
                        new PrimaryDrawerItem().withIdentifier(6).withName(R.string.log_out)
                )
                .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                    @Override
                    public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                        Intent intent;
                        switch ((int)drawerItem.getIdentifier()){
                            case 1:
                                intent = new Intent(MainActivity.this, LastMonthTimeEntriesActivity.class);
                                startActivity(intent);
                                break;
                            case 2:
                                intent = new Intent(MainActivity.this, BeaconSettingsActivity.class);
                                startActivity(intent);
                                break;
                            case 3:
                                intent = new Intent(MainActivity.this, GeofenceSettingsActivity.class);
                                startActivity(intent);
                                break;
                            case 4:
                                PackageInfo pInfo = null;
                                try {
                                    pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
                                    Intent emailIntent = new Intent(Intent.ACTION_VIEW);
                                    Uri data = Uri.parse("mailto:?subject=" + getResources().getString(R.string.app_name) + " - Version: " + pInfo.versionName + "&body=" + "" + "&to=" + EMAIL_ADDRESS);
                                    emailIntent.setData(data);
                                    startActivity(emailIntent);
                                } catch (PackageManager.NameNotFoundException e) {
                                    e.printStackTrace();
                                }
                                break;
                            case 5:
//                                Intent intent = new Intent(MainActivity.this, LastMonthTimeEntriesActivity.class);
//                                startActivity(intent);
                                break;
                            case 6:
                                logoutAction();
                                break;
                        }
                        return false;
                    }
                })
                .withCloseOnClick(true)
                .build();

        drawer.setSelection(-1);
    }
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:78,代码来源:MainActivity.java

示例6: withBadgeStyle

import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
@Override
public CustomUrlPrimaryDrawerItem withBadgeStyle(BadgeStyle badgeStyle) {
    this.mBadgeStyle = badgeStyle;
    return this;
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:6,代码来源:CustomUrlPrimaryDrawerItem.java

示例7: getBadgeStyle

import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
public BadgeStyle getBadgeStyle() {
    return mBadgeStyle;
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:4,代码来源:CustomUrlPrimaryDrawerItem.java

示例8: BadgeDrawableBuilder

import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
public BadgeDrawableBuilder(BadgeStyle style) {
    this.mStyle = style;
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:4,代码来源:BadgeDrawableBuilder.java

示例9: withBadgeStyle

import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
@Override
public PrimaryDrawerItem withBadgeStyle(BadgeStyle badgeStyle) {
    this.mBadgeStyle = badgeStyle;
    return this;
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:6,代码来源:PrimaryDrawerItem.java

示例10: withBadgeStyle

import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
@Override
public SecondaryDrawerItem withBadgeStyle(BadgeStyle badgeStyle) {
    this.mBadgeStyle = badgeStyle;
    return this;
}
 
开发者ID:FreedomZZQ,项目名称:YouJoin-Android,代码行数:6,代码来源:SecondaryDrawerItem.java

示例11: withBadgeStyle

import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
T withBadgeStyle(BadgeStyle badgeStyle); 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:2,代码来源:ColorfulBadgeable.java

示例12: getBadgeStyle

import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
BadgeStyle getBadgeStyle(); 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:2,代码来源:ColorfulBadgeable.java


注:本文中的com.mikepenz.materialdrawer.holder.BadgeStyle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。