Search in sources :

Example 1 with MainActivity

use of com.huetoyou.chatexchange.ui.activity.main.MainActivity 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

EditText (android.widget.EditText)1 ImageButton (android.widget.ImageButton)1 FloatingActionButton (com.github.clans.fab.FloatingActionButton)1 FloatingActionMenu (com.github.clans.fab.FloatingActionMenu)1 MainActivity (com.huetoyou.chatexchange.ui.activity.main.MainActivity)1 SlidingMenu (com.jeremyfeinstein.slidingmenu.lib.SlidingMenu)1 SpotlightView (com.wooplr.spotlight.SpotlightView)1 PreferencesManager (com.wooplr.spotlight.prefs.PreferencesManager)1 SpotlightListener (com.wooplr.spotlight.utils.SpotlightListener)1