This commit is contained in:
tom79 2019-07-09 18:08:04 +02:00
parent 8543f24bc7
commit 1bdfc4f6a6
2 changed files with 28 additions and 1 deletions

View File

@ -96,6 +96,8 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.varunest.sparkbutton.SparkButton;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Calendar;
@ -3735,13 +3737,29 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
}
Toasty.success(context, context.getString(R.string.timed_mute_date, status.getAccount().getAcct(), Helper.dateToString(date_mute)), Toast.LENGTH_LONG).show();
alertDialog.dismiss();
notifyDataSetChanged();
send_delete_statuses(targeted_id);
}
}
});
alertDialog.show();
}
private void send_delete_statuses(String targetedId){
//Delete in the current timeline
List<Status> statusesToRemove = new ArrayList<>();
for(Status status: statuses){
if( status.getAccount().getId().equals(targetedId))
statusesToRemove.add(status);
}
statuses.removeAll(statusesToRemove);
statusListAdapter.notifyDataSetChanged();
//Send an intent to delete in every timelines
Bundle b = new Bundle();
b.putString("receive_action", targetedId);
Intent intentBC = new Intent(Helper.RECEIVE_ACTION);
intentBC.putExtras(b);
}
private void scheduleBoost(Status status){
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);

View File

@ -249,8 +249,17 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
Bundle b = intent.getExtras();
assert b != null;
Status status = b.getParcelable("status");
String delete_statuses_from = b.getString("delete_statuses_for_id", null);
if( status != null && statusListAdapter != null) {
statusListAdapter.notifyStatusWithActionChanged(status);
}else if( delete_statuses_from != null){
List<Status> statusesToRemove = new ArrayList<>();
for(Status status_temp: statuses){
if( status_temp.getAccount().getId().equals(delete_statuses_from))
statusesToRemove.add(status);
}
statuses.removeAll(statusesToRemove);
statusListAdapter.notifyDataSetChanged();
}
}
};