정훈용

API changed

Showing 218 changed files with 548 additions and 43 deletions
...@@ -36,12 +36,11 @@ android { ...@@ -36,12 +36,11 @@ android {
36 36
37 dependencies { 37 dependencies {
38 implementation fileTree(dir: 'libs', include: ['*.jar']) 38 implementation fileTree(dir: 'libs', include: ['*.jar'])
39 - implementation 'androidx.appcompat:appcompat:1.1.0' 39 + implementation 'androidx.appcompat:appcompat:1.0.2'
40 implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 40 implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
41 testImplementation 'junit:junit:4.12' 41 testImplementation 'junit:junit:4.12'
42 - androidTestImplementation 'androidx.test.ext:junit:1.1.1' 42 + androidTestImplementation 'androidx.test.ext:junit:1.1.0'
43 - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 43 + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
44 - //implementation 'com.google.code.gson:gson:2.8.5' 44 + implementation 'com.google.code.gson:gson:2.8.5'
45 //implementation 'com.squareup.okhttp3:okhttp:3.9.0' 45 //implementation 'com.squareup.okhttp3:okhttp:3.9.0'
46 - implementation 'com.github.taycaldwell:riot-api-java:4.3.0'
47 } 46 }
......
1 + Apache License
2 + Version 2.0, January 2004
3 + http://www.apache.org/licenses/
4 +
5 + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 +
7 + 1. Definitions.
8 +
9 + "License" shall mean the terms and conditions for use, reproduction,
10 + and distribution as defined by Sections 1 through 9 of this document.
11 +
12 + "Licensor" shall mean the copyright owner or entity authorized by
13 + the copyright owner that is granting the License.
14 +
15 + "Legal Entity" shall mean the union of the acting entity and all
16 + other entities that control, are controlled by, or are under common
17 + control with that entity. For the purposes of this definition,
18 + "control" means (i) the power, direct or indirect, to cause the
19 + direction or management of such entity, whether by contract or
20 + otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 + outstanding shares, or (iii) beneficial ownership of such entity.
22 +
23 + "You" (or "Your") shall mean an individual or Legal Entity
24 + exercising permissions granted by this License.
25 +
26 + "Source" form shall mean the preferred form for making modifications,
27 + including but not limited to software source code, documentation
28 + source, and configuration files.
29 +
30 + "Object" form shall mean any form resulting from mechanical
31 + transformation or translation of a Source form, including but
32 + not limited to compiled object code, generated documentation,
33 + and conversions to other media types.
34 +
35 + "Work" shall mean the work of authorship, whether in Source or
36 + Object form, made available under the License, as indicated by a
37 + copyright notice that is included in or attached to the work
38 + (an example is provided in the Appendix below).
39 +
40 + "Derivative Works" shall mean any work, whether in Source or Object
41 + form, that is based on (or derived from) the Work and for which the
42 + editorial revisions, annotations, elaborations, or other modifications
43 + represent, as a whole, an original work of authorship. For the purposes
44 + of this License, Derivative Works shall not include works that remain
45 + separable from, or merely link (or bind by name) to the interfaces of,
46 + the Work and Derivative Works thereof.
47 +
48 + "Contribution" shall mean any work of authorship, including
49 + the original version of the Work and any modifications or additions
50 + to that Work or Derivative Works thereof, that is intentionally
51 + submitted to Licensor for inclusion in the Work by the copyright owner
52 + or by an individual or Legal Entity authorized to submit on behalf of
53 + the copyright owner. For the purposes of this definition, "submitted"
54 + means any form of electronic, verbal, or written communication sent
55 + to the Licensor or its representatives, including but not limited to
56 + communication on electronic mailing lists, source code control systems,
57 + and issue tracking systems that are managed by, or on behalf of, the
58 + Licensor for the purpose of discussing and improving the Work, but
59 + excluding communication that is conspicuously marked or otherwise
60 + designated in writing by the copyright owner as "Not a Contribution."
61 +
62 + "Contributor" shall mean Licensor and any individual or Legal Entity
63 + on behalf of whom a Contribution has been received by Licensor and
64 + subsequently incorporated within the Work.
65 +
66 + 2. Grant of Copyright License. Subject to the terms and conditions of
67 + this License, each Contributor hereby grants to You a perpetual,
68 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 + copyright license to reproduce, prepare Derivative Works of,
70 + publicly display, publicly perform, sublicense, and distribute the
71 + Work and such Derivative Works in Source or Object form.
72 +
73 + 3. Grant of Patent License. Subject to the terms and conditions of
74 + this License, each Contributor hereby grants to You a perpetual,
75 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 + (except as stated in this section) patent license to make, have made,
77 + use, offer to sell, sell, import, and otherwise transfer the Work,
78 + where such license applies only to those patent claims licensable
79 + by such Contributor that are necessarily infringed by their
80 + Contribution(s) alone or by combination of their Contribution(s)
81 + with the Work to which such Contribution(s) was submitted. If You
82 + institute patent litigation against any entity (including a
83 + cross-claim or counterclaim in a lawsuit) alleging that the Work
84 + or a Contribution incorporated within the Work constitutes direct
85 + or contributory patent infringement, then any patent licenses
86 + granted to You under this License for that Work shall terminate
87 + as of the date such litigation is filed.
88 +
89 + 4. Redistribution. You may reproduce and distribute copies of the
90 + Work or Derivative Works thereof in any medium, with or without
91 + modifications, and in Source or Object form, provided that You
92 + meet the following conditions:
93 +
94 + (a) You must give any other recipients of the Work or
95 + Derivative Works a copy of this License; and
96 +
97 + (b) You must cause any modified files to carry prominent notices
98 + stating that You changed the files; and
99 +
100 + (c) You must retain, in the Source form of any Derivative Works
101 + that You distribute, all copyright, patent, trademark, and
102 + attribution notices from the Source form of the Work,
103 + excluding those notices that do not pertain to any part of
104 + the Derivative Works; and
105 +
106 + (d) If the Work includes a "NOTICE" text file as part of its
107 + distribution, then any Derivative Works that You distribute must
108 + include a readable copy of the attribution notices contained
109 + within such NOTICE file, excluding those notices that do not
110 + pertain to any part of the Derivative Works, in at least one
111 + of the following places: within a NOTICE text file distributed
112 + as part of the Derivative Works; within the Source form or
113 + documentation, if provided along with the Derivative Works; or,
114 + within a display generated by the Derivative Works, if and
115 + wherever such third-party notices normally appear. The contents
116 + of the NOTICE file are for informational purposes only and
117 + do not modify the License. You may add Your own attribution
118 + notices within Derivative Works that You distribute, alongside
119 + or as an addendum to the NOTICE text from the Work, provided
120 + that such additional attribution notices cannot be construed
121 + as modifying the License.
122 +
123 + You may add Your own copyright statement to Your modifications and
124 + may provide additional or different license terms and conditions
125 + for use, reproduction, or distribution of Your modifications, or
126 + for any such Derivative Works as a whole, provided Your use,
127 + reproduction, and distribution of the Work otherwise complies with
128 + the conditions stated in this License.
129 +
130 + 5. Submission of Contributions. Unless You explicitly state otherwise,
131 + any Contribution intentionally submitted for inclusion in the Work
132 + by You to the Licensor shall be under the terms and conditions of
133 + this License, without any additional terms or conditions.
134 + Notwithstanding the above, nothing herein shall supersede or modify
135 + the terms of any separate license agreement you may have executed
136 + with Licensor regarding such Contributions.
137 +
138 + 6. Trademarks. This License does not grant permission to use the trade
139 + names, trademarks, service marks, or product names of the Licensor,
140 + except as required for reasonable and customary use in describing the
141 + origin of the Work and reproducing the content of the NOTICE file.
142 +
143 + 7. Disclaimer of Warranty. Unless required by applicable law or
144 + agreed to in writing, Licensor provides the Work (and each
145 + Contributor provides its Contributions) on an "AS IS" BASIS,
146 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 + implied, including, without limitation, any warranties or conditions
148 + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 + PARTICULAR PURPOSE. You are solely responsible for determining the
150 + appropriateness of using or redistributing the Work and assume any
151 + risks associated with Your exercise of permissions under this License.
152 +
153 + 8. Limitation of Liability. In no event and under no legal theory,
154 + whether in tort (including negligence), contract, or otherwise,
155 + unless required by applicable law (such as deliberate and grossly
156 + negligent acts) or agreed to in writing, shall any Contributor be
157 + liable to You for damages, including any direct, indirect, special,
158 + incidental, or consequential damages of any character arising as a
159 + result of this License or out of the use or inability to use the
160 + Work (including but not limited to damages for loss of goodwill,
161 + work stoppage, computer failure or malfunction, or any and all
162 + other commercial damages or losses), even if such Contributor
163 + has been advised of the possibility of such damages.
164 +
165 + 9. Accepting Warranty or Additional Liability. While redistributing
166 + the Work or Derivative Works thereof, You may choose to offer,
167 + and charge a fee for, acceptance of support, warranty, indemnity,
168 + or other liability obligations and/or rights consistent with this
169 + License. However, in accepting such obligations, You may act only
170 + on Your own behalf and on Your sole responsibility, not on behalf
171 + of any other Contributor, and only if You agree to indemnify,
172 + defend, and hold each Contributor harmless for any liability
173 + incurred by, or claims asserted against, such Contributor by reason
174 + of your accepting any such warranty or additional liability.
175 +
176 + END OF TERMS AND CONDITIONS
177 +
178 + APPENDIX: How to apply the Apache License to your work.
179 +
180 + To apply the Apache License to your work, attach the following
181 + boilerplate notice, with the fields enclosed by brackets "[]"
182 + replaced with your own identifying information. (Don't include
183 + the brackets!) The text should be enclosed in the appropriate
184 + comment syntax for the file format. We also recommend that a
185 + file or class name and description of purpose be included on the
186 + same "printed page" as the copyright notice for easier
187 + identification within third-party archives.
188 +
189 + Copyright [yyyy] [name of copyright owner]
190 +
191 + Licensed under the Apache License, Version 2.0 (the "License");
192 + you may not use this file except in compliance with the License.
193 + You may obtain a copy of the License at
194 +
195 + http://www.apache.org/licenses/LICENSE-2.0
196 +
197 + Unless required by applicable law or agreed to in writing, software
198 + distributed under the License is distributed on an "AS IS" BASIS,
199 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 + See the License for the specific language governing permissions and
201 + limitations under the License.
1 +Manifest-Version: 1.0
2 +Sealed: true
3 +
1 +# [RIOT-API-JAVA](http://taycaldwell.com/riot-api-java/)
2 +----------
3 +[![JitPack](https://img.shields.io/github/tag/rithms/riot-api-java.svg?label=maven)](https://jitpack.io/#taycaldwell/riot-api-java/4.3.0)
4 +----------
5 +
6 +A simple to use Riot Games API wrapper for Java.
7 +This library makes it easy to gather and use League of Legends data in your apps.
8 +
9 +## Disclaimer
10 +This product is not endorsed, certified or otherwise approved in any way by Riot Games, Inc. or any of its affiliates.
11 +
12 +## Requirements
13 +
14 +**riot-api-java** requires Java 7 and the following libraries:
15 +- [Google Gson](https://code.google.com/p/google-gson/)
16 +
17 +## Setup
18 +
19 +[Download](https://github.com/taycaldwell/riot-api-java/releases) the .jar file, and add it as an external library to your project.
20 +
21 +If you are using Eclipse, this can be done by right clicking your project, and selecting:
22 +
23 +Build Path -> Configure Build Path -> Libraries -> Add External Jars
24 +
25 +and selecting the jar under the Order and Export tab.
26 +
27 +This project is also available on [Jitpack](https://jitpack.io/#rithms/riot-api-java/4.3.0)
28 +
29 +### Gradle
30 +
31 +Add Jitpack to your root build.gradle at the end of repositories:
32 +
33 +```java
34 +allprojects {
35 + repositories {
36 + ...
37 + maven { url 'https://jitpack.io' }
38 + }
39 +}
40 +```
41 +
42 +Add the project as a dependency:
43 +
44 +```java
45 +dependencies {
46 + compile 'com.github.taycaldwell:riot-api-java:4.3.0'
47 +}
48 +```
49 +
50 +### Maven
51 +
52 +Add Jitpack as a repository:
53 +
54 +```xml
55 +<repositories>
56 + <repository>
57 + <id>jitpack.io</id>
58 + <url>https://jitpack.io</url>
59 + </repository>
60 +</repositories>
61 +```
62 +
63 +Add the project as a dependency:
64 +
65 +```xml
66 +<dependency>
67 + <groupId>com.github.taycaldwell</groupId>
68 + <artifactId>riot-api-java</artifactId>
69 + <version>4.2.0</version>
70 +</dependency>
71 +```
72 +
73 +## Usage
74 +
75 +This library can be used strictly according to the [Riot API Documentation](https://developer.riotgames.com/api/methods) like so:
76 +
77 +```java
78 +import net.rithms.riot.api.ApiConfig;
79 +import net.rithms.riot.api.RiotApi;
80 +import net.rithms.riot.api.RiotApiException;
81 +import net.rithms.riot.api.endpoints.summoner.dto.Summoner;
82 +import net.rithms.riot.constant.Platform;
83 +
84 +/**
85 + * This example demonstrates using the RiotApi to request summoner information for a given summoner name
86 + */
87 +public class SummonerExample {
88 +
89 + public static void main(String[] args) throws RiotApiException {
90 + ApiConfig config = new ApiConfig().setKey("YOUR-API-KEY-HERE");
91 + RiotApi api = new RiotApi(config);
92 +
93 + Summoner summoner = api.getSummonerByName(Platform.NA, "tryndamere");
94 + System.out.println("Name: " + summoner.getName());
95 + System.out.println("Summoner ID: " + summoner.getId());
96 + System.out.println("Account ID: " + summoner.getAccountId());
97 + System.out.println("PUUID: " + summoner.getPuuid());
98 + System.out.println("Summoner Level: " + summoner.getSummonerLevel());
99 + System.out.println("Profile Icon ID: " + summoner.getProfileIconId());
100 + }
101 +}
102 +```
103 +
104 +It is important to be aware of your personal rate limit. Any method call from the Riot API is a request that counts towards your rate limit, except requests regarding static data which count toward a method rate limit but not toward your app rate limit. The below code makes 2 requests; one request for a summoner, and another for the match list of a summoner.
105 +
106 +```java
107 +import net.rithms.riot.api.ApiConfig;
108 +import net.rithms.riot.api.RiotApi;
109 +import net.rithms.riot.api.RiotApiException;
110 +import net.rithms.riot.api.endpoints.match.dto.MatchList;
111 +import net.rithms.riot.api.endpoints.match.dto.MatchReference;
112 +import net.rithms.riot.api.endpoints.summoner.dto.Summoner;
113 +import net.rithms.riot.constant.Platform;
114 +
115 +/**
116 + * This example demonstrates using the RiotApi to request the match list for a given summoner name and iterating over the match list
117 + */
118 +public class MatchListExample {
119 +
120 + public static void main(String[] args) throws RiotApiException {
121 + ApiConfig config = new ApiConfig().setKey("YOUR-API-KEY-HERE");
122 + RiotApi api = new RiotApi(config);
123 +
124 + // First we need to request the summoner because we will need it's account ID
125 + Summoner summoner = api.getSummonerByName(Platform.NA, "tryndamere");
126 +
127 + // Then we can use the account ID to request the summoner's match list
128 + MatchList matchList = api.getMatchListByAccountId(Platform.NA, summoner.getAccountId());
129 +
130 + System.out.println("Total Games in requested match list: " + matchList.getTotalGames());
131 +
132 + // We can now iterate over the match list to access the data
133 + if (matchList.getMatches() != null) {
134 + for (MatchReference match : matchList.getMatches()) {
135 + System.out.println("GameID: " + match.getGameId());
136 + }
137 + }
138 + }
139 +}
140 +```
141 +
142 +You can find these and more examples in the repository's directory "examples".
143 +
144 +## Documentation
145 +The documentation for this library can be found [here.](http://taycaldwell.com/riot-api-java/doc/)
146 +
147 +## API Versions
148 +The current version of this library supports the following Riot Games API versions:
149 +- **CHAMPION-MASTERY-V4**
150 +- **CHAMPION-V3**
151 +- **LEAGUE-V4**
152 +- **LOL-STATUS-V3**
153 +- **MATCH-V4**
154 +- **SPECTATOR-V4**
155 +- **STATIC-DATA-V3** (deprecated)
156 +- **SUMMONER-V4**
157 +- **THIRD-PARTY-CODE-V4**
158 +- **TOURNAMENT-V3**
159 +- **TOURNAMENT-STUB-V4**
160 +
161 +## Contributing
162 +All contributions are appreciated.
163 +If you would like to contribute to this project, please send a pull request.
164 +
165 +## Contact
166 +Have a suggestion, complaint, or question? Open an [issue](https://github.com/taycaldwell/riot-api-java/issues).
1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3 + <modelVersion>4.0.0</modelVersion>
4 +
5 + <groupId>com.github.rithms</groupId>
6 + <artifactId>riot-api-java</artifactId>
7 + <version>4.3.0</version>
8 +
9 + <properties>
10 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11 + </properties>
12 +
13 + <build>
14 + <sourceDirectory>src/main/java</sourceDirectory>
15 + <plugins>
16 + <plugin>
17 + <groupId>org.apache.maven.plugins</groupId>
18 + <artifactId>maven-compiler-plugin</artifactId>
19 + <version>3.2</version>
20 + <configuration>
21 + <source>1.7</source>
22 + <target>1.7</target>
23 + </configuration>
24 + </plugin>
25 + <plugin>
26 + <groupId>org.apache.maven.plugins</groupId>
27 + <artifactId>maven-source-plugin</artifactId>
28 + <version>2.2.1</version>
29 + <executions>
30 + <execution>
31 + <id>attach-sources</id>
32 + <phase>package</phase>
33 + <goals>
34 + <goal>jar</goal>
35 + </goals>
36 + </execution>
37 + </executions>
38 + </plugin>
39 + </plugins>
40 + </build>
41 +
42 + <dependencies>
43 + <dependency>
44 + <groupId>com.google.code.gson</groupId>
45 + <artifactId>gson</artifactId>
46 + <version>2.5</version>
47 + </dependency>
48 +
49 + <dependency>
50 + <groupId>junit</groupId>
51 + <artifactId>junit</artifactId>
52 + <version>4.12</version>
53 + <scope>test</scope>
54 + </dependency>
55 + </dependencies>
56 +
57 +</project>
...@@ -3,6 +3,7 @@ package com.example.pro_lol_log; ...@@ -3,6 +3,7 @@ package com.example.pro_lol_log;
3 import androidx.appcompat.app.AppCompatActivity; 3 import androidx.appcompat.app.AppCompatActivity;
4 4
5 import android.app.Activity; 5 import android.app.Activity;
6 +import android.app.ProgressDialog;
6 import android.content.Intent; 7 import android.content.Intent;
7 import android.graphics.Bitmap; 8 import android.graphics.Bitmap;
8 import android.graphics.BitmapFactory; 9 import android.graphics.BitmapFactory;
...@@ -28,13 +29,21 @@ import android.widget.Toast; ...@@ -28,13 +29,21 @@ import android.widget.Toast;
28 import android.view.animation.Animation; 29 import android.view.animation.Animation;
29 import android.view.animation.AnimationUtils; 30 import android.view.animation.AnimationUtils;
30 31
31 -//드디어 롤 관련 API
32 -import net.rithms.riot.api.ApiConfig;
33 -import net.rithms.riot.api.RiotApi;
34 -import net.rithms.riot.api.RiotApiException;
35 32
36 -import net.rithms.riot.api.endpoints.summoner.dto.Summoner; 33 +import android.os.AsyncTask;
37 -import net.rithms.riot.constant.Platform; 34 +
35 +import com.google.gson.Gson;
36 +import com.google.gson.GsonBuilder;
37 +import com.google.gson.JsonElement;
38 +import com.google.gson.JsonParser;
39 +
40 +import java.net.HttpURLConnection;
41 +
42 +import okhttp3.HttpUrl;
43 +import okhttp3.OkHttpClient;
44 +import okhttp3.Request;
45 +import okhttp3.Response;
46 +
38 47
39 48
40 public class MainActivity extends AppCompatActivity { 49 public class MainActivity extends AppCompatActivity {
...@@ -216,6 +225,14 @@ public class MainActivity extends AppCompatActivity { ...@@ -216,6 +225,14 @@ public class MainActivity extends AppCompatActivity {
216 champions_faceList[(14)*10+j] = Bitmap.createBitmap(sp3,j*(100),2*(99),97,97); 225 champions_faceList[(14)*10+j] = Bitmap.createBitmap(sp3,j*(100),2*(99),97,97);
217 } 226 }
218 227
228 + AsyncTask mytask = new AsyncTask() {
229 + @Override
230 + protected Object doInBackground(Object[] objects) {
231 + return null;
232 + }
233 + };
234 + //개량된 TASK가 필요하다.
235 +
219 236
220 237
221 //fr[4].setBackgroundResource(R.color.color_trust3); 238 //fr[4].setBackgroundResource(R.color.color_trust3);
...@@ -223,9 +240,15 @@ public class MainActivity extends AppCompatActivity { ...@@ -223,9 +240,15 @@ public class MainActivity extends AppCompatActivity {
223 //시작 시 mode 0로 보여주기 240 //시작 시 mode 0로 보여주기
224 mode0(); 241 mode0();
225 242
243 + MyAsyncTask mProcessTask = new MyAsyncTask();
244 + mProcessTask.execute();
245 +
226 246
227 } 247 }
228 248
249 +
250 +
251 +
229 // UI관련 클릭 252 // UI관련 클릭
230 public void mOnClick(View v){ 253 public void mOnClick(View v){
231 switch (v.getId()) 254 switch (v.getId())
...@@ -526,6 +549,82 @@ public class MainActivity extends AppCompatActivity { ...@@ -526,6 +549,82 @@ public class MainActivity extends AppCompatActivity {
526 mode1(); 549 mode1();
527 } 550 }
528 } 551 }
552 + //외부 연결용 TASK가 필요하다.
553 + public class MyAsyncTask extends AsyncTask<String, Void,PlayAnalysis> {
554 + ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
555 +
556 + //OkHttp 객체생성
557 + OkHttpClient client = new OkHttpClient();
558 +
559 + @Override
560 + protected void onPreExecute() {
561 + super.onPreExecute();
562 + progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
563 + progressDialog.setMessage("\t로딩중...");
564 + //show dialog
565 + progressDialog.show();
566 + }
567 +
568 + @Override
569 + protected PlayAnalysis doInBackground(String... params) {
570 +
571 + //파라미터를 더해 주거나 authentication header를 추가할 수 있다.
572 +
573 + HttpUrl.Builder urlBuilder = HttpUrl.parse("https://kr.api.riotgames.com/lol/summoner/v4/summoners/by-name/Cuzz?api_key=RGAPI-f3a35288-26a1-46c3-96fd-697863811e8a").newBuilder();
574 + //urlBuilder.addQueryParameter("key","430156241533f1d058c603178cc3ca0e");
575 + //urlBuilder.addQueryParameter("targetDt","20170908");
576 + String url = urlBuilder.build().toString();
577 +
578 + Request request = new Request.Builder()
579 + .url(url)
580 + .build();
581 +
582 + try {
583 + Response response = client.newCall(request).execute();
584 +
585 + //여기서 해야 하나???
586 + //gson을 이용해서 json을 자바 객체로 변환한다.
587 + Gson gson = new GsonBuilder().create();
588 + JsonParser parser = new JsonParser();
589 + //제공되는 오픈API데이터에서 어떤 항목을 가여올지 설정해야 하는데.... 음~
590 + JsonElement rootObject = parser.parse(response.body().charStream())
591 + .getAsJsonObject().get("boxOfficeResult").getAsJsonObject().get("dailyBoxOfficeList"); //원하는 항목(?)까지 찾아 들어가야 한다.
592 + PlayAnalysis posts = gson.fromJson(rootObject, PlayAnalysis.class);
593 +
594 + return posts;
595 + } catch (Exception e) {
596 + e.printStackTrace();
597 + }
598 + return null;
599 + }
600 +
601 + @Override
602 + protected void onPostExecute(PlayAnalysis result) {
603 + super.onPostExecute(result);
604 + progressDialog.dismiss();
605 + //요청결과를 여기서 처리한다. 화면에 출력하기등...
606 +
607 + //아니면 여기서 해야 하나? JSON 오브젝트로 변환하기
608 +
609 + String imp33 = result.get_all();
610 + Toast.makeText(MainActivity.this, imp33, Toast.LENGTH_SHORT).show();
611 +
612 + /*
613 + if(result.length > 0){
614 + for (MovieItem post: result){
615 +// Log.d(TAG, String.valueOf(post.getRank()));//랭킹
616 +// Log.d(TAG, post.getMovieNm());//영화제목 출력
617 +// Log.d(TAG, post.getOpenDt());//개봉일 출력
618 + tv_result.append(String.valueOf(post.getRank())+"\n");
619 + tv_result.append(post.getMovieNm()+"\n");
620 + tv_result.append(post.getOpenDt()+"\n");
621 + }
622 + }
623 + */
624 +
625 + }
626 + }
627 + //새롭게 추가한 함수는 꽤 길다...
529 628
530 629
531 630
......
...@@ -2,7 +2,16 @@ package com.example.pro_lol_log; ...@@ -2,7 +2,16 @@ package com.example.pro_lol_log;
2 2
3 public class PlayAnalysis { 3 public class PlayAnalysis {
4 4
5 - String summoner; 5 + //이 3가지를 중점으로 테스트하자
6 + String name;
7 + long summonerLevel;
8 + String accountId;
9 +
10 + String get_all(){
11 + return name+" / "+summonerLevel+" / "+accountId;
12 + }
13 +
14 + /*
6 int tire; 15 int tire;
7 // 0 없음 1 언랭 2 아이언 3 브론즈 4 실버 5 골드 6 플래티넘 7다이아몬드 8마스터 9그랜드마스터 10챌린저 16 // 0 없음 1 언랭 2 아이언 3 브론즈 4 실버 5 골드 6 플래티넘 7다이아몬드 8마스터 9그랜드마스터 10챌린저
8 int rank; 17 int rank;
...@@ -16,13 +25,9 @@ public class PlayAnalysis { ...@@ -16,13 +25,9 @@ public class PlayAnalysis {
16 // 매치 스탬프 검사 25 // 매치 스탬프 검사
17 long matches[] = new long[20]; 26 long matches[] = new long[20];
18 27
19 - public void init(String name, int tire,int rank)
20 - {
21 -
22 - }
23 public void read_match(int count, long match) 28 public void read_match(int count, long match)
24 { 29 {
25 matches[count]=match; 30 matches[count]=match;
26 } 31 }
27 - 32 + */
28 } 33 }
......
1 package com.example.pro_lol_log; 1 package com.example.pro_lol_log;
2 2
3 -
4 -import net.rithms.riot.api.ApiConfig;
5 -import net.rithms.riot.api.RiotApi;
6 -import net.rithms.riot.api.RiotApiException;
7 -
8 -import net.rithms.riot.api.endpoints.summoner.dto.Summoner;
9 -import net.rithms.riot.constant.Platform;
10 -
11 public class Player_Pro_Analysis { 3 public class Player_Pro_Analysis {
12 -
13 - ApiConfig config = new ApiConfig().setKey("RGAPI-f3a35288-26a1-46c3-96fd-697863811e8a");
14 - RiotApi api = new RiotApi(config);
15 -
16 -
17 - //Summoner summoner = api.getSummonerByName(Platform.KR, "hide on bush");
18 - /*
19 - System.out.println("Name: " + summoner.getName());
20 - System.out.println("Summoner ID: " + summoner.getId());
21 - System.out.println("Account ID: " + summoner.getAccountId());
22 - System.out.println("PUUID: " + summoner.getPuuid());
23 - System.out.println("Summoner Level: " + summoner.getSummonerLevel());
24 - System.out.println("Profile Icon ID: " + summoner.getProfileIconId());
25 - */
26 -
27 -
28 } 4 }
......
...@@ -4,7 +4,7 @@ buildscript { ...@@ -4,7 +4,7 @@ buildscript {
4 repositories { 4 repositories {
5 google() 5 google()
6 jcenter() 6 jcenter()
7 - maven { url 'https://jitpack.io' } 7 +
8 } 8 }
9 dependencies { 9 dependencies {
10 classpath 'com.android.tools.build:gradle:3.5.1' 10 classpath 'com.android.tools.build:gradle:3.5.1'
...@@ -20,7 +20,6 @@ allprojects { ...@@ -20,7 +20,6 @@ allprojects {
20 repositories { 20 repositories {
21 google() 21 google()
22 jcenter() 22 jcenter()
23 - maven { url 'https://jitpack.io' }
24 } 23 }
25 } 24 }
26 25
......