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; Status status=n.status;
Bundle args=new Bundle(); Bundle args=new Bundle();
args.putString("account", accountID); 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)) if(status.inReplyToAccountId!=null && knownAccounts.containsKey(status.inReplyToAccountId))
args.putParcelable("inReplyToAccount", Parcels.wrap(knownAccounts.get(status.inReplyToAccountId))); args.putParcelable("inReplyToAccount", Parcels.wrap(knownAccounts.get(status.inReplyToAccountId)));
Nav.go(getActivity(), ThreadFragment.class, args); Nav.go(getActivity(), ThreadFragment.class, args);

View File

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

View File

@ -8,8 +8,9 @@ import java.lang.reflect.Field;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import androidx.annotation.CallSuper; import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
public abstract class BaseModel{ public abstract class BaseModel implements Cloneable{
@CallSuper @CallSuper
public void postprocess() throws ObjectValidationException{ public void postprocess() throws ObjectValidationException{
try{ try{
@ -23,4 +24,14 @@ public abstract class BaseModel{
} }
}catch(IllegalAccessException ignore){} }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 @NonNull
@Override @Override
public PushSubscription clone(){ public PushSubscription clone(){
PushSubscription copy=null; PushSubscription copy=(PushSubscription) super.clone();
try{
copy=(PushSubscription) super.clone();
}catch(CloneNotSupportedException ignore){}
copy.alerts=alerts.clone(); copy.alerts=alerts.clone();
return copy; return copy;
} }

View File

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