rearrange code

This commit is contained in:
NudeDude 2019-03-28 10:05:10 +01:00
parent 3b30dd4b61
commit 43109bfcac
2 changed files with 29 additions and 33 deletions

View File

@ -36,8 +36,17 @@ import twitter4j.TwitterException;
public class ProfileLoader extends AsyncTask<Long, Void, Void> {
public enum Mode {
LDR_PROFILE,
GET_TWEETS,
GET_FAVORS,
ACTION_FOLLOW,
ACTION_BLOCK,
ACTION_MUTE
}
private final Mode mode;
private boolean failure = false;
private TimelineAdapter homeTl, homeFav;
private WeakReference<UserProfile> ui;
private SimpleDateFormat sdf;
@ -112,7 +121,6 @@ public class ProfileLoader extends AsyncTask<Long, Void, Void> {
tweets = database.getUserTweets(UID);
favors = database.getUserFavs(UID);
}
user = mTwitter.getUser(UID);
publishProgress();
database.storeUser(user);
@ -246,7 +254,6 @@ public class ProfileLoader extends AsyncTask<Long, Void, Void> {
if (isFollowed)
followback.setVisibility(View.VISIBLE);
}
Spanned bio = Tagger.makeText(user.getBio(), highlight, ui.get());
txtBio.setMovementMethod(LinkMovementMethod.getInstance());
txtBio.setText(bio);
@ -410,14 +417,4 @@ public class ProfileLoader extends AsyncTask<Long, Void, Void> {
}
}
}
public enum Mode {
LDR_PROFILE,
GET_TWEETS,
GET_FAVORS,
ACTION_FOLLOW,
ACTION_BLOCK,
ACTION_MUTE
}
}

View File

@ -35,9 +35,29 @@ import static org.nuclearfog.twidda.window.TweetDetail.TWEET_REMOVED;
public class StatusLoader extends AsyncTask<Long, Void, Void> {
public enum Mode {
LOAD,
ANS,
RETWEET,
FAVORITE,
DELETE
}
private final Mode mode;
private boolean failure = false;
private TwitterEngine mTwitter;
private TwitterException err;
private WeakReference<TweetDetail> ui;
private TimelineAdapter answerAdapter;
private DatabaseAdapter database;
private SimpleDateFormat sdf;
private NumberFormat formatter;
private List<Tweet> answers;
private Tweet tweet;
private int highlight, font_color;
private boolean toggleImg, toggleAns;
public StatusLoader(@NonNull TweetDetail context, Mode mode) {
mTwitter = TwitterEngine.getInstance(context);
GlobalSettings settings = GlobalSettings.getInstance(context);
@ -56,18 +76,6 @@ public class StatusLoader extends AsyncTask<Long, Void, Void> {
}
private TwitterEngine mTwitter;
private TwitterException err;
private WeakReference<TweetDetail> ui;
private TimelineAdapter answerAdapter;
private DatabaseAdapter database;
private SimpleDateFormat sdf;
private NumberFormat formatter;
private List<Tweet> answers;
private Tweet tweet;
private int highlight, font_color;
private boolean toggleImg, toggleAns;
@Override
protected void onPreExecute() {
if (ui.get() == null) return;
@ -253,15 +261,6 @@ public class StatusLoader extends AsyncTask<Long, Void, Void> {
}
public enum Mode {
LOAD,
ANS,
RETWEET,
FAVORITE,
DELETE
}
@Override
protected void onCancelled() {
if (ui.get() == null) return;