本文整理汇总了Java中it.neokree.materialnavigationdrawer.MaterialNavigationDrawer类的典型用法代码示例。如果您正苦于以下问题:Java MaterialNavigationDrawer类的具体用法?Java MaterialNavigationDrawer怎么用?Java MaterialNavigationDrawer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MaterialNavigationDrawer类属于it.neokree.materialnavigationdrawer包,在下文中一共展示了MaterialNavigationDrawer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
@Override
public void init(Bundle savedInstanceState) {
MaterialAccount account = new MaterialAccount(this.getResources(),"npes87184","[email protected]",R.drawable.npes, R.drawable.bamboo);
this.addAccount(account);
this.addSection(newSection(getString(R.string.star), R.drawable.ic_menu_star, StarFragment.newInstance(0)));
this.addSection(newSection(getString(R.string.radiation), R.drawable.radiation, RadiationFragment.newInstance(0)));
this.addSection(newSection(getString(R.string.radiation_map), R.drawable.ic_perm_group_location, RadiationMap.newInstance(1)));
this.addSection(newSection(getString(R.string.water_Reservoir), R.drawable.water, WaterFragment.newInstance(2)));
this.addSection(newSection(getString(R.string.water_Info), R.drawable.water, WaterInfoFragment.newInstance(3)));
this.addSection(newSection(getString(R.string.air), R.drawable.air, AirFragment.newInstance(4)));
this.addSection(newSection(getString(R.string.UV), R.drawable.uv, UVFragment.newInstance(5)));
/* this.addSection(newSection("Section 3", R.drawable.ic_mic_white_24dp,new FragmentButton()).setSectionColor(Color.parseColor("#9c27b0")));
this.addSection(newSection("Section",R.drawable.ic_hotel_grey600_24dp,new FragmentButton()).setSectionColor(Color.parseColor("#03a9f4")));
*/
// create bottom section
this.addBottomSection(newSection(getString(R.string.about),R.drawable.ic_menu_info_details, AboutFragment.newInstance(4)));
// add pattern
this.setBackPattern(MaterialNavigationDrawer.BACKPATTERN_BACK_ANYWHERE);
}
示例2: removeRunningTripOfferState
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
private void removeRunningTripOfferState() {
SharedPreferences prefs = getActivity().getSharedPreferences(Constants.SHARED_PREF_FILE_PREFERENCES,
Context.MODE_PRIVATE);
prefs.edit().remove(Constants.SHARED_PREF_KEY_RUNNING_TRIP_OFFER).apply();
// Change "My Trip" (driver) to "Offer Trip" in navigation drawer
MaterialNavigationDrawer drawer = ((MaterialNavigationDrawer) getActivity());
// Find "last" "My Trip", so we don't accidentally rename the join-trip-my trip
List<MaterialSection> sections = drawer.getSectionList();
MaterialSection section = null;
for (MaterialSection s : sections) {
if (s.getTitle().equals(getString(R.string.menu_my_trip))) {
section = s;
}
}
section.setTitle(getString(R.string.menu_offer_trip));
// The next fragment shows the "Offer trip" screen
drawer.setFragment(new OfferTripFragment(), getString(R.string.menu_offer_trip));
}
示例3: onClick
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
@Override
public void onClick(View view) {
if (listener != null) {
listener.onItemClicked(view, getPosition());
}
Vehicle vehicle = vehicles.get(getPosition()-1);
long vehicleId = vehicle.getId();
if (view == edit) {
DataHolder.getInstance().setVehicle_id((int) vehicleId);
((MaterialNavigationDrawer) context).setFragmentChild(new VehicleInfoFragment(), "Edit Vehicle Info");
Timber.v("Clicked on vehicle " + vehicleId);
}
}
示例4: init
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
/**
* The delegation method that initializes the activity. Don't use activity's onCreate method.
*/
@Override
public void init(final Bundle savedInstanceState) {
setUpHeader();
addPrimarySections();
addSecondarySections();
addBottomSections();
setBackPattern(MaterialNavigationDrawer.BACKPATTERN_BACK_TO_FIRST);
initDrawerLearningPattern();
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Timber.tag(TAG);
addFabMenuView();
int initialOrientation = getWindowManager().getDefaultDisplay().getRotation();
if (initialOrientation == Surface.ROTATION_0 || initialOrientation == Surface.ROTATION_180)
mLastOrientationConfiguration = Configuration.ORIENTATION_PORTRAIT;
else
mLastOrientationConfiguration = Configuration.ORIENTATION_LANDSCAPE;
EventBusProvider.getInstance().getEventBus().register(BaseActivity.this);
}
示例5: click
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
@OnClick(R.id.routerPwnButton) public void click(View v){
//this.getActivity().getSupportFragmentManager().beginTransaction().remove(this).commit();
ConnectivityManager connManager = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
if (!mWifi.isConnected()) {
// Do whatever
WifiAlertFragment wifiAlertFragment = new WifiAlertFragment();
// Show Alert DialogFragment
wifiAlertFragment.show(getActivity().getSupportFragmentManager(), "Alert Dialog Fragment");
}
else {
((MaterialNavigationDrawer) this.getActivity()).setFragmentChild(new FragmentRouter(), getActivity().getString(R.string.router_pwner_title));
}
}
示例6: onCreateView
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
setHasOptionsMenu(true);
((MaterialNavigationDrawer) getActivity()).getCurrentSection().setNotificationsText("");
((MaterialNavigationDrawer) getActivity()).getCurrentSection().setTitle(getString(R.string.menu_my_trip));
View view = inflater.inflate(R.layout.fragment_join_results, container, false);
return view;
}
示例7: replaceChildFragment
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
private void replaceChildFragment(Bundle args) {
((MaterialNavigationDrawer) getActivity()).getCurrentSection().setNotificationsText("");
((MaterialNavigationDrawer) getActivity()).getCurrentSection().setTitle(getString(R.string.menu_join_trip));
((MaterialNavigationDrawer) getActivity()).setTitle(R.string.menu_join_trip);
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
SharedPreferences prefs = getActivity().getSharedPreferences(Constants.SHARED_PREF_FILE_PREFERENCES, Context.MODE_PRIVATE);
//SEARCHING -> Show the results fragment (waiting screen + results)
if (prefs.getBoolean(Constants.SHARED_PREF_KEY_SEARCHING, false)) {
if (args != null) {
resultsFragment = new JoinResultsFragment();
resultsFragment.setArguments(args);
}
allowBackPressed = false;
transaction.replace(R.id.child_fragment, resultsFragment).commitAllowingStateLoss();
//ACCEPTED -> Show the driving fragment
} else if (prefs.getBoolean(Constants.SHARED_PREF_KEY_ACCEPTED, false) || prefs.getBoolean(Constants.SHARED_PREF_KEY_WAITING, false)) {
if (args != null) {
drivingFragment = new JoinDrivingFragment();
drivingFragment.setArguments(args);
}
allowBackPressed = false;
transaction.replace(R.id.child_fragment, drivingFragment).commitAllowingStateLoss();
//OTHERWISE -> Show the default search fragment
} else {
if (args != null) {
searchFragment = new JoinSearchFragment();
searchFragment.setArguments(args);
}
allowBackPressed = true;
transaction.replace(R.id.child_fragment, searchFragment).commitAllowingStateLoss();
}
}
示例8: onCreateView
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
setHasOptionsMenu(true);
((MaterialNavigationDrawer) getActivity()).getCurrentSection().setNotificationsText("");
((MaterialNavigationDrawer) getActivity()).getCurrentSection().setTitle(getString(R.string.menu_my_trip));
((MaterialNavigationDrawer) getActivity()).setTitle(R.string.menu_my_trip);
View view = inflater.inflate(R.layout.fragment_join_driving, container, false);
return view;
}
示例9: changeNavigationDrawerImage
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
private void changeNavigationDrawerImage(final String avatarUrl) {
final MaterialNavigationDrawer drawer = ((MaterialNavigationDrawer) getActivity());
if (avatarUrl != null) {
//Download the new profile picture
Observable.defer(new Func0<Observable<Bitmap>>() {
@Override
public Observable<Bitmap> call() {
try {
URL url = new URL(avatarUrl);
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
return Observable.just(BitmapFactory.decodeStream(input));
} catch (Exception e) {
return Observable.error(e);
}
}
}).compose(new DefaultTransformer<Bitmap>())
.subscribe(new Action1<Bitmap>() {
@Override
public void call(Bitmap avatar) {
//Set the profile picture if download was successful
drawer.getCurrentAccount().setPhoto(avatar);
drawer.notifyAccountDataChanged();
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
Timber.e(throwable, "failed to download avatar");
}
});
}
}
示例10: replaceChildFragment
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
/**
* Sets the default title in the navigation drawer ("Offer trip") and shows the correct fragment
* based on the status saved in the shared preferences
* @param args arguments for the new fragment
*/
private void replaceChildFragment(Bundle args) {
// TODO clean saved fragment-navigation from SharedPref if logout
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
SharedPreferences prefs = getActivity().getSharedPreferences(
Constants.SHARED_PREF_FILE_PREFERENCES, Context.MODE_PRIVATE);
if (prefs.getBoolean(Constants.SHARED_PREF_KEY_RUNNING_TRIP_OFFER, false)) {
// MY TRIP (driver) -> Show the MyTripDriverFragment
if (args != null) {
myTripDriverFragment = new MyTripDriverFragment();
myTripDriverFragment.setArguments(args);
}
// "My trip" title
((MaterialNavigationDrawer) getActivity()).getCurrentSection().setTitle(getString(R.string.menu_my_trip));
transaction.replace(R.id.fl_offer_dispatch_child_fragment, myTripDriverFragment)
.commitAllowingStateLoss();
} else {
// OFFER TRIP -> Show the OfferTripFragment
if (args != null) {
offerTripFragment = new OfferTripFragment();
offerTripFragment.setArguments(args);
}
// "Offer trip" title
((MaterialNavigationDrawer) getActivity()).getCurrentSection().setTitle(getString(R.string.menu_offer_trip));
transaction.replace(R.id.fl_offer_dispatch_child_fragment, offerTripFragment)
.commitAllowingStateLoss();
}
}
示例11: init
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
@Override
public void init(Bundle savedInstanceState) {
this.addSection(newSection("Section 1", new FragmentIndex()));
this.addSection(newSection("Section 2",new FragmentIndex()));
this.addSection(newSection("Section 3", R.drawable.ic_mic_white_24dp,new FragmentButton()).setSectionColor(Color.parseColor("#9c27b0")));
this.addSection(newSection("Section",R.drawable.ic_hotel_grey600_24dp,new FragmentButton()).setSectionColor(Color.parseColor("#03a9f4")));
// create bottom section
this.addBottomSection(newSection("Bottom Section",R.drawable.ic_settings_black_24dp,new Intent(this,Settings.class)));
// add pattern
this.setBackPattern(MaterialNavigationDrawer.BACKPATTERN_BACK_ANYWHERE);
}
示例12: init
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
@Override
public void init(Bundle savedInstanceState) {
this.addSection(newSection("Section 1", new FragmentIndex()));
this.addSection(newSection("Section 2",new FragmentIndex()));
this.addSection(newSection("Section 3", R.drawable.ic_mic_white_24dp,new FragmentButton()).setSectionColor(Color.parseColor("#9c27b0")));
this.addSection(newSection("Section",R.drawable.ic_hotel_grey600_24dp,new FragmentButton()).setSectionColor(Color.parseColor("#03a9f4")));
// create bottom section
this.addBottomSection(newSection("Bottom Section",R.drawable.ic_settings_black_24dp,new Intent(this,Settings.class)));
// add pattern
this.setBackPattern(MaterialNavigationDrawer.BACKPATTERN_BACK_TO_FIRST);
}
示例13: nextSection
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
public void nextSection() {
Fragment fragment = new TestFragment2();
Bundle data = new Bundle();
data.putString("Test","Banana");
fragment.setArguments(data);
((MaterialNavigationDrawer)this.getActivity()).setFragmentChild(fragment,"Test page 2");
}
示例14: init
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
@Override
public void init(Bundle bundle) {
//KitKat translucent modes
setTranslucentStatus(this, true);
//账号处理
account = new MaterialAccount(this.getResources(),
getString(R.string.about_me_name), getString(R.string.about_me_email),
R.drawable.profile, R.drawable.header);
this.addAccount(account);
// set listener
this.setAccountListener(this);
MaterialSection homeSection =
newSection(getString(R.string.app_home),
new IconicsDrawable(this)
.icon(FontAwesome.Icon.faw_home)
.color(Color.WHITE)
.sizeDp(24),
BleDevicesFragment.newInstance(getString(R.string.app_home)));
MaterialSection configSection =
newSection(getString(R.string.app_user_config),
new IconicsDrawable(this)
.icon(FontAwesome.Icon.faw_gg_circle)
.color(Color.WHITE)
.sizeDp(24),
ConfigFragment.newInstance(getString(R.string.app_user_config)));
MaterialSection openSourceSection =
newSection(getString(R.string.app_open_source),
new IconicsDrawable(this)
.icon(FontAwesome.Icon.faw_github)
.color(Color.WHITE)
.sizeDp(24),
new LibsBuilder().fragment());
MaterialSection aboutSection =
newSection(getString(R.string.app_about),
new IconicsDrawable(this)
.icon(GoogleMaterial.Icon.gmd_email)
.color(Color.WHITE)
.sizeDp(24),
AboutFragment.newInstance(getString(R.string.app_about)));
addSection(homeSection);
addSection(configSection);
addSection(openSourceSection);
addSection(aboutSection);
disableLearningPattern();
// add pattern
this.setBackPattern(MaterialNavigationDrawer.BACKPATTERN_BACK_TO_FIRST);
//allowArrowAnimation();
enableToolbarElevation();
AppUpgrade.update(this);//版本更新
}
示例15: init
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer; //导入依赖的package包/类
@Override
public void init(Bundle savedInstanceState) {
this.isConnected = false;
fragmentMain = new MainFragment_();
fragmentStatistics = new StatisticsFragment();
fragmentTestOut = new TestOutFragment_();
this.disableLearningPattern();
this.setDrawerHeaderImage(R.drawable.drawer_header);
this.addSection(newSection("Home", fragmentMain));
this.addSection(newSection("Statistics", fragmentStatistics));
this.addSection(newSection("Test Out", fragmentTestOut));
this.addBottomSection(newSection("HELP", new HelpFragment()));
this.addBottomSection(newSection("SETTINGS", new SettingsFragment()));
this.addBottomSection(newSection("ABOUT", new AboutUsFragment()));
setBackPattern(MaterialNavigationDrawer.BACKPATTERN_BACK_TO_FIRST);
setupBluetooth();
}