sPFApp/src/main/java/it/polimi/spf/app/fragments/profile/ProfileFragment.java
private void onProfileDataAvailable() {
        Log.d(TAG, "onProfileDataAvailable");
        mFactory = new ProfileFieldViewFactory(getActivity(), mMode, mCurrentPersona, mContainer);

        String[] mPageTitles = this.getResources().getStringArray(R.array.profileedit_fragments_titles);

        tabLayout.removeAllTabs();
        tabLayout.addTab(tabLayout.newTab().setText(mPageTitles[0].toUpperCase(Locale.getDefault())));
        tabLayout.addTab(tabLayout.newTab().setText(mPageTitles[1].toUpperCase(Locale.getDefault())));
        tabLayout.addTab(tabLayout.newTab().setText(mPageTitles[2].toUpperCase(Locale.getDefault())));
        tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);

        ProfilePagerAdapter mPagerAdapter = new ProfilePagerAdapter(getChildFragmentManager(), mMode, tabLayout.getTabCount());

        mViewPager.setAdapter(mPagerAdapter);
        mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
        tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                mViewPager.setCurrentItem(tab.getPosition());
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {
            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {
            }
        });


        if (mMode != Mode.SELF) {
            showPicture(mContainer.getFieldValue(ProfileField.PHOTO));
        } else {
            if (getActivity() instanceof MainActivity) {
                ((MainActivity) getActivity()).onPhotoReady(mContainer.getFieldValue(ProfileField.PHOTO));
            } else if (getActivity() instanceof ProfileViewActivity) {
                //TODO implement this
//                ((ProfileViewActivity) getActivity()).onPhotoReady(mContainer.getFieldValue(ProfileField.PHOTO));
            }
        }

        // Refresh field fragments
        mPagerAdapter.onRefresh();
    }
private void onProfileDataAvailable() {
        Log.d(TAG, "onProfileDataAvailable");
        mFactory = new ProfileFieldViewFactory(getActivity(), mMode, mCurrentPersona, mContainer);

        String[] mPageTitles = this.getResources().getStringArray(R.array.profileedit_fragments_titles);

        tabLayout.removeAllTabs();
        tabLayout.addTab(tabLayout.newTab().setText(mPageTitles[0].toUpperCase(Locale.getDefault())));
        tabLayout.addTab(tabLayout.newTab().setText(mPageTitles[1].toUpperCase(Locale.getDefault())));
        tabLayout.addTab(tabLayout.newTab().setText(mPageTitles[2].toUpperCase(Locale.getDefault())));
        tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);

        ProfilePagerAdapter mPagerAdapter = new ProfilePagerAdapter(getChildFragmentManager(), mMode, tabLayout.getTabCount());

        mViewPager.setAdapter(mPagerAdapter);
        mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
        tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                mViewPager.setCurrentItem(tab.getPosition());
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {
            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {
            }
        });


        if (mMode != Mode.SELF) {
            showPicture(mContainer.getFieldValue(ProfileField.PHOTO));
        } else {
            if (getActivity() instanceof MainActivity) {
                ((MainActivity) getActivity()).onPhotoReady(mContainer.getFieldValue(ProfileField.PHOTO));
            } else if (getActivity() instanceof ProfileViewActivity) {
                //TODO implement this
//                ((ProfileViewActivity) getActivity()).onPhotoReady(mContainer.getFieldValue(ProfileField.PHOTO));
            }
        }

        // Refresh field fragments
        mPagerAdapter.onRefresh();
    }
private void onProfileDataAvailable ( ) { Log . d ( TAG , "onProfileDataAvailable" ) ; mFactory = new ProfileFieldViewFactory ( getActivity ( ) , mMode , mCurrentPersona , mContainer ) ; String [ ] mPageTitles = this . getResources ( ) . getStringArray ( R . array . profileedit_fragments_titles ) ; tabLayout . removeAllTabs ( ) ; tabLayout . addTab ( tabLayout . newTab ( ) . setText ( mPageTitles [ 0 ] . toUpperCase ( Locale . getDefault ( ) ) ) ) ; tabLayout . addTab ( tabLayout . newTab ( ) . setText ( mPageTitles [ 1 ] . toUpperCase ( Locale . getDefault ( ) ) ) ) ; tabLayout . addTab ( tabLayout . newTab ( ) . setText ( mPageTitles [ 2 ] . toUpperCase ( Locale . getDefault ( ) ) ) ) ; tabLayout . setTabGravity ( TabLayout . GRAVITY_FILL ) ; ProfilePagerAdapter mPagerAdapter = new ProfilePagerAdapter ( getChildFragmentManager ( ) , mMode , tabLayout . getTabCount ( ) ) ; mViewPager . setAdapter ( mPagerAdapter ) ; mViewPager . addOnPageChangeListener ( new TabLayout . TabLayoutOnPageChangeListener ( tabLayout ) ) ; tabLayout . setOnTabSelectedListener ( new TabLayout . OnTabSelectedListener ( ) { @ Override public void onTabSelected ( TabLayout . Tab tab ) { mViewPager . setCurrentItem ( tab . getPosition ( ) ) ; } @ Override public void onTabUnselected ( TabLayout . Tab tab ) { } @ Override public void onTabReselected ( TabLayout . Tab tab ) { } } ) ; if ( mMode != Mode . SELF ) { showPicture ( mContainer . getFieldValue ( ProfileField . PHOTO ) ) ; } else { if ( getActivity ( ) instanceof MainActivity ) { ( ( MainActivity ) getActivity ( ) ) . onPhotoReady ( mContainer . getFieldValue ( ProfileField . PHOTO ) ) ; } else if ( getActivity ( ) instanceof ProfileViewActivity ) { //TODO implement this //                ((ProfileViewActivity) getActivity()).onPhotoReady(mContainer.getFieldValue(ProfileField.PHOTO)); } } // Refresh field fragments mPagerAdapter . onRefresh ( ) ; }
Called when the profile data is available, thus we can set up the view
Called when the profile data is available thus we can set up the view