Skip to content

Commit 2aaeae6

Browse files
*added network layer
*Glide
1 parent 8c0649d commit 2aaeae6

File tree

6 files changed

+163
-0
lines changed

6 files changed

+163
-0
lines changed

app/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
/build
2+
/local.properties
3+
/.idea/workspace.xml
4+
/.idea/libraries
5+
.DS_Store
6+
/build
7+
/captures

app/build.gradle

+7
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,11 @@ dependencies {
2525
compile 'com.android.support:appcompat-v7:23.1.1'
2626
compile 'com.android.support:design:23.1.1'
2727
compile 'com.jakewharton:butterknife:7.0.1'
28+
compile 'com.google.code.gson:gson:2.4'
29+
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
30+
compile 'com.github.bumptech.glide:glide:3.6.1'
31+
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
32+
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
33+
compile 'com.squareup.okhttp:okhttp:2.5.0'
34+
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
2835
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
package com.example.techjini.myappportfolio.NetworkLayer;
2+
3+
import java.util.HashMap;
4+
import java.util.Map;
5+
6+
import retrofit.Call;
7+
import retrofit.http.Body;
8+
import retrofit.http.DELETE;
9+
import retrofit.http.Field;
10+
import retrofit.http.FieldMap;
11+
import retrofit.http.FormUrlEncoded;
12+
import retrofit.http.GET;
13+
import retrofit.http.Header;
14+
import retrofit.http.Headers;
15+
import retrofit.http.Multipart;
16+
import retrofit.http.POST;
17+
import retrofit.http.PUT;
18+
import retrofit.http.Part;
19+
import retrofit.http.Path;
20+
import retrofit.http.Query;
21+
22+
/**
23+
* Created by Shakeeb on 1/11/2016
24+
*/
25+
public interface ApiService {
26+
String baseURL="http://image.tmdb.org/t/p/w185";
27+
28+
//String baseURL="http://52.25.62.3/api/rest/techjini/";
29+
//http://52.25.62.3/api/rest/techjini/products/list/zipcode/560010/tokenid/9dc7777af14d3a886132fc1fda72b22a
30+
// String url = "api/rest/techjini/products/list/zipcode/560010";
31+
//api/rest/techjini/v1/catalogs/
32+
/* String url = "api/rest/techjini/v1/catalogs/dc_id//pincode//prefer_teaser_menu//device_resolution/mdpi";
33+
//String url = "api/rest/techjini/products/list/zipcode/560010/tokenid/9dc7777af14d3a886132fc1fda72b22a";
34+
35+
String createOrAddtoCartUrl = "api/rest/techjini/checkout/cart/create";
36+
37+
String checkProductAvailableAPI = "api/rest/techjini/inventory/list/zipcode/560010";
38+
39+
String signUpUrl = "api/rest/techjini/customer/create/";
40+
41+
//String loginAPIUrl = "api/rest/techjini/customer/login/email/customer@example.com/password/password/websiteid/1";
42+
String loginAPIUrl = "api/rest/techjini/v1/login/";
43+
44+
45+
final String OrderHistoryUrl = "api/rest/techjini/v1/customer/orderhistory";
46+
47+
final String GetZipCodeUrl = "api/rest/techjini/v1/postalcodes/page_index/";
48+
final String GetCatLog = "api/rest/techjini/v1/catalogs/";
49+
final String VERIFY_OTP = "api/rest/techjini/v1/verifyotp/";
50+
final String RESEND_OTP = "api/rest/techjini/v1/resendotp/";
51+
final String addReviewURL = "api/rest/techjini/v1/product/review/add";
52+
final String ForgotPasswordURL="api/rest/techjini/v1/forgotpassword/";
53+
final String UpdateProfileURL="api/rest/techjini/v1/customer/update/";
54+
final String ChangePasswordURL="api/rest/techjini/v1/customer/password/";
55+
56+
final String addAddressAPIURL = "api/rest/techjini/v1/customer/address/";
57+
58+
final String updateAddressAPIURL = "api/rest/techjini/v1/customer/address/update";
59+
60+
@GET("products")
61+
@Headers({"Content-Type: application/json", "Accept: application/json"})
62+
Call<Map<String, Map<String, String>>> getNewsList();
63+
//.baseUrl("http://52.25.62.3/api/rest/techjini/products/list/zipcode/560010")
64+
65+
@GET(url)
66+
@Headers({"Content-Type: application/json", "Accept: application/json"})
67+
Call<CatalogModel> getCatalog(@Header("fltoken") String fltoken, @Header("guid") String guid);*/
68+
69+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.example.techjini.myappportfolio.NetworkLayer;
2+
3+
/**
4+
* Created by Devavrata on 12/15/2015.
5+
*/
6+
public class ApiUrls {
7+
8+
public static final String baseUrl = "";
9+
10+
public static final String catalogApiUrl = "";
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.example.techjini.myappportfolio.NetworkLayer;
2+
3+
/**
4+
* Created by Shakeeb on 2/11/2016.
5+
*/
6+
public class NetworkHelper {
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package com.example.techjini.myappportfolio.NetworkLayer;
2+
3+
import android.util.Log;
4+
5+
import java.util.HashMap;
6+
import java.util.Map;
7+
8+
import retrofit.Call;
9+
import retrofit.Callback;
10+
import retrofit.GsonConverterFactory;
11+
import retrofit.Retrofit;
12+
13+
/**
14+
* Created by techjini on 5/11/15.
15+
*/
16+
public class NetworkManager {
17+
private static final String TAG = NetworkManager.class.getSimpleName();
18+
private static NetworkManager ourInstance;
19+
private ApiService apiService;
20+
21+
public static NetworkManager getInstance() {
22+
if (ourInstance == null) {
23+
ourInstance = new NetworkManager();
24+
}
25+
return ourInstance;
26+
}
27+
28+
29+
private Retrofit getRetroFit() {
30+
Retrofit retrofit = new Retrofit.Builder()
31+
.baseUrl("http://api.themoviedb.org/3/discover/movie?").addConverterFactory(GsonConverterFactory.create())
32+
.build();
33+
return retrofit;
34+
35+
}
36+
/*
37+
38+
public void getNews(Callback<Map<String, Map<String, String>>> callback) {
39+
ApiService service = getApiService();
40+
Call<Map<String, Map<String, String>>> model = service.getNewsList();
41+
model.enqueue(callback);
42+
43+
}
44+
45+
public void getCatalog(Callback<CatalogModel> catalogModelCallback) {
46+
Log.d(TAG, "getCatalog: ");
47+
ApiService apiService = getApiService();
48+
Call<CatalogModel> catalogModel = apiService.getCatalog("123456","1234567");
49+
catalogModel.enqueue(catalogModelCallback);
50+
}
51+
*/
52+
53+
54+
55+
private ApiService getApiService() {
56+
57+
if (apiService == null)
58+
apiService = getRetroFit().create(ApiService.class);
59+
60+
return apiService;
61+
}
62+
63+
}

0 commit comments

Comments
 (0)