Search in sources :

Example 26 with AQuery

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

the class Progress method show.

public void show(String url) {
    reset();
    if (pd != null) {
        AQuery aq = new AQuery(pd.getContext());
        aq.show(pd);
    }
    if (act != null) {
        act.setProgressBarIndeterminateVisibility(true);
        act.setProgressBarVisibility(true);
    }
    if (pb != null) {
        pb.setTag(AQuery.TAG_URL, url);
        pb.setVisibility(View.VISIBLE);
    }
    if (view != null) {
        view.setTag(AQuery.TAG_URL, url);
        view.setVisibility(View.VISIBLE);
    }
}
Also used : AQuery(com.androidquery.AQuery)

Example 27 with AQuery

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

the class Progress method dismiss.

private void dismiss(String url) {
    if (pd != null) {
        AQuery aq = new AQuery(pd.getContext());
        aq.dismiss(pd);
    }
    if (act != null) {
        act.setProgressBarIndeterminateVisibility(false);
        act.setProgressBarVisibility(false);
    }
    if (pb != null) {
        pb.setTag(AQuery.TAG_URL, url);
        pb.setVisibility(View.VISIBLE);
    }
    View pv = pb;
    if (pv == null) {
        pv = view;
    }
    if (pv != null) {
        Object tag = pv.getTag(AQuery.TAG_URL);
        if (tag == null || tag.equals(url)) {
            pv.setTag(AQuery.TAG_URL, null);
            if (pb != null && pb.isIndeterminate()) {
                pv.setVisibility(View.GONE);
            }
        }
    }
}
Also used : AQuery(com.androidquery.AQuery) View(android.view.View)

Example 28 with AQuery

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

the class AQueryAsyncTest method testAjaxInactiveActivity.

public void testAjaxInactiveActivity() {
    String url = "http://www.google.com/uds/GnewsSearch?q=Obama&v=1.0";
    Activity act = getActivity();
    act.finish();
    assertTrue(act.isFinishing());
    AQuery aq = new AQuery(act);
    AjaxCallback<JSONObject> cb = new AjaxCallback<JSONObject>() {

        @Override
        public void callback(String url, JSONObject jo, AjaxStatus status) {
            assertFalse(true);
            done(url, jo, status);
        }
    };
    aq.ajax(url, JSONObject.class, cb);
    waitAsync();
    JSONObject jo = (JSONObject) result;
    assertNull(jo);
}
Also used : AQuery(com.androidquery.AQuery) JSONObject(org.json.JSONObject) Activity(android.app.Activity) AjaxCallback(com.androidquery.callback.AjaxCallback) AbstractAjaxCallback(com.androidquery.callback.AbstractAjaxCallback) BitmapAjaxCallback(com.androidquery.callback.BitmapAjaxCallback) AjaxStatus(com.androidquery.callback.AjaxStatus)

Example 29 with AQuery

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

the class ProfileFragment method buildUI.

public void buildUI(final User user) {
    if (user == null) {
        return;
    }
    mListView.setAdapter(new InfoListAdapter(getBaseActivity()));
    mListView.getListAdapter().fillWithItems(mHolders);
    mListView.getListAdapter().notifyDataSetChanged();
    if (user != null) {
        final AQuery aq = new AQuery(getBaseActivity());
        aq.id(mGravatarView).image(user.getAvatarUrl(), true, true, 200, R.drawable.gravatar, null, AQuery.FADE_IN_NETWORK, 1.0f);
        final TextView tvLogin = (TextView) mContent.findViewById(R.id.tv_user_login);
        tvLogin.setText(user.getLogin());
        final TextView tvFullName = (TextView) mContent.findViewById(R.id.tv_user_fullname);
        if (!isStringEmpty(user.getName())) {
            tvFullName.setText(user.getName());
        } else {
            tvFullName.setVisibility(GONE);
        }
    }
    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            final InfoListAdapter.InfoHolder holder;
            try {
                holder = mHolders.get(position);
                if (holder.onClick != null) {
                    holder.onClick.onItemClick(parent, view, position, id);
                }
            } catch (IndexOutOfBoundsException e) {
                e.printStackTrace();
            }
        }
    });
    mListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            final InfoListAdapter.InfoHolder holder;
            try {
                holder = mHolders.get(position);
                if (holder.onLongClick != null) {
                    holder.onLongClick.onItemLongClick(parent, view, position, id);
                }
            } catch (IndexOutOfBoundsException e) {
                e.printStackTrace();
            }
            return false;
        }
    });
}
Also used : InfoListAdapter(net.idlesoft.android.apps.github.ui.adapters.InfoListAdapter) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) AQuery(com.androidquery.AQuery) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView)

Example 30 with AQuery

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

the class ContextListAdapter method doGetView.

public View doGetView(int position, View convertView, ViewGroup parent, boolean dropdown) {
    ViewHolder holder;
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.user_list_item, null);
        holder = new ViewHolder();
        holder.gravatar = (ImageView) convertView.findViewById(R.id.iv_user_gravatar);
        holder.login = (TextView) convertView.findViewById(R.id.tv_user_login);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    final User user = getItem(position);
    final String login = user.getLogin();
    final String type = user.getType();
    final AQuery aq = new AQuery(convertView);
    aq.id(holder.gravatar).image(user.getAvatarUrl(), true, true, 200, R.drawable.gravatar, null, AQuery.FADE_IN_NETWORK, 1.0f);
    holder.login.setText(login);
    holder.login.setTextColor(Color.parseColor("#2c2c2c"));
    return convertView;
}
Also used : AQuery(com.androidquery.AQuery) User(org.eclipse.egit.github.core.User)

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