use of com.androidquery.callback.AjaxStatus in project androidquery by androidquery.
the class AjaxLoadingActivity method async_progress_dialogbar.
public void async_progress_dialogbar() {
ProgressDialog dialog = new ProgressDialog(this);
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dialog.setIndeterminate(false);
dialog.setCancelable(true);
dialog.setInverseBackgroundForced(false);
dialog.setCanceledOnTouchOutside(true);
dialog.setTitle("Loading...");
String url = "http://farm6.static.flickr.com/5035/5802797131_a729dac808_b.jpg";
File ext = Environment.getExternalStorageDirectory();
File target = new File(ext, "aquery/myfolder2/photo.jpg");
aq.progress(dialog).download(url, target, new AjaxCallback<File>() {
public void callback(String url, File file, AjaxStatus status) {
if (file != null) {
showResult("File:" + file.length() + ":" + file, status);
} else {
showResult("Failed", status);
}
}
});
}
use of com.androidquery.callback.AjaxStatus in project androidquery by androidquery.
the class AjaxLoadingActivity method async_transformer.
public void async_transformer() {
String url = "https://graph.facebook.com/205050232863343";
GsonTransformer t = new GsonTransformer();
aq.transformer(t).progress(R.id.progress).ajax(url, Profile.class, new AjaxCallback<Profile>() {
public void callback(String url, Profile profile, AjaxStatus status) {
Gson gson = new Gson();
showResult("GSON Object:" + gson.toJson(profile), status);
}
});
}
use of com.androidquery.callback.AjaxStatus in project simplefacebook by androidquery.
the class PostActivity method attachPhoto.
private void attachPhoto(File file) {
if (file == null || !file.exists() || file.length() < 10) {
aq.id(R.id.image_box).gone();
return;
}
AQUtility.debug("photo", file.length());
sendEnable(false);
BitmapAjaxCallback cb = new BitmapAjaxCallback() {
@Override
protected void callback(String url, ImageView iv, Bitmap bm, AjaxStatus status) {
sendEnable(true);
if (photo != null && bm != null) {
iv.setImageBitmap(bm);
String dim = bm.getWidth() + "x" + bm.getHeight();
aq.id(R.id.text_dim).text(dim);
String length = FormatUtility.scientificShort(photo.length()) + "b";
aq.id(R.id.text_size).text(length);
PostActivity.this.bm = bm;
}
}
};
//.targetDim(false);
cb.file(file).targetWidth(720);
aq.id(R.id.image_photo).image(cb);
clear();
this.photo = file;
refreshButtons();
}
use of com.androidquery.callback.AjaxStatus in project androidquery by androidquery.
the class AQueryXmlTest method testMalformXml.
public void testMalformXml() {
String url = "http://fotbollskanalen.apps.tv4.se/news/topnews";
AjaxCallback<XmlDom> cb = new AjaxCallback<XmlDom>() {
@Override
public void callback(String url, XmlDom object, AjaxStatus status) {
done(url, object, status);
}
};
cb.url(url).type(XmlDom.class);
aq.ajax(cb);
waitAsync();
XmlDom xml = (XmlDom) result;
assertNotNull(xml);
AQUtility.debug(xml);
}
use of com.androidquery.callback.AjaxStatus in project androidquery by androidquery.
the class AQueryLocationTest method testLocationIter2Acc10000.
public void testLocationIter2Acc10000() {
LocationAjaxCallback cb = new LocationAjaxCallback() {
private int n;
@Override
public void callback(String url, Location loc, AjaxStatus status) {
n++;
AQUtility.debug(n);
AQUtility.debug(loc);
assertNotNull(loc);
if (n == 2) {
assertEquals("gps", loc.getProvider());
}
}
};
cb.timeout(30 * 1000).accuracy(10000).iteration(2).tolerance(-1);
cb.async(getActivity());
waitAsync(5000);
}
Aggregations