mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-23 04:09:52 +00:00
Improve UI
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.capstone.foodify.Fragment;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import com.capstone.foodify.Fragment.BasketFragment;
|
||||
import com.capstone.foodify.Fragment.HomeFragment;
|
||||
import com.capstone.foodify.Fragment.ProfileFragment;
|
||||
import com.capstone.foodify.Fragment.SearchFragment;
|
||||
|
||||
public class ViewPagerAdapter extends FragmentStateAdapter {
|
||||
|
||||
public ViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) {
|
||||
super(fragmentActivity);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
switch(position) {
|
||||
case 1: return new SearchFragment();
|
||||
case 2: return new BasketFragment();
|
||||
case 3: return new ProfileFragment();
|
||||
default: return new HomeFragment();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user