Search in sources :

Example 1 with PreferencesManager

use of com.wooplr.spotlight.prefs.PreferencesManager 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 PreferencesManager

use of com.wooplr.spotlight.prefs.PreferencesManager 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 PreferencesManager

use of com.wooplr.spotlight.prefs.PreferencesManager in project ChatExchange by HueToYou.

the class SpotlightView method init.

private void init(Context context) {
    setWillNotDraw(false);
    setVisibility(INVISIBLE);
    lineStroke = Utils.dpToPx(4);
    isReady = false;
    isRevealAnimationEnabled = true;
    dismissOnTouch = false;
    isPerformClick = false;
    enableDismissAfterShown = false;
    dismissOnBackPress = false;
    handler = new Handler();
    preferencesManager = new PreferencesManager(context);
    eraser = new Paint();
    eraser.setColor(0xFFFFFFFF);
    eraser.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
    eraser.setFlags(Paint.ANTI_ALIAS_FLAG);
}
Also used : PorterDuffXfermode(android.graphics.PorterDuffXfermode) Handler(android.os.Handler) Paint(android.graphics.Paint) PreferencesManager(com.wooplr.spotlight.prefs.PreferencesManager)

Example 4 with PreferencesManager

use of com.wooplr.spotlight.prefs.PreferencesManager 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 5 with PreferencesManager

use of com.wooplr.spotlight.prefs.PreferencesManager in project ChatExchange by HueToYou.

the class TutorialStuff method resetSpotlights.

public static void resetSpotlights(Activity activity) {
    PreferencesManager manager = new PreferencesManager(activity);
    manager.resetAll();
}
Also used : PreferencesManager(com.wooplr.spotlight.prefs.PreferencesManager)

Aggregations

PreferencesManager (com.wooplr.spotlight.prefs.PreferencesManager)7 SpotlightView (com.wooplr.spotlight.SpotlightView)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 Paint (android.graphics.Paint)1 PorterDuffXfermode (android.graphics.PorterDuffXfermode)1 Drawable (android.graphics.drawable.Drawable)1 Bundle (android.os.Bundle)1 Handler (android.os.Handler)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