/*
 * Copyright 2018 The twicalico authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.github.moko256.twicalico;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

/**
 * Created by moko256 on 2017/01/15.
 *
 * @author moko256
 */

public class ShowUserFragmentsPagerAdapter extends FragmentPagerAdapter {
    private Fragment[] mFragments;
    private Context mContext;

    ShowUserFragmentsPagerAdapter(FragmentManager fm, Context context, long userId) {
        super(fm);

        mFragments=new Fragment[]{
                UserInfoFragment.newInstance(userId),
                UserTimelineFragment.newInstance(userId),
                UserLikeFragment.newInstance(userId),
                UserFollowsFragment.newInstance(userId),
                UserFollowersFragment.newInstance(userId)
        };
        mContext=context;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments[position];
    }

    @Override
    public int getCount() {
        return mFragments.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        Fragment fragment=mFragments[position];
        if(fragment instanceof ToolbarTitleInterface){
            return mContext.getString(((ToolbarTitleInterface)fragment).getTitleResourceId());
        }
        else return null;
    }
}

@@ -810,16 +810,66 @@
 apter;%0A%0A
+import com.github.moko256.twicalico.entity.Type;%0A%0A
 /**%0A * C
@@ -1174,16 +1174,118 @@
 r(fm);%0A%0A
+        if (GlobalApplication.clientType == Type.MASTODON && userId != GlobalApplication.userId)%7B%0A    
         
@@ -1311,16 +1311,20 @@
 ment%5B%5D%7B%0A
+    
         
@@ -1381,24 +1381,28 @@
             
+ 
+   
 UserTimeline
@@ -1423,32 +1423,352 @@
 stance(userId),%0A
+                    UserFollowsFragment.newInstance(userId),%0A                    UserFollowersFragment.newInstance(userId)%0A            %7D;%0A        %7D else %7B%0A            mFragments = new Fragment%5B%5D%7B%0A                    UserInfoFragment.newInstance(userId),%0A                    UserTimelineFragment.newInstance(userId),%0A    
                 
@@ -1813,32 +1813,36 @@
                 
+  
+  
 UserFollowsFragm
@@ -1858,32 +1858,36 @@
 stance(userId),%0A
+    
                 
@@ -1928,34 +1928,49 @@
 userId)%0A        
+ 
-%7D;
+   %7D;%0A        %7D%0A
 %0A        mContex

remove user likes tab when client type is Mastodon