Search in sources :

Example 16 with AQuery

use of com.androidquery.AQuery in project androidquery by androidquery.

the class ImageLoadingListOptionsActivity method renderPhotos.

public void renderPhotos(String url, XmlDom xml, AjaxStatus status) {
    if (xml == null)
        return;
    List<Photo> entries = convertAll(xml);
    ArrayAdapter<Photo> aa = new ArrayAdapter<Photo>(this, R.layout.photo_item, entries) {

        public View getView(int position, View convertView, ViewGroup parent) {
            if (convertView == null) {
                convertView = getLayoutInflater().inflate(R.layout.photo_item, parent, false);
            }
            Photo photo = getItem(position);
            AQuery aq = new AQuery(convertView);
            aq.id(R.id.name).text(photo.title);
            aq.id(R.id.meta).text(photo.author);
            String tbUrl = photo.tb;
            aq.id(R.id.tb);
            if (delay && aq.shouldDelay(convertView, parent, tbUrl, 0)) {
                if (preset != null) {
                    aq.image(preset, ratio);
                } else {
                    aq.clear();
                    if (progress) {
                        aq.invisible();
                        aq.id(R.id.pbar).visible();
                    }
                }
            } else {
                if (progress) {
                    aq.progress(R.id.pbar);
                }
                aq.image(tbUrl, memcache, true, 0, R.drawable.image_missing, preset, animation, ratio);
            }
            return convertView;
        }
    };
    aq.id(R.id.list).adapter(aa);
}
Also used : AQuery(com.androidquery.AQuery) ViewGroup(android.view.ViewGroup) AbsListView(android.widget.AbsListView) View(android.view.View) ArrayAdapter(android.widget.ArrayAdapter)

Example 17 with AQuery

use of com.androidquery.AQuery in project androidquery by androidquery.

the class AdhocActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.adhoc_activity);
    aq = new AQuery(this);
    aq.id(R.id.button).clicked(this, "goClicked");
}
Also used : AQuery(com.androidquery.AQuery)

Example 18 with AQuery

use of com.androidquery.AQuery in project androidquery by androidquery.

the class IntentListActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    if (!init) {
        AQUtility.setDebug(true);
        AQUtility.setCacheDir(null);
        BitmapAjaxCallback.setPixelLimit(600 * 600);
        BitmapAjaxCallback.setCacheLimit(200);
        BitmapAjaxCallback.setIconCacheLimit(100);
        BitmapAjaxCallback.setMaxPixelLimit(10000000);
        init = true;
        ErrorReporter.installReporter(getApplicationContext());
    }
    super.onCreate(savedInstanceState);
    type = getIntent().getStringExtra("type");
    aq = new AQuery(this);
    setContentView(R.layout.empty_list);
    aq.id(android.R.id.list).adapter(getAA()).itemClicked(this, "itemClicked");
    if (type == null && debug) {
        forward();
    }
    AQUtility.debug("on create");
    if (isTaskRoot()) {
        AQUtility.debug("task root start version check");
        MarketService ms = new MarketService(this);
        ms.level(MarketService.MINOR).checkVersion();
    }
}
Also used : AQuery(com.androidquery.AQuery) MarketService(com.androidquery.service.MarketService)

Example 19 with AQuery

use of com.androidquery.AQuery in project androidquery by androidquery.

the class ImageLoadingExpandableListActivity method renderPhotos.

public void renderPhotos(String url, XmlDom xml, AjaxStatus status) {
    if (xml == null)
        return;
    List<Photo> entries = convertAll(xml);
    group1 = entries.subList(0, entries.size() / 2);
    group2 = entries.subList(entries.size() / 2, entries.size() - 1);
    listAq = new AQuery(this);
    BaseExpandableListAdapter aa = new BaseExpandableListAdapter() {

        @Override
        public Object getChild(int groupPosition, int childPosition) {
            if (groupPosition == 0) {
                return group1.get(childPosition);
            }
            return group2.get(childPosition);
        }

        @Override
        public long getChildId(int groupPosition, int childPosition) {
            return childPosition;
        }

        @Override
        public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
            if (convertView == null) {
                convertView = getLayoutInflater().inflate(R.layout.content_item_s, parent, false);
            }
            Photo photo = (Photo) getChild(groupPosition, childPosition);
            AQuery aq = listAq.recycle(convertView);
            aq.id(R.id.name).text(photo.title);
            String tbUrl = photo.tb;
            if (!aq.shouldDelay(groupPosition, childPosition, isLastChild, convertView, parent, tbUrl)) {
                aq.id(R.id.tb).image(tbUrl, true, true, 0, 0, null, 0, 1);
                aq.id(R.id.name).text(photo.title);
            } else {
                aq.id(R.id.tb).clear();
                aq.id(R.id.text).text(photo.title);
            }
            return convertView;
        }

        @Override
        public int getChildrenCount(int groupPosition) {
            if (groupPosition == 0) {
                return group1.size();
            }
            return group2.size();
        }

        @Override
        public Object getGroup(int groupPosition) {
            if (groupPosition == 0) {
                return group1;
            }
            return group2;
        }

        @Override
        public int getGroupCount() {
            if (group1 != null) {
                return 2;
            }
            return 0;
        }

        @Override
        public long getGroupId(int groupPosition) {
            return groupPosition;
        }

        @Override
        public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
            if (convertView == null) {
                convertView = getLayoutInflater().inflate(R.layout.content_item_s, parent, false);
            }
            Photo photo = (Photo) getChild(groupPosition, 0);
            AQuery aq = listAq.recycle(convertView);
            aq.id(R.id.name).text(photo.title);
            String tbUrl = photo.tb;
            if (!aq.shouldDelay(groupPosition, isExpanded, convertView, parent, tbUrl)) {
                aq.id(R.id.tb).image(tbUrl, true, true, 0, 0, null, 0, 1);
            } else {
                aq.id(R.id.tb).clear();
            }
            aq.id(R.id.name).text("Group " + groupPosition);
            aq.id(R.id.meta).text("");
            return convertView;
        }

        @Override
        public boolean hasStableIds() {
            return false;
        }

        @Override
        public boolean isChildSelectable(int arg0, int arg1) {
            return false;
        }
    };
    aq.id(R.id.list).adapter(aa);
}
Also used : AQuery(com.androidquery.AQuery) BaseExpandableListAdapter(android.widget.BaseExpandableListAdapter) ViewGroup(android.view.ViewGroup) Photo(com.androidquery.test.image.ImageLoadingList4Activity.Photo) View(android.view.View) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) ExpandableListView(android.widget.ExpandableListView)

Example 20 with AQuery

use of com.androidquery.AQuery in project androidquery by androidquery.

the class FacebookHandle method ajaxProfile.

public void ajaxProfile(AjaxCallback<JSONObject> cb, long expire) {
    String url = "https://graph.facebook.com/me";
    AQuery aq = new AQuery(act);
    aq.auth(this).ajax(url, JSONObject.class, expire, cb);
}
Also used : AQuery(com.androidquery.AQuery)

Aggregations

AQuery (com.androidquery.AQuery)31 View (android.view.View)17 ViewGroup (android.view.ViewGroup)9 ArrayAdapter (android.widget.ArrayAdapter)8 AdapterView (android.widget.AdapterView)5 TextView (android.widget.TextView)5 AbsListView (android.widget.AbsListView)4 ImageView (android.widget.ImageView)4 JSONObject (org.json.JSONObject)4 Activity (android.app.Activity)3 ExpandableListView (android.widget.ExpandableListView)3 Photo (com.androidquery.test.image.ImageLoadingList4Activity.Photo)3 ArrayList (java.util.ArrayList)3 Dialog (android.app.Dialog)2 Bitmap (android.graphics.Bitmap)2 ProgressBar (android.widget.ProgressBar)2 JSONArray (org.json.JSONArray)2 AlertDialog (android.app.AlertDialog)1 ProgressDialog (android.app.ProgressDialog)1 Intent (android.content.Intent)1