This commit is contained in:
Grishka 2023-06-04 02:11:40 +03:00
parent 31c8665653
commit ae6ce0f9b0
5 changed files with 25 additions and 7 deletions

View File

@ -144,7 +144,7 @@ public class NotificationsListFragment extends BaseStatusListFragment<Notificati
Status status=n.status;
Bundle args=new Bundle();
args.putString("account", accountID);
args.putParcelable("status", Parcels.wrap(status));
args.putParcelable("status", Parcels.wrap(status.clone()));
if(status.inReplyToAccountId!=null && knownAccounts.containsKey(status.inReplyToAccountId))
args.putParcelable("inReplyToAccount", Parcels.wrap(knownAccounts.get(status.inReplyToAccountId)));
Nav.go(getActivity(), ThreadFragment.class, args);

View File

@ -57,7 +57,7 @@ public abstract class StatusListFragment extends BaseStatusListFragment<Status>{
return;
Bundle args=new Bundle();
args.putString("account", accountID);
args.putParcelable("status", Parcels.wrap(status));
args.putParcelable("status", Parcels.wrap(status.clone()));
if(status.inReplyToAccountId!=null && knownAccounts.containsKey(status.inReplyToAccountId))
args.putParcelable("inReplyToAccount", Parcels.wrap(knownAccounts.get(status.inReplyToAccountId)));
Nav.go(getActivity(), ThreadFragment.class, args);

View File

@ -8,8 +8,9 @@ import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
public abstract class BaseModel{
public abstract class BaseModel implements Cloneable{
@CallSuper
public void postprocess() throws ObjectValidationException{
try{
@ -23,4 +24,14 @@ public abstract class BaseModel{
}
}catch(IllegalAccessException ignore){}
}
@NonNull
@Override
public Object clone(){
try{
return super.clone();
}catch(CloneNotSupportedException x){
throw new RuntimeException(x);
}
}
}

View File

@ -30,10 +30,7 @@ public class PushSubscription extends BaseModel implements Cloneable{
@NonNull
@Override
public PushSubscription clone(){
PushSubscription copy=null;
try{
copy=(PushSubscription) super.clone();
}catch(CloneNotSupportedException ignore){}
PushSubscription copy=(PushSubscription) super.clone();
copy.alerts=alerts.clone();
return copy;
}

View File

@ -9,6 +9,8 @@ import org.parceler.Parcel;
import java.time.Instant;
import java.util.List;
import androidx.annotation.NonNull;
@Parcel
public class Status extends BaseModel implements DisplayItemsParent{
@RequiredField
@ -176,4 +178,12 @@ public class Status extends BaseModel implements DisplayItemsParent{
strippedText=HtmlParser.strip(content);
return strippedText;
}
@NonNull
@Override
public Status clone(){
Status copy=(Status) super.clone();
copy.spoilerRevealed=false;
return copy;
}
}