code cleanup
This commit is contained in:
parent
82489e2aba
commit
33962cea93
|
@ -251,19 +251,20 @@ public class ProfileLoader extends AsyncTask<Long, Void, Void> {
|
|||
TextView txtBio = ui.get().findViewById(R.id.bio);
|
||||
TextView txtLocation = ui.get().findViewById(R.id.location);
|
||||
TextView txtLink = ui.get().findViewById(R.id.links);
|
||||
|
||||
TextView txtFollowing = ui.get().findViewById(R.id.following);
|
||||
TextView txtFollower = ui.get().findViewById(R.id.follower);
|
||||
|
||||
ImageView profile = ui.get().findViewById(R.id.profile_img);
|
||||
View location_ico = ui.get().findViewById(R.id.loction_ico);
|
||||
View link_ico = ui.get().findViewById(R.id.links_ico);
|
||||
View followback = ui.get().findViewById(R.id.followback);
|
||||
View verified = ui.get().findViewById(R.id.profile_verify);
|
||||
View locked = ui.get().findViewById(R.id.profile_locked);
|
||||
View profile_head = ui.get().findViewById(R.id.profile_header);
|
||||
|
||||
if (mode == Mode.LDR_PROFILE) {
|
||||
View profile_head = ui.get().findViewById(R.id.profile_header);
|
||||
if (profile_head.getVisibility() != VISIBLE) {
|
||||
profile_head.setVisibility(VISIBLE);
|
||||
|
||||
View verified = ui.get().findViewById(R.id.profile_verify);
|
||||
View followback = ui.get().findViewById(R.id.followback);
|
||||
View locked = ui.get().findViewById(R.id.profile_locked);
|
||||
TextView txtCreated = ui.get().findViewById(R.id.profile_date);
|
||||
String date = sdf.format(new Date(user.getCreatedAt()));
|
||||
txtCreated.setText(date);
|
||||
|
@ -275,7 +276,6 @@ public class ProfileLoader extends AsyncTask<Long, Void, Void> {
|
|||
if (user.isLocked()) {
|
||||
locked.setVisibility(VISIBLE);
|
||||
} else {
|
||||
if(!txtFollowing.isClickable()) {
|
||||
txtFollowing.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -285,8 +285,6 @@ public class ProfileLoader extends AsyncTask<Long, Void, Void> {
|
|||
ui.get().startActivity(following);
|
||||
}
|
||||
});
|
||||
}
|
||||
if(!txtFollower.isClickable()) {
|
||||
txtFollower.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -296,8 +294,6 @@ public class ProfileLoader extends AsyncTask<Long, Void, Void> {
|
|||
ui.get().startActivity(follower);
|
||||
}
|
||||
});
|
||||
}
|
||||
if(!profile.isClickable()) {
|
||||
profile.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -339,9 +335,6 @@ public class ProfileLoader extends AsyncTask<Long, Void, Void> {
|
|||
Picasso.get().load(link).into(profile);
|
||||
}
|
||||
|
||||
if(profile_head.getVisibility() != VISIBLE)
|
||||
profile_head.setVisibility(VISIBLE);
|
||||
|
||||
ui.get().setTweetCount(user.getTweetCount(), user.getFavorCount());
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ public class StatusLoader extends AsyncTask<Long, Void, Void> {
|
|||
protected Void doInBackground(Long... data) {
|
||||
final long TWEETID = data[0];
|
||||
long sinceId = TWEETID;
|
||||
boolean updateStatus = false;
|
||||
try {
|
||||
switch (mode) {
|
||||
case LOAD:
|
||||
|
@ -101,22 +102,24 @@ public class StatusLoader extends AsyncTask<Long, Void, Void> {
|
|||
if(tweet != null) {
|
||||
answers = database.getAnswers(TWEETID);
|
||||
publishProgress();
|
||||
updateStatus = true;
|
||||
}
|
||||
case ANS:
|
||||
tweet = mTwitter.getStatus(TWEETID);
|
||||
boolean storeStatus = database.containStatus(TWEETID);
|
||||
if (!updateStatus)
|
||||
updateStatus = database.containStatus(TWEETID);
|
||||
|
||||
if (mode == Mode.ANS || toggleAns) {
|
||||
if (answerAdapter.getItemCount() > 0)
|
||||
sinceId = answerAdapter.getItemId(0);
|
||||
answers = mTwitter.getAnswers(tweet.getUser().getScreenname(), TWEETID, sinceId);
|
||||
if (storeStatus && !answers.isEmpty())
|
||||
if (updateStatus && !answers.isEmpty())
|
||||
database.storeReplies(answers);
|
||||
answers.addAll(answerAdapter.getData());
|
||||
}
|
||||
publishProgress();
|
||||
|
||||
if(storeStatus)
|
||||
if (updateStatus)
|
||||
database.updateStatus(tweet);
|
||||
break;
|
||||
|
||||
|
@ -170,12 +173,25 @@ public class StatusLoader extends AsyncTask<Long, Void, Void> {
|
|||
answerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
TextView username = ui.get().findViewById(R.id.usernamedetail);
|
||||
TextView scrName = ui.get().findViewById(R.id.scrnamedetail);
|
||||
TextView replyName = ui.get().findViewById(R.id.answer_reference_detail);
|
||||
TextView txtRet = ui.get().findViewById(R.id.no_rt_detail);
|
||||
TextView txtFav = ui.get().findViewById(R.id.no_fav_detail);
|
||||
TextView txtAns = ui.get().findViewById(R.id.no_ans_detail);
|
||||
ImageView profile_img = ui.get().findViewById(R.id.profileimage_detail);
|
||||
ImageView retweetButton = ui.get().findViewById(R.id.rt_button_detail);
|
||||
ImageView favoriteButton = ui.get().findViewById(R.id.fav_button_detail);
|
||||
|
||||
if(mode == Mode.LOAD) {
|
||||
View tweet_header = ui.get().findViewById(R.id.tweet_head);
|
||||
if (tweet_header.getVisibility() != VISIBLE) {
|
||||
TextView tweetText = ui.get().findViewById(R.id.tweet_detailed);
|
||||
TextView tweetDate = ui.get().findViewById(R.id.timedetail);
|
||||
TextView tweet_api = ui.get().findViewById(R.id.used_api);
|
||||
View tweet_verify = ui.get().findViewById(R.id.tweet_verify);
|
||||
View tweet_locked = ui.get().findViewById(R.id.tweet_locked);
|
||||
View tweet_footer = ui.get().findViewById(R.id.tweet_foot);
|
||||
|
||||
Spannable sTweet = Tagger.makeText(tweet.getTweet(), highlight, ui.get());
|
||||
tweetText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
@ -196,7 +212,6 @@ public class StatusLoader extends AsyncTask<Long, Void, Void> {
|
|||
if (tweet.getMediaLinks() != null && tweet.getMediaLinks().length > 0) {
|
||||
View mediaButton = ui.get().findViewById(R.id.image_attach);
|
||||
mediaButton.setVisibility(VISIBLE);
|
||||
if(!mediaButton.isClickable()) {
|
||||
mediaButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -204,21 +219,20 @@ public class StatusLoader extends AsyncTask<Long, Void, Void> {
|
|||
}
|
||||
});
|
||||
}
|
||||
profile_img.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent profile = new Intent(ui.get(), UserProfile.class);
|
||||
profile.putExtra("userID", tweet.getUser().getId());
|
||||
profile.putExtra("username", tweet.getUser().getScreenname());
|
||||
ui.get().startActivity(profile);
|
||||
}
|
||||
});
|
||||
tweet_header.setVisibility(VISIBLE);
|
||||
tweet_footer.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
TextView username = ui.get().findViewById(R.id.usernamedetail);
|
||||
TextView scrName = ui.get().findViewById(R.id.scrnamedetail);
|
||||
TextView replyName = ui.get().findViewById(R.id.answer_reference_detail);
|
||||
TextView txtRet = ui.get().findViewById(R.id.no_rt_detail);
|
||||
TextView txtFav = ui.get().findViewById(R.id.no_fav_detail);
|
||||
TextView txtAns = ui.get().findViewById(R.id.no_ans_detail);
|
||||
ImageView profile_img = ui.get().findViewById(R.id.profileimage_detail);
|
||||
ImageView retweetButton = ui.get().findViewById(R.id.rt_button_detail);
|
||||
ImageView favoriteButton = ui.get().findViewById(R.id.fav_button_detail);
|
||||
View tweet_header = ui.get().findViewById(R.id.tweet_head);
|
||||
View tweet_footer = ui.get().findViewById(R.id.tweet_foot);
|
||||
|
||||
username.setText(tweet.getUser().getUsername());
|
||||
username.setTextColor(font_color);
|
||||
scrName.setText(tweet.getUser().getScreenname());
|
||||
|
@ -247,18 +261,6 @@ public class StatusLoader extends AsyncTask<Long, Void, Void> {
|
|||
}
|
||||
}
|
||||
|
||||
if(!profile_img.isClickable()) {
|
||||
profile_img.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent profile = new Intent(ui.get(), UserProfile.class);
|
||||
profile.putExtra("userID", tweet.getUser().getId());
|
||||
profile.putExtra("username", tweet.getUser().getScreenname());
|
||||
ui.get().startActivity(profile);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (toggleImg) {
|
||||
Picasso.get().load(tweet.getUser().getImageLink() + "_bigger").into(profile_img);
|
||||
}
|
||||
|
@ -275,10 +277,6 @@ public class StatusLoader extends AsyncTask<Long, Void, Void> {
|
|||
if(tweet.getUser().getId() == homeId) {
|
||||
ui.get().enableDelete();
|
||||
}
|
||||
if(tweet_header.getVisibility() != VISIBLE)
|
||||
tweet_header.setVisibility(VISIBLE);
|
||||
if(tweet_footer.getVisibility() != VISIBLE)
|
||||
tweet_footer.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue