This commit is contained in:
NudeDude 2019-03-30 12:23:11 +01:00
parent 3169b4d735
commit bd0892dbe0
1 changed files with 64 additions and 57 deletions

View File

@ -116,10 +116,11 @@ public class ProfileLoader extends AsyncTask<Long, Void, Void> {
try { try {
if (mode == Mode.LDR_PROFILE) { if (mode == Mode.LDR_PROFILE) {
user = database.getUser(UID); user = database.getUser(UID);
if (user != null) if (user != null) {
publishProgress();
tweets = database.getUserTweets(UID); tweets = database.getUserTweets(UID);
favors = database.getUserFavs(UID); favors = database.getUserFavs(UID);
publishProgress();
}
} }
user = mTwitter.getUser(UID); user = mTwitter.getUser(UID);
publishProgress(); publishProgress();
@ -329,11 +330,20 @@ public class ProfileLoader extends AsyncTask<Long, Void, Void> {
protected void onPostExecute(final Void v) { protected void onPostExecute(final Void v) {
if (ui.get() == null) return; if (ui.get() == null) return;
if (!isHome) { if (failure) {
ui.get().setConnection(isFollowing, isMuted, isBlocked, canDm, user.followRequested()); SwipeRefreshLayout homeReload = ui.get().findViewById(R.id.hometweets);
ui.get().invalidateOptionsMenu(); SwipeRefreshLayout favReload = ui.get().findViewById(R.id.homefavorits);
} if(homeReload.isRefreshing())
homeReload.setRefreshing(false);
if(favReload.isRefreshing())
favReload.setRefreshing(false);
if (err != null) {
boolean killActivity = ErrorHandling.printError(ui.get(), err);
if (killActivity)
ui.get().finish();
}
} else {
switch (mode) { switch (mode) {
case LDR_PROFILE: case LDR_PROFILE:
if (tweets.isEmpty()) { if (tweets.isEmpty()) {
@ -382,12 +392,9 @@ public class ProfileLoader extends AsyncTask<Long, Void, Void> {
Toast.makeText(ui.get(), R.string.unmuted, Toast.LENGTH_SHORT).show(); Toast.makeText(ui.get(), R.string.unmuted, Toast.LENGTH_SHORT).show();
break; break;
} }
if (!isHome) {
if (failure) { ui.get().setConnection(isFollowing, isMuted, isBlocked, canDm, user.followRequested());
if (err != null) { ui.get().invalidateOptionsMenu();
boolean killActivity = ErrorHandling.printError(ui.get(), err);
if (killActivity)
ui.get().finish();
} }
} }
} }