Search in sources :

Example 11 with AQuery

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

the class Common method showProgress.

public static void showProgress(Object p, String url, boolean show) {
    if (p != null) {
        if (p instanceof View) {
            View pv = (View) p;
            ProgressBar pbar = null;
            if (p instanceof ProgressBar) {
                pbar = (ProgressBar) p;
            }
            if (show) {
                pv.setTag(AQuery.TAG_URL, url);
                pv.setVisibility(View.VISIBLE);
                if (pbar != null) {
                    pbar.setProgress(0);
                    pbar.setMax(100);
                }
            } else {
                Object tag = pv.getTag(AQuery.TAG_URL);
                if (tag == null || tag.equals(url)) {
                    pv.setTag(AQuery.TAG_URL, null);
                    if (pbar == null || pbar.isIndeterminate()) {
                        pv.setVisibility(View.GONE);
                    }
                }
            }
        } else if (p instanceof Dialog) {
            Dialog pd = (Dialog) p;
            AQuery aq = new AQuery(pd.getContext());
            if (show) {
                aq.show(pd);
            } else {
                aq.dismiss(pd);
            }
        } else if (p instanceof Activity) {
            Activity act = (Activity) p;
            ;
            act.setProgressBarIndeterminateVisibility(show);
            act.setProgressBarVisibility(show);
            if (show) {
                act.setProgress(0);
            }
        }
    }
}
Also used : AQuery(com.androidquery.AQuery) Dialog(android.app.Dialog) Activity(android.app.Activity) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) ExpandableListView(android.widget.ExpandableListView) ProgressBar(android.widget.ProgressBar)

Example 12 with AQuery

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

the class Progress method showProgress.

private void showProgress(Object p, String url, boolean show) {
    if (p != null) {
        if (p instanceof View) {
            View pv = (View) p;
            ProgressBar pbar = null;
            if (p instanceof ProgressBar) {
                pbar = (ProgressBar) p;
            }
            if (show) {
                pv.setTag(AQuery.TAG_URL, url);
                pv.setVisibility(View.VISIBLE);
                if (pbar != null) {
                    pbar.setProgress(0);
                    pbar.setMax(100);
                }
            } else {
                Object tag = pv.getTag(AQuery.TAG_URL);
                if (tag == null || tag.equals(url)) {
                    pv.setTag(AQuery.TAG_URL, null);
                    if (pbar != null && pbar.isIndeterminate()) {
                        pv.setVisibility(View.GONE);
                    }
                }
            }
        } else if (p instanceof Dialog) {
            Dialog pd = (Dialog) p;
            AQuery aq = new AQuery(pd.getContext());
            if (show) {
                aq.show(pd);
            } else {
                aq.dismiss(pd);
            }
        } else if (p instanceof Activity) {
            Activity act = (Activity) p;
            ;
            act.setProgressBarIndeterminateVisibility(show);
            act.setProgressBarVisibility(show);
            if (show) {
                act.setProgress(0);
            }
        }
    }
}
Also used : AQuery(com.androidquery.AQuery) ProgressDialog(android.app.ProgressDialog) Dialog(android.app.Dialog) Activity(android.app.Activity) View(android.view.View) ProgressBar(android.widget.ProgressBar)

Example 13 with AQuery

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

the class AQueryImageTest method testCachedImageWithRecycle.

public void testCachedImageWithRecycle() {
    clearCache();
    final AQuery listAq = new AQuery(this.getActivity());
    final View view = aq.id(R.id.image).getView();
    AQUtility.post(new Runnable() {

        @Override
        public void run() {
            AQuery aq = listAq.recycle(view);
            Bitmap bm = aq.getCachedImage(R.drawable.icon);
            assertNotNull(bm);
        }
    });
    waitAsync(2000);
}
Also used : AQuery(com.androidquery.AQuery) Bitmap(android.graphics.Bitmap) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Example 14 with AQuery

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

the class ImageGridFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.image_grid_fragment, container, false);
    aq = new AQuery(getActivity(), view);
    aq2 = new AQuery(getActivity());
    return view;
}
Also used : AQuery(com.androidquery.AQuery) View(android.view.View)

Example 15 with AQuery

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

the class ImageLoadingListActivity method renderNews.

public void renderNews(String url, JSONObject json, AjaxStatus status) {
    if (json == null)
        return;
    JSONArray ja = json.optJSONObject("responseData").optJSONArray("results");
    if (ja == null)
        return;
    List<JSONObject> items = new ArrayList<JSONObject>();
    addItems(ja, items);
    addItems(ja, items);
    addItems(ja, items);
    addItems(ja, items);
    listAq = new AQuery(this);
    ArrayAdapter<JSONObject> aa = new ArrayAdapter<JSONObject>(this, R.layout.content_item_s, items) {

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            if (convertView == null) {
                convertView = getLayoutInflater().inflate(R.layout.content_item_s, null);
            }
            JSONObject jo = getItem(position);
            AQuery aq = listAq.recycle(convertView);
            aq.id(R.id.name).text(jo.optString("titleNoFormatting", "No Title"));
            aq.id(R.id.meta).text(jo.optString("publisher", ""));
            String tb = jo.optJSONObject("image").optString("tbUrl");
            aq.id(R.id.tb).progress(R.id.progress).image(tb, true, true, 0, 0, null, AQuery.FADE_IN_NETWORK, 1.0f);
            return convertView;
        }
    };
    aq.id(R.id.list).adapter(aa);
}
Also used : AQuery(com.androidquery.AQuery) JSONObject(org.json.JSONObject) ViewGroup(android.view.ViewGroup) JSONArray(org.json.JSONArray) ArrayList(java.util.ArrayList) View(android.view.View) ArrayAdapter(android.widget.ArrayAdapter)

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