Fixes count numbers for remote accounts
This commit is contained in:
parent
9fa8359cab
commit
1a42e4e09a
|
@ -149,7 +149,7 @@ public class AboutActivity extends AppCompatActivity implements OnRetrieveRemote
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRetrieveRemoteAccount(boolean error, String name, String username, String instance_name, boolean locked, String avatar, String bio, int statusCount, int followingCount, int followersCount) {
|
public void onRetrieveRemoteAccount(boolean error, String name, String username, String instance_name, boolean locked, String avatar, String bio, String statusCount, String followingCount, String followersCount) {
|
||||||
if( error){
|
if( error){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -158,9 +158,9 @@ public class AboutActivity extends AppCompatActivity implements OnRetrieveRemote
|
||||||
account.setAcct(username + "@" + instance_name);
|
account.setAcct(username + "@" + instance_name);
|
||||||
account.setAvatar(avatar);
|
account.setAvatar(avatar);
|
||||||
account.setDisplay_name(username);
|
account.setDisplay_name(username);
|
||||||
account.setStatuses_count(statusCount);
|
account.setStatuses_count_str(statusCount);
|
||||||
account.setFollowers_count(followersCount);
|
account.setFollowers_count_str(followersCount);
|
||||||
account.setFollowing_count(followingCount);
|
account.setFollowing_count_str(followingCount);
|
||||||
account.setUsername(name);
|
account.setUsername(name);
|
||||||
account.setLocked(locked);
|
account.setLocked(locked);
|
||||||
account.setNote(bio);
|
account.setNote(bio);
|
||||||
|
|
|
@ -261,7 +261,7 @@ public class RemoteFollowActivity extends AppCompatActivity implements OnRetriev
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRetrieveRemoteAccount(boolean error, String name, String username, String instance_name, boolean locked, String avatar, String bio, int statusCount, int followingCount, int followersCount) {
|
public void onRetrieveRemoteAccount(boolean error, String name, String username, String instance_name, boolean locked, String avatar, String bio, String statusCount, String followingCount, String followersCount) {
|
||||||
loader.setVisibility(View.GONE);
|
loader.setVisibility(View.GONE);
|
||||||
rf_search.setEnabled(true);
|
rf_search.setEnabled(true);
|
||||||
if( error){
|
if( error){
|
||||||
|
@ -274,9 +274,9 @@ public class RemoteFollowActivity extends AppCompatActivity implements OnRetriev
|
||||||
account.setAcct(screen_name + "@" + instance_name);
|
account.setAcct(screen_name + "@" + instance_name);
|
||||||
account.setAvatar(avatar);
|
account.setAvatar(avatar);
|
||||||
account.setDisplay_name(username);
|
account.setDisplay_name(username);
|
||||||
account.setStatuses_count(statusCount);
|
account.setStatuses_count_str(statusCount);
|
||||||
account.setFollowers_count(followersCount);
|
account.setFollowers_count_str(followersCount);
|
||||||
account.setFollowing_count(followingCount);
|
account.setFollowing_count_str(followingCount);
|
||||||
account.setUsername(name);
|
account.setUsername(name);
|
||||||
account.setLocked(locked);
|
account.setLocked(locked);
|
||||||
account.setNote(bio);
|
account.setNote(bio);
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class RetrieveRemoteAccountsAsyncTask extends AsyncTask<Void, Void, Void>
|
||||||
private OnRetrieveRemoteAccountInterface listener;
|
private OnRetrieveRemoteAccountInterface listener;
|
||||||
private String url;
|
private String url;
|
||||||
private String avatar, name, username, bio;
|
private String avatar, name, username, bio;
|
||||||
private int statusCount, followingCount, followersCount;
|
private String statusCount, followingCount, followersCount;
|
||||||
private boolean islocked;
|
private boolean islocked;
|
||||||
private boolean error = false;
|
private boolean error = false;
|
||||||
private String instance;
|
private String instance;
|
||||||
|
@ -62,9 +62,9 @@ public class RetrieveRemoteAccountsAsyncTask extends AsyncTask<Void, Void, Void>
|
||||||
Elements bioElement = document.getElementsByClass("bio");
|
Elements bioElement = document.getElementsByClass("bio");
|
||||||
bio = bioElement.get(0).html();
|
bio = bioElement.get(0).html();
|
||||||
Elements countElement = document.getElementsByClass("counter-number");
|
Elements countElement = document.getElementsByClass("counter-number");
|
||||||
statusCount = Integer.parseInt(countElement.get(0).html().replace(",",""));
|
statusCount = countElement.get(0).html();
|
||||||
followingCount = Integer.parseInt(countElement.get(1).html().replace(",",""));
|
followingCount = countElement.get(1).html();
|
||||||
followersCount = Integer.parseInt(countElement.get(2).html().replace(",",""));
|
followersCount = countElement.get(2).html();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
error = true;
|
error = true;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -35,6 +35,9 @@ public class Account implements Parcelable {
|
||||||
private int followers_count;
|
private int followers_count;
|
||||||
private int following_count;
|
private int following_count;
|
||||||
private int statuses_count;
|
private int statuses_count;
|
||||||
|
private String followers_count_str;
|
||||||
|
private String following_count_str;
|
||||||
|
private String statuses_count_str;
|
||||||
private String note;
|
private String note;
|
||||||
private String url;
|
private String url;
|
||||||
private String avatar;
|
private String avatar;
|
||||||
|
@ -255,4 +258,28 @@ public class Account implements Parcelable {
|
||||||
public void setRemote(boolean remote) {
|
public void setRemote(boolean remote) {
|
||||||
isRemote = remote;
|
isRemote = remote;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFollowers_count_str() {
|
||||||
|
return followers_count_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFollowers_count_str(String followers_count_str) {
|
||||||
|
this.followers_count_str = followers_count_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFollowing_count_str() {
|
||||||
|
return following_count_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFollowing_count_str(String following_count_str) {
|
||||||
|
this.following_count_str = following_count_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatuses_count_str() {
|
||||||
|
return statuses_count_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatuses_count_str(String statuses_count_str) {
|
||||||
|
this.statuses_count_str = statuses_count_str;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,9 +143,9 @@ public class AccountSearchWebAdapter extends BaseAdapter implements OnPostAction
|
||||||
}
|
}
|
||||||
changeDrawableColor(context, R.drawable.ic_action_lock_closed,R.color.mastodonC4);
|
changeDrawableColor(context, R.drawable.ic_action_lock_closed,R.color.mastodonC4);
|
||||||
holder.account_ds.setAutoLinkMask(Linkify.WEB_URLS);
|
holder.account_ds.setAutoLinkMask(Linkify.WEB_URLS);
|
||||||
holder.account_sc.setText(String.valueOf(account.getStatuses_count()));
|
holder.account_sc.setText(String.valueOf(account.getStatuses_count_str()));
|
||||||
holder.account_fgc.setText(String.valueOf(account.getFollowing_count()));
|
holder.account_fgc.setText(String.valueOf(account.getFollowing_count_str()));
|
||||||
holder.account_frc.setText(String.valueOf(account.getFollowers_count()));
|
holder.account_frc.setText(String.valueOf(account.getFollowers_count_str()));
|
||||||
//Profile picture
|
//Profile picture
|
||||||
imageLoader.displayImage(account.getAvatar(), holder.account_pp, options);
|
imageLoader.displayImage(account.getAvatar(), holder.account_pp, options);
|
||||||
|
|
||||||
|
|
|
@ -20,5 +20,5 @@ package fr.gouv.etalab.mastodon.interfaces;
|
||||||
* Interface for retrieving a remote account
|
* Interface for retrieving a remote account
|
||||||
*/
|
*/
|
||||||
public interface OnRetrieveRemoteAccountInterface {
|
public interface OnRetrieveRemoteAccountInterface {
|
||||||
void onRetrieveRemoteAccount(boolean error, String name, String username, String instance, boolean locked, String avatar, String bio, int statusCount, int followingCount, int followersCount);
|
void onRetrieveRemoteAccount(boolean error, String name, String username, String instance, boolean locked, String avatar, String bio, String statusCount, String followingCount, String followersCount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,7 +220,6 @@ public class StreamingService extends Service {
|
||||||
}
|
}
|
||||||
if (event !=null){
|
if (event !=null){
|
||||||
if( (lastEvent == EventStreaming.NONE || lastEvent == null) && !event.startsWith("data: ")) {
|
if( (lastEvent == EventStreaming.NONE || lastEvent == null) && !event.startsWith("data: ")) {
|
||||||
|
|
||||||
switch (event.trim()) {
|
switch (event.trim()) {
|
||||||
case "event: update":
|
case "event: update":
|
||||||
lastEvent = EventStreaming.UPDATE;
|
lastEvent = EventStreaming.UPDATE;
|
||||||
|
|
Loading…
Reference in New Issue