Android Open Source - worldwondersproject Place Cursor Adapter






From Project

Back to project page worldwondersproject.

License

The source code is released under:

MIT License

If you think the Android project worldwondersproject listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ciandt.cursoandroid.worldwondersapp.adapter;
/*  www . j  a v  a 2 s.c om*/
import android.content.Context;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.ciandt.cursoandroid.worldwondersapp.R;
import com.ciandt.cursoandroid.worldwondersapp.entity.Place;
import com.koushikdutta.urlimageviewhelper.UrlImageViewCallback;
import com.koushikdutta.urlimageviewhelper.UrlImageViewHelper;

public class PlaceCursorAdapter extends CursorAdapter {

    public PlaceCursorAdapter(Context context, Cursor cursor) {
        super(context, cursor, true);
    }

    @Override
    public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
        LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext());
        View newView = inflater.inflate(R.layout.main_feed_item, viewGroup, false);
        return newView;
    }

    @Override
    public void bindView(View view, Context context, Cursor cursor) {
        Place place = new Place(cursor);

        final ImageView imageItem = (ImageView) view.findViewById(R.id.imageItem);
        TextView textItemName = (TextView) view.findViewById(R.id.textItemName);
        TextView textCountry = (TextView) view.findViewById(R.id.textItemCountry);
        TextView textDescription = (TextView) view.findViewById(R.id.textItemDescription);
        final ProgressBar progressBarImageItem = (ProgressBar) view.findViewById(R.id.progressBarImageItem);

        imageItem.setVisibility(View.GONE);
        //progressBarImageItem.setVisibility(View.VISIBLE);

        UrlImageViewHelper.setUrlDrawable(imageItem, place.placeImageUrl, new UrlImageViewCallback() {
            @Override
            public void onLoaded(ImageView imageView, Bitmap loadedBitmap, String url, boolean loadedFromCache) {
                imageItem.setVisibility(View.VISIBLE);
                //progressBarImageItem.setVisibility(View.GONE);
            }
        });

        textItemName.setText(place.placeName);
        textCountry.setText(place.placeCountry);
        textDescription.setText(place.placeDescription);
    }
}




Java Source Code List

com.ciandt.cursoandroid.worldwondersapp.ApplicationTest.java
com.ciandt.cursoandroid.worldwondersapp.activity.LoginActivity.java
com.ciandt.cursoandroid.worldwondersapp.activity.MainActivity.java
com.ciandt.cursoandroid.worldwondersapp.activity.PlaceDetailActivity.java
com.ciandt.cursoandroid.worldwondersapp.activity.RegisterActivity.java
com.ciandt.cursoandroid.worldwondersapp.adapter.PlaceCursorAdapter.java
com.ciandt.cursoandroid.worldwondersapp.businesscoordinator.PlaceBusinessCoordinator.java
com.ciandt.cursoandroid.worldwondersapp.contentprovider.WorldWondersContentProvider.java
com.ciandt.cursoandroid.worldwondersapp.database.Database.java
com.ciandt.cursoandroid.worldwondersapp.database.table.PlaceTable.java
com.ciandt.cursoandroid.worldwondersapp.entity.BaseEntity.java
com.ciandt.cursoandroid.worldwondersapp.entity.Place.java
com.ciandt.cursoandroid.worldwondersapp.entity.User.java
com.ciandt.cursoandroid.worldwondersapp.fragment.PlaceDetailFragment.java
com.ciandt.cursoandroid.worldwondersapp.fragment.PlaceListFragment.java
com.ciandt.cursoandroid.worldwondersapp.infrastructure.Constants.java
com.ciandt.cursoandroid.worldwondersapp.infrastructure.NetworkUtil.java
com.ciandt.cursoandroid.worldwondersapp.integrator.BaseIntegrator.java
com.ciandt.cursoandroid.worldwondersapp.integrator.GeneralIntegrator.java
com.ciandt.cursoandroid.worldwondersapp.integrator.PlaceIntegrator.java
com.ciandt.cursoandroid.worldwondersapp.listener.DatabaseOperatorCallback.java
com.ciandt.cursoandroid.worldwondersapp.listener.IntegratorOperatorCallback.java
com.ciandt.cursoandroid.worldwondersapp.manager.DatabaseManager.java
com.ciandt.cursoandroid.worldwondersapp.manager.LoginManager.java
com.ciandt.cursoandroid.worldwondersapp.manager.PlaceManager.java
com.ciandt.cursoandroid.worldwondersapp.manager.RegisterManager.java
com.ciandt.cursoandroid.worldwondersapp.service.SyncService.java
com.ciandt.cursoandroid.worldwondersapp.service.syncer.PlaceSyncer.java
com.ciandt.cursoandroid.worldwondersapp.service.syncer.Syncer.java