Search in sources :

Example 1 with SponsorAdapter

use of ca.etsmtl.applets.etsmobile.ui.adapter.SponsorAdapter in project ETSMobile-Android2 by ApplETS.

the class SponsorsFragment method refreshList.

public void refreshList() {
    sponsorList = mSponsorManager.getSponsorList();
    adapter = new SponsorAdapter(getActivity(), R.layout.row_sponsor, sponsorList, this);
    sponsorGridView.setAdapter(adapter);
    adapter.notifyDataSetChanged();
    sponsorGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            Sponsor item = sponsorList.get(position);
            String url = item.getUrl();
            if (URLUtil.isValidUrl(url)) {
                Intent internetIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                startActivity(internetIntent);
            }
        }
    });
}
Also used : Sponsor(ca.etsmtl.applets.etsmobile.model.Sponsor) AdapterView(android.widget.AdapterView) Intent(android.content.Intent) GridView(android.widget.GridView) LoadingView(ca.etsmtl.applets.etsmobile.views.LoadingView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) SponsorAdapter(ca.etsmtl.applets.etsmobile.ui.adapter.SponsorAdapter)

Aggregations

Intent (android.content.Intent)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 GridView (android.widget.GridView)1 ListView (android.widget.ListView)1 Sponsor (ca.etsmtl.applets.etsmobile.model.Sponsor)1 SponsorAdapter (ca.etsmtl.applets.etsmobile.ui.adapter.SponsorAdapter)1 LoadingView (ca.etsmtl.applets.etsmobile.views.LoadingView)1