Search in sources :

Example 1 with SpotlightListener

use of com.wooplr.spotlight.utils.SpotlightListener in project ChatExchange by HueToYou.

the class TutorialStuff method showChatSliderTutorial_MainActivity.

/*
     * Main Activity
     */
public static void showChatSliderTutorial_MainActivity(final Activity activity) {
    if (mSharedPreferences == null) {
        mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
    }
    if (mCategoryConfig == null) {
        setCategoryConfig(activity);
    }
    if (mItemConfig == null) {
        setItemConfig(activity);
    }
    final FloatingActionMenu chatFam = activity.findViewById(R.id.chat_slide_menu);
    final FloatingActionButton home = activity.findViewById(R.id.home_fab);
    final FloatingActionButton add = activity.findViewById(R.id.add_chat_fab);
    final FloatingActionButton removeAll = activity.findViewById(R.id.remove_all_chats_fab);
    final CustomRecyclerView dummyChats = activity.findViewById(R.id.dummy_chat_list);
    final Drawable ico = activity.getResources().getDrawable(R.mipmap.ic_launcher);
    final RecyclerViewSwipeManager swipeManager = new RecyclerViewSwipeManager();
    final RecyclerAdapter recyclerAdapter = new RecyclerAdapter(activity, null, swipeManager);
    recyclerAdapter.addItem(new ChatroomRecyclerObject(0, "Example 1", "U", ico, 0, 0, 0));
    recyclerAdapter.addItem(new ChatroomRecyclerObject(1, "Example 2", "U", ico, 0, 0, 1));
    recyclerAdapter.addItem(new ChatroomRecyclerObject(2, "Example 3", "U", ico, 0, 0, 2));
    RecyclerView.Adapter adapter = swipeManager.createWrappedAdapter(recyclerAdapter);
    dummyChats.setAdapter(adapter);
    // disable change animations
    ((SimpleItemAnimator) dummyChats.getItemAnimator()).setSupportsChangeAnimations(false);
    swipeManager.attachRecyclerView(dummyChats);
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(dummyChats.getContext(), DividerItemDecoration.VERTICAL);
    dummyChats.addItemDecoration(dividerItemDecoration);
    final OnSwipeListener onSwipeListener = new OnSwipeListener() {

        @Override
        public void onSwipeRight(RecyclerView.ViewHolder viewHolder) {
            swipeManager.performFakeSwipe(viewHolder, RecyclerViewSwipeManager.RESULT_SWIPED_RIGHT);
        }

        @Override
        public void onSwipeLeft(RecyclerView.ViewHolder viewHolder) {
            swipeManager.performFakeSwipe(viewHolder, RecyclerViewSwipeManager.RESULT_SWIPED_LEFT);
        }
    };
    PreferencesManager manager = new PreferencesManager(activity);
    if (!manager.isDisplayed(CHAT_ITEM)) {
        activity.findViewById(R.id.chatroomsListView).setVisibility(View.GONE);
        dummyChats.setVisibility(View.VISIBLE);
        MainActivity.touchesBlocked = true;
    }
    SpotlightView chats = new SpotlightView.Builder(activity).target(dummyChats).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.chatrooms_slidingMenu_chats_tutorial_text_title)).subHeadingTvText(activity.getResources().getString(R.string.chatrooms_slidingMenu_chats_tutorial_text)).usageId(CHAT_ITEM).targetPadding(Util.dpToPx(activity, 50)).show();
    final SpotlightView.Builder chatsSwipe = new SpotlightView.Builder(activity).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.chatrooms_slidingMenu_chats_tutorial_text_swipe_delete)).subHeadingTvText(activity.getResources().getString(R.string.chatrooms_slidingMenu_chats_tutorial_swipe_left_text)).usageId(CHAT_ITEM_SLIDE);
    final SpotlightView.Builder chatFAM = new SpotlightView.Builder(activity).setConfiguration(mCategoryConfig).target(chatFam.getMenuButton()).headingTvText(activity.getResources().getString(R.string.tutorial_menu)).subHeadingTvText(activity.getResources().getString(R.string.chatrooms_slidingMenu_FAM_tutorial_text)).usageId(CHAT_ITEM_FAM);
    final SpotlightView.Builder chatHome = new SpotlightView.Builder(activity).setConfiguration(mItemConfig).target(home).headingTvText(activity.getResources().getString(R.string.tutorial_home)).subHeadingTvText(activity.getResources().getString(R.string.chatrooms_slidingMenu_homeFAB_tutorial_text)).usageId(CHAT_ITEM_HOME);
    final SpotlightView.Builder chatAdd = new SpotlightView.Builder(activity).setConfiguration(mItemConfig).target(add).headingTvText(activity.getResources().getString(R.string.tutorial_add)).subHeadingTvText(activity.getResources().getString(R.string.chatrooms_slidingMenu_addChatFAB_tutorial_text)).usageId(CHAT_ITEM_ADD);
    final SpotlightView.Builder chatRemAll = new SpotlightView.Builder(activity).setConfiguration(mItemConfig).target(removeAll).headingTvText(activity.getResources().getString(R.string.tutorial_remove_all)).subHeadingTvText(activity.getResources().getString(R.string.chatrooms_slidingMenu_removeALlChatsFAB_tutorial_text)).usageId(CHAT_ITEM_REMOVE_ALL);
    SpotlightListener listener = new SpotlightListener() {

        @Override
        public void onUserClicked(String s) {
            switch(s) {
                case CHAT_ITEM:
                    chatsSwipe.target(recyclerAdapter.getViewHolderAt(0).getCloseChatButton()).show();
                    onSwipeListener.onSwipeRight(recyclerAdapter.getViewHolderAt(0));
                    MainActivity.touchesBlocked = true;
                    break;
                case CHAT_ITEM_SLIDE:
                    onSwipeListener.onSwipeLeft(recyclerAdapter.getViewHolderAt(0));
                    MainActivity.touchesBlocked = true;
                    chatFAM.show();
                    break;
                case CHAT_ITEM_FAM:
                    chatFam.open(true);
                    chatHome.show();
                    MainActivity.touchesBlocked = true;
                    break;
                case CHAT_ITEM_HOME:
                    chatAdd.show();
                    MainActivity.touchesBlocked = true;
                    break;
                case CHAT_ITEM_ADD:
                    chatRemAll.show();
                    MainActivity.touchesBlocked = true;
                    break;
                case CHAT_ITEM_REMOVE_ALL:
                    chatFam.close(true);
                    activity.findViewById(R.id.chatroomsListView).setVisibility(View.VISIBLE);
                    dummyChats.setVisibility(View.GONE);
                    MainActivity.touchesBlocked = false;
                    break;
            }
        }

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

        @Override
        public void onStartedDrawingSpotlight() {
            MainActivity.touchesBlocked = false;
        }
    };
    chats.setListener(listener);
    chatsSwipe.setListener(listener);
    chatFAM.setListener(listener);
    chatHome.setListener(listener);
    chatAdd.setListener(listener);
    chatRemAll.setListener(listener);
}
Also used : RecyclerViewSwipeManager(com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager) SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) Drawable(android.graphics.drawable.Drawable) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) PreferencesManager(com.wooplr.spotlight.prefs.PreferencesManager) FloatingActionMenu(com.github.clans.fab.FloatingActionMenu) SpotlightListener(com.wooplr.spotlight.utils.SpotlightListener) FloatingActionButton(com.github.clans.fab.FloatingActionButton) RecyclerView(android.support.v7.widget.RecyclerView) SpotlightView(com.wooplr.spotlight.SpotlightView)

Example 2 with SpotlightListener

use of com.wooplr.spotlight.utils.SpotlightListener in project ChatExchange by HueToYou.

the class TutorialStuff method chatsExplorationTutorial.

public static void chatsExplorationTutorial(final Activity activity, final LinearLayoutCompat hueLayout) {
    PreferencesManager manager = new PreferencesManager(activity);
    if (!manager.isDisplayed(SE_ROOMS_TAB)) {
        ChatroomsExplorationActivity.touchesBlocked = true;
    }
    if (mCategoryConfig == null) {
        setCategoryConfig(activity);
    }
    ArrayList<View> seTxtView = new ArrayList<>();
    final ArrayList<View> soTxtView = new ArrayList<>();
    hueLayout.getChildAt(0).findViewsWithText(seTxtView, "SE", View.FIND_VIEWS_WITH_TEXT);
    hueLayout.getChildAt(1).findViewsWithText(soTxtView, "SO", View.FIND_VIEWS_WITH_TEXT);
    SpotlightView SErooms = new SpotlightView.Builder(activity).target(seTxtView.get(0)).usageId(SE_ROOMS_TAB).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.CEA_SErooms_tab_tutorial_heading)).subHeadingTvText(activity.getResources().getString(R.string.CEA_SErooms_tab_tutorial_text)).show();
    final SpotlightView.Builder SOrooms = new SpotlightView.Builder(activity).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.CEA_SOrooms_tab_tutorial_heading)).subHeadingTvText(activity.getResources().getString(R.string.CEA_SOrooms_tab_tutorial_text)).usageId(SO_ROOMS_TAB);
    SpotlightListener listener = new SpotlightListener() {

        @Override
        public void onUserClicked(String s) {
            switch(s) {
                case SE_ROOMS_TAB:
                    ChatroomsExplorationActivity.touchesBlocked = true;
                    SOrooms.target(soTxtView.get(0)).show();
                    break;
                case SO_ROOMS_TAB:
                    ChatroomsExplorationActivity.touchesBlocked = false;
                    break;
            }
        }

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

        @Override
        public void onStartedDrawingSpotlight() {
            ChatroomsExplorationActivity.touchesBlocked = false;
        }
    };
    SErooms.setListener(listener);
    SOrooms.setListener(listener);
}
Also used : SpotlightListener(com.wooplr.spotlight.utils.SpotlightListener) ArrayList(java.util.ArrayList) SpotlightView(com.wooplr.spotlight.SpotlightView) PreferencesManager(com.wooplr.spotlight.prefs.PreferencesManager) SpotlightView(com.wooplr.spotlight.SpotlightView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Example 3 with SpotlightListener

use of com.wooplr.spotlight.utils.SpotlightListener 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)

Example 4 with SpotlightListener

use of com.wooplr.spotlight.utils.SpotlightListener in project ChatExchange by HueToYou.

the class TutorialStuff method homeFragTutorial.

/*
     * Home fragment
     */
public static void homeFragTutorial(final MainActivity activity) {
    if (mSharedPreferences == null) {
        mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
    }
    if (mCategoryConfig == null) {
        setCategoryConfig(activity);
    }
    // SpotlightSequence.getInstance(activity, mCategoryConfig)
    // .addSpotlight(Utils.getActionBar(activity.getWindow().getDecorView()).getChildAt(1),
    // activity.getResources().getString(R.string.tutorial_drawer),
    // activity.getResources().getString(R.string.homeFrag_hamburger_tutorial_text),
    // MAIN_DRAWER)
    // .addSpotlight(Utils.getActionBar(activity.getWindow().getDecorView()).getChildAt(2),
    // activity.getResources().getString(R.string.tutorial_menu),
    // activity.getResources().getString(R.string.homeFrag_options_menu_tutorial_text),
    // MAIN_MENU)
    // .startSequence();
    PreferencesManager manager = new PreferencesManager(activity);
    if (!manager.isDisplayed(MAIN_DRAWER)) {
        MainActivity.touchesBlocked = true;
    }
    SpotlightView drawer = new SpotlightView.Builder(activity).target(Utils.getActionBar(activity.getWindow().getDecorView()).getChildAt(1)).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.tutorial_drawer)).subHeadingTvText(activity.getResources().getString(R.string.homeFrag_hamburger_tutorial_text)).usageId(MAIN_DRAWER).show();
    final SpotlightView.Builder menu = new SpotlightView.Builder(activity).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.tutorial_menu)).subHeadingTvText(activity.getResources().getString(R.string.homeFrag_options_menu_tutorial_text)).usageId(MAIN_MENU);
    SpotlightListener listener = new SpotlightListener() {

        @Override
        public void onUserClicked(String s) {
            switch(s) {
                case MAIN_DRAWER:
                    menu.target(Utils.getActionBar(activity.getWindow().getDecorView()).getChildAt(2)).show();
                    MainActivity.touchesBlocked = true;
                    break;
                case MAIN_MENU:
                    MainActivity.touchesBlocked = false;
                    break;
            }
        }

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

        @Override
        public void onStartedDrawingSpotlight() {
            MainActivity.touchesBlocked = false;
        }
    };
    drawer.setListener(listener);
    menu.setListener(listener);
}
Also used : SpotlightListener(com.wooplr.spotlight.utils.SpotlightListener) SpotlightView(com.wooplr.spotlight.SpotlightView) PreferencesManager(com.wooplr.spotlight.prefs.PreferencesManager)

Example 5 with SpotlightListener

use of com.wooplr.spotlight.utils.SpotlightListener in project ChatExchange by HueToYou.

the class TutorialStuff method showUsersTutorial.

public static void showUsersTutorial(final Activity activity) {
    if (mSharedPreferences == null) {
        mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
    }
    if (mCategoryConfig == null) {
        setCategoryConfig(activity);
    }
    if (mItemConfig == null) {
        setItemConfig(activity);
    }
    Bundle args = new Bundle();
    args.putString(USER_NAME_KEY, "Edwinksl");
    args.putString(USER_AVATAR_URL_KEY, "https://images.duckduckgo.com/iu/?u=http%3A%2F%2Fimages.clipshrine.com%2Fdownload%2Fdownloadpnglarge%2FBlack-Question-Mark-2269-large.png&f=1");
    args.putString(USER_URL_KEY, "https://example.stackexchange.com");
    args.putBoolean("IsExampleTile", true);
    args.putInt("ExampleNum", 0);
    args.putInt(USER_ID_KEY, 12345);
    args.putInt(USER_LAST_POST_KEY, 0);
    args.putInt(USER_REP_KEY, 123);
    args.putBoolean(USER_IS_MOD_KEY, false);
    args.putBoolean(USER_IS_OWNER_KEY, false);
    final UserTileFragment userTileFragment = new UserTileFragment();
    userTileFragment.setArguments(args);
    args = new Bundle();
    args.putString(USER_NAME_KEY, "Thomas Ward");
    args.putString(USER_AVATAR_URL_KEY, "https://images.duckduckgo.com/iu/?u=http%3A%2F%2Fimages.clipshrine.com%2Fdownload%2Fdownloadpnglarge%2FBlack-Question-Mark-2269-large.png&f=1");
    args.putString(USER_URL_KEY, "https://example.stackexchange.com");
    args.putBoolean("IsExampleTile", true);
    args.putInt("ExampleNum", 1);
    args.putInt(USER_ID_KEY, 12346);
    args.putInt(USER_LAST_POST_KEY, 0);
    args.putInt(USER_REP_KEY, 123);
    args.putBoolean(USER_IS_MOD_KEY, true);
    args.putBoolean(USER_IS_OWNER_KEY, false);
    final UserTileFragment userTileFragment1 = new UserTileFragment();
    userTileFragment1.setArguments(args);
    args = new Bundle();
    args.putString(USER_NAME_KEY, "Rinzwind");
    args.putString(USER_AVATAR_URL_KEY, "https://images.duckduckgo.com/iu/?u=http%3A%2F%2Fimages.clipshrine.com%2Fdownload%2Fdownloadpnglarge%2FBlack-Question-Mark-2269-large.png&f=1");
    args.putString(USER_URL_KEY, "https://example.stackexchange.com");
    args.putBoolean("IsExampleTile", true);
    args.putInt("ExampleNum", 2);
    args.putInt(USER_ID_KEY, 12347);
    args.putInt(USER_LAST_POST_KEY, 0);
    args.putInt(USER_REP_KEY, 123);
    args.putBoolean(USER_IS_MOD_KEY, false);
    args.putBoolean(USER_IS_OWNER_KEY, true);
    final UserTileFragment userTileFragment2 = new UserTileFragment();
    userTileFragment2.setArguments(args);
    PreferencesManager manager = new PreferencesManager(activity);
    LinearLayout users = activity.findViewById(R.id.users_scroll_slide);
    if (!manager.isDisplayed(USERS_SLIDE_INTRO)) {
        List<android.support.v4.app.Fragment> fragments = ((AppCompatActivity) activity).getSupportFragmentManager().getFragments();
        for (int i = 0; i < fragments.size(); i++) {
            ((AppCompatActivity) activity).getSupportFragmentManager().beginTransaction().hide(fragments.get(i)).commit();
        }
        ((AppCompatActivity) activity).getSupportFragmentManager().beginTransaction().add(R.id.users_scroll_slide, userTileFragment, "user_" + 12345).commit();
        ((AppCompatActivity) activity).getSupportFragmentManager().beginTransaction().add(R.id.users_scroll_slide, userTileFragment1, "user_" + 12346).commit();
        ((AppCompatActivity) activity).getSupportFragmentManager().beginTransaction().add(R.id.users_scroll_slide, userTileFragment2, "user_" + 12347).commit();
        MainActivity.touchesBlocked = true;
    }
    SpotlightView usersOverview = new SpotlightView.Builder(activity).target(users).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.chatFrag_usersSlidingPanel_tutorial_text_title_main)).subHeadingTvText(activity.getResources().getString(R.string.chatFrag_usersSlidingPanel_tutorial_text)).usageId(USERS_SLIDE_INTRO).targetPadding(Util.dpToPx(activity, 50)).show();
    final SpotlightView.Builder overviewMore = new SpotlightView.Builder(activity).target(users).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.chatFrag_usersSlidingPanel_tutorial_text_title_main)).subHeadingTvText(activity.getResources().getString(R.string.chatFrag_usersSlidingPanel_tutorial_text_more)).usageId(USERS_SLIDE_INTRO_MORE).targetPadding(Util.dpToPx(activity, 50));
    final SpotlightView.Builder user1 = new SpotlightView.Builder(activity).target(users.getChildAt(0)).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.chatFrag_usersSlidingPanel_tutorial_text_title_user_normal)).subHeadingTvText(activity.getResources().getString(R.string.chatFrag_normalUser_tutorial_text)).usageId(USER_ONE);
    final SpotlightView.Builder userMod = new SpotlightView.Builder(activity).target(users.getChildAt(1)).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.chatFrag_usersSlidingPanel_tutorial_text_title_user_mod)).subHeadingTvText(activity.getResources().getString(R.string.chatFrag_modUser_tutorial_text)).usageId(USER_MOD);
    final SpotlightView.Builder userOwner = new SpotlightView.Builder(activity).setConfiguration(mCategoryConfig).target(users.getChildAt(2)).headingTvText(activity.getResources().getString(R.string.chatFrag_usersSlidingPanel_tutorial_text_title_user_owner)).subHeadingTvText(activity.getResources().getString(R.string.chatFrag_ROuser_tutorial_text)).usageId(USER_OWNER);
    SpotlightListener listener = new SpotlightListener() {

        @Override
        public void onUserClicked(String s) {
            Log.e("Which", s);
            switch(s) {
                case USERS_SLIDE_INTRO:
                    overviewMore.show();
                    MainActivity.touchesBlocked = true;
                    break;
                case USERS_SLIDE_INTRO_MORE:
                    user1.show();
                    MainActivity.touchesBlocked = true;
                    break;
                case USER_ONE:
                    userMod.show();
                    MainActivity.touchesBlocked = true;
                    break;
                case USER_MOD:
                    userOwner.show();
                    MainActivity.touchesBlocked = true;
                    break;
                case USER_OWNER:
                    List<android.support.v4.app.Fragment> fragments = ((AppCompatActivity) activity).getSupportFragmentManager().getFragments();
                    for (int i = 0; i < fragments.size(); i++) {
                        ((AppCompatActivity) activity).getSupportFragmentManager().beginTransaction().show(fragments.get(i)).commit();
                    }
                    ((AppCompatActivity) activity).getSupportFragmentManager().beginTransaction().remove(userTileFragment).remove(userTileFragment1).remove(userTileFragment2).commit();
                    MainActivity.touchesBlocked = false;
                    break;
            }
        }

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

        @Override
        public void onStartedDrawingSpotlight() {
            MainActivity.touchesBlocked = false;
        }
    };
    usersOverview.setListener(listener);
    overviewMore.setListener(listener);
    user1.setListener(listener);
    userMod.setListener(listener);
    userOwner.setListener(listener);
}
Also used : UserTileFragment(com.huetoyou.chatexchange.ui.frags.UserTileFragment) Bundle(android.os.Bundle) PreferencesManager(com.wooplr.spotlight.prefs.PreferencesManager) UserTileFragment(com.huetoyou.chatexchange.ui.frags.UserTileFragment) SpotlightListener(com.wooplr.spotlight.utils.SpotlightListener) SpotlightView(com.wooplr.spotlight.SpotlightView) LinearLayout(android.widget.LinearLayout)

Aggregations

SpotlightView (com.wooplr.spotlight.SpotlightView)5 PreferencesManager (com.wooplr.spotlight.prefs.PreferencesManager)5 SpotlightListener (com.wooplr.spotlight.utils.SpotlightListener)5 RecyclerView (android.support.v7.widget.RecyclerView)2 FloatingActionButton (com.github.clans.fab.FloatingActionButton)2 FloatingActionMenu (com.github.clans.fab.FloatingActionMenu)2 Drawable (android.graphics.drawable.Drawable)1 Bundle (android.os.Bundle)1 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)1 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)1 View (android.view.View)1 EditText (android.widget.EditText)1 ImageButton (android.widget.ImageButton)1 LinearLayout (android.widget.LinearLayout)1 TextView (android.widget.TextView)1 RecyclerViewSwipeManager (com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager)1 MainActivity (com.huetoyou.chatexchange.ui.activity.main.MainActivity)1 UserTileFragment (com.huetoyou.chatexchange.ui.frags.UserTileFragment)1 SlidingMenu (com.jeremyfeinstein.slidingmenu.lib.SlidingMenu)1 ArrayList (java.util.ArrayList)1