Skip to content

Commit

Permalink
Merge pull request #7 from Sash0k/master
Browse files Browse the repository at this point in the history
UrlPagerAdapter minor update
  • Loading branch information
RomanTruba committed Jan 28, 2013
2 parents 1df41c4 + 8d2dcca commit d2ce306
Showing 1 changed file with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
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.view.ViewGroup;
import android.widget.Gallery;
import ru.truba.touchgallery.TouchView.UrlTouchImageView;

import java.util.List;
Expand All @@ -33,8 +31,8 @@
*/
public class UrlPagerAdapter extends PagerAdapter {

private List<String> mResources;
private Context mContext;
private final List<String> mResources;
private final Context mContext;
public UrlPagerAdapter(Context context, List<String> resources){
this.mResources = resources;
this.mContext = context;
Expand All @@ -47,18 +45,18 @@ public void setPrimaryItem(ViewGroup container, int position, Object object) {
}

@Override
public Object instantiateItem(View collection, int position){
UrlTouchImageView iv = new UrlTouchImageView(mContext);
public Object instantiateItem(ViewGroup collection, int position){
final UrlTouchImageView iv = new UrlTouchImageView(mContext);
iv.setUrl(mResources.get(position));
iv.setLayoutParams(new Gallery.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

((ViewPager) collection).addView(iv, 0);
iv.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
collection.addView(iv, 0);
return iv;
}

@Override
public void destroyItem(View collection, int position, Object view){
((ViewPager) collection).removeView((View) view);
public void destroyItem(ViewGroup collection, int position, Object view){
collection.removeView((View) view);
}

@Override
Expand All @@ -72,7 +70,7 @@ public boolean isViewFromObject(View view, Object object){
}

@Override
public void finishUpdate(View arg0){
public void finishUpdate(ViewGroup arg0){
}

@Override
Expand All @@ -85,7 +83,7 @@ public Parcelable saveState(){
}

@Override
public void startUpdate(View arg0){
public void startUpdate(ViewGroup arg0){
}

}
}

0 comments on commit d2ce306

Please sign in to comment.