Search in sources :

Example 1 with SlidingMenu

use of com.jeremyfeinstein.slidingmenu.lib.SlidingMenu in project ChatExchange by HueToYou.

the class MainActivity method createUsersSlidingMenu.

/**
 * Setup current users {@link SlidingMenu}
 */
private void createUsersSlidingMenu() {
    // configure the SlidingMenu
    mCurrentUsers_SlidingMenu = new SlidingMenu(MainActivity.this);
    mCurrentUsers_SlidingMenu.setMode(SlidingMenu.RIGHT);
    // mCurrentUsers_SlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
    mCurrentUsers_SlidingMenu.setShadowWidthRes(R.dimen.shadow_width);
    mCurrentUsers_SlidingMenu.setShadowDrawable(new ColorDrawable(getResources().getColor(R.color.transparentGrey)));
    mCurrentUsers_SlidingMenu.setBehindWidthRes(R.dimen.sliding_menu_width);
    mCurrentUsers_SlidingMenu.setFadeDegree(0.35f);
    mCurrentUsers_SlidingMenu.attachToActivity(MainActivity.this, SlidingMenu.SLIDING_CONTENT);
    mCurrentUsers_SlidingMenu.setMenu(R.layout.users_slideout);
    mCurrentUsers_SlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
    mCurrentUsers_SlidingMenu.setOnOpenedListener(new SlidingMenu.OnOpenedListener() {

        @Override
        public void onOpened() {
            TutorialStuff.showUsersTutorial(MainActivity.this);
        }
    });
}
Also used : SlidingMenu(com.jeremyfeinstein.slidingmenu.lib.SlidingMenu) ColorDrawable(android.graphics.drawable.ColorDrawable)

Example 2 with SlidingMenu

use of com.jeremyfeinstein.slidingmenu.lib.SlidingMenu in project SlidingMenu by jfeinstein10.

the class PropertiesActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setSlidingActionBarEnabled(true);
    setContentView(R.layout.properties);
    // left and right modes
    RadioGroup mode = (RadioGroup) findViewById(R.id.mode);
    mode.check(R.id.left);
    mode.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            SlidingMenu sm = getSlidingMenu();
            switch(checkedId) {
                case R.id.left:
                    sm.setMode(SlidingMenu.LEFT);
                    sm.setShadowDrawable(R.drawable.shadow);
                    break;
                case R.id.right:
                    sm.setMode(SlidingMenu.RIGHT);
                    sm.setShadowDrawable(R.drawable.shadowright);
                    break;
                case R.id.left_right:
                    sm.setMode(SlidingMenu.LEFT_RIGHT);
                    sm.setSecondaryMenu(R.layout.menu_frame_two);
                    getSupportFragmentManager().beginTransaction().replace(R.id.menu_frame_two, new SampleListFragment()).commit();
                    sm.setSecondaryShadowDrawable(R.drawable.shadowright);
                    sm.setShadowDrawable(R.drawable.shadow);
            }
        }
    });
    // touch mode stuff
    RadioGroup touchAbove = (RadioGroup) findViewById(R.id.touch_above);
    touchAbove.check(R.id.touch_above_full);
    touchAbove.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            switch(checkedId) {
                case R.id.touch_above_full:
                    getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
                    break;
                case R.id.touch_above_margin:
                    getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
                    break;
                case R.id.touch_above_none:
                    getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
                    break;
            }
        }
    });
    // scroll scale stuff
    SeekBar scrollScale = (SeekBar) findViewById(R.id.scroll_scale);
    scrollScale.setMax(1000);
    scrollScale.setProgress(333);
    scrollScale.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            getSlidingMenu().setBehindScrollScale((float) seekBar.getProgress() / seekBar.getMax());
        }
    });
    // behind width stuff
    SeekBar behindWidth = (SeekBar) findViewById(R.id.behind_width);
    behindWidth.setMax(1000);
    behindWidth.setProgress(750);
    behindWidth.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            float percent = (float) seekBar.getProgress() / seekBar.getMax();
            getSlidingMenu().setBehindWidth((int) (percent * getSlidingMenu().getWidth()));
            getSlidingMenu().requestLayout();
        }
    });
    // shadow stuff
    CheckBox shadowEnabled = (CheckBox) findViewById(R.id.shadow_enabled);
    shadowEnabled.setChecked(true);
    shadowEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked)
                getSlidingMenu().setShadowDrawable(getSlidingMenu().getMode() == SlidingMenu.LEFT ? R.drawable.shadow : R.drawable.shadowright);
            else
                getSlidingMenu().setShadowDrawable(null);
        }
    });
    SeekBar shadowWidth = (SeekBar) findViewById(R.id.shadow_width);
    shadowWidth.setMax(1000);
    shadowWidth.setProgress(75);
    shadowWidth.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) {
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            float percent = (float) seekBar.getProgress() / (float) seekBar.getMax();
            int width = (int) (percent * (float) getSlidingMenu().getWidth());
            getSlidingMenu().setShadowWidth(width);
            getSlidingMenu().invalidate();
        }
    });
    // fading stuff
    CheckBox fadeEnabled = (CheckBox) findViewById(R.id.fade_enabled);
    fadeEnabled.setChecked(true);
    fadeEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            getSlidingMenu().setFadeEnabled(isChecked);
        }
    });
    SeekBar fadeDeg = (SeekBar) findViewById(R.id.fade_degree);
    fadeDeg.setMax(1000);
    fadeDeg.setProgress(666);
    fadeDeg.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            getSlidingMenu().setFadeDegree((float) seekBar.getProgress() / seekBar.getMax());
        }
    });
}
Also used : SlidingMenu(com.jeremyfeinstein.slidingmenu.lib.SlidingMenu) OnCheckedChangeListener(android.widget.RadioGroup.OnCheckedChangeListener) RadioGroup(android.widget.RadioGroup) SeekBar(android.widget.SeekBar) CheckBox(android.widget.CheckBox) OnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener) CompoundButton(android.widget.CompoundButton)

Example 3 with SlidingMenu

use of com.jeremyfeinstein.slidingmenu.lib.SlidingMenu in project SlidingMenu by jfeinstein10.

the class ResponsiveUIActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle(R.string.responsive_ui);
    setContentView(R.layout.responsive_content_frame);
    // check if the content frame contains the menu frame
    if (findViewById(R.id.menu_frame) == null) {
        setBehindContentView(R.layout.menu_frame);
        getSlidingMenu().setSlidingEnabled(true);
        getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        // show home as up so we can toggle
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    } else {
        // add a dummy view
        View v = new View(this);
        setBehindContentView(v);
        getSlidingMenu().setSlidingEnabled(false);
        getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
    }
    // set the Above View Fragment
    if (savedInstanceState != null)
        mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent");
    if (mContent == null)
        mContent = new BirdGridFragment(0);
    getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, mContent).commit();
    // set the Behind View Fragment
    getSupportFragmentManager().beginTransaction().replace(R.id.menu_frame, new BirdMenuFragment()).commit();
    // customize the SlidingMenu
    SlidingMenu sm = getSlidingMenu();
    sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    sm.setShadowWidthRes(R.dimen.shadow_width);
    sm.setShadowDrawable(R.drawable.shadow);
    sm.setBehindScrollScale(0.25f);
    sm.setFadeDegree(0.25f);
    // show the explanation dialog
    if (savedInstanceState == null)
        new AlertDialog.Builder(this).setTitle(R.string.what_is_this).setMessage(R.string.responsive_explanation).show();
}
Also used : SlidingMenu(com.jeremyfeinstein.slidingmenu.lib.SlidingMenu) View(android.view.View)

Example 4 with SlidingMenu

use of com.jeremyfeinstein.slidingmenu.lib.SlidingMenu in project SlidingMenu by jfeinstein10.

the class AttachExample method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle(R.string.attach);
    // set the Above View
    setContentView(R.layout.content_frame);
    getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, new SampleListFragment()).commit();
    // configure the SlidingMenu
    menu = new SlidingMenu(this);
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    menu.setShadowWidthRes(R.dimen.shadow_width);
    menu.setShadowDrawable(R.drawable.shadow);
    menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    menu.setFadeDegree(0.35f);
    menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    menu.setMenu(R.layout.menu_frame);
    getSupportFragmentManager().beginTransaction().replace(R.id.menu_frame, new SampleListFragment()).commit();
}
Also used : SlidingMenu(com.jeremyfeinstein.slidingmenu.lib.SlidingMenu)

Example 5 with SlidingMenu

use of com.jeremyfeinstein.slidingmenu.lib.SlidingMenu in project ChatExchange by HueToYou.

the class TutorialStuff method chatFragTutorial.

/*
     * Chat fragment
     */
public static void chatFragTutorial(Activity activity, View view, int mAppBarColor) {
    SlidingMenu chatroomsMenu = ((MainActivity) activity).getmChatroomSlidingMenu();
    if (chatroomsMenu.isMenuShowing()) {
        chatroomsMenu.hideMenu(false);
    }
    if (mSharedPreferences == null) {
        mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
    }
    if (mCategoryConfig == null) {
        setCategoryConfig(activity);
    }
    if (mItemConfig == null) {
        setItemConfig(activity);
    }
    PreferencesManager manager = new PreferencesManager(activity);
    if (!manager.isDisplayed(CHAT_FRAG_MENU_BTN)) {
        MainActivity.touchesBlocked = true;
    }
    final FloatingActionMenu fam = view.findViewById(R.id.chat_menu);
    final FloatingActionButton users = view.findViewById(R.id.show_users_fab);
    final FloatingActionButton info = view.findViewById(R.id.room_info_fab);
    final FloatingActionButton stars = view.findViewById(R.id.star_fab);
    final FloatingActionButton openInBrowser = view.findViewById(R.id.open_in_browser_fab);
    final EditText messageEntryBox = view.findViewById(R.id.messageToSend);
    final ImageButton sendMsg = view.findViewById(R.id.sendMessageBtn);
    final SpotlightView menuBtn = new SpotlightView.Builder(activity).target(Utils.getActionBar(activity.getWindow().getDecorView()).getChildAt(1)).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.tutorial_menu)).subHeadingTvText(activity.getResources().getString(R.string.chatFrag_hamburger_tutorial_text)).usageId(CHAT_FRAG_MENU_BTN).show();
    final SpotlightView.Builder chatFragFam = new SpotlightView.Builder(activity).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.tutorial_menu)).target(fam.getMenuButton()).subHeadingTvText(activity.getResources().getString(R.string.chatFrag_FAM_tutorial_text)).usageId(CHAT_FRAG_FAM);
    final SpotlightView.Builder chatFragUsersFAB = new SpotlightView.Builder(activity).setConfiguration(mItemConfig).headingTvText(activity.getResources().getString(R.string.chatFrag_usersSlidingPanel_tutorial_text_title_main)).target(users).subHeadingTvText(activity.getResources().getString(R.string.chatFrag_showUsersFAB_tutorial_text)).usageId(CHAT_FRAG_USERS_FAB);
    final SpotlightView.Builder chatFragInfoFAB = new SpotlightView.Builder(activity).setConfiguration(mItemConfig).headingTvText(activity.getResources().getString(R.string.tutorial_info)).target(info).subHeadingTvText(activity.getResources().getString(R.string.chatFrag_roomInfoFAB_tutorial_text)).usageId(CHAT_FRAG_INFO_FAB);
    final SpotlightView.Builder chatFragStarsFAB = new SpotlightView.Builder(activity).setConfiguration(mItemConfig).headingTvText(activity.getResources().getString(R.string.tutorial_stars)).target(stars).subHeadingTvText(activity.getResources().getString(R.string.chatFrag_starredMessagesFAB_tutorial_text)).usageId(CHAT_FRAG_STARS_FAB);
    final SpotlightView.Builder chatFragOpenInBrowserFAB = new SpotlightView.Builder(activity).setConfiguration(mItemConfig).headingTvText(activity.getResources().getString(R.string.tutorial_open_browser)).target(openInBrowser).subHeadingTvText(activity.getResources().getString(R.string.chatFrag_openInBrowserFAB_tutorial_text)).usageId(CHAT_FRAG_OPENINBROWSER_FAB);
    final SpotlightView.Builder chatFragMessageEntryBox = new SpotlightView.Builder(activity).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.tutorial_msg_box)).target(messageEntryBox).subHeadingTvText(activity.getResources().getString(R.string.chatFrag_messageEntryBox_tutorial_text)).usageId(CHAT_FRAG_MESSG_ENTRY_BOX);
    final SpotlightView.Builder chatFragSendMessageButton = new SpotlightView.Builder(activity).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.tutorial_send_btn)).target(sendMsg).subHeadingTvText(activity.getResources().getString(R.string.chatFrag_sendMsgBtn_tutorial_text)).usageId(CHAT_FRAG_SEND_MESSG_BTN);
    SpotlightListener huehuelistener = new SpotlightListener() {

        @Override
        public void onUserClicked(String s) {
            switch(s) {
                case CHAT_FRAG_MENU_BTN:
                    chatFragFam.show();
                    MainActivity.touchesBlocked = true;
                    break;
                case CHAT_FRAG_FAM:
                    fam.open(true);
                    chatFragUsersFAB.show();
                    MainActivity.touchesBlocked = true;
                    break;
                case CHAT_FRAG_USERS_FAB:
                    chatFragInfoFAB.show();
                    MainActivity.touchesBlocked = true;
                    break;
                case CHAT_FRAG_INFO_FAB:
                    chatFragStarsFAB.show();
                    MainActivity.touchesBlocked = true;
                    break;
                case CHAT_FRAG_STARS_FAB:
                    chatFragOpenInBrowserFAB.show();
                    MainActivity.touchesBlocked = true;
                    break;
                case CHAT_FRAG_OPENINBROWSER_FAB:
                    fam.close(true);
                    chatFragMessageEntryBox.show();
                    MainActivity.touchesBlocked = true;
                    break;
                case CHAT_FRAG_MESSG_ENTRY_BOX:
                    chatFragSendMessageButton.show();
                    MainActivity.touchesBlocked = false;
                    break;
            }
        }

        @Override
        public void onFinishedDrawingSpotlight() {
            MainActivity.touchesBlocked = false;
        }

        @Override
        public void onStartedDrawingSpotlight() {
            MainActivity.touchesBlocked = false;
        }
    };
    menuBtn.setListener(huehuelistener);
    chatFragFam.setListener(huehuelistener);
    chatFragUsersFAB.setListener(huehuelistener);
    chatFragInfoFAB.setListener(huehuelistener);
    chatFragStarsFAB.setListener(huehuelistener);
    chatFragOpenInBrowserFAB.setListener(huehuelistener);
    chatFragMessageEntryBox.setListener(huehuelistener);
    chatFragSendMessageButton.setListener(huehuelistener);
}
Also used : EditText(android.widget.EditText) SlidingMenu(com.jeremyfeinstein.slidingmenu.lib.SlidingMenu) ImageButton(android.widget.ImageButton) SpotlightListener(com.wooplr.spotlight.utils.SpotlightListener) FloatingActionButton(com.github.clans.fab.FloatingActionButton) SpotlightView(com.wooplr.spotlight.SpotlightView) MainActivity(com.huetoyou.chatexchange.ui.activity.main.MainActivity) PreferencesManager(com.wooplr.spotlight.prefs.PreferencesManager) FloatingActionMenu(com.github.clans.fab.FloatingActionMenu)

Aggregations

SlidingMenu (com.jeremyfeinstein.slidingmenu.lib.SlidingMenu)7 ColorDrawable (android.graphics.drawable.ColorDrawable)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 View (android.view.View)1 CheckBox (android.widget.CheckBox)1 CompoundButton (android.widget.CompoundButton)1 EditText (android.widget.EditText)1 ImageButton (android.widget.ImageButton)1 RadioGroup (android.widget.RadioGroup)1 OnCheckedChangeListener (android.widget.RadioGroup.OnCheckedChangeListener)1 SeekBar (android.widget.SeekBar)1 OnSeekBarChangeListener (android.widget.SeekBar.OnSeekBarChangeListener)1 FloatingActionButton (com.github.clans.fab.FloatingActionButton)1 FloatingActionMenu (com.github.clans.fab.FloatingActionMenu)1 MainActivity (com.huetoyou.chatexchange.ui.activity.main.MainActivity)1 SampleListFragment (com.jeremyfeinstein.slidingmenu.example.SampleListFragment)1 SpotlightView (com.wooplr.spotlight.SpotlightView)1 PreferencesManager (com.wooplr.spotlight.prefs.PreferencesManager)1 SpotlightListener (com.wooplr.spotlight.utils.SpotlightListener)1