Skip to content

Commit d4a38bb

Browse files
committed
maxime_commit
1 parent 3c8a2d6 commit d4a38bb

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

.idea/caches/build_file_checksums.ser

0 Bytes
Binary file not shown.

app/src/main/java/com/example/golfier/android_youtube_api/DataApi.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public void getResultsFromApi() {
7878
private void chooseAccount() {
7979
if (EasyPermissions.hasPermissions(activity, Manifest.permission.GET_ACCOUNTS)) {
8080
String accountName = activity.getPreferences(Activity.MODE_PRIVATE).getString("accountName", null);
81-
System.out.println("account name "+accountName);
8281
if (accountName != null) {
8382
this.mCredential.setSelectedAccountName(accountName);
8483
getResultsFromApi();

app/src/main/java/com/example/golfier/android_youtube_api/MakeRequestTask.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class MakeRequestTask extends AsyncTask<Void, Void, YoutubeUser> {
4343
this.ri = RequestInfo.getInstance();
4444
this.mProgress = pd;
4545
this.youtubeUser = new YoutubeUser();
46+
this.youtubeUser.setAccountMail(this.credential.getSelectedAccountName());
4647
}
4748

4849
@Override
@@ -147,7 +148,7 @@ protected void onPostExecute(YoutubeUser output) {
147148
System.out.println(output.toString());
148149
if (output.getNbVideo() == 0) {
149150
System.out.println("Launch the second asynchronous task");
150-
//new MakeRequestTaskName(this.credential,this.mProgress, youtubeUser.getPossibleUserName()).execute();
151+
new MakeRequestTaskName(this.credential,this.mProgress, youtubeUser.getPossibleUserName()).execute();
151152
}
152153
}
153154

app/src/main/java/com/example/golfier/android_youtube_api/YoutubeUser.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class YoutubeUser {
1313
private List<String> listChannelIdUpload;
1414
private List<YoutubeVideo> listUpload;
1515
private List<BigInteger> listViewCount;
16+
private Integer nbSubscriber;
1617

1718
public YoutubeUser() {
1819
accountMail="";
@@ -53,16 +54,24 @@ public List<YoutubeVideo> getListUpload() {
5354
return listUpload;
5455
}
5556

57+
public Integer getNbSubscriber() {
58+
return nbSubscriber;
59+
}
60+
61+
public void setNbSubscriber(Integer nbSubscriber) {
62+
this.nbSubscriber = nbSubscriber;
63+
}
64+
5665
public void setListUpload(List<YoutubeVideo> listUpload) {
5766
this.listUpload = listUpload;
5867
}
5968

6069
public void setAccountMail(String accountMail) {
6170
this.accountMail = accountMail;
62-
}
63-
64-
public void setPossibleUserName(String possibleUserName) {
65-
this.possibleUserName = possibleUserName;
71+
//Set the possible username
72+
int index = accountMail.indexOf("@");
73+
this.possibleUserName = accountMail.substring(0, index);
74+
System.out.println("POSSIBLE USERNAME is : "+this.possibleUserName);
6675
}
6776

6877
public void setListId(List<String> listId) {
@@ -102,6 +111,7 @@ public String toString() {
102111
return "YoutubeUser{" +
103112
"accountMail='" + accountMail + '\'' +
104113
", possibleUserName='" + possibleUserName + '\'' +
114+
", nbSubscriber='" + nbSubscriber + '\'' +
105115
", listId=" + listId +
106116
", listTitle=" + listTitle +
107117
", listChannelIdUpload=" + listChannelIdUpload +

0 commit comments

Comments
 (0)