|
1 | 1 | package com.amit.api; |
2 | 2 |
|
3 | | -import android.annotation.SuppressLint; |
4 | 3 | import android.content.Context; |
5 | 4 | import android.graphics.Bitmap; |
6 | 5 | import android.graphics.BitmapFactory; |
7 | | -import android.os.Build; |
8 | | -import android.provider.Settings.Secure; |
| 6 | +import android.support.annotation.NonNull; |
9 | 7 | import android.support.v4.util.Pair; |
10 | 8 | import android.util.Log; |
11 | 9 |
|
|
24 | 22 | * 2018 April 17 - Tuesday - 12:56 PM |
25 | 23 | **/ |
26 | 24 | @SuppressWarnings("unused") |
27 | | -@SuppressLint("HardwareIds") |
28 | 25 | public class ApiServices |
29 | 26 | { |
30 | 27 | private static final String TAG = ApiServices.class.getSimpleName(); |
31 | 28 |
|
32 | | - private String apiPath, mDeviceID; |
| 29 | + private String apiPath; |
33 | 30 | private SharedPreferenceData sharedPreferenceData; |
34 | 31 |
|
35 | | - public ApiServices(Context context) |
| 32 | + public ApiServices(@NonNull Context context) |
36 | 33 | { |
37 | 34 | this.sharedPreferenceData = new SharedPreferenceData(context); |
38 | 35 |
|
39 | 36 | // set api path before using it |
40 | 37 | // this path will consist of the url which is repeated in every api |
41 | 38 | // Ex: http://www.example.com/api/ |
42 | 39 | this.apiPath = sharedPreferenceData.getValue("apiPath"); |
43 | | - |
44 | | - // this will get the device id of the device |
45 | | - this.mDeviceID = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID); |
46 | | - } |
47 | | - |
48 | | - public String getDeviceID() |
49 | | - { |
50 | | - return mDeviceID; |
51 | | - } |
52 | | - |
53 | | - /** |
54 | | - * get device name method |
55 | | - * |
56 | | - * this method will get the name of the device |
57 | | - **/ |
58 | | - public String getDeviceName() |
59 | | - { |
60 | | - String manufacturer = Build.MANUFACTURER; |
61 | | - String model = Build.MODEL; |
62 | | - |
63 | | - if (model.startsWith(manufacturer)) |
64 | | - { |
65 | | - return capitalizeString(model); |
66 | | - } |
67 | | - else |
68 | | - { |
69 | | - return capitalizeString(manufacturer + " " + model); |
70 | | - } |
71 | | - } |
72 | | - |
73 | | - /** |
74 | | - * capitalizeString method |
75 | | - * |
76 | | - * this method will capitalizeString or set the string to upper case |
77 | | - * |
78 | | - * @param string - string to capitalize |
79 | | - * return - will return the string which was passed in capitalize form |
80 | | - **/ |
81 | | - private String capitalizeString(String string) |
82 | | - { |
83 | | - if (string == null || string.length() == 0) |
84 | | - { |
85 | | - return ""; |
86 | | - } |
87 | | - |
88 | | - char first = string.charAt(0); |
89 | | - |
90 | | - if (Character.isUpperCase(first)) |
91 | | - { |
92 | | - return string; |
93 | | - } |
94 | | - else |
95 | | - { |
96 | | - return Character.toUpperCase(first) + string.substring(1); |
97 | | - } |
98 | 40 | } |
99 | 41 |
|
100 | 42 | /** |
@@ -224,15 +166,19 @@ public Pair<Integer, String> makeAPICall(final String apiName, final String requ |
224 | 166 | * |
225 | 167 | * @param apiPath - this parameter will contain the apiPath where the image has to be downloaded |
226 | 168 | * this apiPath parameter will contain the entire path for the image to be downloaded. |
| 169 | + * |
227 | 170 | * @param requestType - request type will be GET OR POST |
| 171 | + * |
228 | 172 | * @param parameter - if any information has to be sent in body then set parameters |
229 | 173 | * use json object for this parameter. |
230 | 174 | * |
231 | 175 | * return - pair of integer and bitmap value |
232 | 176 | * where integer will be the response code |
233 | 177 | * and bitmap will be the file uploaded. |
234 | 178 | * |
| 179 | + * will be removed in next release |
235 | 180 | **/ |
| 181 | + @Deprecated |
236 | 182 | public Pair<Integer, Bitmap> getBitmapImageFromServer(String apiPath, String requestType, String parameter) |
237 | 183 | { |
238 | 184 | Bitmap resultVal = null; |
|
0 commit comments