本文整理汇总了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);
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
示例6: withBadgeStyle
import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
@Override
public CustomUrlPrimaryDrawerItem withBadgeStyle(BadgeStyle badgeStyle) {
this.mBadgeStyle = badgeStyle;
return this;
}
示例7: getBadgeStyle
import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
public BadgeStyle getBadgeStyle() {
return mBadgeStyle;
}
示例8: BadgeDrawableBuilder
import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
public BadgeDrawableBuilder(BadgeStyle style) {
this.mStyle = style;
}
示例9: withBadgeStyle
import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
@Override
public PrimaryDrawerItem withBadgeStyle(BadgeStyle badgeStyle) {
this.mBadgeStyle = badgeStyle;
return this;
}
示例10: withBadgeStyle
import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
@Override
public SecondaryDrawerItem withBadgeStyle(BadgeStyle badgeStyle) {
this.mBadgeStyle = badgeStyle;
return this;
}
示例11: withBadgeStyle
import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
T withBadgeStyle(BadgeStyle badgeStyle);
示例12: getBadgeStyle
import com.mikepenz.materialdrawer.holder.BadgeStyle; //导入依赖的package包/类
BadgeStyle getBadgeStyle();