~singpolyma/cheogram-android

9d79d9a200477c183100f0e17148c4742faa16d8 — Stephen Paul Weber 1 year, 16 days ago 885e866
Never show tabs in onboarding mode
M src/main/java/eu/siacs/conversations/entities/Conversation.java => src/main/java/eu/siacs/conversations/entities/Conversation.java +6 -4
@@ 1307,8 1307,8 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
        return pagerAdapter.switchToSession(node);
    }

    public void setupViewPager(ViewPager pager, TabLayout tabs) {
        pagerAdapter.setupViewPager(pager, tabs);
    public void setupViewPager(ViewPager pager, TabLayout tabs, boolean onboarding) {
        pagerAdapter.setupViewPager(pager, tabs, onboarding);
    }

    public void showViewPager() {


@@ 1347,10 1347,12 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
        ArrayList<CommandSession> sessions = null;
        protected View page1 = null;
        protected View page2 = null;
        protected boolean mOnboarding = false;

        public void setupViewPager(ViewPager pager, TabLayout tabs) {
        public void setupViewPager(ViewPager pager, TabLayout tabs, boolean onboarding) {
            mPager = pager;
            mTabs = tabs;
            mOnboarding = onboarding;

            if (mPager == null) return;
            if (sessions != null) show();


@@ 1376,7 1378,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
                sessions = new ArrayList<>();
                notifyDataSetChanged();
            }
            if (mTabs != null) mTabs.setVisibility(View.VISIBLE);
            if (!mOnboarding && mTabs != null) mTabs.setVisibility(View.VISIBLE);
        }

        public void hide() {

M src/main/java/eu/siacs/conversations/ui/ConversationFragment.java => src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +4 -5
@@ 1359,7 1359,7 @@ public class ConversationFragment extends XmppFragment
        messageListAdapter.setOnContactPictureClicked(null);
        messageListAdapter.setOnContactPictureLongClicked(null);
        messageListAdapter.setOnInlineImageLongClicked(null);
        if (conversation != null) conversation.setupViewPager(null, null);
        if (conversation != null) conversation.setupViewPager(null, null, false);
    }

    private void quoteText(String text) {


@@ 2838,12 2838,12 @@ public class ConversationFragment extends XmppFragment
                .setOpenConversation(this.conversation);

        if (commandAdapter != null && conversation != originalConversation) {
            originalConversation.setupViewPager(null, null);
            conversation.setupViewPager(binding.conversationViewPager, binding.tabLayout);
            originalConversation.setupViewPager(null, null, false);
            conversation.setupViewPager(binding.conversationViewPager, binding.tabLayout, activity.xmppConnectionService.isOnboarding());
            refreshCommands(false);
        }
        if (commandAdapter == null && conversation != null) {
            conversation.setupViewPager(binding.conversationViewPager, binding.tabLayout);
            conversation.setupViewPager(binding.conversationViewPager, binding.tabLayout, activity.xmppConnectionService.isOnboarding());
            commandAdapter = new CommandAdapter((XmppActivity) getActivity());
            binding.commandsView.setAdapter(commandAdapter);
            binding.commandsView.setOnItemClickListener((parent, view, position, id) -> {


@@ 3001,7 3001,6 @@ public class ConversationFragment extends XmppFragment
                    if (!conversation.switchToSession(node)) {
                        conversation.startCommand(commandFor(commandJid, node), activity.xmppConnectionService);
                    }
                    if (activity.xmppConnectionService.isOnboarding()) binding.tabLayout.setVisibility(View.GONE);
                }
            });
            return;