Broadcasts now cause a refresh on timelines after a post is composed instead of listeners.
As a side effect, pagers don't have to keep track of "registered fragments", which was a bad idea and caused crashes.
This commit is contained in:
parent
9c56f0e7bc
commit
a4ee128e26
8 changed files with 36 additions and 108 deletions
|
|
@ -33,7 +33,6 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
|
||||
import com.keylesspalace.tusky.MainActivity;
|
||||
import com.keylesspalace.tusky.adapter.NotificationsAdapter;
|
||||
import com.keylesspalace.tusky.R;
|
||||
|
|
@ -44,7 +43,6 @@ import com.keylesspalace.tusky.receiver.TimelineReceiver;
|
|||
import com.keylesspalace.tusky.util.ThemeUtils;
|
||||
import com.keylesspalace.tusky.view.EndlessOnScrollListener;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.util.List;
|
||||
|
||||
import retrofit2.Call;
|
||||
|
|
|
|||
|
|
@ -99,17 +99,6 @@ public abstract class SFragment extends BaseFragment {
|
|||
startActivityForResult(intent, COMPOSE_RESULT);
|
||||
}
|
||||
|
||||
public void onSuccessfulStatus() {}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == COMPOSE_RESULT && resultCode == ComposeActivity.RESULT_OK) {
|
||||
onSuccessfulStatus();
|
||||
} else {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
protected void reblog(final Status status, final boolean reblog,
|
||||
final RecyclerView.Adapter adapter, final int position) {
|
||||
String id = status.getActionableId();
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ public class TimelineFragment extends SFragment implements
|
|||
adapter = new TimelineAdapter(this);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
timelineReceiver = new TimelineReceiver(adapter);
|
||||
timelineReceiver = new TimelineReceiver(adapter, this);
|
||||
LocalBroadcastManager.getInstance(context.getApplicationContext())
|
||||
.registerReceiver(timelineReceiver, TimelineReceiver.getFilter(kind));
|
||||
return rootView;
|
||||
|
|
@ -352,14 +352,6 @@ public class TimelineFragment extends SFragment implements
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccessfulStatus() {
|
||||
if (kind == Kind.HOME || kind == Kind.PUBLIC_FEDERATED || kind == Kind.PUBLIC_LOCAL) {
|
||||
onRefresh();
|
||||
}
|
||||
super.onSuccessfulStatus();
|
||||
}
|
||||
|
||||
public void onReply(int position) {
|
||||
super.reply(adapter.getItem(position));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public class ViewThreadFragment extends SFragment implements
|
|||
mastodonApi = null;
|
||||
thisThreadsStatusId = null;
|
||||
|
||||
timelineReceiver = new TimelineReceiver(adapter);
|
||||
timelineReceiver = new TimelineReceiver(adapter, this);
|
||||
LocalBroadcastManager.getInstance(context.getApplicationContext())
|
||||
.registerReceiver(timelineReceiver, TimelineReceiver.getFilter(null));
|
||||
|
||||
|
|
@ -187,12 +187,6 @@ public class ViewThreadFragment extends SFragment implements
|
|||
sendThreadRequest(thisThreadsStatusId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccessfulStatus() {
|
||||
onRefresh();
|
||||
super.onSuccessfulStatus();
|
||||
}
|
||||
|
||||
public void onReply(int position) {
|
||||
super.reply(adapter.getItem(position));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue