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);
}
}
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);
}
}
}
}
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);
}
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;
}
});
}
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;
}
Aggregations