content: package io.alcatraz.audiohq.adapters;
  
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  import java.util.List;
  
  import androidx.annotation.NonNull;
  import androidx.annotation.Nullable;
  import androidx.viewpager.widget.PagerAdapter;
  import io.alcatraz.audiohq.beans.preset.NormalViewPage;
  
  public class SimplePagerAdapter extends PagerAdapter {
      private List<NormalViewPage> data;
      private Context context;
      private LayoutInflater inflater;
  
      public SimplePagerAdapter(Context context, List<NormalViewPage> data){
          this.context = context;
          this.data = data;
          inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      }
  
      @Override
      public int getCount() {
          return data.size();
      }
  
      @Override
      public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
          return view == object;
      }
  
      @NonNull
      @Override
      public Object instantiateItem(@NonNull ViewGroup container, int position) {
          View v = data.get(position).getView();
          container.addView(v);
          return v;
      }
  
      @Override
      public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
          container.removeView((View) object);
      }
  
      @Nullable
      @Override
      public CharSequence getPageTitle(int position) {
          return data.get(position).getTitle();
      }
  }
  