Java Code Examples for androidx.viewpager.widget.ViewPager#setAdapter()

The following examples show how to use androidx.viewpager.widget.ViewPager#setAdapter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EndLessActivity.java    From android with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_end_less);

    mFragmentList.add(new LinearLayoutFragment());
    mFragmentList.add(new LinearLayoutFragment());

    tableLayout = (TabLayout) findViewById(R.id.tableLayout);
    viewPager = (ViewPager) findViewById(R.id.viewPager);

    mAdapter = new FragmentAdapter(getSupportFragmentManager());
    viewPager.setAdapter(mAdapter);
    tableLayout.setupWithViewPager(viewPager);
    tableLayout.setTabMode(TabLayout.MODE_FIXED);
}
 
Example 2
Source File: VPAnim2Activity.java    From AndroidAnimationExercise with Apache License 2.0 6 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = this;
        setContentView(R.layout.activity_vpanim2);
        initDatas();
//        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//        setSupportActionBar(toolbar);
        // Create the adapter that will return a fragment for each of the three
        // primary sections of the activity.
        mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

        // Set up the ViewPager with the sections adapter.
        mViewPager = (ViewPager) findViewById(R.id.container);
        mViewPager.setPageMargin(20);
        mViewPager.setAdapter(mSectionsPagerAdapter);
        mViewPager.setOffscreenPageLimit(3);
        mViewPager.setPageTransformer(true, new MyTranformer());
    }
 
Example 3
Source File: ViewsActivity.java    From AndroidAnimationExercise with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_views);


    mFragments.add(new CircleMenuFragment());

    tabs.add("环形菜单");


    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
    mViewPager = (ViewPager) findViewById(R.id.container);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
    tabLayout.setupWithViewPager(mViewPager);
    tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));

}
 
Example 4
Source File: MultiFragmentsActivity.java    From AndroidAnimationExercise with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_multi_fragments);

    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.container);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);

    mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
    tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
    tabLayout.setupWithViewPager(mViewPager);

}
 
Example 5
Source File: CPUBoostActivity.java    From SmartPack-Kernel-Manager with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tablayout);

    TabLayout tabLayout = findViewById(R.id.tabLayoutID);
    ViewPager viewPager = findViewById(R.id.viewPagerID);

    PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager());
    if (CPUBoost.getInstance().supported() || CPUInputBoost.getInstance().supported()) {
        adapter.AddFragment(new CPUBoostFragment(), getString(R.string.cpu_boost));
    }
    if (VoxPopuli.hasVoxpopuliTunable()) {
        adapter.AddFragment(new PowerHalFragment(), getString(R.string.powerhal));
    }
    if (StuneBoost.supported()) {
        adapter.AddFragment(new StuneBoostFragment(), getString(R.string.stune_boost));
    }

    viewPager.setAdapter(adapter);
    tabLayout.setVisibility(View.VISIBLE);
    ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) viewPager.getLayoutParams();
    lp.bottomMargin += 150;
    tabLayout.setupWithViewPager(viewPager);
}
 
Example 6
Source File: AboutActivity.java    From andOTP with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTitle(R.string.about_activity_title);
    setContentView(R.layout.activity_container);

    Toolbar toolbar = findViewById(R.id.container_toolbar);
    setSupportActionBar(toolbar);

    ViewStub stub = findViewById(R.id.container_stub);
    stub.setLayoutResource(R.layout.component_about);

    View v = stub.inflate();

    ViewPager viewPager = v.findViewById(R.id.viewPager);
    TabLayout tabLayout = v.findViewById(R.id.tabLayout);
    AboutPageAdapter aboutPageAdapter = new AboutPageAdapter(getSupportFragmentManager());

    viewPager.setAdapter(aboutPageAdapter);
    tabLayout.setupWithViewPager(viewPager);
}
 
Example 7
Source File: SnackbarBehaviorFragment.java    From CircleIndicator with Apache License 2.0 6 votes vote down vote up
@Override public void onViewCreated(@NonNull final View view, @Nullable Bundle savedInstanceState) {
    ViewPager viewpager = view.findViewById(R.id.viewpager);
    CircleIndicator indicator = view.findViewById(R.id.indicator);
    viewpager.setAdapter(new SamplePagerAdapter());
    indicator.setViewPager(viewpager);

    mSnackbar = Snackbar.make(view.findViewById(R.id.coordinator_layout), "Snackbar",
            Snackbar.LENGTH_SHORT);

    view.findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
        @Override public void onClick(View v) {
            if (!mSnackbar.isShown()) {
                mSnackbar.show();
            } else {
                mSnackbar.dismiss();
            }
        }
    });
}
 
Example 8
Source File: HideActivity.java    From PagerBottomTabStrip with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_hide);

    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    PageNavigationView pageBottomTabLayout = findViewById(tab);

    mNavigationController = pageBottomTabLayout.material()
            .addItem(R.drawable.ic_restore_teal_24dp, "Recents")
            .addItem(R.drawable.ic_favorite_teal_24dp, "Favorites")
            .addItem(R.drawable.ic_nearby_teal_24dp, "Nearby")
            .build();

    ViewPager viewPager = findViewById(R.id.viewPager);
    viewPager.setAdapter(new TestViewPagerAdapter(getSupportFragmentManager()));

    mNavigationController.setupWithViewPager(viewPager);
}
 
Example 9
Source File: DetailActivity.java    From animation-samples with Apache License 2.0 6 votes vote down vote up
private void setUpViewPager(ArrayList<Photo> photos) {
    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPager.setAdapter(new DetailViewPagerAdapter(this, photos, sharedElementCallback));
    viewPager.setCurrentItem(initialItem);

    viewPager.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom,
                                   int oldLeft, int oldTop, int oldRight, int oldBottom) {
            if (viewPager.getChildCount() > 0) {
                viewPager.removeOnLayoutChangeListener(this);
                startPostponedEnterTransition();
            }
        }
    });

    viewPager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.padding_mini));
    viewPager.setPageMarginDrawable(R.drawable.page_margin);
}
 
Example 10
Source File: DetailsActivity.java    From tracker-control-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_details);

    // Receive about details
    Intent intent = getIntent();
    appPackageName = intent.getStringExtra(INTENT_EXTRA_APP_PACKAGENAME);
    appUid = intent.getIntExtra(INTENT_EXTRA_APP_UID, -1);
    appName = intent.getStringExtra(INTENT_EXTRA_APP_NAME);

    // Set up paging
    DetailsPagesAdapter detailsPagesAdapter =
            new DetailsPagesAdapter(this,
                    getSupportFragmentManager(),
                    Common.getAppName(getPackageManager(), appUid),
                    appName,
                    appUid);
    ViewPager viewPager = findViewById(R.id.view_pager);
    viewPager.setAdapter(detailsPagesAdapter);
    TabLayout tabs = findViewById(R.id.tabs);
    tabs.setupWithViewPager(viewPager);

    // set toolbar and back arrow
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    // Set title
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    toolbar.setTitle(getString(R.string.app_info));
    toolbar.setSubtitle(appName);
}
 
Example 11
Source File: DConnectSettingPageFragmentActivity.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
/**
 * ViewPagerを持つレイアウトを自動的に設定する.
 * サブクラスでオーバーライドする場合は setContentView を<strong>実行しないこと</strong>。
 * 
 * @param savedInstanceState パラメータ
 * @see android.app.Activity#onCreate(android.os.Bundle)
 */
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_setting_page);

    mViewPager = (ViewPager) findViewById(R.id.setting_pager);
    mViewPager.setAdapter(new DConnectFragmentPagerAdapter(getSupportFragmentManager(), this));

    if (getActionBar() != null) {
        getActionBar().setDisplayHomeAsUpEnabled(true);
        getActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_HOME);
        getActionBar().setTitle(R.string.activity_setting_page_title);
    }
}
 
Example 12
Source File: SettingActivity.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_linking_setting);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setElevation(0);
    }

    pageTitle[0] = getString(R.string.activity_setting_tab_paring);
    pageTitle[1] = getString(R.string.activity_setting_tab_beacon);

    mFragments[0] = LinkingDeviceListFragment.newInstance();
    mFragments[1] = LinkingBeaconListFragment.newInstance();

    TabLayout tabLayout = findViewById(R.id.activity_setting_tabs);
    ViewPager viewPager = findViewById(R.id.activity_setting_view_pager);

    if (viewPager != null) {
        viewPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager()));
        if (tabLayout != null) {
            tabLayout.setupWithViewPager(viewPager);
        }
    }

    checkArguments(getIntent());

    if (LinkingUtil.getVersionCode(this) < LinkingUtil.LINKING_APP_VERSION) {
        openUpdateDialog();
    }
}
 
Example 13
Source File: ImageTransferFormatSelectorDialogFragment.java    From Bluefruit_LE_Connect_Android_V2 with MIT License 5 votes vote down vote up
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {

    // Set animations
    Dialog dialog = getDialog();
    if (dialog != null) {
        //dialog.setTitle(R.string.imagetransfer_resolution_choose);
        //dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        Window window = dialog.getWindow();
        if (window != null) {
            window.setWindowAnimations(R.style.DialogAnimation);
        }
    }

    // Configure tabs and viewpager
    ViewPager viewPager = view.findViewById(R.id.viewpager);
    ResolutionsPageAdapter adapter = new ResolutionsPageAdapter(getChildFragmentManager(), FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT, mResolution);
    viewPager.setAdapter(adapter);

    TabLayout tabLayout = view.findViewById(R.id.tabLayout);
    tabLayout.setupWithViewPager(viewPager);

    // Force titles
    TabLayout.Tab standardResolutions = tabLayout.getTabAt(0);
    if (standardResolutions != null) {
        standardResolutions.setText(R.string.imagetransfer_resolution_mode_standard);
    }
    TabLayout.Tab eInkResolutions = tabLayout.getTabAt(1);
    if (eInkResolutions != null) {
        eInkResolutions.setText(R.string.imagetransfer_resolution_mode_eink);
    }

    // Set initial item
    viewPager.setCurrentItem(mIsEInkModeEnabled ? 1 : 0);
}
 
Example 14
Source File: MyGuildView.java    From Ruisi with Apache License 2.0 5 votes vote down vote up
private void init(Context context) {
    this.context = context;
    dotMargine = DimenUtils.dip2px(context, 2);
    containerPaddingTB = DimenUtils.dip2px(context, 8);
    containerPaddingLR = DimenUtils.dip2px(context, 12);

    dotImageResourseId = R.drawable.dot_bg;
    viewPager = new ViewPager(context);
    viewPager.setLayoutParams(new LayoutParams(RMP, RMP));
    viewPager.addOnPageChangeListener(this);
    adapter = new PageAdapter();
    viewPager.setPageTransformer(true, new ScalePageTransformer());
    viewPager.setAdapter(adapter);
    addView(viewPager);

    dotContainer = new LinearLayout(context);
    LayoutParams lp = new LayoutParams(RMP, RWC);
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    // 在这儿设置圆点位置
    lp.addRule(CENTER_HORIZONTAL);
    dotContainer.setLayoutParams(lp);
    dotContainer.setOrientation(LinearLayout.HORIZONTAL);
    //dotContainer.setGravity(CENTER_HORIZONTAL);
    dotContainer.setGravity(CENTER_VERTICAL);
    dotContainer.setBackgroundColor(0x7f333333);
    dotContainer.setPadding(containerPaddingLR, containerPaddingTB, containerPaddingLR, containerPaddingTB);
    addView(dotContainer);

    mAutoPlayTask = new AutoPlayTask(this);
}
 
Example 15
Source File: ViewPagerDialog.java    From SmartPack-Kernel-Manager with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.viewpager_view, container, false);

    ViewPager viewPager = rootView.findViewById(R.id.viewpager);
    CirclePageIndicator indicator = rootView.findViewById(R.id.indicator);
    viewPager.setAdapter(new RecyclerViewFragment.ViewPagerAdapter(getChildFragmentManager(), mFragments));
    indicator.setViewPager(viewPager);

    return rootView;
}
 
Example 16
Source File: MainActivity.java    From fresco with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_main);

  ViewPager pager = (ViewPager) findViewById(R.id.pager);
  mAdapter = new MyPagerAdapter(pager.getChildCount());

  pager.setAdapter(mAdapter);
}
 
Example 17
Source File: SimpleChartDemo.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_awesomedesign);

    setTitle("SimpleChartDemo");

    ViewPager pager = findViewById(R.id.pager);
    pager.setOffscreenPageLimit(3);

    PageAdapter a = new PageAdapter(getSupportFragmentManager());
    pager.setAdapter(a);


    AlertDialog.Builder b = new AlertDialog.Builder(this);
    b.setTitle("This is a ViewPager.");
    b.setMessage("Swipe left and right for more awesome design examples!");
    b.setPositiveButton("OK", new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    b.show();
}
 
Example 18
Source File: MapInPagerDemoActivity.java    From android-samples with Apache License 2.0 5 votes vote down vote up
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.map_in_pager_demo);
    MyAdapter adapter = new MyAdapter(getSupportFragmentManager());

    ViewPager pager = findViewById(R.id.pager);
    pager.setAdapter(adapter);

    // This is required to avoid a black flash when the map is loaded.  The flash is due
    // to the use of a SurfaceView as the underlying view of the map.
    pager.requestTransparentRegion(pager);
}
 
Example 19
Source File: EmojiPalettesView.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 4 votes vote down vote up
@Override
protected void onFinishInflate() {
    mTabHost = (TabHost)findViewById(R.id.emoji_category_tabhost);
    mTabHost.setup();
    for (final EmojiCategory.CategoryProperties properties
            : mEmojiCategory.getShownCategories()) {
        addTab(mTabHost, properties.mCategoryId);
    }
    mTabHost.setOnTabChangedListener(this);
    final TabWidget tabWidget = mTabHost.getTabWidget();
    tabWidget.setStripEnabled(mCategoryIndicatorEnabled);
    if (mCategoryIndicatorEnabled) {
        // On TabWidget's strip, what looks like an indicator is actually a background.
        // And what looks like a background are actually left and right drawables.
        tabWidget.setBackgroundResource(mCategoryIndicatorDrawableResId);
        tabWidget.setLeftStripDrawable(mCategoryIndicatorBackgroundResId);
        tabWidget.setRightStripDrawable(mCategoryIndicatorBackgroundResId);
    }

    mEmojiPalettesAdapter = new EmojiPalettesAdapter(mEmojiCategory, this);

    mEmojiPager = (ViewPager)findViewById(R.id.emoji_keyboard_pager);
    mEmojiPager.setAdapter(mEmojiPalettesAdapter);
    mEmojiPager.setOnPageChangeListener(this);
    mEmojiPager.setOffscreenPageLimit(0);
    mEmojiPager.setPersistentDrawingCache(PERSISTENT_NO_CACHE);
    mEmojiLayoutParams.setPagerProperties(mEmojiPager);

    mEmojiCategoryPageIndicatorView =
            (EmojiCategoryPageIndicatorView)findViewById(R.id.emoji_category_page_id_view);
    mEmojiCategoryPageIndicatorView.setColors(
            mCategoryPageIndicatorColor, mCategoryPageIndicatorBackground);
    mEmojiLayoutParams.setCategoryPageIdViewProperties(mEmojiCategoryPageIndicatorView);

    setCurrentCategoryId(mEmojiCategory.getCurrentCategoryId(), true /* force */);

    final LinearLayout actionBar = (LinearLayout)findViewById(R.id.emoji_action_bar);
    mEmojiLayoutParams.setActionBarProperties(actionBar);

    // deleteKey depends only on OnTouchListener.
    mDeleteKey = (ImageButton)findViewById(R.id.emoji_keyboard_delete);
    mDeleteKey.setBackgroundResource(mFunctionalKeyBackgroundId);
    mDeleteKey.setTag(Constants.CODE_DELETE);
    mDeleteKey.setOnTouchListener(mDeleteKeyOnTouchListener);

    // {@link #mAlphabetKeyLeft}, {@link #mAlphabetKeyRight, and spaceKey depend on
    // {@link View.OnClickListener} as well as {@link View.OnTouchListener}.
    // {@link View.OnTouchListener} is used as the trigger of key-press, while
    // {@link View.OnClickListener} is used as the trigger of key-release which does not occur
    // if the event is canceled by moving off the finger from the view.
    // The text on alphabet keys are set at
    // {@link #startEmojiPalettes(String,int,float,Typeface)}.
    mAlphabetKeyLeft = (TextView)findViewById(R.id.emoji_keyboard_alphabet_left);
    mAlphabetKeyLeft.setBackgroundResource(mFunctionalKeyBackgroundId);
    mAlphabetKeyLeft.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
    mAlphabetKeyLeft.setOnTouchListener(this);
    mAlphabetKeyLeft.setOnClickListener(this);
    mAlphabetKeyRight = (TextView)findViewById(R.id.emoji_keyboard_alphabet_right);
    mAlphabetKeyRight.setBackgroundResource(mFunctionalKeyBackgroundId);
    mAlphabetKeyRight.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
    mAlphabetKeyRight.setOnTouchListener(this);
    mAlphabetKeyRight.setOnClickListener(this);
    mSpacebar = findViewById(R.id.emoji_keyboard_space);
    mSpacebar.setBackgroundResource(mSpacebarBackgroundId);
    mSpacebar.setTag(Constants.CODE_SPACE);
    mSpacebar.setOnTouchListener(this);
    mSpacebar.setOnClickListener(this);
    mEmojiLayoutParams.setKeyProperties(mSpacebar);
    mSpacebarIcon = findViewById(R.id.emoji_keyboard_space_icon);
}
 
Example 20
Source File: TabLayoutActivity.java    From WhatsApp-Cleaner with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tab);

    TabLayout tabLayout = findViewById(R.id.tabs);
    ViewPager viewPager = findViewById(R.id.viewpager);
    String category = getIntent().getStringExtra("category");
    String pathname = getIntent().getStringExtra("pathname");
    TabsAdapter tabsAdapter;

    settings = getSharedPreferences(PREFS, MODE_PRIVATE);
    editor = settings.edit();


    // First time running app?
    if (!settings.contains("lastRun"))
        enableNotification(null);
    else
        recordRunTime();

    Log.v(TAG, "Starting CheckRecentRun service...");
    startService(new Intent(this, CheckRecentRun.class));

    switch (category) {

        case DataHolder.IMAGE:
            tabsAdapter = new TabsAdapter(getSupportFragmentManager(), DataHolder.IMAGE, DataHolder.imagesReceivedPath, DataHolder.imagesSentPath);
            break;
        case DataHolder.DOCUMENT:
            tabsAdapter = new TabsAdapter(getSupportFragmentManager(), DataHolder.DOCUMENT, DataHolder.documentsReceivedPath, DataHolder.documentsSentPath);
            break;
        case DataHolder.VIDEO:
            tabsAdapter = new TabsAdapter(getSupportFragmentManager(), DataHolder.VIDEO, DataHolder.videosReceivedPath, DataHolder.videosSentPath);
            break;
        case DataHolder.AUDIO:
            tabsAdapter = new TabsAdapter(getSupportFragmentManager(), DataHolder.AUDIO, DataHolder.audiosReceivedPath, DataHolder.audiosSentPath);
            break;
        case DataHolder.GIF:
            tabsAdapter = new TabsAdapter(getSupportFragmentManager(), DataHolder.GIF, DataHolder.gifReceivedPath, DataHolder.gifSentPath);
            break;
        case DataHolder.WALLPAPER:
            tabsAdapter = new TabsAdapter(getSupportFragmentManager(), DataHolder.WALLPAPER, DataHolder.wallReceivedPath, DataHolder.wallgifSentPath);
            break;
        case DataHolder.VOICE:
            tabsAdapter = new TabsAdapter(getSupportFragmentManager(), DataHolder.VOICE, DataHolder.voiceReceivedPath, DataHolder.voicegifSentPath);
            break;
        case DataHolder.STATUS:
            tabsAdapter = new TabsAdapter(getSupportFragmentManager(), DataHolder.STATUS, DataHolder.statuscache, DataHolder.statusdownload);
            break;
        default:
            tabsAdapter = new TabsAdapter(getSupportFragmentManager(), DataHolder.NONDEFAULT, pathname, pathname);
            break;
    }

    viewPager.setAdapter(tabsAdapter);

    tabLayout.setupWithViewPager(viewPager);
}