diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java index dad8440db..eeb1ef9f0 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java @@ -125,10 +125,9 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt private ViewPager mPager; private String accountId; private TabLayout tabLayout; - private TextView account_note, account_follow_request, account_type; + private TextView account_note, account_follow_request, account_type, account_bot; private String userId; private Relationship relationship; - private ImageView pp_actionBar; private FloatingActionButton header_edit_profile; private List pins; private String accountUrl; @@ -183,6 +182,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt account_dn = findViewById(R.id.account_dn); account_un = findViewById(R.id.account_un); account_type = findViewById(R.id.account_type); + account_bot = findViewById(R.id.account_bot); if(b != null){ accountId = b.getString("accountId"); peertubeAccount = b.getBoolean("peertubeAccount", false); @@ -525,10 +525,15 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt if( peertubeAccount) { account_type.setVisibility(View.VISIBLE); } + //Bot account + if( account.isBot()){ + account_bot.setVisibility(View.VISIBLE); + } + TextView actionbar_title = findViewById(R.id.show_account_title); if( account.getAcct() != null) actionbar_title.setText(account.getAcct()); - pp_actionBar = findViewById(R.id.pp_actionBar); + ImageView pp_actionBar = findViewById(R.id.pp_actionBar); if( account.getAvatar() != null){ String url = account.getAvatar(); if( url.startsWith("/") ){ diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/client/API.java b/app/src/main/java/fr/gouv/etalab/mastodon/client/API.java index 27c999206..bc47ba348 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/client/API.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/client/API.java @@ -3316,6 +3316,11 @@ public class API { account.setFollowing_count(Integer.valueOf(resobj.get("following_count").toString())); account.setStatuses_count(Integer.valueOf(resobj.get("statuses_count").toString())); account.setNote(resobj.get("note").toString()); + try { + account.setBot(Boolean.parseBoolean(resobj.get("bot").toString())); + }catch (Exception e){ + account.setBot(false); + } try{ account.setMoved_to_account(parseAccountResponse(context, resobj.getJSONObject("moved"))); }catch (Exception ignored){account.setMoved_to_account(null);} diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Account.java b/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Account.java index e97fa2241..f676aa6dd 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Account.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Account.java @@ -93,7 +93,7 @@ public class Account implements Parcelable { private List emojis; private Account account; private String host; - + private boolean isBot; protected Account(Parcel in) { id = in.readString(); @@ -105,6 +105,7 @@ public class Account implements Parcelable { displayNameSpan = (SpannableString) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); noteSpan = (SpannableString) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); locked = in.readByte() != 0; + isBot = in.readByte() != 0; followers_count = in.readInt(); following_count = in.readInt(); statuses_count = in.readInt(); @@ -146,6 +147,7 @@ public class Account implements Parcelable { TextUtils.writeToParcel(displayNameSpan, dest, flags); TextUtils.writeToParcel(noteSpan, dest, flags); dest.writeByte((byte) (locked ? 1 : 0)); + dest.writeByte((byte) (isBot ? 1 : 0)); dest.writeInt(followers_count); dest.writeInt(following_count); dest.writeInt(statuses_count); @@ -240,6 +242,14 @@ public class Account implements Parcelable { this.host = host; } + public boolean isBot() { + return isBot; + } + + public void setBot(boolean bot) { + isBot = bot; + } + public enum followAction{ FOLLOW, diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java index dbb373dde..80d9a2dbe 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java @@ -778,13 +778,21 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn } for (int i = statuses.size() - 1; i >= 0; i--) { if( this.statuses != null) { - if (this.statuses.size() == 0 || - Long.parseLong(statuses.get(i).getId()) > Long.parseLong(this.statuses.get(0).getId())) { - if (type == RetrieveFeedsAsyncTask.Type.HOME) - statuses.get(i).setNew(true); - MainActivity.countNewStatus++; - inserted++; - this.statuses.add(0, statuses.get(i)); + if (this.statuses.size() == 0){ + if( type != RetrieveFeedsAsyncTask.Type.HOME){ + if( Long.parseLong(statuses.get(i).getId()) > Long.parseLong(this.statuses.get(0).getId())) { + inserted++; + this.statuses.add(0, statuses.get(i)); + } + }else { + if( Long.parseLong(statuses.get(i).getId()) > Long.parseLong(lastReadToot)) { + statuses.get(i).setNew(true); + MainActivity.countNewStatus++; + inserted++; + this.statuses.add(0, statuses.get(i)); + } + } + } } } @@ -829,7 +837,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn //Put the toot at its place in the list (id desc) if( !this.statuses.contains(tmpStatus) ) { //Element not already added //Mark status at new ones when their id is greater than the last read toot id - if (lastReadToot != null && Long.parseLong(tmpStatus.getId()) > Long.parseLong(lastReadToot)) { + if (type == RetrieveFeedsAsyncTask.Type.HOME && lastReadToot != null && Long.parseLong(tmpStatus.getId()) > Long.parseLong(lastReadToot)) { tmpStatus.setNew(true); MainActivity.countNewStatus++; } diff --git a/app/src/main/res/drawable/blue_border.xml b/app/src/main/res/drawable/blue_border.xml new file mode 100644 index 000000000..5a63b6ee2 --- /dev/null +++ b/app/src/main/res/drawable/blue_border.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_show_account.xml b/app/src/main/res/layout/activity_show_account.xml index 69c23405b..5a2f10cf7 100644 --- a/app/src/main/res/layout/activity_show_account.xml +++ b/app/src/main/res/layout/activity_show_account.xml @@ -154,6 +154,15 @@ android:id="@+id/account_type" android:layout_width="wrap_content" android:layout_height="wrap_content" /> + Crowdin manager Translation of the application About Crowdin + Bot \ No newline at end of file