summaryrefslogtreecommitdiffstats
path: root/app/src/main/java/fr/gouv/etalab/mastodon/drawers
diff options
context:
space:
mode:
authorstom79 <tschneider.ac@gmail.com>2018-12-15 17:13:06 +0100
committerstom79 <tschneider.ac@gmail.com>2018-12-15 17:13:06 +0100
commitcf1dc7518c4988ab54b78ef3d78741e53cc2de5f (patch)
treea43d0a81ac7255dd28c2d8d788a759539ff20641 /app/src/main/java/fr/gouv/etalab/mastodon/drawers
parentdd7695f1c1f679bb28d3f6ac395af1995adf2227 (diff)
Change frontend
Diffstat (limited to 'app/src/main/java/fr/gouv/etalab/mastodon/drawers')
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java
index 8989616af..02077c162 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java
@@ -105,6 +105,7 @@ import fr.gouv.etalab.mastodon.client.Entities.Card;
import fr.gouv.etalab.mastodon.client.Entities.Emojis;
import fr.gouv.etalab.mastodon.client.Entities.Error;
import fr.gouv.etalab.mastodon.client.Entities.Status;
+import fr.gouv.etalab.mastodon.client.Entities.TagTimeline;
import fr.gouv.etalab.mastodon.fragments.DisplayStatusFragment;
import fr.gouv.etalab.mastodon.helper.CrossActions;
import fr.gouv.etalab.mastodon.helper.CustomTextView;
@@ -152,6 +153,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
private List<String> timedMute;
private boolean redraft;
private Status toot;
+ private TagTimeline tagTimeline;
public StatusListAdapter(Context context, RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){
super();
@@ -167,6 +169,21 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
redraft = false;
}
+ public StatusListAdapter(Context context, TagTimeline tagTimeline, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){
+ super();
+ this.context = context;
+ this.statuses = statuses;
+ this.isOnWifi = isOnWifi;
+ this.behaviorWithAttachments = behaviorWithAttachments;
+ layoutInflater = LayoutInflater.from(this.context);
+ statusListAdapter = this;
+ this.type = RetrieveFeedsAsyncTask.Type.TAG;
+ this.targetedId = targetedId;
+ this.translator = translator;
+ redraft = false;
+ this.tagTimeline = tagTimeline;
+ }
+
public StatusListAdapter(Context context, int position, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){
this.context = context;
this.statuses = statuses;
@@ -221,7 +238,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
@Override
public void onViewAttachedToWindow(@NonNull RecyclerView.ViewHolder holder) {
super.onViewAttachedToWindow(holder);
- if( type != RetrieveFeedsAsyncTask.Type.ART && (holder.getItemViewType() == DISPLAYED_STATUS || holder.getItemViewType() == COMPACT_STATUS)) {
+ if( type != RetrieveFeedsAsyncTask.Type.ART && (tagTimeline == null || !tagTimeline.isART()) && (holder.getItemViewType() == DISPLAYED_STATUS || holder.getItemViewType() == COMPACT_STATUS)) {
final ViewHolder viewHolder = (ViewHolder) holder;
// Bug workaround for losing text selection ability, see:
// https://code.google.com/p/android/issues/detail?id=208169
@@ -426,7 +443,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- if( type == RetrieveFeedsAsyncTask.Type.ART)
+ if( type == RetrieveFeedsAsyncTask.Type.ART || (tagTimeline != null && tagTimeline.isART()))
return new ViewHolderArt(layoutInflater.inflate(R.layout.drawer_art, parent, false));
else if( viewType == DISPLAYED_STATUS)
return new ViewHolder(layoutInflater.inflate(R.layout.drawer_status, parent, false));
@@ -445,7 +462,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int i) {
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
final String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
- if( type == RetrieveFeedsAsyncTask.Type.ART) {
+ if( type == RetrieveFeedsAsyncTask.Type.ART || (tagTimeline != null && tagTimeline.isART())) {
final ViewHolderArt holder = (ViewHolderArt) viewHolder;
final Status status = statuses.get(viewHolder.getAdapterPosition());