本文整理汇总了Java中com.mikepenz.materialdrawer.model.SwitchDrawerItem类的典型用法代码示例。如果您正苦于以下问题:Java SwitchDrawerItem类的具体用法?Java SwitchDrawerItem怎么用?Java SwitchDrawerItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SwitchDrawerItem类属于com.mikepenz.materialdrawer.model包,在下文中一共展示了SwitchDrawerItem类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUpSwitches
import com.mikepenz.materialdrawer.model.SwitchDrawerItem; //导入依赖的package包/类
private void setUpSwitches() {
darkSwitch = new SwitchDrawerItem()
.withName(R.string.dark_col)
.withLevel(2).withIdentifier(ID_DARK_THEME)
.withOnCheckedChangeListener(this)
.withChecked(mDarkTheme)
.withSelectable(false);
doneSwitch = new SwitchDrawerItem()
.withName(R.string.show_done_msg)
.withLevel(2).withIdentifier(ID_TOGGLE_DONE)
.withOnCheckedChangeListener(this)
.withSelectable(false);
if (mTinyDB.getBoolean(getString(R.string.show_done_pref)))
doneSwitch.withChecked(true);
else
toggleDoneTab();
bigTextSwitch = new SwitchDrawerItem()
.withName(R.string.big_text_msg)
.withLevel(2).withIdentifier(ID_TOGGLE_BIG_TEXT)
.withOnCheckedChangeListener(this)
.withSelectable(false);
if (mTinyDB.getBoolean(getString(R.string.big_text_pref), false)) {
bigTextSwitch.withChecked(true);
HorizontalAdapter.setBigText(true);
}
}
开发者ID:IdeaTrackerPlus,项目名称:IdeaTrackerPlus,代码行数:32,代码来源:MainActivity.java
示例2: onCreate
import com.mikepenz.materialdrawer.model.SwitchDrawerItem; //导入依赖的package包/类
/**
*
* @param savedInstanceState
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Preferences
mSharedPreferences = new ClientSharedPreferences(this);
// Bluetooth OBD2 Device
mDevice = new OBD2Device(mSharedPreferences);
// Action bar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//ClientSharedPreferences prefs = new ClientSharedPreferences(getApplicationContext());
// Navigation Drawer
mDrawer = new DrawerBuilder(this)
.withActivity(this)
.withToolbar(toolbar)
.withHasStableIds(true)
.withHeader(R.layout.nav_header)
.addDrawerItems(
new SwitchDrawerItem().withIdentifier(NavigationDrawerItem.Bluetooth.ordinal()).withName(R.string.action_bluetooth).withIcon(GoogleMaterial.Icon.gmd_bluetooth).withChecked(false).withSelectable(false).withOnCheckedChangeListener(mOnCheckedBluetoothDevice),
new DividerDrawerItem(),
new PrimaryDrawerItem().withIdentifier(NavigationDrawerItem.Car.ordinal()).withName(R.string.action_car_information).withIcon(FontAwesome.Icon.faw_car),
new PrimaryDrawerItem().withIdentifier(NavigationDrawerItem.Dashboard.ordinal()).withName(R.string.action_dashboard).withIcon(FontAwesome.Icon.faw_dashboard).withEnabled(false),
new PrimaryDrawerItem().withIdentifier(NavigationDrawerItem.Battery.ordinal()).withName(R.string.action_battery).withIcon(FontAwesome.Icon.faw_battery_three_quarters),
new PrimaryDrawerItem().withIdentifier(NavigationDrawerItem.DtcCodes.ordinal()).withName(R.string.action_dtc).withIcon(FontAwesome.Icon.faw_stethoscope).withEnabled(false),
new DividerDrawerItem(),
new SecondaryDrawerItem().withIdentifier(NavigationDrawerItem.Settings.ordinal()).withName(R.string.action_settings).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_settings),
new SecondaryDrawerItem().withIdentifier(NavigationDrawerItem.HelpFeedback.ordinal()).withName(R.string.action_help).withIcon(GoogleMaterial.Icon.gmd_help).withEnabled(false)
)
.withOnDrawerItemClickListener(this)
.withSavedInstance(savedInstanceState)
.withShowDrawerOnFirstLaunch(true)
.build();
//only set the active selection or active profile if we do not recreate the activity
if (savedInstanceState == null) {
// set the selection to the item with the identifier 2
mDrawer.setSelection(NavigationDrawerItem.Battery.ordinal(), true);
}
}
开发者ID:pemessier,项目名称:SoulEVSpy,代码行数:50,代码来源:MainActivity.java
注:本文中的com.mikepenz.materialdrawer.model.SwitchDrawerItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论