GithubHelp home page GithubHelp logo

androidquery's Introduction

androidquery's People

Contributors

aigens avatar androidquery avatar brk3 avatar free1002 avatar neocoin avatar robisaks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

androidquery's Issues

targetWidth options are ignored In some cases.

targetWidth options are ignored when we request multiple image downloads simultaneously.

For example, we requests following 3 image downloads simultaneously.
request#1: url=https://www.google.com/images/srpr/logo3w.png, targetWidth=20
request#2: url=https://www.google.com/images/srpr/logo3w.png, targetWidth=0
request#3: url=https://www.google.com/images/srpr/logo3w.png, targetWidth=10

These all requests show same image whose width is 20.

Maybe the cause of this is that multiple requests arranged as one requests. In BitmapAjaxCallback.java,

        if(!queueMap.containsKey(url)){
            addQueue(url, v);   
            super.async(v.getContext());
        }else{  
            showProgress(true);         
            addQueue(url, v);
        }

shouldDelay method for file

Hi,
This is not an issue but a feature request.
Is it possible to write a shouldDelay method that take a file or a path instead of an url in order to load asynchronously an image that has not be cached by AQUery before ?
For exemple, I'm writing an app where I download myself a .zip containing images. Then I save them in a folder in the sdcard and I want to display them in a list/gridview with the benefits of the shouldDelay method.
Thanks again for this awesome lib, I use it a lot in Traktoid : https://github.com/florianmski/Traktoid

AjaxCallback - handle own responses

A service I am calling returns status code 422 for invalid login (wrong password, etc)
However, it still returns a valid JSON response along with it, which includes error messages.

AjaxCallback does'nt seem to return the JSON in that case

I see this in the source:
if(code < 200 || code >= 300)

Source code version

On google code site, in download section the newest version is 0.26.8, but in source code there's still 0.25.9.

Don't know what kind of version is in sonatype repository and / or maven central but version should be fixed.

Thanks

Image transparency

Is it possible to add image transparency because when I load a transparent gif from the web the transparent part is white, this happens on devices with Android 4.4. Code used:

    AQuery aq = new AQuery(view);
    Bitmap preset = aq.getCachedImage(url);
    if (preset != null)
        view.setImageBitmap(preset);
    else
        aq.id(view).image(url, true, true);

[BUG] ah in AbstractAjaxCallback is overwrite and cleared by ah in AbstractAQuery

What steps will reproduce the problem?

  1. Just run AjaxAuthActivity in demo project
  2. Debug output ah in networkWork() of AbstractAjaxCallback.java
  3. You will see ah is null and is not set by cb.auth(this, AQuery.AUTH_PICASA, AQuery.ACTIVE_ACCOUNT);

What is the expected output? What do you see instead?
Expect ah is not null, but ah is null

What version of the product are you using? On what operating system
Release 0.25.8

Please provide any additional information below.
AbstractAjaxCallback 's ah is set to AbstractAQuery's ah in AbstractAQuery's invoke() function.

no result when the server status code is not 200

Hello

When the server send status code other than 200, the body always null!

for example:

<?php 

    header("HTTP/1.1 433 OK");

    $response = array();
    $response['key'] = 'value';
    echo json_encode($response);
?>

In AQuery, this will show status code 433 but the body is null!

Could you please help in this?

Thank you.

Shared HTTP Client for holding auth session information cookie

I am looking for solution for enabling holding cookie using Android Query (not native Android HTTPClient).

If I'm getting cookie information from first request, how to use it in other requests?

Here I described my problem with more details:

http://stackoverflow.com/questions/20786545/set-cookie-using-adroid-query-ajaxcallback

I know that, many people has this issue, and I also saw that there is issue about it on Google Project page, without solution. I mean this 2:

http://code.google.com/p/android-query/issues/detail?id=94
http://code.google.com/p/android-query/issues/detail?id=28

It would be nice to have persisted session on default, same as browsers has.

Suggerstion

I would like to add a boolean method like isVisible() like
[code]return view != null && view.getVisibility() == View.VISIBILE[/code]

This would be extremely useful for developers like in Android when they have to check portrait and landscape specific view.

Load and cache an image without mandatory ImageView

Hello and thanks for your library! :-)

How can I load and cache an image to receive a bitmap in a callback without necessity to point an AQuery instance to some ImageView?
E.g. you may want to download and cache an image to set it as a compound drawable for some TextView (like drawableLeft).

Actually you have to use a fake ImageView something like:

mAq.id(new ImageView(getActivity())).image(mSetAvatarCallback);
// set the loaded and cached bitmap as a compound drawable in the callback 

instead of a simpler and cleaner one:

mAq.image(mSetAvatarCallback);

Thanks

AbstractAjaxCallback should give precedence to custom Transformer

Method

AbstractAjaxCallback#transform( String, byte[], AjaxStatus )

should give chance to custom Transformer before all other transformations, since it's most logical and probably correct way to handle custom things, even if we want to use "output" type already covered with your code.

I suggest that you move lines
702-704:
if(transformer != null){
return transformer.transform(url, type, encoding, data, status);
}

in front of other checks, somewhere around line 631.

NullPointerExeption in LocationAjaxCallback

I receive this stacktrace from my app on Google Play. Lib ver 0.21.5

java.lang.NullPointerException
at com.androidquery.callback.LocationAjaxCallback.stop(LocationAjaxCallback.java:206)
at com.androidquery.callback.LocationAjaxCallback.check(LocationAjaxCallback.java:107)
at com.androidquery.callback.LocationAjaxCallback.access$0(LocationAjaxCallback.java:85)
at com.androidquery.callback.LocationAjaxCallback$Listener.onLocationChanged(LocationAjaxCallback.java:283)
at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:227)
at android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:160)
at android.location.LocationManager$ListenerTransport$2.handleMessage(LocationManager.java:183)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3701)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
at dalvik.system.NativeStart.main(Native Method)

CACHE_TEMPORARY policy and Config.ARGB_4444 bitmaps

So there are 2 policies:

public static final int CACHE_DEFAULT = 0;
public static final int CACHE_PERSISTENT = 1;

I added 1 more:

public static final int CACHE_TEMPORARY = 2;

Malachiasz@b53e680

AQuery works little different than I was expecting. Expiry parameter of ajax() means only that file should be fetched from the Internet when it expired. It is not removed from the disk when it expired. (IMHO it's and error) Files are removed based on the last time they were used only.

my CACHE_TEMPORARY causes every file downloaded with this policy to be removed as soon as AQUtility.cleanCacheAsync() is invoked, regardless of cache trigger parameters. I use it for downloading huge, short living bitmaps.

Example usage:
AjaxCallback cbBmp = new AjaxCallbackLoadingBitmap();
cbBmp.url(url).showLowQualityImages(true).type(Bitmap.class)
.header("User-Agent", getUserAgent().fileCache(true).memCache(false).policy(AQuery.CACHE_TEMPORARY);
aq.ajax(cbBmp);

showLowQualityImages(true) is another parameter, which I added here:
Malachiasz@504fd08
It adds support of Config.ARGB_4444 bitmaps. It's useful when we're tight on memory.
(http://stackoverflow.com/a/8527745/2075875)

Ability to provide params to delete(...)

I am calling an API that requires sending parameters in the body of a HTTP DELETE method, however, it seems AQuery does not provide an overload that allows me to do this.

I don't control the API so I can't change the server side.

support change httpclient?

I notice that there already have a getClient function been created in recent release, if aq provide interface to inject httpClient, we could easily take the advantage to utilize for example okhttp lib , it's not a big change, isn't it?

resolveUri failed using cached image as preset

I have a problem while using cached Images as preset.

Bitmap cached = aq.getCachedImage(url, 0);
if(cached != null){
    aq.id(view).image(url, true, true, 0, R.drawable.no_image, cached, 0);
}

The error message
"resolveUri failed on bad bitmap uri: http://farm5.staticflickr.com/.....jpg"
is printed by the ImageView. I dont know why but the ImageView want to load the Drawable by his Uri by calling "resolveUri". But the Uri is set tu the Url of the original image and not to the filesystem.

NullPointerException on empty body in response

If the server returns an empty body (as in a 204 response), AQuery hits a NPE trying to get the length of the response.

To reproduce, make any request that returns only a head, but no body. It fails on the line int size = Math.max(32, Math.min(1024 * 64, (int) entity.getContentLength())); in httpDo().

[new feature request] network traffic

it's would be a widely used functionality be used, esp. in China. picture (or any large size file) download only allowed in wifi(or 3G ) enviorment, and of course, this is a option user can choose. this would be a functions without any dependency. good to have.

request typeface

I need use typeface with my TextView, anything like
aq.id().typeFace("myFont.ttf"); would be great :-)

I have already post this issue on google code repo , I don't know where it's better :-s

MarketService doesn't work anymore

It used to detect when a new version has been uploaded but not anymore. it hasn't showed the update dialog in my app for a few months now.

This is how the code n my app looks and has always been the same:
protected void onCreate(Bundle savedInstanceState) {
....
MarketService ms = new MarketService(this);
ms.level(MarketService.MINOR).checkVersion();
}

ArrayIndexOutOfBoundsException in FacebookHandle.decodeUrl()

What steps will reproduce the problem?

  1. new FacebookHandler(activity, appId, permissions)
  2. facebookHandle.sso(requestCode)
  3. aQuery.auth(facebookHandle).ajax("https://graph.facebook.com/me/feed", String.class, new AjaxCallback() {})

What is the expected output? What do you see instead?
No exception.

What version of the product are you using? On what operating system?
android-query-full.0.25.10.jar
android 4.2.2

Please provide any additional information below.
E/AndroidRuntime(31589): FATAL EXCEPTION: main
E/AndroidRuntime(31589): java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
E/AndroidRuntime(31589): at com.androidquery.auth.FacebookHandle.decodeUrl(FacebookHandle.java:352)
E/AndroidRuntime(31589): at com.androidquery.auth.FacebookHandle.parseUrl(FacebookHandle.java:363)
E/AndroidRuntime(31589): at com.androidquery.auth.FacebookHandle.access$0(FacebookHandle.java:359)
E/AndroidRuntime(31589): at com.androidquery.auth.FacebookHandle$FbWebViewClient.checkDone(FacebookHandle.java:240)
E/AndroidRuntime(31589): at com.androidquery.auth.FacebookHandle$FbWebViewClient.shouldOverrideUrlLoading(FacebookHandle.java:277)
E/AndroidRuntime(31589): at com.androidquery.WebDialog$DialogWebViewClient.shouldOverrideUrlLoading(WebDialog.java:158)
E/AndroidRuntime(31589): at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:270)
E/AndroidRuntime(31589): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:377)
E/AndroidRuntime(31589): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(31589): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(31589): at android.app.ActivityThread.main(ActivityThread.java:5195)
E/AndroidRuntime(31589): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(31589): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(31589): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
E/AndroidRuntime(31589): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
E/AndroidRuntime(31589): at dalvik.system.NativeStart.main(Native Method)

Editing files before storing in cache is impossible

It would be nice to have in
public synchronized void callback(String url, Bitmap bitmap, AjaxStatus status) {
status, an option to save to cache under given url editet version. Now it's possible only to invalidate.

http://stackoverflow.com/questions/13917905/how-to-edit-bitmap-before-is-it-stored-in-a-cache-with-aquery

For example I load bitmap and want to resize it in callback (in callback, because I need to know image size) and save to cache in order for resizing to be unnecessery next time

[BUG] Cache incomplete content when network error during httpDo

  1. Make a ajax call which generating file cache, eg. aq.ajax(url, File.class, cb);
  2. If there is network error during AbstractAjaxCallback#copy(InputStream is, OutputStream os, String encoding, int max), there will generate a cached file with incomplete content.
  3. Make another ajax call with same url and cache, eg. aq.ajax(url, File.class, expire, cb), AQuery will return success with incomplete content file.

Suggestion:

in function AbstractAjaxCallback#copy, there shuold catch exception and remove incomplete cache file

Download progress status?

Hi, is it possible to get the status of a download as a float? or int between 0 and 100?

Didnt found any way... and .progress(R.id.progress) just hides the progressbar after loading... no percentage... please help.

Edit:
I don't want to have a Dialog, i just want to show the user, that ist 12% at the moment.

Context = null

Aquery v0.22.10

in list adapter:

AQuery aq = listAq.recycle(convertView);
Bitmap placeholder = aq.getCachedImage(R.drawable.image_ph);

returns NullPointerException.

For avoiding it i need to use smth like

aq.id(R.id.name).text(photo.title);

after recycle method. But it doesnot make sence if i need only async Image loading in this adapter.

Full stack trace:

08-05 14:40:11.513: ERROR/AndroidRuntime(9947): FATAL EXCEPTION: main
java.lang.NullPointerException
at com.androidquery.callback.BitmapAjaxCallback.getMemoryCached(BitmapAjaxCallback.java:384)
at com.androidquery.AbstractAQuery.getCachedImage(AbstractAQuery.java:2030)
at fm.soundtracker.ui.AsyncItemAdapter.getView(AsyncItemAdapter.java:47)
at android.widget.AbsListView.obtainView(AbsListView.java:2040)
at android.widget.GridView.onMeasure(GridView.java:1041)
at android.view.View.measure(View.java:12881)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:599)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:381)
at android.view.View.measure(View.java:12881)

In app version check not correct with version code

Sometime,when I check version app in google play Its not correct version code

06-18 10:55:05.577: W/AQuery(15656): version:1.6->1.7:8->8

version name is right but version code is must be 9., I don't know why.may be cached?
Would you tell me how to resolved it?

thank for your help

Multipart request doesn't contain headers passed by parameter

HttpURLConnection requires only two properties.

conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("Content-Type", "multipart/form-data;charset=utf-8;boundary="+ boundary);

Headers passed by parameter should be contained.

Is it possible to set the number of retries globally?

I want to do something like AjaxCallback.setNumberRetries() but I can't find anything like that.

Is it possible to set a value so that all ajaxcallback instances have that value without having to set in each individually?

JAR available on Maven Central

Hi,

I'd like to reference your library from a Maven-compatible repository. Do you have any plans to upload each version to Maven Central or another OSS repo?

Thanks,

Ben

Potential null pointer access in AbstractAjaxCallback

Hi Peter,

there are missing brackets in the If-condition in the private Method httpDo. So you will get an NullPointerException iff header is null.

private void httpDo(...)

...

-       if(GZIP && headers == null || !headers.containsKey("Accept-Encoding")){
+       if(GZIP && (headers == null || !headers.containsKey("Accept-Encoding"))){

regards,
David

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.