This commit is contained in:
stom79 2018-10-29 18:32:55 +01:00
parent f934a4800f
commit b9ea9f67ac
5 changed files with 203 additions and 3 deletions

View File

@ -119,6 +119,8 @@ public class Status implements Parcelable{
public Status(){
this.status = this;
}
private List<String> conversationProfilePicture;
protected Status(Parcel in) {
id = in.readString();
@ -1028,4 +1030,12 @@ public class Status implements Parcelable{
public void setType(RetrieveFeedsAsyncTask.Type type) {
this.type = type;
}
public List<String> getConversationProfilePicture() {
return conversationProfilePicture;
}
public void setConversationProfilePicture(List<String> conversationProfilePicture) {
this.conversationProfilePicture = conversationProfilePicture;
}
}

View File

@ -42,6 +42,7 @@ import android.text.Spannable;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MenuItem;
@ -62,7 +63,11 @@ import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.FitCenter;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
import com.github.stom79.mytransl.MyTransL;
@ -255,10 +260,17 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
ImageView status_prev2_h;
ImageView status_prev3_h;
ImageView status_prev4_h;
LinearLayout conversation_pp_2_container, conversation_pp_3_container;
ImageView status_prev1_play_h;
ImageView status_prev2_play_h;
ImageView status_prev3_play_h;
ImageView status_prev4_play_h;
ImageView conversation_pp_1;
ImageView conversation_pp_2;
ImageView conversation_pp_3;
ImageView conversation_pp_4;
LinearLayout conversation_pp;
RelativeLayout status_prev4_container;
TextView status_reply;
ImageView status_pin;
@ -281,7 +293,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
ImageView hide_preview, hide_preview_h;
TextView status_toot_app;
public View getView(){
return itemView;
}
@ -348,6 +359,13 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
hide_preview = itemView.findViewById(R.id.hide_preview);
hide_preview_h = itemView.findViewById(R.id.hide_preview_h);
status_toot_app = itemView.findViewById(R.id.status_toot_app);
conversation_pp = itemView.findViewById(R.id.conversation_pp);
conversation_pp_1 = itemView.findViewById(R.id.conversation_pp_1);
conversation_pp_2 = itemView.findViewById(R.id.conversation_pp_2);
conversation_pp_3 = itemView.findViewById(R.id.conversation_pp_3);
conversation_pp_4 = itemView.findViewById(R.id.conversation_pp_4);
conversation_pp_2_container = itemView.findViewById(R.id.conversation_pp_2_container);
conversation_pp_3_container = itemView.findViewById(R.id.conversation_pp_3_container);
}
}
@ -748,6 +766,54 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
holder.status_account_profile_boost_by.setVisibility(View.GONE);
holder.status_account_profile.setVisibility(View.VISIBLE);
}
if( type == RetrieveFeedsAsyncTask.Type.CONVERSATION && status.getConversationProfilePicture() != null){
holder.status_account_profile.setVisibility(View.GONE);
holder.conversation_pp.setVisibility(View.VISIBLE);
if( status.getConversationProfilePicture().size() == 1) {
holder.conversation_pp_1.setVisibility(View.VISIBLE);
holder.conversation_pp_1.setScaleType(ImageView.ScaleType.CENTER_CROP);
holder.conversation_pp_2_container.setVisibility(View.GONE);
holder.conversation_pp_3_container.setVisibility(View.GONE);
holder.conversation_pp_2.setVisibility(View.GONE);
holder.conversation_pp_3.setVisibility(View.GONE);
holder.conversation_pp_4.setVisibility(View.GONE);
Glide.with(context)
.load(status.getConversationProfilePicture().get(0))
.apply(new RequestOptions().transforms(new FitCenter(), new RoundedCorners(10)))
.into(holder.conversation_pp_1);
}else if( status.getConversationProfilePicture().size() == 2) {
holder.conversation_pp_2_container.setVisibility(View.VISIBLE);
holder.conversation_pp_3_container.setVisibility(View.GONE);
holder.conversation_pp_1.setVisibility(View.VISIBLE);
holder.conversation_pp_2.setVisibility(View.VISIBLE);
holder.conversation_pp_3.setVisibility(View.GONE);
holder.conversation_pp_4.setVisibility(View.GONE);
Helper.loadGiF(context, status.getConversationProfilePicture().get(0), holder.conversation_pp_1);
Helper.loadGiF(context, status.getConversationProfilePicture().get(1), holder.conversation_pp_2);
}else if( status.getConversationProfilePicture().size() == 3) {
holder.conversation_pp_4.setVisibility(View.GONE);
holder.conversation_pp_1.setVisibility(View.VISIBLE);
holder.conversation_pp_2.setVisibility(View.VISIBLE);
holder.conversation_pp_3.setVisibility(View.VISIBLE);
holder.conversation_pp_4.setVisibility(View.GONE);
holder.conversation_pp_2_container.setVisibility(View.VISIBLE);
holder.conversation_pp_3_container.setVisibility(View.VISIBLE);
Helper.loadGiF(context, status.getConversationProfilePicture().get(0), holder.conversation_pp_1);
Helper.loadGiF(context, status.getConversationProfilePicture().get(1), holder.conversation_pp_2);
Helper.loadGiF(context, status.getConversationProfilePicture().get(2), holder.conversation_pp_3);
}else if( status.getConversationProfilePicture().size() == 4) {
holder.conversation_pp_1.setVisibility(View.VISIBLE);
holder.conversation_pp_2.setVisibility(View.VISIBLE);
holder.conversation_pp_3.setVisibility(View.VISIBLE);
holder.conversation_pp_4.setVisibility(View.VISIBLE);
holder.conversation_pp_2_container.setVisibility(View.VISIBLE);
holder.conversation_pp_3_container.setVisibility(View.VISIBLE);
Helper.loadGiF(context, status.getConversationProfilePicture().get(0), holder.conversation_pp_1);
Helper.loadGiF(context, status.getConversationProfilePicture().get(1), holder.conversation_pp_2);
Helper.loadGiF(context, status.getConversationProfilePicture().get(2), holder.conversation_pp_3);
Helper.loadGiF(context, status.getConversationProfilePicture().get(3), holder.conversation_pp_4);
}
}
holder.status_action_container.setVisibility(View.VISIBLE);
if( ( getItemViewType(position) != COMPACT_STATUS ) && (trans_forced || (translator != Helper.TRANS_NONE && currentLocale != null && status.getLanguage() != null && !status.getLanguage().trim().equals(currentLocale)))){
holder.status_translate.setVisibility(View.VISIBLE);

View File

@ -387,8 +387,15 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
if( type == RetrieveFeedsAsyncTask.Type.CONVERSATION ){
List<Conversation> conversations = apiResponse.getConversations();
List<Status> statusesConversations = new ArrayList<>();
for( Conversation conversation: conversations)
statusesConversations.add(conversation.getLast_status());
for( Conversation conversation: conversations) {
Status status = new Status();
status = conversation.getLast_status();
List<String> ppConversation = new ArrayList<>();
for(Account account: conversation.getAccounts())
ppConversation.add(account.getAvatar());
status.setConversationProfilePicture(ppConversation);
statusesConversations.add(status);
}
apiResponse.setStatuses(statusesConversations);
}
int previousPosition = this.statuses.size();

View File

@ -46,6 +46,66 @@
android:layout_centerHorizontal="true"
android:id="@+id/status_account_profile"
tools:ignore="ContentDescription" />
<LinearLayout
android:id="@+id/conversation_pp"
android:visibility="gone"
android:layout_width="50dp"
android:layout_height="50dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/conversation_pp_1"
android:layout_width="0dp"
android:layout_weight="1"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:layout_height="match_parent"
tools:ignore="ContentDescription" />
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:id="@+id/conversation_pp_2_container"
android:orientation="vertical"
>
<ImageView
android:id="@+id/conversation_pp_2"
android:scaleType="centerCrop"
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
tools:ignore="ContentDescription" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:orientation="horizontal"
android:id="@+id/conversation_pp_3_container"
android:baselineAligned="false">
<ImageView
android:id="@+id/conversation_pp_3"
android:layout_width="0dp"
android:layout_weight="1"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:layout_height="wrap_content"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/conversation_pp_4"
android:layout_width="0dp"
android:layout_weight="1"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:layout_height="wrap_content"
tools:ignore="ContentDescription" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"

View File

@ -46,6 +46,63 @@
android:layout_centerHorizontal="true"
android:id="@+id/status_account_profile"
tools:ignore="ContentDescription" />
<LinearLayout
android:id="@+id/conversation_pp"
android:visibility="gone"
android:layout_width="50dp"
android:layout_height="50dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/conversation_pp_1"
android:layout_width="0dp"
android:layout_weight="1"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:layout_height="match_parent"
tools:ignore="ContentDescription" />
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:id="@+id/conversation_pp_2_container"
android:orientation="vertical"
>
<ImageView
android:id="@+id/conversation_pp_2"
android:scaleType="fitCenter"
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
tools:ignore="ContentDescription" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:id="@+id/conversation_pp_3_container"
android:baselineAligned="false">
<ImageView
android:id="@+id/conversation_pp_3"
android:layout_width="0dp"
android:layout_weight="1"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:layout_height="match_parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/conversation_pp_4"
android:layout_width="0dp"
android:layout_weight="1"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:layout_height="match_parent"
tools:ignore="ContentDescription" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"