-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Edwin Wu
committed
Jun 16, 2017
1 parent
d13304b
commit 277b5e1
Showing
11 changed files
with
267 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 9 additions & 1 deletion
10
http-library/src/main/java/com/github/why168/http/BitmapCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
package com.github.why168.http; | ||
|
||
import android.graphics.Bitmap; | ||
import android.graphics.BitmapFactory; | ||
|
||
/** | ||
* @author Edwin.Wu | ||
* @version 2017/6/15 22:57 | ||
* @since JDK1.8 | ||
*/ | ||
public class BitmapCallback { | ||
public abstract class BitmapCallback extends Callback<Bitmap> { | ||
@Override | ||
public Bitmap parseNetworkResponse(Response response) throws Exception { | ||
byte[] body = response.getBody(); | ||
return BitmapFactory.decodeByteArray(body, 0, body.length); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 4 additions & 9 deletions
13
http-library/src/main/java/com/github/why168/http/FileCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,15 @@ | ||
package com.github.why168.http; | ||
|
||
import java.io.IOException; | ||
import java.io.File; | ||
|
||
/** | ||
* @author Edwin.Wu | ||
* @version 2017/6/15 21:57 | ||
* @since JDK1.8 | ||
*/ | ||
public class FileCallback implements Callback { | ||
public abstract class FileCallback extends Callback<File> { | ||
@Override | ||
public void onFailure(Exception e) { | ||
|
||
} | ||
|
||
@Override | ||
public void onSuccessful(String results) throws IOException { | ||
|
||
public File parseNetworkResponse(Response response) throws Exception { | ||
return null; | ||
} | ||
} |
13 changes: 5 additions & 8 deletions
13
http-library/src/main/java/com/github/why168/http/JsonCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
package com.github.why168.http; | ||
|
||
import java.io.IOException; | ||
import org.json.JSONObject; | ||
|
||
/** | ||
* @author Edwin.Wu | ||
* @version 2017/6/15 21:56 | ||
* @since JDK1.8 | ||
*/ | ||
public class JsonCallback implements Callback { | ||
@Override | ||
public void onFailure(Exception e) { | ||
|
||
} | ||
public abstract class JsonCallback extends Callback<JSONObject> { | ||
|
||
@Override | ||
public void onSuccessful(String results) throws IOException { | ||
|
||
public JSONObject parseNetworkResponse(Response response) throws Exception { | ||
String results = new String(response.getBody()); | ||
return new JSONObject(results); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.