com.android.volley.toolbox.NetworkImageView Java Examples

The following examples show how to use com.android.volley.toolbox.NetworkImageView. 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: HaikuFragment.java    From gplus-haiku-client-android with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View v = inflater.inflate(R.layout.fragment_haiku, container, false);
    VolleyContainer volley = VolleyContainer.getInstance(getActivity());

    if (mHaiku != null) {
        NetworkImageView profile = ((NetworkImageView) v.findViewById(R.id.haiku_profile_pic));
        profile.setImageUrl(mHaiku.author.googlePhotoUrl, volley.getImageLoader());
        ((TextView) v.findViewById(R.id.haiku_title)).setText(mHaiku.title);
        ((TextView) v.findViewById(R.id.haiku_line_one)).setText(mHaiku.lineOne);
        ((TextView) v.findViewById(R.id.haiku_line_two)).setText(mHaiku.lineTwo);
        ((TextView) v.findViewById(R.id.haiku_line_three)).setText(mHaiku.lineThree);
        ((TextView) v.findViewById(R.id.haiku_user_display_name))
                .setText(mHaiku.author.googleDisplayName);
        ((TextView) v.findViewById(R.id.haiku_date)).setText(mHaiku.getFormattedDate());
        ((TextView) v.findViewById(R.id.haiku_vote_count)).setText(mHaiku.votes + " votes");
        ((Button) v.findViewById(R.id.button_promote)).setOnClickListener(this);
        ((Button) v.findViewById(R.id.button_vote)).setOnClickListener(this);
    }
    return v;
}
 
Example #2
Source File: MainActivity.java    From android-advanced-light with MIT License 6 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        iv_image = (ImageView) this.findViewById(R.id.iv_image);
        bt_send = (Button) this.findViewById(R.id.bt_send);
        nv_image = (NetworkImageView) this.findViewById(R.id.nv_image);
        mQueue = Volley.newRequestQueue(getApplicationContext());
        bt_send.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                UseStringRequest();
                  UseJsonRequest();
//                UseImageRequest();
//                UseImageLoader();
//                UseNetworkImageView();
            }
        });
    }
 
Example #3
Source File: CircleOf6Application.java    From OpenCircle with GNU General Public License v3.0 6 votes vote down vote up
public void setUpLogo(NetworkImageView logo, DBHelper dbHelper){

        //Get the set college
        String college_id = AppPreferences.getInstance(this).getCollegeLocation();
        if (!college_id.equals("")) {
            CollegeCountry collegeCountry;
            if (college_id.startsWith("c_")) {
                //this is campus, find parent
                collegeCountry = dbHelper.getParentCollege(college_id.replace("c_", ""));
            } else {
                collegeCountry = dbHelper.getCollege(college_id);
            }
            if (!isUniversalFlavor()) {
                logo.setVisibility(View.VISIBLE);

                ImageLoader imageLoader = getImageLoader();

                logo.setImageUrl(collegeCountry.getLogoUrl(), imageLoader);

            }
        }

    }
 
Example #4
Source File: PagedTutorialActivity.java    From OpenCircle with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_paged_tutorial);
    CircleOf6Application.defaultLabelTrackingEvent(this, ConstantsAnalytics.ACTION_TUTORIAL_RAN);

    DBHelper dbHelper = new DBHelper(PagedTutorialActivity.this);
    NetworkImageView logo = (NetworkImageView) findViewById(R.id.logo);
    CircleOf6Application.getInstance().setUpLogo(logo, dbHelper);

    setupViewPagerTutorial();
    setupCloseButtonTutorial();
    setupImageIndicator();

}
 
Example #5
Source File: PhotoDetailFragment.java    From soas with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_photo_detail, container, false);

    if (mPhoto != null) {
        NetworkImageView photo = (NetworkImageView) rootView.findViewById(R.id.photo);
        photo.setImageUrl(mPhoto.photoFileUrl, SoasApplication.getImageLoader(getActivity()));
        photo.setDefaultImageResId(R.drawable.default_photo);

        TextView photoName = (TextView) rootView.findViewById(R.id.photoName);
        photoName.setText(mPhoto.photoTitle);

        TextView photoOwner = (TextView) rootView.findViewById(R.id.photoOwner);
        photoOwner.setText(mPhoto.ownerName);
    }

    return rootView;
}
 
Example #6
Source File: CarouselImageFragment.java    From Android-SDK with MIT License 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View rootView = inflater.inflate(R.layout.fragment_carousel_dialog, container, false);

    image = (NetworkImageView) rootView.findViewById(R.id.carousel_image);

    String url = getArguments().getString("url");

    ImageLoader imgLoader = MyVolley.getInstance(getActivity().getApplicationContext())
            .getImageLoader();

    image.setImageUrl(url, imgLoader);

    return rootView;
}
 
Example #7
Source File: LocalPlayerActivity.java    From CastVideos-android with Apache License 2.0 6 votes vote down vote up
private void loadViews() {
    mVideoView = (VideoView) findViewById(R.id.videoView1);
    mTitleView = (TextView) findViewById(R.id.titleTextView);
    mDescriptionView = (TextView) findViewById(R.id.descriptionTextView);
    mDescriptionView.setMovementMethod(new ScrollingMovementMethod());
    mAuthorView = (TextView) findViewById(R.id.authorTextView);
    mStartText = (TextView) findViewById(R.id.startText);
    mStartText.setText(Utils.formatMillis(0));
    mEndText = (TextView) findViewById(R.id.endText);
    mSeekbar = (SeekBar) findViewById(R.id.seekBar1);
    mPlayPause = (ImageView) findViewById(R.id.playPauseImageView);
    mLoading = (ProgressBar) findViewById(R.id.progressBar1);
    mControllers = findViewById(R.id.controllers);
    mContainer = findViewById(R.id.container);
    mCoverArt = (NetworkImageView) findViewById(R.id.coverArtView);
    ViewCompat.setTransitionName(mCoverArt, getString(R.string.transition_image));
    mPlayCircle = (ImageButton) findViewById(R.id.play_circle);
    mPlayCircle.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            togglePlayback();
        }
    });
}
 
Example #8
Source File: NetworkImageViewActivity.java    From android-opensource-library-56 with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_network_image_view);
    RequestQueue queue = Volley.newRequestQueue(this);
    ImageLoader loader = new ImageLoader(queue, new NoImageCache());
    String url = "http://farm6.staticflickr.com/5026/5735032857_68a332481e_z.jpg";

    NetworkImageView imageView = (NetworkImageView) findViewById(R.id.image);

    imageView.setDefaultImageResId(R.drawable.ic_launcher);
    imageView.setErrorImageResId(R.drawable.ic_launcher);
    imageView.setImageUrl(url, loader);

}
 
Example #9
Source File: QueueListAdapter.java    From CastVideos-android with Apache License 2.0 5 votes vote down vote up
public QueueItemViewHolder(View itemView) {
    super(itemView);
    mContext = itemView.getContext();
    mContainer = (ViewGroup) itemView.findViewById(R.id.container);
    mDragHandle = (ImageView) itemView.findViewById(R.id.drag_handle);
    mTitleView = (TextView) itemView.findViewById(R.id.textView1);
    mDescriptionView = (TextView) itemView.findViewById(R.id.textView2);
    mImageView = (NetworkImageView) itemView.findViewById(R.id.imageView1);
    mPlayPause = (ImageButton) itemView.findViewById(R.id.play_pause);
    mControls = itemView.findViewById(R.id.controls);
    mUpcomingControls = itemView.findViewById(R.id.controls_upcoming);
    mPlayUpcoming = (ImageButton) itemView.findViewById(R.id.play_upcoming);
    mStopUpcoming = (ImageButton) itemView.findViewById(R.id.stop_upcoming);
}
 
Example #10
Source File: MainActivity.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
ProductViewHolder(ViewGroup parent) {
    super(LayoutInflater.from(parent.getContext()).inflate(
            R.layout.shr_product_entry, parent, false));
    imageView = (NetworkImageView) itemView.findViewById(R.id.image);
    priceView = (TextView) itemView.findViewById(R.id.price);
    itemView.setOnClickListener(clickListener);
}
 
Example #11
Source File: RssListNetworkImageViewAdapter.java    From android-opensource-library-56 with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if (convertView == null) {
        convertView = mInflator.inflate(R.layout.card_list2, null);
        holder = new ViewHolder();
        holder.text = (TextView) convertView.findViewById(R.id.title);
        holder.entryImage = (NetworkImageView) convertView
                .findViewById(R.id.entry_image);
        holder.description = (TextView) convertView
                .findViewById(R.id.description);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    Item item = getItem(position);
    holder.text.setText(item.title);
    holder.description.setText(item.description);
    if (item.imageUrl != null) {
        holder.entryImage.setDefaultImageResId(R.drawable.ic_launcher);
        holder.entryImage.setImageUrl(item.imageUrl, mImageLoader);
        holder.entryImage.setVisibility(View.VISIBLE);
    } else {
        holder.entryImage.setVisibility(View.GONE);
    }
    return convertView;
}
 
Example #12
Source File: ListItemViewHolder.java    From recyclerViewToTheRescue with MIT License 5 votes vote down vote up
public ListItemViewHolder(View itemView) {
    super(itemView);
    primary = (TextView)itemView.findViewById(R.id.primary);
    secondary = (TextView)itemView.findViewById(R.id.secondary);
    tertiary = (TextView)itemView.findViewById(R.id.tertiary);
    imageView = (NetworkImageView)itemView.findViewById(R.id.image);
}
 
Example #13
Source File: HorizontalImageRecyclerViewAdapter.java    From Netease with GNU General Public License v3.0 5 votes vote down vote up
ImageViewHolder(View view , int weight, int height, int i) {
    super(view);
    index = i;

    //第一张图不要边距
    if (index == 0) {
        RelativeLayout.LayoutParams rl = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.MATCH_PARENT);
        RelativeLayout rv = (RelativeLayout) view.findViewById(R.id.rlContainer);
        rl.setMargins(0, 0, 0, 0);
        rv.setLayoutParams(rl);
    }
    imageView = (NetworkImageView) view.findViewById(R.id.iv_sub_image);
    imageView.setLayoutParams(new RelativeLayout.LayoutParams(weight, height));
}
 
Example #14
Source File: NormalRecyclerViewAdapter.java    From Netease with GNU General Public License v3.0 5 votes vote down vote up
TextViewHolder(View view) {
    super(view);
    v = view;
    mImageView = (NetworkImageView) view.findViewById(R.id.iv_left_image);
    mTitle = (TextView) view.findViewById(R.id.list_item_news_title);
    mSubTitle = (TextView) view.findViewById(R.id.list_item_news_subtitle);
    mVote = (TextView) view.findViewById(R.id.list_item_vote);
}
 
Example #15
Source File: NetworkImageViewAdapter.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Override
void setImage(ImageView imageView, String imageUrl) {
	NetworkImageView networkImageView=(NetworkImageView)imageView;
	networkImageView.setDefaultImageResId(R.drawable.ic_empty);  
	networkImageView.setErrorImageResId(R.drawable.ic_empty);  
	networkImageView.setImageUrl(StringUtil.preUrl(imageUrl),  imageLoader); 
}
 
Example #16
Source File: ImagesActivity.java    From volley_demo with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_images);

    imageView = (ImageView) findViewById(R.id.imageView);
    textview = (TextView) findViewById(R.id.textview);
    networkImageView = (NetworkImageView) findViewById(R.id.networkImageView);
}
 
Example #17
Source File: MyListAdapter.java    From nearbydemo with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	View rowView = convertView;
	if (rowView == null) {
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		rowView = inflater.inflate(R.layout.activity_main_list_item, null);
		ViewHolder viewHolder = new ViewHolder();
		
		viewHolder.name = (TextView) rowView.findViewById(R.id.name);
		viewHolder.title = (TextView) rowView.findViewById(R.id.title);
		viewHolder.content = (TextView) rowView.findViewById(R.id.content);
		viewHolder.image = (NetworkImageView) rowView.findViewById(R.id.image);
		
		rowView.setTag(viewHolder);
	}

	ViewHolder holder = (ViewHolder) rowView.getTag();

	NearbyInfo item = getItem(position);

	holder.name.setText(item.getName());
	holder.title.setText(item.getDescribe());
	holder.content.setText(item.getDistance());

	String url = item.getPicUrl();
	holder.image.setImageUrl(url, imageLoader);

	return rowView;
}
 
Example #18
Source File: MainActivity.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
ProductViewHolder(ViewGroup parent) {
    super(LayoutInflater.from(parent.getContext()).inflate(
            R.layout.shr_product_entry, parent, false));
    imageView = (NetworkImageView) itemView.findViewById(R.id.image);
    priceView = (TextView) itemView.findViewById(R.id.price);
    itemView.setOnClickListener(clickListener);
}
 
Example #19
Source File: EventViewModel.java    From SmileEssence with MIT License 5 votes vote down vote up
@Override
public View getView(final Activity activity, LayoutInflater inflater, View convertedView) {
    if (convertedView == null) {
        convertedView = inflater.inflate(R.layout.list_item_status, null);
    }
    UserPreferenceHelper preferenceHelper = new UserPreferenceHelper(activity);
    int textSize = preferenceHelper.getValue(R.string.key_setting_text_size, 10);
    int nameStyle = preferenceHelper.getValue(R.string.key_setting_namestyle, 0);
    int theme = ((MainActivity) activity).getThemeIndex();
    NetworkImageView icon = (NetworkImageView) convertedView.findViewById(R.id.imageview_status_icon);
    ImageCache.getInstance().setImageToView(getIconURL(), icon);
    TextView header = (TextView) convertedView.findViewById(R.id.textview_status_header);
    header.setTextSize(textSize);
    int colorHeader = Themes.getStyledColor(activity, theme, R.attr.color_status_text_mine, 0);
    header.setTextColor(colorHeader);
    header.setText(getFormattedString(activity));
    TextView content = (TextView) convertedView.findViewById(R.id.textview_status_text);
    content.setTextSize(textSize);
    int colorNormal = Themes.getStyledColor(activity, theme, R.attr.color_status_text_normal, 0);
    content.setTextColor(colorNormal);
    content.setText(getTargetText());
    TextView footer = (TextView) convertedView.findViewById(R.id.textview_status_footer);
    footer.setTextSize(textSize - 2);
    int colorFooter = Themes.getStyledColor(activity, theme, R.attr.color_status_text_footer, 0);
    footer.setTextColor(colorFooter);
    footer.setText(StringUtils.dateToString(getCreatedAt()));
    ImageView favorited = (ImageView) convertedView.findViewById(R.id.imageview_status_favorited);
    favorited.setVisibility(View.GONE);
    int colorBgNormal = Themes.getStyledColor(activity, theme, R.attr.color_status_bg_normal, 0);
    convertedView.setBackgroundColor(colorBgNormal);
    convertedView.setOnClickListener(new ListItemClickListener(activity, new Runnable() {
        @Override
        public void run() {
            UserDetailDialogFragment fragment = new UserDetailDialogFragment();
            fragment.setUserID(getSourceUserID());
            DialogHelper.showDialog(activity, fragment);
        }
    }));
    return convertedView;
}
 
Example #20
Source File: VideoListAdapter.java    From CastVideos-android with Apache License 2.0 5 votes vote down vote up
private ViewHolder(View parent, NetworkImageView imgView, View textContainer, TextView titleView,
        TextView descriptionView, View menu) {
    super(parent);
    mParent = parent;
    mImgView = imgView;
    mTextContainer = textContainer;
    mMenu = menu;
    mTitleView = titleView;
    mDescriptionView = descriptionView;
}
 
Example #21
Source File: VideoListAdapter.java    From CastVideos-android with Apache License 2.0 5 votes vote down vote up
public static ViewHolder newInstance(View parent) {
    NetworkImageView imgView = (NetworkImageView) parent.findViewById(R.id.imageView1);
    TextView titleView = (TextView) parent.findViewById(R.id.textView1);
    TextView descriptionView = (TextView) parent.findViewById(R.id.textView2);
    View menu = parent.findViewById(R.id.menu);
    View textContainer = parent.findViewById(R.id.text_container);
    return new ViewHolder(parent, imgView, textContainer, titleView, descriptionView, menu);
}
 
Example #22
Source File: MainActivity.java    From gplus-haiku-client-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onUserRetrieved(final User user) {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            StreamFragment frag =
                    (StreamFragment) getFragmentManager().findFragmentByTag(STREAM_FRAG_TAG);
            if (user != null) {
                mUser = user;
                ((TextView) findViewById(R.id.user_name)).setText(mUser.googleDisplayName);
                NetworkImageView profile = ((NetworkImageView) findViewById(R.id.user_profile_pic));
                profile.setImageUrl(mUser.googlePhotoUrl, mVolley.getImageLoader());
                findViewById(R.id.signed_in_container).setVisibility(View.VISIBLE);
                findViewById(R.id.signed_out_container).setVisibility(View.GONE);
                if (frag != null) {
                    frag.setUser(mUser, MainActivity.this);
                }
            } else {
                mUser = null;
                findViewById(R.id.signed_in_container).setVisibility(View.GONE);
                findViewById(R.id.signed_out_container).setVisibility(View.VISIBLE);
                if (frag != null) {
                    frag.setUser(null, MainActivity.this);
                }
            }
            setProgressBarIndeterminateVisibility(false);

            // Run a queued action
            // NOTE: In some situations, mRunAfterSignIn may be garbage collected while the SignIn
            // process takes place.  Therefore, it is not recommended to use this pattern for
            // critical tasks.
            if (mRunAfterSignIn != null) {
                mRunAfterSignIn.run();
                mRunAfterSignIn = null;
            }
        }
    });

}
 
Example #23
Source File: MainActivity.java    From OpenCircle with GNU General Public License v3.0 5 votes vote down vote up
public void setUpCollege() {
    //Default 911 is off
    circleOf6View.setEnableButton911(false);

    //Get the set college
    NetworkImageView logo = (NetworkImageView) findViewById(R.id.logo);
    CircleOf6Application.getInstance().setUpLogo(logo, dbHelper);

}
 
Example #24
Source File: PickExpandableAdapter.java    From OpenCircle with GNU General Public License v3.0 5 votes vote down vote up
public CollegeViewHolder(View itemView)
{
    super(itemView);
    collegeImage = (NetworkImageView) itemView.findViewById(R.id.image_college);
    collegeName = (TextView) itemView.findViewById(R.id.text_college_name);
    imageArrowExpandable = (ImageView) itemView.findViewById(R.id.image_arrow_expandable);
    isExpandable = false;
}
 
Example #25
Source File: CloudDetailActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	LayoutInflater layoutInflater = LayoutInflater.from(context);
	convertView = layoutInflater.inflate(R.layout.photo_layout, null);
	NetworkImageView imagev = (NetworkImageView) convertView
			.findViewById(R.id.ItemImage);
	imagev.setDefaultImageResId(R.drawable.ic_launcher);
	imagev.setImageUrl(mImageitem.get(position).getPreurl(),
			mImageLoader);
	return convertView;
}
 
Example #26
Source File: PreviewPhotoActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
@SuppressLint({ "NewApi", "InlinedApi" })
private void initListViews() {
	if (listViews == null) {
		listViews = new ArrayList<NetworkImageView>();
	}
	NetworkImageView img = new NetworkImageView(this);
	img.setBackgroundColor(0xff000000);// 黑色
	img.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
			LayoutParams.MATCH_PARENT));
	img.setScaleType(ScaleType.FIT_CENTER);// 图片填充方式
	listViews.add(img);// 添加view
}
 
Example #27
Source File: NetworkFragment.java    From okulus with Apache License 2.0 4 votes vote down vote up
private void loadImage(final ImageView imageView, final int position) {

            final String imageurl = (String) getItem(position);
            switch (getItemViewType(position)) {

                //Volley - ImageRequest
                case 0: {
                    final ImageRequest request = new ImageRequest(
                            imageurl,
                            new Response.Listener<Bitmap>() {
                                @Override
                                public void onResponse(Bitmap response) {
                                    imageView.setImageBitmap(response);
                                }
                            },
                            dpToPx(128),
                            dpToPx(96),
                            null,
                            new Response.ErrorListener() {
                                @Override
                                public void onErrorResponse(VolleyError error) {

                                }
                            }
                    );

                    mRequestQueue.add(request);
                    break;
                }

                //Volley - NetworkImageView - In this case, NetworkImageView has been modified to extend OkulusImageView
                case 1: {

                    final NetworkImageView networkImageView = (NetworkImageView) imageView;
                    networkImageView.setImageUrl(imageurl, mImageLoader);
                    break;
                }

                //Picasso
                case 2: {

                    Picasso.with(imageView.getContext())
                            .load(imageurl)
                            .resize(dpToPx(128), dpToPx(96))
                            .centerCrop()
                            .into(new Target() {
                                @Override
                                public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
                                    imageView.setImageBitmap(bitmap);
                                }

                                @Override
                                public void onBitmapFailed(Drawable errorDrawable) {

                                }

                                @Override
                                public void onPrepareLoad(Drawable placeHolderDrawable) {

                                }
                            });
                    break;
                }

                //Glide
                case 3: {

                    Glide.with(imageView.getContext())
                            .load(imageurl)
                            .asBitmap()
                            //.override(dpToPx(128), dpToPx(96))
                            .centerCrop()
                            .into(new ViewTarget<ImageView, Bitmap>(imageView) {
                                @Override
                                public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                                    imageView.setImageBitmap(resource);
                                }
                            });
                    break;
                }

                // Universal Image Loader
                case 4: {

                    ImageSize targetSize = new ImageSize(dpToPx(96), dpToPx(128));
                    mUniversalImageLoader.loadImage(imageurl, targetSize, new SimpleImageLoadingListener() {

                        @Override
                        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
                            imageView.setImageBitmap(loadedImage);
                        }
                    });
                    break;
                }

            }
        }
 
Example #28
Source File: HaikuArrayAdapter.java    From gplus-haiku-client-android with Apache License 2.0 4 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final int type = getItemViewType(position);
    if (type == ViewTypes.EMPTY_ITEM.ordinal()) {
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.haiku_empty, parent, false);
        }
    } else if (type == ViewTypes.FILTER_ITEM.ordinal()) {
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.list_header, parent, false);
        }
        if (mListener != null) {
            convertView.findViewById(R.id.button_create_haiku).setOnClickListener(mListener);
            convertView.findViewById(R.id.radio_everyone).setOnClickListener(mListener);
            convertView.findViewById(R.id.radio_friends).setOnClickListener(mListener);
        }
        ((RadioButton) convertView.findViewById(R.id.radio_everyone))
                .setChecked(HaikuClient.StreamMode.ALL.equals(mCurrentMode));
        ((RadioButton) convertView.findViewById(R.id.radio_friends))
                .setChecked(HaikuClient.StreamMode.FRIENDS.equals(mCurrentMode));
    } else {
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.haiku_item, parent, false);
        }

        Haiku item = getItem(position - (mDisplayHeader ? 1 : 0));

        NetworkImageView profile =
                ((NetworkImageView) convertView.findViewById(R.id.haiku_profile_pic));
        profile.setImageUrl(item.author.googlePhotoUrl, mVolley.getImageLoader());
        ((TextView) convertView.findViewById(R.id.haiku_title))
                .setText(item.title);
        ((TextView) convertView.findViewById(R.id.haiku_user_display_name))
                .setText(item.author.googleDisplayName);
        ((TextView) convertView.findViewById(R.id.haiku_date)).setText(item.getFormattedDate());
        ((TextView) convertView.findViewById(R.id.haiku_vote_count))
                .setText(item.votes + " Votes");
    }

    return convertView;
}
 
Example #29
Source File: PinsAdapter.java    From Presentation with Apache License 2.0 4 votes vote down vote up
private Holder(View v) {
    mImageView = (NetworkImageView) v.findViewById(R.id.url);
    mTitle = (TextView) v.findViewById(R.id.title);
    v.setTag(this);
}
 
Example #30
Source File: PicasaArrayAdapter.java    From android_volley_examples with Apache License 2.0 4 votes vote down vote up
public ViewHolder(View v) {
    image = (NetworkImageView) v.findViewById(R.id.iv_thumb);
    title = (TextView) v.findViewById(R.id.tv_title);
    
    v.setTag(this);
}