summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java13
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/activities/TootInfoActivity.java4
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java9
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/client/PeertubeAPI.java260
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountsListAdapter.java150
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayAccountsFragment.java6
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayMediaFragment.java2
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java7
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/fragments/TabLayoutTootsFragment.java10
9 files changed, 173 insertions, 288 deletions
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 97ef8c7c3..08d4aba7c 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
@@ -143,6 +143,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
private boolean peertubeAccount;
private ImageView pp_actionBar;
private String accountId;
+ private boolean ischannel;
public enum action{
FOLLOW,
@@ -192,6 +193,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
}else {
accountId = account.getId();
}
+ ischannel = b.getBoolean("ischannel", false);
peertubeAccount = b.getBoolean("peertubeaccount", false);
if (account == null) {
new RetrieveAccountAsyncTask(getApplicationContext(), accountId, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@@ -507,7 +509,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
});
- if ( account.getFields() != null && account.getFields().size() > 0){
+ if ( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON && account.getFields() != null && account.getFields().size() > 0){
LinkedHashMap<String, String> fields = account.getFields();
LinkedHashMap<String, Boolean> fieldsVerified = account.getFieldsVerified();
Iterator it = fields.entrySet().iterator();
@@ -860,8 +862,9 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
DisplayStatusFragment displayStatusFragment = new DisplayStatusFragment();
bundle = new Bundle();
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.USER);
- bundle.putString("targetedId", account.getAcct());
+ bundle.putString("targetedid", account.getAcct());
bundle.putBoolean("showReply",false);
+ bundle.putBoolean("ischannel",ischannel);
displayStatusFragment.setArguments(bundle);
return displayStatusFragment;
}
@@ -869,7 +872,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
if( peertubeAccount){
DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment();
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.CHANNELS);
- bundle.putString("targetedId", account.getId());
+ bundle.putString("targetedid", account.getId());
bundle.putString("instance",account.getAcct().split("@")[1]);
bundle.putString("name",account.getAcct().split("@")[0]);
displayAccountsFragment.setArguments(bundle);
@@ -877,7 +880,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
}else{
DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment();
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.FOLLOWING);
- bundle.putString("targetedId", account.getId());
+ bundle.putString("targetedid", account.getId());
displayAccountsFragment.setArguments(bundle);
return displayAccountsFragment;
}
@@ -885,7 +888,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
case 2:
DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment();
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.FOLLOWERS);
- bundle.putString("targetedId", account.getId());
+ bundle.putString("targetedid", account.getId());
displayAccountsFragment.setArguments(bundle);
return displayAccountsFragment;
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootInfoActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootInfoActivity.java
index ff54cdcc6..b64fd859f 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootInfoActivity.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootInfoActivity.java
@@ -142,13 +142,13 @@ public class TootInfoActivity extends BaseActivity {
case 0:
DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment();
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.REBLOGGED);
- bundle.putString("targetedId", toot_id);
+ bundle.putString("targetedid", toot_id);
displayAccountsFragment.setArguments(bundle);
return displayAccountsFragment;
case 1:
displayAccountsFragment = new DisplayAccountsFragment();
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.FAVOURITED);
- bundle.putString("targetedId", toot_id);
+ bundle.putString("targetedid", toot_id);
displayAccountsFragment.setArguments(bundle);
return displayAccountsFragment;
}
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java
index 4fc05c510..e3d24f489 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java
@@ -83,7 +83,8 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
POVERVIEW,
PTRENDING,
PRECENTLYADDED,
- PLOCAL
+ PLOCAL,
+ CHANNEL
}
@@ -212,6 +213,10 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
apiResponse = peertubeAPI.getVideos(targetedID, max_id);
}
break;
+ case CHANNEL:
+ PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get());
+ apiResponse = peertubeAPI.getVideosChannel(targetedID, max_id);
+ break;
case ONESTATUS:
apiResponse = api.getStatusbyId(targetedID);
break;
@@ -260,7 +265,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
break;
case PSUBSCRIPTIONS:
- PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get());
+ peertubeAPI = new PeertubeAPI(this.contextReference.get());
apiResponse = peertubeAPI.getSubscriptionsTL(max_id);
break;
case POVERVIEW:
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/client/PeertubeAPI.java b/app/src/main/java/fr/gouv/etalab/mastodon/client/PeertubeAPI.java
index fd1ae7d3c..8056f2ee1 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/client/PeertubeAPI.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/client/PeertubeAPI.java
@@ -17,6 +17,7 @@ package fr.gouv.etalab.mastodon.client;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
+import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
@@ -350,6 +351,7 @@ public class PeertubeAPI {
try {
HttpsConnection httpsConnection = new HttpsConnection(context);
+ Log.v(Helper.TAG,"url: " + getAbsoluteUrl(String.format("/accounts/%s/videos", acct)));
String response = httpsConnection.get(getAbsoluteUrl(String.format("/accounts/%s/videos", acct)), 60, params, prefKeyOauthTokenT);
JSONArray jsonArray = new JSONObject(response).getJSONArray("data");
@@ -372,6 +374,63 @@ public class PeertubeAPI {
}
+ /**
+ * Retrieves videos channel for the account *synchronously*
+ *
+ * @param acct String Id of the account
+ * @param max_id String id max
+ * @return APIResponse
+ */
+ public APIResponse getVideosChannel(String acct, String max_id) {
+ return getVideosChannel(acct, max_id, null, tootPerPage);
+ }
+
+ /**
+ * Retrieves status for the account *synchronously*
+ *
+ * @param acct String Id of the account
+ * @param max_id String id max
+ * @param since_id String since the id
+ * @param limit int limit - max value 40
+ * @return APIResponse
+ */
+ @SuppressWarnings("SameParameterValue")
+ private APIResponse getVideosChannel(String acct, String max_id, String since_id, int limit) {
+
+ HashMap<String, String> params = new HashMap<>();
+ if (max_id != null)
+ params.put("start", max_id);
+ if (since_id != null)
+ params.put("since_id", since_id);
+ if (0 < limit || limit > 40)
+ limit = 40;
+ params.put("count", String.valueOf(limit));
+ List<Peertube> peertubes = new ArrayList<>();
+ try {
+
+ HttpsConnection httpsConnection = new HttpsConnection(context);
+ Log.v(Helper.TAG,"url: " + getAbsoluteUrl(String.format("/video-channels/%s/videos", acct)));
+ String response = httpsConnection.get(getAbsoluteUrl(String.format("/video-channels/%s/videos", acct)), 60, params, prefKeyOauthTokenT);
+
+ JSONArray jsonArray = new JSONObject(response).getJSONArray("data");
+ peertubes = parsePeertube(jsonArray);
+
+ } catch (HttpsConnection.HttpsConnectionException e) {
+ setError(e.getStatusCode(), e);
+ e.printStackTrace();
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (KeyManagementException e) {
+ e.printStackTrace();
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ apiResponse.setPeertubes(peertubes);
+ return apiResponse;
+ }
+
/**
* Retrieves accounts that reblogged the status *synchronously*
@@ -935,212 +994,11 @@ public class PeertubeAPI {
return apiResponse;
}
- /**
- * Retrieves home timeline for the account *synchronously*
- * @return APIResponse
- */
- public APIResponse getHowTo() {
- List<HowToVideo> howToVideos = new ArrayList<>();
- try {
- HttpsConnection httpsConnection = new HttpsConnection(context);
- String response = httpsConnection.get("https://peertube.social/api/v1/video-channels/mastalab_channel/videos", 60, null, null);
- JSONArray jsonArray = new JSONObject(response).getJSONArray("data");
- howToVideos = parseHowTos(jsonArray);
- } catch (HttpsConnection.HttpsConnectionException e) {
- setError(e.getStatusCode(), e);
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (KeyManagementException e) {
- e.printStackTrace();
- } catch (JSONException e) {
- e.printStackTrace();
- }
- apiResponse.setHowToVideos(howToVideos);
- return apiResponse;
- }
- /**
- * Retrieves Peertube videos from an instance *synchronously*
- * @return APIResponse
- */
- public APIResponse getMisskey(String instance, String max_id) {
- JSONObject params = new JSONObject();
- try {
- params.put("file", false);
- if( max_id != null)
- params.put("untilId",max_id);
- params.put("local",true);
- params.put("poll",false);
- params.put("renote",false);
- params.put("reply",false);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- try {
- statuses = new ArrayList<>();
- HttpsConnection httpsConnection = new HttpsConnection(context);
- String response = httpsConnection.postMisskey("https://"+instance+"/api/notes", 60, params, null);
- statuses = parseNotes(context, instance, new JSONArray(response));
- if( statuses != null && statuses.size() > 0){
- apiResponse.setSince_id(statuses.get(0).getId());
- apiResponse.setMax_id(statuses.get(statuses.size() -1).getId());
- }
- } catch (HttpsConnection.HttpsConnectionException e) {
- setError(e.getStatusCode(), e);
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (KeyManagementException e) {
- e.printStackTrace();
- } catch (JSONException e) {
- e.printStackTrace();
- }
- apiResponse.setStatuses(statuses);
- return apiResponse;
- }
- /**
- * Retrieves public timeline for the account *synchronously*
- * @param local boolean only local timeline
- * @param max_id String id max
- * @return APIResponse
- */
- public APIResponse getPublicTimeline(String instanceName, boolean local, String max_id){
- return getPublicTimeline(local, instanceName, max_id, null, tootPerPage);
- }
-
- /**
- * Retrieves public timeline for the account *synchronously*
- * @param local boolean only local timeline
- * @param max_id String id max
- * @return APIResponse
- */
- public APIResponse getPublicTimeline(boolean local, String max_id){
- return getPublicTimeline(local, null, max_id, null, tootPerPage);
- }
-
- /**
- * Retrieves public timeline for the account since an Id value *synchronously*
- * @param local boolean only local timeline
- * @param since_id String id since
- * @return APIResponse
- */
- public APIResponse getPublicTimelineSinceId(boolean local, String since_id) {
- return getPublicTimeline(local, null, null, since_id, tootPerPage);
- }
-
- /**
- * Retrieves instance timeline since an Id value *synchronously*
- * @param instanceName String instance name
- * @param since_id String id since
- * @return APIResponse
- */
- public APIResponse getInstanceTimelineSinceId(String instanceName, String since_id) {
- return getPublicTimeline(true, instanceName, null, since_id, tootPerPage);
- }
-
- /**
- * Retrieves public timeline for the account *synchronously*
- * @param local boolean only local timeline
- * @param max_id String id max
- * @param since_id String since the id
- * @param limit int limit - max value 40
- * @return APIResponse
- */
- private APIResponse getPublicTimeline(boolean local, String instanceName, String max_id, String since_id, int limit){
-
- HashMap<String, String> params = new HashMap<>();
- if( local)
- params.put("local", Boolean.toString(true));
- if( max_id != null )
- params.put("max_id", max_id);
- if( since_id != null )
- params.put("since_id", since_id);
- if( 0 > limit || limit > 40)
- limit = 40;
- params.put("limit",String.valueOf(limit));
- statuses = new ArrayList<>();
- try {
- HttpsConnection httpsConnection = new HttpsConnection(context);
- String url;
- if( instanceName == null)
- url = getAbsoluteUrl("/timelines/public");
- else
- url = getAbsoluteUrlRemoteInstance(instanceName);
- String response = httpsConnection.get(url, 60, params, prefKeyOauthTokenT);
- apiResponse.setSince_id(httpsConnection.getSince_id());
- apiResponse.setMax_id(httpsConnection.getMax_id());
- statuses = parseStatuses(context, new JSONArray(response));
- } catch (HttpsConnection.HttpsConnectionException e) {
- setError(e.getStatusCode(), e);
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (KeyManagementException e) {
- e.printStackTrace();
- } catch (JSONException e) {
- e.printStackTrace();
- }
- apiResponse.setStatuses(statuses);
- return apiResponse;
- }
-
-
-
- public APIResponse getCustomArtTimeline(boolean local, String tag, String max_id, List<String> any, List<String> all, List<String> none){
- return getArtTimeline(local, tag, max_id, null, any, all, none);
- }
-
- public APIResponse getArtTimeline(boolean local, String max_id, List<String> any, List<String> all, List<String> none){
- return getArtTimeline(local, null, max_id, null, any, all, none);
- }
-
- public APIResponse getCustomArtTimelineSinceId(boolean local, String tag, String since_id, List<String> any, List<String> all, List<String> none){
- return getArtTimeline(local, tag, null, since_id, any, all, none);
- }
-
- public APIResponse getArtTimelineSinceId(boolean local, String since_id, List<String> any, List<String> all, List<String> none){
- return getArtTimeline(local, null, null, since_id, any, all, none);
- }
- /**
- * Retrieves art timeline
- * @param local boolean only local timeline
- * @param max_id String id max
- * @return APIResponse
- */
- private APIResponse getArtTimeline(boolean local, String tag, String max_id, String since_id, List<String> any, List<String> all, List<String> none){
- if( tag == null)
- tag = "mastoart";
- APIResponse apiResponse = getPublicTimelineTag(tag, local, true, max_id, since_id, tootPerPage, any, all, none);
- APIResponse apiResponseReply = new APIResponse();
- if( apiResponse != null){
- apiResponseReply.setMax_id(apiResponse.getMax_id());
- apiResponseReply.setSince_id(apiResponse.getSince_id());
- apiResponseReply.setStatuses(new ArrayList<>());
- if( apiResponse.getStatuses() != null && apiResponse.getStatuses().size() > 0){
- for( Status status: apiResponse.getStatuses()){
- if( status.getMedia_attachments() != null ) {
- String statusSerialized = Helper.statusToStringStorage(status);
- for (Attachment attachment : status.getMedia_attachments()) {
- Status newStatus = Helper.restoreStatusFromString(statusSerialized);
- if (newStatus == null)
- break;
- newStatus.setArt_attachment(attachment);
- apiResponseReply.getStatuses().add(newStatus);
- }
- }
- }
- }
- }
- return apiResponseReply;
- }
/**
* Retrieves public tag timeline *synchronously*
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountsListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountsListAdapter.java
index dd9d7ba0f..3bed0aa86 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountsListAdapter.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountsListAdapter.java
@@ -38,9 +38,11 @@ import java.util.List;
import es.dmoral.toasty.Toasty;
import fr.gouv.etalab.mastodon.R;
+import fr.gouv.etalab.mastodon.activities.MainActivity;
import fr.gouv.etalab.mastodon.activities.ShowAccountActivity;
import fr.gouv.etalab.mastodon.asynctasks.PostActionAsyncTask;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveAccountsAsyncTask;
+import fr.gouv.etalab.mastodon.asynctasks.UpdateAccountInfoAsyncTask;
import fr.gouv.etalab.mastodon.client.API;
import fr.gouv.etalab.mastodon.client.Entities.Account;
import fr.gouv.etalab.mastodon.client.Entities.Error;
@@ -92,77 +94,82 @@ public class AccountsListAdapter extends RecyclerView.Adapter implements OnPostA
final Account account = accounts.get(position);
- if( action == RetrieveAccountsAsyncTask.Type.BLOCKED)
- account.setFollowType(Account.followAction.BLOCK);
- else if( action == RetrieveAccountsAsyncTask.Type.MUTED)
- account.setFollowType(Account.followAction.MUTE);
-
- if( action == RetrieveAccountsAsyncTask.Type.CHANNELS)
- account.setFollowType(Account.followAction.NOT_FOLLOW);
+ if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
+ if (action == RetrieveAccountsAsyncTask.Type.BLOCKED)
+ account.setFollowType(Account.followAction.BLOCK);
+ else if (action == RetrieveAccountsAsyncTask.Type.MUTED)
+ account.setFollowType(Account.followAction.MUTE);
+
+ if (action == RetrieveAccountsAsyncTask.Type.CHANNELS)
+ account.setFollowType(Account.followAction.NOT_FOLLOW);
+
+ if (account.getFollowType() == Account.followAction.NOTHING) {
+ holder.account_follow.hide();
+ holder.account_follow_request.setVisibility(View.GONE);
+ doAction = null;
+ } else if (account.getFollowType() == Account.followAction.REQUEST_SENT) {
+ holder.account_follow.hide();
+ holder.account_follow_request.setVisibility(View.VISIBLE);
+ doAction = null;
+ } else if (account.getFollowType() == Account.followAction.FOLLOW) {
+ holder.account_follow.setImageResource(R.drawable.ic_user_times);
+ doAction = API.StatusAction.UNFOLLOW;
+ holder.account_follow.show();
+ holder.account_follow_request.setVisibility(View.GONE);
+ } else if (account.getFollowType() == Account.followAction.NOT_FOLLOW) {
+ holder.account_follow.setImageResource(R.drawable.ic_user_plus);
+ doAction = API.StatusAction.FOLLOW;
+ holder.account_follow.show();
+ holder.account_follow_request.setVisibility(View.GONE);
+ } else if (account.getFollowType() == Account.followAction.BLOCK) {
+ holder.account_follow.setImageResource(R.drawable.ic_lock_open);
+ doAction = API.StatusAction.UNBLOCK;
+ holder.account_follow.show();
+ holder.account_follow_request.setVisibility(View.GONE);
+ } else if (account.getFollowType() == Account.followAction.MUTE) {
+
+ if (account.isMuting_notifications())
+ holder.account_mute_notification.setImageResource(R.drawable.ic_notifications_active);
+ else
+ holder.account_mute_notification.setImageResource(R.drawable.ic_notifications_off);
+
+ holder.account_mute_notification.show();
+ holder.account_follow.setImageResource(R.drawable.ic_volume_up);
+ doAction = API.StatusAction.UNMUTE;
+ holder.account_follow.show();
+ holder.account_follow_request.setVisibility(View.GONE);
+ final int positionFinal = position;
+ holder.account_mute_notification.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ account.setMuting_notifications(!account.isMuting_notifications());
+ new PostActionAsyncTask(context, API.StatusAction.MUTE_NOTIFICATIONS, account.getId(), account.isMuting_notifications(), AccountsListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+ accountsListAdapter.notifyItemChanged(positionFinal);
+ }
+ });
+ }
- if (account.getFollowType() == Account.followAction.NOTHING){
- holder.account_follow.hide();
- holder.account_follow_request.setVisibility(View.GONE);
- doAction = null;
- }else if( account.getFollowType() == Account.followAction.REQUEST_SENT){
- holder.account_follow.hide();
- holder.account_follow_request.setVisibility(View.VISIBLE);
- doAction = null;
- }else if( account.getFollowType() == Account.followAction.FOLLOW){
- holder.account_follow.setImageResource(R.drawable.ic_user_times);
- doAction = API.StatusAction.UNFOLLOW;
- holder.account_follow.show();
- holder.account_follow_request.setVisibility(View.GONE);
- }else if( account.getFollowType() == Account.followAction.NOT_FOLLOW){
- holder.account_follow.setImageResource(R.drawable.ic_user_plus);
- doAction = API.StatusAction.FOLLOW;
- holder.account_follow.show();
- holder.account_follow_request.setVisibility(View.GONE);
- }else if( account.getFollowType() == Account.followAction.BLOCK){
- holder.account_follow.setImageResource(R.drawable.ic_lock_open);
- doAction = API.StatusAction.UNBLOCK;
- holder.account_follow.show();
- holder.account_follow_request.setVisibility(View.GONE);
- }else if( account.getFollowType() == Account.followAction.MUTE){
-
- if(account.isMuting_notifications())
- holder.account_mute_notification.setImageResource(R.drawable.ic_notifications_active);
- else
- holder.account_mute_notification.setImageResource(R.drawable.ic_notifications_off);
-
- holder.account_mute_notification.show();
- holder.account_follow.setImageResource(R.drawable.ic_volume_up);
- doAction = API.StatusAction.UNMUTE;
- holder.account_follow.show();
- holder.account_follow_request.setVisibility(View.GONE);
- final int positionFinal = position;
- holder.account_mute_notification.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- account.setMuting_notifications(!account.isMuting_notifications());
- new PostActionAsyncTask(context, API.StatusAction.MUTE_NOTIFICATIONS, account.getId(), account.isMuting_notifications(), AccountsListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
- accountsListAdapter.notifyItemChanged(positionFinal);
- }
- });
- }
- if( action != RetrieveAccountsAsyncTask.Type.CHANNELS){
- holder.account_container.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if( holder.account_info.getVisibility() == View.VISIBLE)
- holder.account_info.setVisibility(View.GONE);
- else
- holder.account_info.setVisibility(View.VISIBLE);
- }
- });
- }else{
- holder.account_container.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
+ if (action != RetrieveAccountsAsyncTask.Type.CHANNELS) {
+ holder.account_container.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (holder.account_info.getVisibility() == View.VISIBLE)
+ holder.account_info.setVisibility(View.GONE);
+ else
+ holder.account_info.setVisibility(View.VISIBLE);
+ }
+ });
+ } else {
+ holder.account_container.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
- }
- });
+ }
+ });
+ }
+ }else {
+ holder.account_follow.hide();
}
account.makeAccountNameEmoji(context, AccountsListAdapter.this, account);
@@ -212,11 +219,16 @@ public class AccountsListAdapter extends RecyclerView.Adapter implements OnPostA
holder.account_pp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- if(action != RetrieveAccountsAsyncTask.Type.CHANNELS) {
+ if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE || action != RetrieveAccountsAsyncTask.Type.CHANNELS) {
//Avoid to reopen details about the current account
if (targetedId == null || !targetedId.equals(account.getId())) {
Intent intent = new Intent(context, ShowAccountActivity.class);
Bundle b = new Bundle();
+ if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
+ b.putBoolean("peertubeaccount", true);
+ b.putBoolean("ischannel", true);
+ b.putString("targetedid", account.getAcct());
+ }
b.putParcelable("account", account);
intent.putExtras(b);
context.startActivity(intent);
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayAccountsFragment.java b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayAccountsFragment.java
index bd077201b..f8f5ed165 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayAccountsFragment.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayAccountsFragment.java
@@ -36,8 +36,10 @@ import java.util.List;
import es.dmoral.toasty.Toasty;
import fr.gouv.etalab.mastodon.R;
+import fr.gouv.etalab.mastodon.activities.MainActivity;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveAccountsAsyncTask;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveManyRelationshipsAsyncTask;
+import fr.gouv.etalab.mastodon.asynctasks.UpdateAccountInfoAsyncTask;
import fr.gouv.etalab.mastodon.client.APIResponse;
import fr.gouv.etalab.mastodon.client.Entities.Account;
import fr.gouv.etalab.mastodon.client.Entities.Relationship;
@@ -78,7 +80,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
accounts = new ArrayList<>();
if (bundle != null) {
type = (RetrieveAccountsAsyncTask.Type) bundle.get("type");
- targetedId = bundle.getString("targetedId", null);
+ targetedId = bundle.getString("targetedid", null);
instance = bundle.getString("instance", null);
name = bundle.getString("name", null);
}
@@ -228,7 +230,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
}
swipeRefreshLayout.setRefreshing(false);
firstLoad = false;
- if( type != RetrieveAccountsAsyncTask.Type.BLOCKED )
+ if( type != RetrieveAccountsAsyncTask.Type.BLOCKED && MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON)
new RetrieveManyRelationshipsAsyncTask(context, accounts,DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayMediaFragment.java b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayMediaFragment.java
index b03932c90..d06a84fe6 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayMediaFragment.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayMediaFragment.java
@@ -90,7 +90,7 @@ public class DisplayMediaFragment extends Fragment implements OnRetrieveFeedsInt
mainLoader.setVisibility(View.VISIBLE);
nextElementLoader.setVisibility(View.GONE);
if (bundle != null) {
- targetedId = bundle.getString("targetedId", null);
+ targetedId = bundle.getString("targetedid", null);
}
attachments = new ArrayList<>();
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 a480729e3..75cbdf80c 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
@@ -110,6 +110,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
private String updatedBookMark;
private String lastReadToot;
+ private boolean ischannel;
public DisplayStatusFragment(){
}
@@ -130,7 +131,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
tagTimeline = null;
if (bundle != null) {
type = (RetrieveFeedsAsyncTask.Type) bundle.get("type");
- targetedId = bundle.getString("targetedId", null);
+ targetedId = bundle.getString("targetedid", null);
tag = bundle.getString("tag", null);
showMediaOnly = bundle.getBoolean("showMediaOnly",false);
showPinned = bundle.getBoolean("showPinned",false);
@@ -139,7 +140,11 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
search_peertube = bundle.getString("search_peertube", null);
remote_channel_name = bundle.getString("remote_channel_name", null);
instanceType = bundle.getString("instanceType", null);
+ ischannel = bundle.getBoolean("ischannel",false);
}
+ if( ischannel)
+ type = RetrieveFeedsAsyncTask.Type.CHANNEL;
+
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
//instanceType should not be null only for Peertube accounts
if( !remoteInstance.equals("") && instanceType == null){
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/TabLayoutTootsFragment.java b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/TabLayoutTootsFragment.java
index 906440765..c606de4d9 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/TabLayoutTootsFragment.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/TabLayoutTootsFragment.java
@@ -52,7 +52,7 @@ public class TabLayoutTootsFragment extends Fragment {
final ViewPager viewPager = inflatedView.findViewById(R.id.viewpager);
Bundle bundle = this.getArguments();
if (bundle != null) {
- this.targetedId = bundle.getString("targetedId", null);
+ this.targetedId = bundle.getString("targetedid", null);
}
viewPager.setAdapter(new PagerAdapter
(getChildFragmentManager(), tabLayout.getTabCount()));
@@ -97,7 +97,7 @@ public class TabLayoutTootsFragment extends Fragment {
DisplayStatusFragment displayStatusFragment = new DisplayStatusFragment();
Bundle bundle = new Bundle();
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.USER);
- bundle.putString("targetedId", targetedId);
+ bundle.putString("targetedid", targetedId);
bundle.putBoolean("showReply",false);
displayStatusFragment.setArguments(bundle);
return displayStatusFragment;
@@ -105,21 +105,21 @@ public class TabLayoutTootsFragment extends Fragment {
displayStatusFragment = new DisplayStatusFragment();
bundle = new Bundle();
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.USER);
- bundle.putString("targetedId", targetedId);
+ bundle.putString("targetedid", targetedId);
bundle.putBoolean("showReply",true);
displayStatusFragment.setArguments(bundle);
return displayStatusFragment;
case 2:
DisplayMediaFragment displayMediaFragment = new DisplayMediaFragment();