/* MultiWii EZ-GUI
Copyright (C) <2012> Bartosz Szczygiel (eziosoft)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.ezio.multiwii.Main;
import java.util.ArrayList;
import android.content.Context;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.LinearLayout;
public class MyPagerAdapter extends PagerAdapter {
public ArrayList<View> views;
private String[] titles = new String[0];
Context context;
public MyPagerAdapter(Context context) {
this.context = context;
views = new ArrayList<View>();
}
@Override
public CharSequence getPageTitle(int position) {
// TODO Auto-generated method stub
return titles[position];
}
public void SetTitles(String[] titles) {
this.titles = titles;
}
public void AddView(View v) {
views.add(v);
}
@Override
public void destroyItem(View view, int arg1, Object object) {
((ViewPager) view).removeView((LinearLayout) object);
}
@Override
public void finishUpdate(View arg0) {
}
@Override
public int getCount() {
return views.size();
}
@Override
public Object instantiateItem(View view, int position) {
View myView = views.get(position);
((ViewPager) view).addView(myView);
return myView;
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public void restoreState(Parcelable arg0, ClassLoader arg1) {
}
@Override
public Parcelable saveState() {
return null;
}
@Override
public void startUpdate(View arg0) {
}
}