Code Monkey home page Code Monkey logo

volleyplus's Introduction

dworks

DWorkS

Build Setup

# install dependencies
$ yarn install

# serve with hot reload at localhost:3000
$ yarn run dev

# build for production and launch server
$ yarn run build
$ yarn start

# generate static project
$ yarn run generate

For detailed explanation on how things work, checkout Nuxt.js docs.

volleyplus's People

Contributors

1hakr avatar cristianomad avatar mu-hasan avatar puresprout 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

volleyplus's Issues

example for video

Hi
in your documentation you specified that imagecache-ing supports among other video cache-ing. Can you provide a example?

Progress Bar in MultiPartRequest

how to use progressbar in multipart request?

SimpleMultiPartRequest smpReq = new SimpleMultiPartRequest(Request.Method.POST, Functions.MSG_URL, new Response.Listener<String>() { @Override public void onResponse(String response) {..........

Request Failure when using data

Hi,

I successfully implemented a SimpleMultiPartRequest with both string and file params; file param is optional in my case.

But now the issue is, my requests keep failing whenever am using data(edge or 3G) not wifi; in fact it is very fast on wifi. I have to resubmit severally for it to work.

I have tried increasing the time in retry policy but still not working. Other requests(JsonObjectRequest and JsonArrayRequest) are however ok.

What could be the issue here?

Thanks

volley error = -1

Volley error some time is returned by -1 , and ten work correctly

SimpleMultipartRequest always returns octet-stream file extension

I am working with an android application where I am trying to upload a file to server with SimpleMultipartRequest, either I upload the jpeg,pdf,png but i always receive xyz.octet-stream file path in response. Even if I add some extra parameter. Below is the code for the same.

SimpleMultiPartRequest request = new SimpleMultiPartRequest(methodType, url, new Response.Listener() {

        @Override
        public void onResponse(String s) {

            uploadSettable.set(s);
        }
    }, new Response.ErrorListener() {

        @Override
        public void onErrorResponse(VolleyError volleyError) {

            uploadSettable.setException(volleyError);
        }
    }) {

        @Override
        public Map<String, String> getFilesToUpload() {
            Map<String, String> map = new HashMap<>();
            map.put("FileData", filePath);
            return map;
        }


        @Override
        public Map<String, MultiPartParam> getMultipartParams() {

            HashMap<String, MultiPartParam> stringMultiPartParamHashMap = new HashMap<>();
            stringMultiPartParamHashMap.put("Content-Type",new MultiPartParam("Content-Type","image/jpeg"));

            return super.getMultipartParams();
        }

        @Override
        public int getMethod() {
            return Method.POST;
        }


        @Override
        public Map<String, String> getHeaders() throws AuthFailureError {

            Map headerMap = new HashMap();
            headerMap.put(ServiceConfig.AUTHORIZATION_KEY, ServiceConfig.BEARER_KEY + SharedPrefUtil.getAccessToken(
                    ServiceConfig.ACCESS_TOKEN_KEY, KeyConstants.SHARED_PREF_DEFAULT_VALUE, DoctorApplicationClass.getInstance().getBaseContext()));
            return headerMap;
        }

        @Override
        public void onProgress(final long transferredBytes, final long totalSize) {

            fileSize = totalSize;

            super.onProgress(transferredBytes, totalSize);

            new Thread(new Runnable() {

                @Override
                public void run() {

                    if (progressBarStatus < totalSize) {

                        progressBarStatus = (int) ((transferredBytes * 100) / totalSize);
                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        progressBarHandler.post(new Runnable() {
                            public void run() {
                                progressBar.setProgress(progressBarStatus);
                            }
                        });

                    }

                    if (progressBarStatus >= totalSize) {

                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        progressBar.dismiss();

                    }
                }
            }).start();
        }
    };

Is this library using up to date Volley source code?

I was wondering if this library is a plus to the current Google Volley library(so, using the Volley library as an up to date core), or it uses an old version of that library and it has couple of improvements.
Anyway, can you tell me when was the last time the core library was updated to the version delivered by Google on their git host?

Thanks!

MultipartReqest Example

Can you provide any example to upload image on server(Multipart request).i didnt find any example.
Please help me..
Thanx in advance.

NetworkImageViewPlus wrap_content attribute doesnt work

Hi guys,
When I using NetworkImageViewPlus in my adapter, I found wrap_content attribute caused height=0, width=0, when I wanted to view the full image.

Here is my view

holder.mImage.setImageUrl(mData.get(position), ImageUtil.getImageLoader());
Log.d("PictureAdapter", "height = " + holder.mImage.getHeight());
Log.d("PictureAdapter", "width = " + holder.mImage.getWidth());

Logs showed me both height and width are 0.

And my ImageLoader is down here.

mImageLoader = new SimpleImageLoader(RequestManager.getRequestQueue(), BitmapImageCache.getInstance(null, 0.5F));

B.R.
Jinsen

anonymous class derived from ErrorListener must either be declared abstract or implement abstract method onErrorResponse(VolleyError error) in ErrorListener

 JSONObject jsonParams = new JSONObject(params);
        final JsonObjectRequest jsObjRequest = new JsonObjectRequest(context, Request.Method.POST, SERVER_URL, jsonParams, new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject response) {
                Log.d("deletePost", "response: " + response);
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                Log.e("deletePost", "error: " + error);
            }
        });

        VolleySingleton.getInstance(context).addToRequestQueue(jsObjRequest);

This is the error I'm getting from Androdi Studio, I can compile and run it without a problem:
anonymous class derived from ErrorListener must either be declared abstract or implement abstract method onErrorResponse(VolleyError error) in ErrorListener

Tickle Request is Not Work!

My simple code is doesnt work, why?!

RequestTickle mRequestTickle = VolleyTickle.newRequestTickle(getApplicationContext());
String url = "http://yad.ptapp.ir/core/v1/shahid";

        StringRequest stringRequest = new StringRequest(Request.Method.POST, url, null, null);
        mRequestTickle.add(stringRequest);
        NetworkResponse response = mRequestTickle.start();

        if (response.statusCode == 200) {
            String data = VolleyTickle.parseResponse(response);
            tools.Alert(this,data);
        }
        else{
            tools.Alert(this,"Error!");
        }

Confused about which to import

I found there's a subfolder "plus" everywhere.
E.g. for "SimpleImageLoader", shall I import
"com.android.cache.SimpleImageLoader"
or "com.android.cache.plus.SimpleImageLoader" ???
I compared two files and there're minor differences, which one is the correct one to use?

BTW, could you pls add an example to show how to use onProgress in upload/download ?

How to get file path cache?

Sorry my both English because I am Brazilian and I'm using google translator, I need to take the path of the file is cached, because I want to open the image with an intent with the default viewer and download it again is not legal. and also would like to share it on whatsapp power. Thank U.

MultiPartRequest does not work properly

nice work with Volley Plus, but it has some little bug here, please fix it up;

MultiPartRequest can not work with Volley plus, both HurlStack and HttpClientStack;

when MultiPartRequest work with HurlStack,the server will return a error code 411;
when MultiPartRequest work with HtttpClientStatck,the PostRequest will be add a wrong header with multipart/form-data body,

attemptRetryOnUnknownException and retry policy bug

I am not certain that why there exists an attemptRetryOnUnknownException() when there is an attemptRetryOnException(). The difference is in this line:

RetryPolicy retryPolicy = new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS, 
    3, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);

Which is a bug, because if an unknown exception happens, then the retry policy which is specified by the programmer will be ignored (this is creating a completely new default retry policy instead of using the one that the request already has), and this actually produces an infinite loop. Because every time the exception occurs a new retry policy is created with 3 attempts, so the attempts will never run out.

An easy way to produce the bug is to start() a long running request in RequestTickle (For example a large file upload using multipart) and while in the middle of upload, disconnect internet connection. This will result an IOException with Status -1, which will be interpreted as an UnknownException, and so happens the case above.

addMultipartParam

How to use method "addMultipartParam",can you give me a example?
I need to add the string parameters of a multipart request,also,I want to upload files.
Those are what I must to add:
params.put("source", val1);
params.put("access_token", val2);
params.put("status", val3);
Can you understand me?

SimpleMultiPartRequest Unexpected response code 403

SimpleMultiPartRequest multipartRequest = new SimpleMultiPartRequest( Request.Method.POST,"url",this, this) { @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String,String> params = new HashMap<String, String>(); params.put("Content-Type","application/x-www-form-urlencoded"); // params.put("Content-Type","multipart/form-data; boundary="+ "blah" + "; charset=utf-8"); return params; } }; //add files AppInit.getInstance(getBaseContext()).addToRequestQueue(multipartRequest);

How to use RequestTickle

Hi,
I am getting RequestTickle.start: Unhandled exception android.os.NetworkOnMainThreadException.
How can I use RequestTickle to perform sync request?

I used your sample to test.

RequestTickle mRequestTickle = VolleyTickle.newRequestTickle(getApplicationContext());

StringRequest stringRequest = new StringRequest(Request.Method.GET, url, null, null);
mRequestTickle.add(stringRequest);
NetworkResponse response = mRequestTickle.start();

if (response.statusCode == 200) {
    String data = VolleyTickle.parseResponse(response);
    Log.i("Response",data);
}
else{
    Log.e("error",mRequestTickle.getError().getMessage());
}

Using this in AsyncTask<> gives the response.Do I need to include the call in AsyncTask to work?Then how can I get and return the response?

Note : Works also if ThreadPolicy is set to permitAll.

Do we support "https" ?

I am a rookie here, we use http now, but we may use https instead.
I would like to know, do we support https ?

Image quality

I use this code for show an image from an URL, the problem is the image quality that is not so good, there is a way for improve the image quality?

NetworkImageViewPlus mNetworkImageView;
mNetworkImageView = (NetworkImageViewPlus) viewLayout.findViewById(R.id.networkImageView);
mNetworkImageView.setAdjustViewBounds(true);
mNetworkImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
mNetworkImageView.setImageUrl(DataSource.base_url + string, mImageLoader);
mNetworkImageView.setDefaultImageResId(R.drawable.no_image);
mNetworkImageView.setErrorImageResId(R.drawable.no_image);

Returning null object when proguard on

Hi. Im having problems with parsing response with proguard on. Object is always empty.

This is my proguard file

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-dump class_files.txt
-printseeds seeds.txt
-printusage unused.txt
-printmapping mapping.txt
-optimizations !code/simplification/arithmetic,!field/,!class/merging/

-allowaccessmodification
-keepattributes Annotation
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-repackageclasses ''

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-dontnote com.android.vending.licensing.ILicensingService

Explicitly preserve all serialization members. The Serializable interface

is only a marker interface, so it wouldn't save them.

-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}

Preserve all native method names and the names of their classes.

-keepclasseswithmembernames class * {
native ;
}

-keepclasseswithmembernames class * {
public (android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
public (android.content.Context, android.util.AttributeSet, int);
}

Preserve static fields of inner classes of R classes that might be accessed

through introspection.

-keepclassmembers class *.R$ {
public static ;
}

Preserve the special static methods that are required in all enumeration classes.

-keepclassmembers enum * {
public static *[] values();
public static *
valueOf(java.lang.String);
}

-keep public class * {
public protected *;
}

-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

---------------End: proguard configuration common for all Android apps ----------

---------------Begin: proguard configuration for Gson ----------

Gson uses generic type information stored in a class file when working with fields. Proguard

removes such information by default, so configure it to keep all of it.

-keepattributes Signature

For using GSON @expose annotation

-keepattributes Annotation

Gson specific classes

-keep class sun.misc.Unsafe { *; }

-keep class com.google.gson.stream.** { *; }

Application classes that will be serialized/deserialized over Gson

-keep class com.google.gson.examples.android.model.** { *; }

---------------End: proguard configuration for Gson ----------

Volley

-keep class com.android.volley.* { ; }
-keep interface com.android.volley.
* { ; }
-keep class org.apache.

-dontwarn org.apache.**

Goolge

-keep class com.google.* {;}
-keepclassmembers class com.google.
* {;}
-dontwarn com.google.

Application crashes on HTTP 404 status code

when server return HTTP status code 404 then application crashes.
new Response.ErrorListener() {

                @Override
                public void onErrorResponse(VolleyError error) {
                    Log.e(TAG, "Registration Error: " + error.getMessage());
                    Toast.makeText(getApplicationContext(),
                            error.getMessage(), Toast.LENGTH_LONG).show();
                    hideDialog();
                }
            })

in this method and return null Toast

GsonRequest and ISODate

Your Gson object doesn't deserialize an ISODate (ISODate("2015-03-24T14:58:42.570Z")) into a Date object.

Download file with download progress in %

Hi , i am not able to find any sample implementation to do this , before i was using volley and now i chose to use volleyPlus only to get the download progress %, and now i am unable to implement this , can anyone help me with a sample or any snippet to get download progress

thanks ,
Vinay

Request Identity onErrorResponse Section

public void getTestDats(String unique_id) {
    final String tag = "testList";
    String url = Constants.BASE_URL + "test_module.php";
    Map<String, String> params = new HashMap<String, String>();
    params.put("user_id", SharedPreferenceUtil.getString(Constants.PrefKeys.PREF_USER_ID, "1"));
    params.put("unique_id", unique_id);//1,2,3,4,5
    DataRequest loginRequest = new DataRequest(Method.POST, url, params, new Response.Listener<JSONObject>() {
        @Override
        public void onResponse(JSONObject response) {
            switch (response.optInt("unique_id")) {
                case 1:
                    //task 1
                    break;
                case 2:
                    //task 2
                    break;
                default:
                    //nothing
            }
        }
    }, new ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
                //I want to know which unique_id request is failed 
        }
    });
    loginRequest.setRetryPolicy(new DefaultRetryPolicy(20000, 0, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
    AppController.getInstance().addToRequestQueue(loginRequest);
} 

I'm trying to identity which request is failed with having unique_id.

I'm calling getTestDats("1") function with unique_id. And function called 10 times and all the api call in addToRequestQueue.

When API go into Success part its working as per code. But when API go into Error part I didn't identity the request. Is there any way to know my request param so I can retry with particular unique_id request.

Make ActionBarPlus a submodule of this project?

Cloning this would require less effort if ActionBarPlus was included in this project as a submodule. Users may not be compelled to install ActionBarPlus just to see how VolleyPlus examples work

Singleton requestQueue?

do i need to make a singleton of this volleyPlus lib or you already handle it?
sorry for my bad english

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.