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


Java MaterialNavigationDrawer类代码示例

本文整理汇总了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);
    }
 
开发者ID:npes87184,项目名称:EnvironmentTW,代码行数:23,代码来源:NavigationDrawer.java

示例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));
}
 
开发者ID:AMOS-2015,项目名称:amos-ss15-proj2,代码行数:23,代码来源:MyTripDriverFragment.java

示例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);
    }
}
 
开发者ID:AMOS-2015,项目名称:amos-ss15-proj2,代码行数:17,代码来源:VehiclesListAdapter.java

示例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);
}
 
开发者ID:filipebezerra,项目名称:HorariosRmtcGoiania,代码行数:27,代码来源:BaseActivity.java

示例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));
	}
}
 
开发者ID:h3ph4est7s,项目名称:Helepolis,代码行数:16,代码来源:FragmentIndex.java

示例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;
}
 
开发者ID:AMOS-2015,项目名称:amos-ss15-proj2,代码行数:13,代码来源:JoinResultsFragment.java

示例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();
    }
}
 
开发者ID:AMOS-2015,项目名称:amos-ss15-proj2,代码行数:41,代码来源:JoinDispatchFragment.java

示例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;
}
 
开发者ID:AMOS-2015,项目名称:amos-ss15-proj2,代码行数:13,代码来源:JoinDrivingFragment.java

示例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");
                    }
                });
    }
}
 
开发者ID:AMOS-2015,项目名称:amos-ss15-proj2,代码行数:35,代码来源:EditProfileFragment.java

示例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();
    }
}
 
开发者ID:AMOS-2015,项目名称:amos-ss15-proj2,代码行数:44,代码来源:DispatchOfferTripFragment.java

示例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);
}
 
开发者ID:GeorgeMe,项目名称:MaterialNavigationDrawer,代码行数:14,代码来源:BackAnywhere.java

示例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);
}
 
开发者ID:GeorgeMe,项目名称:MaterialNavigationDrawer,代码行数:14,代码来源:BackToFirst.java

示例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");
}
 
开发者ID:GeorgeMe,项目名称:MaterialNavigationDrawer,代码行数:9,代码来源:TestFragment.java

示例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);//版本更新
}
 
开发者ID:captain-miao,项目名称:bleYan,代码行数:61,代码来源:HomeActivity.java

示例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();

}
 
开发者ID:alinekborges,项目名称:SmartChair,代码行数:26,代码来源:MainActivity.java


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