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 ed356177a..26323f197 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
@@ -42,6 +42,7 @@ import android.support.v7.widget.PopupMenu;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.style.UnderlineSpan;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -319,6 +320,8 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
popup.getMenu().findItem(R.id.action_mute).setVisible(false);
popup.getMenu().findItem(R.id.action_mention).setVisible(false);
popup.getMenu().findItem(R.id.action_follow_instance).setVisible(false);
+ popup.getMenu().findItem(R.id.action_hide_boost).setVisible(false);
+ popup.getMenu().findItem(R.id.action_endorse).setVisible(false);
stringArrayConf = getResources().getStringArray(R.array.more_action_owner_confirm);
}else {
popup.getMenu().findItem(R.id.action_block).setVisible(true);
@@ -326,6 +329,23 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
popup.getMenu().findItem(R.id.action_mention).setVisible(true);
stringArrayConf = getResources().getStringArray(R.array.more_action_confirm);
}
+ if( relationship != null){
+ if( !relationship.isFollowing()) {
+ popup.getMenu().findItem(R.id.action_hide_boost).setVisible(false);
+ popup.getMenu().findItem(R.id.action_endorse).setVisible(false);
+ }
+ if(relationship.isEndorsed()){
+ popup.getMenu().findItem(R.id.action_endorse).setTitle(R.string.unendorse);
+ }else {
+ popup.getMenu().findItem(R.id.action_endorse).setTitle(R.string.endorse);
+ }
+ if(relationship.isShowing_reblogs()){
+ popup.getMenu().findItem(R.id.action_hide_boost).setTitle(getString(R.string.hide_boost, account.getUsername()));
+ }else {
+ popup.getMenu().findItem(R.id.action_hide_boost).setTitle(getString(R.string.show_boost, account.getUsername()));
+ }
+ }
+
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
AlertDialog.Builder builderInner;
@@ -374,6 +394,22 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
}
}).start();
return true;
+ case R.id.action_endorse:
+ if( relationship != null)
+ if(relationship.isEndorsed()){
+ new PostActionAsyncTask(getApplicationContext(), API.StatusAction.UNENDORSE, account.getId(), ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+ }else {
+ new PostActionAsyncTask(getApplicationContext(), API.StatusAction.ENDORSE, account.getId(), ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+ }
+ return true;
+ case R.id.action_hide_boost:
+ if( relationship != null)
+ if(relationship.isShowing_reblogs()){
+ new PostActionAsyncTask(getApplicationContext(), API.StatusAction.HIDE_BOOST, account.getId(), ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+ }else {
+ new PostActionAsyncTask(getApplicationContext(), API.StatusAction.SHOW_BOOST, account.getId(), ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+ }
+ return true;
case R.id.action_show_pinned:
showPinned = !showPinned;
if( tabLayout.getTabAt(0) != null)
@@ -889,6 +925,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
TextView account_followed_by = findViewById(R.id.account_followed_by);
account_followed_by.setVisibility(View.VISIBLE);
}
+ invalidateOptionsMenu();
}
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 d1fcb3d63..f1c81ba91 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
@@ -84,7 +84,12 @@ public class API {
REPORT,
REMOTE_FOLLOW,
PIN,
- UNPIN
+ UNPIN,
+ ENDORSE,
+ UNENDORSE,
+ SHOW_BOOST,
+ HIDE_BOOST
+
}
public enum accountPrivacy {
PUBLIC,
@@ -964,6 +969,18 @@ public class API {
case UNPIN:
action = String.format("/statuses/%s/unpin", targetedId);
break;
+ case ENDORSE:
+ action = String.format("/accounts/%s/pin", targetedId);
+ break;
+ case UNENDORSE:
+ action = String.format("/accounts/%s/unpin", targetedId);
+ break;
+ case SHOW_BOOST:
+ action = String.format("/accounts/%s/follow", targetedId);
+ break;
+ case HIDE_BOOST:
+ action = String.format("/accounts/%s/follow", targetedId);
+ break;
case UNSTATUS:
action = String.format("/statuses/%s", targetedId);
break;
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java
index 05cd81715..22cf62e37 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java
@@ -702,7 +702,16 @@ public class Helper {
message = context.getString(R.string.toast_report);
}else if(statusAction == API.StatusAction.UNSTATUS){
message = context.getString(R.string.toast_unstatus);
+ }else if(statusAction == API.StatusAction.UNENDORSE){
+ message = context.getString(R.string.toast_unendorse);
+ }else if(statusAction == API.StatusAction.ENDORSE){
+ message = context.getString(R.string.toast_endorse);
+ }else if(statusAction == API.StatusAction.SHOW_BOOST){
+ message = context.getString(R.string.toast_show_boost);
+ }else if(statusAction == API.StatusAction.HIDE_BOOST){
+ message = context.getString(R.string.toast_hide_boost);
}
+
}else {
message = context.getString(R.string.toast_error);
}
diff --git a/app/src/main/res/menu/main_showaccount.xml b/app/src/main/res/menu/main_showaccount.xml
index ac9ab856a..42b92f173 100644
--- a/app/src/main/res/menu/main_showaccount.xml
+++ b/app/src/main/res/menu/main_showaccount.xml
@@ -31,6 +31,21 @@
android:title="@string/more_action_7"
android:icon="@drawable/ic_chat_bubble_outline"
app:showAsAction="ifRoom" />
+
+
+
+
+
+
- Masto.host is our Mastodon hosting partner.\n\nWith this partnership they provide me free hosting for Mastalab\'s instance and in exchange I promote them in here.\n\nTo be clear, there is no money involved or tracking of users. I needed an instance for testing, we talked and agreed on this.\n\nGo check them out if you want to run your own Mastodon instance.
Partnerships
Information
+
+ Hide boosts from %s
+ Feature on profile
+ Hide everything from %s
+ Show boosts from %s
+ Don\'t feature on profile
+ Show everything from %s
+ The account is now featured on profile
+ The account is no longer featured on profile
+ Boosts are now shown!
+ Boosts are now hidden!
+
+
- HTTP
- SOCKS