Fixes issue with asynchronous call for replies.
This commit is contained in:
parent
0d8642af49
commit
d4dbba3d3f
|
@ -1259,6 +1259,7 @@ public class API {
|
|||
status.setVisibility(resobj.get("visibility").toString());
|
||||
status.setLanguage(resobj.get("language").toString());
|
||||
status.setUrl(resobj.get("url").toString());
|
||||
status.setReplies(null);
|
||||
//TODO: replace by the value
|
||||
status.setApplication(new Application());
|
||||
|
||||
|
|
|
@ -157,6 +157,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
if (convertView == null) {
|
||||
convertView = layoutInflater.inflate(R.layout.drawer_status, parent, false);
|
||||
holder = new ViewHolder();
|
||||
holder.loader_replies = (LinearLayout) convertView.findViewById(R.id.loader_replies);
|
||||
holder.card_status_container = (CardView) convertView.findViewById(R.id.card_status_container);
|
||||
holder.status_document_container = (LinearLayout) convertView.findViewById(R.id.status_document_container);
|
||||
holder.status_content = (TextView) convertView.findViewById(R.id.status_content);
|
||||
|
@ -207,8 +208,12 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
//Display a preview for accounts that have replied *if enabled and only for home timeline*
|
||||
if( type == RetrieveFeedsAsyncTask.Type.HOME ) {
|
||||
boolean showPreview = sharedpreferences.getBoolean(Helper.SET_PREVIEW_REPLIES, true);
|
||||
if ( !showPreview || status.getReplies() == null || status.getReplies().size() == 0){
|
||||
if( showPreview){
|
||||
if( status.getReplies() == null){
|
||||
holder.loader_replies.setVisibility(View.VISIBLE);
|
||||
}else if(status.getReplies().size() == 0){
|
||||
holder.status_replies.setVisibility(View.GONE);
|
||||
holder.loader_replies.setVisibility(View.GONE);
|
||||
}else if(status.getReplies().size() > 0 ){
|
||||
ArrayList<String> addedPictures = new ArrayList<>();
|
||||
holder.status_replies_profile_pictures.removeAllViews();
|
||||
|
@ -233,7 +238,13 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
holder.status_replies_text.setText(context.getResources().getQuantityString(R.plurals.preview_replies, status.getReplies().size(), status.getReplies().size()));
|
||||
holder.status_replies.setVisibility(View.VISIBLE);
|
||||
holder.status_replies_text.setVisibility(View.VISIBLE);
|
||||
holder.loader_replies.setVisibility(View.GONE);
|
||||
}
|
||||
}else{
|
||||
holder.loader_replies.setVisibility(View.GONE);
|
||||
holder.status_replies.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
int iconSizePercent = sharedpreferences.getInt(Helper.SET_ICON_SIZE, 130);
|
||||
int textSizePercent = sharedpreferences.getInt(Helper.SET_TEXT_SIZE, 110);
|
||||
|
@ -942,6 +953,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
LinearLayout status_replies;
|
||||
LinearLayout status_replies_profile_pictures;
|
||||
TextView status_replies_text;
|
||||
LinearLayout loader_replies;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.os.Parcelable;
|
|||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -329,7 +330,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
|
||||
@Override
|
||||
public void onRetrieveReplies(APIResponse apiResponse) {
|
||||
|
||||
if( apiResponse.getError() != null || apiResponse.getStatuses() == null || apiResponse.getStatuses().size() == 0){
|
||||
return;
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
for(Status stmp: modifiedStatus){
|
||||
for(Status status: statuses){
|
||||
if( status.getId().equals(stmp.getId()))
|
||||
statuses.set(0,stmp);
|
||||
status.setReplies(stmp.getReplies());
|
||||
}
|
||||
}
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
|
|
|
@ -392,6 +392,27 @@
|
|||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:visibility="gone"
|
||||
android:id="@+id/loader_replies"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="@string/replies"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<ProgressBar
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:indeterminate="true"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:visibility="gone"
|
||||
android:layout_marginBottom="5dp"
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
<string name="media">Médias</string>
|
||||
<string name="share_with">Partager avec</string>
|
||||
<string name="shared_via">Partagé via Mastalab</string>
|
||||
<string name="replies">Réponses</string>
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Accueil</string>
|
||||
<string name="local_menu">Fil public local</string>
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
<string name="media">Media</string>
|
||||
<string name="share_with">Share with</string>
|
||||
<string name="shared_via">Shared via Mastalab</string>
|
||||
<string name="replies">Replies</string>
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Home</string>
|
||||
<string name="local_menu">Local timeline</string>
|
||||
|
@ -88,6 +89,7 @@
|
|||
<string name="reblog_removed">The toot is no longer boosted!</string>
|
||||
<string name="reblog_by">Shared via %1$s</string>
|
||||
|
||||
|
||||
<string name="favourite_add">Add this toot to your favourites?</string>
|
||||
<string name="favourite_remove">Remove this toot from your favourites?</string>
|
||||
<string name="reblog_add">Boost this toot?</string>
|
||||
|
|
Loading…
Reference in New Issue