Flags new toots.

This commit is contained in:
tom79 2017-09-08 18:30:49 +02:00
parent e55c982808
commit 9dedaa0f7a
4 changed files with 30 additions and 0 deletions

View File

@ -55,6 +55,7 @@ public class Status implements Parcelable {
private String language;
private boolean isTranslated = false;
private boolean isTranslationShown = false;
private boolean isNew = false;
protected Status(Parcel in) {
id = in.readString();
@ -79,6 +80,7 @@ public class Status implements Parcelable {
spoilerShown = in.readByte() != 0;
isTranslated = in.readByte() != 0;
isTranslationShown = in.readByte() != 0;
isNew = in.readByte() != 0;
}
public Status(){}
@ -294,6 +296,7 @@ public class Status implements Parcelable {
dest.writeByte((byte) (spoilerShown ? 1 : 0));
dest.writeByte((byte) (isTranslated ? 1 : 0));
dest.writeByte((byte) (isTranslationShown ? 1 : 0));
dest.writeByte((byte) (isNew ? 1 : 0));
}
public boolean isSpoilerShown() {
@ -343,4 +346,12 @@ public class Status implements Parcelable {
public void setReplies(List<Status> replies) {
this.replies = replies;
}
public boolean isNew() {
return isNew;
}
public void setNew(boolean aNew) {
isNew = aNew;
}
}

View File

@ -211,6 +211,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
holder.status_replies = (LinearLayout) convertView.findViewById(R.id.status_replies);
holder.status_replies_profile_pictures = (LinearLayout) convertView.findViewById(R.id.status_replies_profile_pictures);
holder.status_replies_text = (TextView) convertView.findViewById(R.id.status_replies_text);
holder.new_element = (ImageView) convertView.findViewById(R.id.new_element);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
@ -262,6 +263,11 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
}
}
changeDrawableColor(context, R.drawable.ic_fiber_new,R.color.mastodonC4);
if( status.isNew())
holder.new_element.setVisibility(View.VISIBLE);
else
holder.new_element.setVisibility(View.GONE);
int iconSizePercent = sharedpreferences.getInt(Helper.SET_ICON_SIZE, 130);
int textSizePercent = sharedpreferences.getInt(Helper.SET_TEXT_SIZE, 110);
@ -1092,6 +1098,8 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
LinearLayout status_replies_profile_pictures;
TextView status_replies_text;
LinearLayout loader_replies;
ImageView new_element;
}

View File

@ -386,6 +386,7 @@ public class StreamingService extends Service {
}else if ( event == EventStreaming.UPDATE){
status = API.parseStatuses(getApplicationContext(), response);
status.setReplies(new ArrayList<Status>()); //Force to don't display replies
status.setNew(true);
Helper.cacheStatus(getApplicationContext(), status, userId);
if( status.getContent() != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)

View File

@ -71,6 +71,16 @@
style="?attr/shapeBorder"
android:visibility="gone"
tools:ignore="ContentDescription" />
<ImageView
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:id="@+id/new_element"
android:visibility="gone"
android:src="@drawable/ic_fiber_new"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:ignore="ContentDescription" />
</RelativeLayout>
<LinearLayout
android:layout_marginStart="5dp"