sunnnl

뷰 스플래싱 완료, api 동작 확인 필요

...@@ -38,10 +38,10 @@ public class Api { ...@@ -38,10 +38,10 @@ public class Api {
38 ApiResult apiResult; 38 ApiResult apiResult;
39 try { 39 try {
40 String queryString = ""; 40 String queryString = "";
41 - if(("GET".equals(method) || "DELETE".equals(method)) && params != null) { 41 + if (("GET".equals(method) || "DELETE".equals(method)) && params != null) {
42 Set<String> keys = params.keySet(); 42 Set<String> keys = params.keySet();
43 Iterator<String> iter = keys.iterator(); 43 Iterator<String> iter = keys.iterator();
44 - while(iter.hasNext()) { 44 + while (iter.hasNext()) {
45 String key = iter.next(); 45 String key = iter.next();
46 queryString += "&" + key + "=" + params.get(key).getAsString(); 46 queryString += "&" + key + "=" + params.get(key).getAsString();
47 } 47 }
...@@ -52,12 +52,12 @@ public class Api { ...@@ -52,12 +52,12 @@ public class Api {
52 HttpURLConnection conn = (HttpURLConnection) url.openConnection(); 52 HttpURLConnection conn = (HttpURLConnection) url.openConnection();
53 conn.setRequestMethod(method); 53 conn.setRequestMethod(method);
54 54
55 - if(accessToken != null) { 55 + if (accessToken != null) {
56 conn.setRequestProperty("access_token", accessToken); 56 conn.setRequestProperty("access_token", accessToken);
57 } 57 }
58 58
59 - if("POST".equals(method) || "PUT".equals(method)) { 59 + if ("POST".equals(method) || "PUT".equals(method)) {
60 - if(params != null) { 60 + if (params != null) {
61 OutputStream os = conn.getOutputStream(); 61 OutputStream os = conn.getOutputStream();
62 os.write(params.toString().getBytes()); 62 os.write(params.toString().getBytes());
63 os.flush(); 63 os.flush();
...@@ -68,13 +68,13 @@ public class Api { ...@@ -68,13 +68,13 @@ public class Api {
68 int status = conn.getResponseCode(); 68 int status = conn.getResponseCode();
69 Log.d("status", String.valueOf(status)); 69 Log.d("status", String.valueOf(status));
70 InputStream is = conn.getErrorStream(); 70 InputStream is = conn.getErrorStream();
71 - if(is == null) 71 + if (is == null)
72 is = conn.getInputStream(); 72 is = conn.getInputStream();
73 73
74 StringBuilder builder = new StringBuilder(); 74 StringBuilder builder = new StringBuilder();
75 BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); 75 BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
76 String line; 76 String line;
77 - while((line = reader.readLine()) != null) { 77 + while ((line = reader.readLine()) != null) {
78 builder.append(line); 78 builder.append(line);
79 } 79 }
80 80
...@@ -103,7 +103,7 @@ public class Api { ...@@ -103,7 +103,7 @@ public class Api {
103 } 103 }
104 104
105 static public void auth(String doorId, final Callback callback) { 105 static public void auth(String doorId, final Callback callback) {
106 - if("123123123".equals(doorId)) { 106 + if ("123123123".equals(doorId)) {
107 // 테스트를 위한 super pass 107 // 테스트를 위한 super pass
108 callback.callbackMethod(new Auth(true, "superpass")); 108 callback.callbackMethod(new Auth(true, "superpass"));
109 return; 109 return;
...@@ -115,9 +115,9 @@ public class Api { ...@@ -115,9 +115,9 @@ public class Api {
115 @Override 115 @Override
116 public void callbackMethod(Object obj) { 116 public void callbackMethod(Object obj) {
117 ApiResult apiResult = (ApiResult) obj; 117 ApiResult apiResult = (ApiResult) obj;
118 - if(apiResult.isSuccess()) { 118 + if (apiResult.isSuccess()) {
119 JsonObject resp = (JsonObject) apiResult.getData(); 119 JsonObject resp = (JsonObject) apiResult.getData();
120 - if(resp.get("is_available").getAsBoolean()) { 120 + if (resp.get("is_available").getAsBoolean()) {
121 callback.callbackMethod(new Auth(true, resp.get("access_token").getAsString())); 121 callback.callbackMethod(new Auth(true, resp.get("access_token").getAsString()));
122 } else { 122 } else {
123 callback.callbackMethod(new Auth(false)); 123 callback.callbackMethod(new Auth(false));
...@@ -134,7 +134,7 @@ public class Api { ...@@ -134,7 +134,7 @@ public class Api {
134 @Override 134 @Override
135 public void callbackMethod(Object obj) { 135 public void callbackMethod(Object obj) {
136 ApiResult apiResult = (ApiResult) obj; 136 ApiResult apiResult = (ApiResult) obj;
137 - if(apiResult.isSuccess()) { 137 + if (apiResult.isSuccess()) {
138 JsonObject resp = (JsonObject) apiResult.getData(); 138 JsonObject resp = (JsonObject) apiResult.getData();
139 callback.callbackMethod(new Setting(resp.get("recording").getAsBoolean())); 139 callback.callbackMethod(new Setting(resp.get("recording").getAsBoolean()));
140 } else { 140 } else {
...@@ -152,7 +152,7 @@ public class Api { ...@@ -152,7 +152,7 @@ public class Api {
152 @Override 152 @Override
153 public void callbackMethod(Object obj) { 153 public void callbackMethod(Object obj) {
154 ApiResult apiResult = (ApiResult) obj; 154 ApiResult apiResult = (ApiResult) obj;
155 - if(apiResult.isSuccess()) { 155 + if (apiResult.isSuccess()) {
156 callback.callbackMethod(true); 156 callback.callbackMethod(true);
157 } else { 157 } else {
158 callback.callbackMethod(null); 158 callback.callbackMethod(null);
...@@ -169,7 +169,7 @@ public class Api { ...@@ -169,7 +169,7 @@ public class Api {
169 @Override 169 @Override
170 public void callbackMethod(Object obj) { 170 public void callbackMethod(Object obj) {
171 ApiResult apiResult = (ApiResult) obj; 171 ApiResult apiResult = (ApiResult) obj;
172 - if(apiResult.isSuccess()) { 172 + if (apiResult.isSuccess()) {
173 callback.callbackMethod(new Boolean(true)); 173 callback.callbackMethod(new Boolean(true));
174 } else { 174 } else {
175 callback.callbackMethod(null); 175 callback.callbackMethod(null);
...@@ -183,12 +183,12 @@ public class Api { ...@@ -183,12 +183,12 @@ public class Api {
183 @Override 183 @Override
184 public void callbackMethod(Object obj) { 184 public void callbackMethod(Object obj) {
185 ApiResult apiResult = (ApiResult) obj; 185 ApiResult apiResult = (ApiResult) obj;
186 - if(apiResult.isSuccess()) { 186 + if (apiResult.isSuccess()) {
187 JsonObject resp = (JsonObject) apiResult.getData(); 187 JsonObject resp = (JsonObject) apiResult.getData();
188 - if(resp.has("remoteHistoryList")) { 188 + if (resp.has("remoteHistoryList")) {
189 ArrayList<RemoteRecord> remoteRecords = new ArrayList<RemoteRecord>(); 189 ArrayList<RemoteRecord> remoteRecords = new ArrayList<RemoteRecord>();
190 Iterator it = resp.getAsJsonArray("remoteHistoryList").iterator(); 190 Iterator it = resp.getAsJsonArray("remoteHistoryList").iterator();
191 - while(it.hasNext()) { 191 + while (it.hasNext()) {
192 JsonObject jsonObject = (JsonObject) it.next(); 192 JsonObject jsonObject = (JsonObject) it.next();
193 remoteRecords.add(new RemoteRecord(jsonObject.get("device_name").getAsString(), jsonObject.get("created").getAsString())); 193 remoteRecords.add(new RemoteRecord(jsonObject.get("device_name").getAsString(), jsonObject.get("created").getAsString()));
194 } 194 }
...@@ -208,14 +208,14 @@ public class Api { ...@@ -208,14 +208,14 @@ public class Api {
208 @Override 208 @Override
209 public void callbackMethod(Object obj) { 209 public void callbackMethod(Object obj) {
210 ApiResult apiResult = (ApiResult) obj; 210 ApiResult apiResult = (ApiResult) obj;
211 - if(apiResult.isSuccess()) { 211 + if (apiResult.isSuccess()) {
212 JsonObject resp = (JsonObject) apiResult.getData(); 212 JsonObject resp = (JsonObject) apiResult.getData();
213 - if(resp.has("videoList")) { 213 + if (resp.has("videoList")) {
214 ArrayList<Video> videos = new ArrayList<Video>(); 214 ArrayList<Video> videos = new ArrayList<Video>();
215 Iterator it = resp.getAsJsonArray("videoList").iterator(); 215 Iterator it = resp.getAsJsonArray("videoList").iterator();
216 - while(it.hasNext()) { 216 + while (it.hasNext()) {
217 JsonObject jsonObject = (JsonObject) it.next(); 217 JsonObject jsonObject = (JsonObject) it.next();
218 - videos.add(new Video(jsonObject.get("vid_name").getAsString(), jsonObject.get("thumb").getAsString(), jsonObject.get("created").getAsString(), "01:14")); 218 + videos.add(new Video(jsonObject.get("vid_name").getAsString(), jsonObject.get("thumb").getAsString(), jsonObject.get("created").getAsString(), jsonObject.get("vid_time").getAsString()));
219 } 219 }
220 callback.callbackMethod(videos); 220 callback.callbackMethod(videos);
221 } else { 221 } else {
...@@ -233,9 +233,9 @@ public class Api { ...@@ -233,9 +233,9 @@ public class Api {
233 @Override 233 @Override
234 public void callbackMethod(Object obj) { 234 public void callbackMethod(Object obj) {
235 ApiResult apiResult = (ApiResult) obj; 235 ApiResult apiResult = (ApiResult) obj;
236 - if(apiResult.isSuccess()) { 236 + if (apiResult.isSuccess()) {
237 JsonObject resp = (JsonObject) apiResult.getData(); 237 JsonObject resp = (JsonObject) apiResult.getData();
238 - if(resp.has("s3link")) { 238 + if (resp.has("s3link")) {
239 callback.callbackMethod(resp.get("s3link").getAsString()); 239 callback.callbackMethod(resp.get("s3link").getAsString());
240 } else { 240 } else {
241 callback.callbackMethod(null); 241 callback.callbackMethod(null);
...@@ -252,7 +252,7 @@ public class Api { ...@@ -252,7 +252,7 @@ public class Api {
252 @Override 252 @Override
253 public void callbackMethod(Object obj) { 253 public void callbackMethod(Object obj) {
254 ApiResult apiResult = (ApiResult) obj; 254 ApiResult apiResult = (ApiResult) obj;
255 - if(apiResult.isSuccess()) { 255 + if (apiResult.isSuccess()) {
256 callback.callbackMethod(new Boolean(true)); 256 callback.callbackMethod(new Boolean(true));
257 } else { 257 } else {
258 callback.callbackMethod(null); 258 callback.callbackMethod(null);
...@@ -266,12 +266,12 @@ public class Api { ...@@ -266,12 +266,12 @@ public class Api {
266 @Override 266 @Override
267 public void callbackMethod(Object obj) { 267 public void callbackMethod(Object obj) {
268 ApiResult apiResult = (ApiResult) obj; 268 ApiResult apiResult = (ApiResult) obj;
269 - if(apiResult.isSuccess()) { 269 + if (apiResult.isSuccess()) {
270 JsonObject resp = (JsonObject) apiResult.getData(); 270 JsonObject resp = (JsonObject) apiResult.getData();
271 - if(resp.has("deviceList")) { 271 + if (resp.has("deviceList")) {
272 ArrayList<Device> videos = new ArrayList<Device>(); 272 ArrayList<Device> videos = new ArrayList<Device>();
273 Iterator it = resp.getAsJsonArray("deviceList").iterator(); 273 Iterator it = resp.getAsJsonArray("deviceList").iterator();
274 - while(it.hasNext()) { 274 + while (it.hasNext()) {
275 JsonObject jsonObject = (JsonObject) it.next(); 275 JsonObject jsonObject = (JsonObject) it.next();
276 videos.add(new Device(jsonObject.get("device_id").getAsInt(), jsonObject.get("rfid_id").getAsString(), jsonObject.get("created").getAsString())); 276 videos.add(new Device(jsonObject.get("device_id").getAsInt(), jsonObject.get("rfid_id").getAsString(), jsonObject.get("created").getAsString()));
277 } 277 }
...@@ -291,7 +291,7 @@ public class Api { ...@@ -291,7 +291,7 @@ public class Api {
291 @Override 291 @Override
292 public void callbackMethod(Object obj) { 292 public void callbackMethod(Object obj) {
293 ApiResult apiResult = (ApiResult) obj; 293 ApiResult apiResult = (ApiResult) obj;
294 - if(apiResult.isSuccess()) { 294 + if (apiResult.isSuccess()) {
295 callback.callbackMethod(new Boolean(true)); 295 callback.callbackMethod(new Boolean(true));
296 } else { 296 } else {
297 callback.callbackMethod(null); 297 callback.callbackMethod(null);
...@@ -305,7 +305,7 @@ public class Api { ...@@ -305,7 +305,7 @@ public class Api {
305 @Override 305 @Override
306 public void callbackMethod(Object obj) { 306 public void callbackMethod(Object obj) {
307 ApiResult apiResult = (ApiResult) obj; 307 ApiResult apiResult = (ApiResult) obj;
308 - if(apiResult.isSuccess()) { 308 + if (apiResult.isSuccess()) {
309 callback.callbackMethod(new Boolean(true)); 309 callback.callbackMethod(new Boolean(true));
310 } else { 310 } else {
311 callback.callbackMethod(null); 311 callback.callbackMethod(null);
......
...@@ -82,4 +82,8 @@ public class RemoteControlRecordActivity extends AppCompatActivity { ...@@ -82,4 +82,8 @@ public class RemoteControlRecordActivity extends AppCompatActivity {
82 mRecyclerView.setLayoutManager(manager); 82 mRecyclerView.setLayoutManager(manager);
83 mRecyclerView.setAdapter(mAdapter); 83 mRecyclerView.setAdapter(mAdapter);
84 } 84 }
85 +
86 + private void dummy(){
87 +
88 + }
85 } 89 }
......
...@@ -53,7 +53,7 @@ public class VideoCheckActivity extends AppCompatActivity { ...@@ -53,7 +53,7 @@ public class VideoCheckActivity extends AppCompatActivity {
53 Api.removeVideo(mVideoList.get(0), new Api.Callback() { 53 Api.removeVideo(mVideoList.get(0), new Api.Callback() {
54 @Override 54 @Override
55 public void callbackMethod(Object obj) { 55 public void callbackMethod(Object obj) {
56 - if(obj == null) { 56 + if (obj == null) {
57 Toast.makeText(getApplicationContext(), "연결 상태가 불안정합니다.", Toast.LENGTH_SHORT).show(); 57 Toast.makeText(getApplicationContext(), "연결 상태가 불안정합니다.", Toast.LENGTH_SHORT).show();
58 startActivity(new Intent(VideoCheckActivity.this, MainActivity.class)); 58 startActivity(new Intent(VideoCheckActivity.this, MainActivity.class));
59 return; 59 return;
...@@ -74,7 +74,7 @@ public class VideoCheckActivity extends AppCompatActivity { ...@@ -74,7 +74,7 @@ public class VideoCheckActivity extends AppCompatActivity {
74 // 원래는 각 비디오에 대해서 동작해야 함. 코드 의미 전달을 위해 video[0]에 대해 재생하는 코드만 구현 74 // 원래는 각 비디오에 대해서 동작해야 함. 코드 의미 전달을 위해 video[0]에 대해 재생하는 코드만 구현
75 final Video video = mVideoList.get(0); 75 final Video video = mVideoList.get(0);
76 // s3 링크를 받아오지 못한 경우에만 조회. 이미 받아온 경우 바로 해당 링크로 재생 76 // s3 링크를 받아오지 못한 경우에만 조회. 이미 받아온 경우 바로 해당 링크로 재생
77 - if(video.getS3link() == null) { 77 + if (video.getS3link() == null) {
78 Api.getVideo(mVideoList.get(0), new Api.Callback() { 78 Api.getVideo(mVideoList.get(0), new Api.Callback() {
79 @Override 79 @Override
80 public void callbackMethod(Object obj) { 80 public void callbackMethod(Object obj) {
...@@ -96,7 +96,7 @@ public class VideoCheckActivity extends AppCompatActivity { ...@@ -96,7 +96,7 @@ public class VideoCheckActivity extends AppCompatActivity {
96 }); 96 });
97 } 97 }
98 98
99 - private void setToolbar(Toolbar toolbar){ 99 + private void setToolbar(Toolbar toolbar) {
100 setSupportActionBar(toolbar); 100 setSupportActionBar(toolbar);
101 Objects.requireNonNull(getSupportActionBar()).setDisplayShowCustomEnabled(true); 101 Objects.requireNonNull(getSupportActionBar()).setDisplayShowCustomEnabled(true);
102 getSupportActionBar().setDisplayShowTitleEnabled(false); 102 getSupportActionBar().setDisplayShowTitleEnabled(false);
...@@ -116,7 +116,7 @@ public class VideoCheckActivity extends AppCompatActivity { ...@@ -116,7 +116,7 @@ public class VideoCheckActivity extends AppCompatActivity {
116 @Override 116 @Override
117 public void callbackMethod(Object obj) { 117 public void callbackMethod(Object obj) {
118 // TODO : 비디오 리스트가 로드되었을 때 118 // TODO : 비디오 리스트가 로드되었을 때
119 - if(obj == null) { 119 + if (obj == null) {
120 Toast.makeText(getApplicationContext(), "연결 상태가 불안정합니다.", Toast.LENGTH_SHORT).show(); 120 Toast.makeText(getApplicationContext(), "연결 상태가 불안정합니다.", Toast.LENGTH_SHORT).show();
121 startActivity(new Intent(VideoCheckActivity.this, MainActivity.class)); 121 startActivity(new Intent(VideoCheckActivity.this, MainActivity.class));
122 return; 122 return;
...@@ -129,12 +129,12 @@ public class VideoCheckActivity extends AppCompatActivity { ...@@ -129,12 +129,12 @@ public class VideoCheckActivity extends AppCompatActivity {
129 }); 129 });
130 } 130 }
131 131
132 - private void init(){ 132 + private void init() {
133 NestedScrollView nestedScrollView = findViewById(R.id.scroll_video_check); 133 NestedScrollView nestedScrollView = findViewById(R.id.scroll_video_check);
134 nestedScrollView.getParent().requestChildFocus(nestedScrollView, nestedScrollView); 134 nestedScrollView.getParent().requestChildFocus(nestedScrollView, nestedScrollView);
135 } 135 }
136 136
137 - private void setRecyclerView(){ 137 + private void setRecyclerView() {
138 mRecyclerView = findViewById(R.id.rv_video_list); 138 mRecyclerView = findViewById(R.id.rv_video_list);
139 GridLayoutManager manager = new GridLayoutManager(this, 2); 139 GridLayoutManager manager = new GridLayoutManager(this, 2);
140 mAdapter = new VideoRvAdapter(mVideoList); 140 mAdapter = new VideoRvAdapter(mVideoList);
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
18 android:layout_width="0dp" 18 android:layout_width="0dp"
19 android:layout_height="0dp" 19 android:layout_height="0dp"
20 android:background="@color/colorPrimary" 20 android:background="@color/colorPrimary"
21 - app:layout_constraintDimensionRatio="7:3" 21 + app:layout_constraintDimensionRatio="3:2"
22 app:layout_constraintEnd_toEndOf="parent" 22 app:layout_constraintEnd_toEndOf="parent"
23 app:layout_constraintStart_toStartOf="parent" 23 app:layout_constraintStart_toStartOf="parent"
24 app:layout_constraintTop_toTopOf="parent" /> 24 app:layout_constraintTop_toTopOf="parent" />
......