diff --git a/README.md b/README.md
index b0bc9ab..bd2d7ee 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-DownZ
-===================
+# DownZ
+
[](https://jitpack.io/#100rabhkr/DownZLibrary) | [View release history](https://github.com/100rabhkr/DownZLibrary/releases)
DownZ is an HTTP library that boosts networking in Android apps and makes it significantly easier and faster.
@@ -18,175 +18,160 @@ DownZ offers the following benefits:
DownZ excels at handling HTTP requests.It comes with built-in support for images, JSON and Xml. By providing built-in support for the features you require, DownZ frees you from writing tons of code and finally allows you to concentrate on the logic that is specific to your app.
+---
-----------
-
-
-Download
--------------
-
+## Download
You can use Gradle
**Step 1.** Add the JitPack repository to your build file , Add it in your root build.gradle at the end of repositories:
- allprojects {
- repositories {
- ...
- maven { url 'https://jitpack.io' }
- }
+```groovy
+allprojects {
+ repositories {
+ ...
+ maven { url 'https://jitpack.io' }
}
+}
+```
**Step 2.** Add the dependency
- dependencies {
- compile 'com.github.100rabhkr:DownZLibrary:1.1'
- }
-
+```groovy
+dependencies {
+ compile 'com.github.100rabhkr:DownZLibrary:1.1'
+}
+```
Or Maven:
**Step 1.** Add the JitPack repository to your build file
-
-
- jitpack.io
- https://jitpack.io
-
-
+```xml
+
+
+ jitpack.io
+ https://jitpack.io
+
+
+```
**Step 2.** Add the dependency
-
- com.github.100rabhkr
- DownZLibrary
- 1.1
-
+```xml
+
+ com.github.100rabhkr
+ DownZLibrary
+ 1.1
+
+```
Or Sbt:
**Step 1.** Add the JitPack repository to your build file Add it in your build.sbt at the end of resolvers:
- resolvers += "jitpack" at "https://jitpack.io"
-
+```
+resolvers += "jitpack" at "https://jitpack.io"
+```
+
**Step 2.** Add the dependency
-
- libraryDependencies += "com.github.100rabhkr" % "DownZLibrary" % "1.1"
+```
+libraryDependencies += "com.github.100rabhkr" % "DownZLibrary" % "1.1"
+```
-Snapshots from Sample App
--------------
+### Snapshots from Sample App
+### Download Sample App
-
-----------
-
-Download Sample App
--------------
All the source code can be downloaded from [Github's Release page](https://github.com/100rabhkr/DownZLibrary/releases)
You can also download the sample app from [here](https://drive.google.com/open?id=0BwG2nwOU6FIWLW50V2tCYmVZZXpFc2VOQkhQMTZ1bG16cWZr)
-How do I use DownZ?
--------------------
-
-**Make Standard Request**
-
- …
- DownZ
- .from(mContext) //context
- .load(DownZ.Method.GET, “http://yoururl.com”)
- .asBitmap() //asJsonArray() or asJsonObject() or asXml() can be used depending on need
- .setCallback(new HttpListener() {
- @Override
- public void onRequest() {
-
- //On Beginning of request
-
- }
-
- @Override
- public void onResponse(Bitmap data) {
-
- if(data != null){
-
- // do something
-
- }
- }
-
- @Override
- public void onError() {
-
- //do something when there is an error
-
- }
-
- @Override
- public void onCancel() {
-
- //do something when request cancelled
-
- }
- });
-
-**Pass Header or Request Parameters (Optional)**
-
-
-
- ...
- DownZ
- .from(MainActivity.this)
- .load(DownZ.Method.GET,mUrl)
- .setHeaderParameter("key","value")
- .setRequestParameter("key1","value1")
- .setRequestParameter("key2","value2")
- .asBitmap()
- .setCallback(new HttpListener() {
- @Override
- public void onRequest() {
-
- }
-
- @Override
- public void onResponse(Bitmap bitmap) {
- if(bitmap != null){
-
- //do something
- }
- }
-
- @Override
- public void onError() {
-
- }
-
- @Override
- public void onCancel() {
-
- }
- });
-
-
-**Enable Cache**
-
-
- ...
- public class SomeActivity extends AppCompatActivity {
- ...
- CacheManager cacheManager; // we can use JSONObject, Bitmap as generic type
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- ...
- cacheManager=new CacheManager<>(40*1024*1024); // 40mb
- }
+## How do I use DownZ?
+
+### Make Standard Request
+
+```java
+DownZ.from(mContext)
+ .load(DownZ.Method.GET, "http://yoururl.com")
+ .asBitmap() //asJsonArray() or asJsonObject() or asXml() can be used depending on need
+ .setCallback(new HttpListener() {
+ @Override
+ public void onRequest() {
+ //On Beginning of request
+ }
+
+ @Override
+ public void onResponse(Bitmap data) {
+ if (data != null) {
+ // do something
+ }
+ }
+
+ @Override
+ public void onError() {
+ //do something when there is an error
+ }
+
+ @Override
+ public void onCancel() {
+ //do something when request cancelled
+ }
+ });
+```
+
+### Pass Header or Request Parameters (Optional)
+
+```java
+DownZ.from(MainActivity.this)
+ .load(DownZ.Method.GET, mUrl)
+ .setHeaderParameter("key", "value")
+ .setRequestParameter("key1", "value1")
+ .setRequestParameter("key2", "value2")
+ .asBitmap()
+ .setCallback(new HttpListener() {
+ @Override
+ public void onRequest() {
+
+ }
+
+ @Override
+ public void onResponse(Bitmap bitmap) {
+ if (bitmap != null) {
+ //do something
+ }
+ }
+
+ @Override
+ public void onError() {
+
+ }
+
+ @Override
+ public void onCancel() {
+
+ }
+ });
+```
+### Enable Cache
+
+```java
+public class SomeActivity extends AppCompatActivity {
+ // ...
+ CacheManager cacheManager; // we can use JSONObject, Bitmap as generic type
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ // ...
+ cacheManager = new CacheManager<>(40 * 1024 * 1024); // 40mb
+ }
- public void OnRequestMade(View v){
- DownZ
- .from(this)
+ public void OnRequestMade(View v) {
+ DownZ.from(this)
.load(DownZ.Method.GET, "http://www.url.com")
.asJsonArray()
.setCacheManager(cacheManager)
@@ -198,7 +183,7 @@ How do I use DownZ?
@Override
public void onResponse(JSONArray data) {
- if(data!=null){
+ if (data != null) {
// do some stuff here
}
}
@@ -214,30 +199,28 @@ How do I use DownZ?
}
});
}
+}
+```
+
+### Load Image into ImageView
+
+```java
+public class SomeActivity extends AppCompatActivity {
+ CacheManager cacheManager;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ // ...
+ cacheManager = new CacheManager<>(40 * 1024 * 1024); // 40mb
+ imageview = (ImageView) findViewById(R.id.image_profile);
+ imageview.setDrawingCacheEnabled(true); //can be used if Image has to be shared afterwards
+ imageview.buildDrawingCache();
+
}
-
-**Load Image into ImageView**
-
-
- ...
- public class SomeActivity extends AppCompatActivity {
- ...
- CacheManager cacheManager;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- ...
- cacheManager=new CacheManager<>(40*1024*1024); // 40mb
- imageview = (ImageView) findViewById(R.id.image_profile);
- imageview.setDrawingCacheEnabled(true); //can be used if Image has to be shared afterwards
- imageview.buildDrawingCache();
- ...
-
- }
//event to make request
- public void btnLoadImageClicked(View v){
- DownZ
- .from(this)
+ public void btnLoadImageClicked(View v) {
+ DownZ.from(this)
.load(DownZ.Method.GET, "http://www.url.com/image.jpg")
.asBitmap()
.setCacheManager(cacheManager)
@@ -245,13 +228,11 @@ How do I use DownZ?
@Override
public void onRequest() {
//fired when request begin
-
-
- }
+ }
@Override
public void onResponse(Bitmap data) {
- if(data!=null){
+ if (data != null) {
// do some stuff here
imageview.setImageBitmap(data);
}
@@ -268,55 +249,52 @@ How do I use DownZ?
}
});
}
+}
+```
- }
-
-**Removing from Cache**
-
- ...
- public class SomeActivity extends AppCompatActivity {
- ...
- CacheManager cacheManager;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- ...
- String mUrl = "http://yoururl.com/image.png";
- cacheManager=new CacheManager<>(40*1024*1024); // 40mb
- imageview = (ImageView) findViewById(R.id.image_profile);
- imageview.setDrawingCacheEnabled(true); //can be used if Image has to be shared afterwards
- imageview.buildDrawingCache();
- ...
-
- }
- //event to clear item from cache
- public void btntoClearCache(View v){
+### Removing from Cache
+
+```java
+public class SomeActivity extends AppCompatActivity {
+
+ // ...
+ CacheManager cacheManager;
- cacheManager.removeDataFromCache(mUrl);
- }
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+
+ //...
+ String mUrl = "http://yoururl.com/image.png";
+ cacheManager = new CacheManager<>(40 * 1024 * 1024); // 40mb
+ imageview = (ImageView) findViewById(R.id.image_profile);
+ imageview.setDrawingCacheEnabled(true); //can be used if Image has to be shared afterwards
+ imageview.buildDrawingCache();
+ // ...
}
+ //event to clear item from cache
+ public void btntoClearCache(View v) {
+ cacheManager.removeDataFromCache(mUrl);
+ }
+}
+```
-Getting Help
-------------
+## Getting Help
To report a specific problem or feature request in DownZ, you can [open a new issue on Github](https://github.com/100rabhkr/DownZLibrary/issues/new). For questions, suggestions, or even to say 'hi', just drop an email at skkumar.sk94@gmail.com
-Contributing
-------------
+## Contributing
If you like DownZ, please contribute by writing at skkumar.sk94@gmail.com. Your help and support would make DownZ even better. Before submitting pull requests, contributors must sign [Google's individual contributor license agreement.](https://cla.developers.google.com/about/google-individual)
-Author
-------
+## Author
Saurabh Kumar - [@100rabhkr](https://github.com/100rabhkr) on GitHub, [@NotSaurabhKumar](https://twitter.com/NotSaurabhKumar) on Twitter
-License
--------
+## License
MIT See the [LICENSE](https://github.com/100rabhkr/DownZLibrary/blob/master/LICENSE) file for details.
-Disclaimer
-----------
+## Disclaimer
This is not an official Google product.