Fix issue for 1.30.0

This commit is contained in:
stom79 2018-11-18 11:50:21 +01:00
parent c3127357d1
commit 5663ff9fd7
5 changed files with 65 additions and 9 deletions

View File

@ -44,7 +44,7 @@ allprojects {
}
ext.supportLibraryVersion = '28.0.0'
ext.glideLibraryVersion = '4.8.0'
ext.conscryptLibraryVersion = '1.4.1'
ext.conscryptLibraryVersion = '1.3.0'
ext.evernoteLibraryVersion = '1.3.0-alpha08'
ext.gsonLibraryVersion = '2.8.2'
ext.guavaLibraryVersion = '24.1-android'

View File

@ -15,6 +15,9 @@
package fr.gouv.etalab.mastodon.client.Entities;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by Thomas on 23/04/2017.
* Manages card in toots, only used during a call to the context
@ -22,7 +25,7 @@ package fr.gouv.etalab.mastodon.client.Entities;
* All values are not implemented
*/
public class Card{
public class Card implements Parcelable {
private String url;
private String title;
@ -41,6 +44,34 @@ public class Card{
public Card(){}
protected Card(Parcel in) {
url = in.readString();
title = in.readString();
description = in.readString();
image = in.readString();
type = in.readString();
html = in.readString();
author_name = in.readString();
author_url = in.readString();
embed_url = in.readString();
provider_name = in.readString();
provider_url = in.readString();
height = in.readInt();
width = in.readInt();
}
public static final Creator<Card> CREATOR = new Creator<Card>() {
@Override
public Card createFromParcel(Parcel in) {
return new Card(in);
}
@Override
public Card[] newArray(int size) {
return new Card[size];
}
};
public String getUrl() {
return url;
}
@ -145,4 +176,26 @@ public class Card{
public void setWidth(int width) {
this.width = width;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(url);
dest.writeString(title);
dest.writeString(description);
dest.writeString(image);
dest.writeString(type);
dest.writeString(html);
dest.writeString(author_name);
dest.writeString(author_url);
dest.writeString(embed_url);
dest.writeString(provider_name);
dest.writeString(provider_url);
dest.writeInt(height);
dest.writeInt(width);
}
}

View File

@ -130,6 +130,7 @@ public class Status implements Parcelable{
in_reply_to_id = in.readString();
in_reply_to_account_id = in.readString();
reblog = in.readParcelable(Status.class.getClassLoader());
card = in.readParcelable(Card.class.getClassLoader());
account = in.readParcelable(Account.class.getClassLoader());
application = in.readParcelable(Application.class.getClassLoader());
mentions = in.readArrayList(Mention.class.getClassLoader());
@ -166,6 +167,7 @@ public class Status implements Parcelable{
dest.writeString(in_reply_to_id);
dest.writeString(in_reply_to_account_id);
dest.writeParcelable(reblog, flags);
dest.writeParcelable(card, flags);
dest.writeParcelable(account, flags);
dest.writeParcelable(application, flags);
dest.writeList(mentions);

View File

@ -1222,15 +1222,14 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
holder.webview_preview.setVisibility(View.VISIBLE);
}
boolean display_video_preview = sharedpreferences.getBoolean(Helper.SET_DISPLAY_VIDEO_PREVIEWS, true);
if( type == RetrieveFeedsAsyncTask.Type.CONTEXT || display_card || display_video_preview){
if( (type == RetrieveFeedsAsyncTask.Type.CONTEXT && position == conversationPosition ) || display_card || display_video_preview){
if( type == RetrieveFeedsAsyncTask.Type.CONTEXT)
if( type == RetrieveFeedsAsyncTask.Type.CONTEXT & position == conversationPosition)
holder.status_cardview_content.setVisibility(View.VISIBLE);
else
holder.status_cardview_content.setVisibility(View.GONE);
if( position == conversationPosition || display_card || display_video_preview){
Card card = status.getReblog()!= null?status.getReblog().getCard():status.getCard();
if( card != null){
holder.status_cardview_content.setText(card.getDescription());

View File

@ -214,25 +214,27 @@
<LinearLayout
android:id="@+id/status_cardview"
android:padding="5dp"
android:layout_marginBottom="10dp"
android:visibility="gone"
android:background="@drawable/card_border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="1dp"
android:orientation="horizontal">
<ImageView
android:layout_gravity="center"
android:id="@+id/status_cardview_image"
android:layout_width="80dp"
android:gravity="center"
android:layout_height="80dp"
android:scaleType="centerCrop"
android:layout_height="match_parent"
android:minHeight="80dp"
tools:ignore="ContentDescription" />
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_marginLeft="2dp"
android:layout_marginStart="2dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:layout_height="wrap_content">
<TextView