diff --git a/app/src/main/java/org/nuclearfog/twidda/window/UserProfile.java b/app/src/main/java/org/nuclearfog/twidda/window/UserProfile.java index 828d1dde..fdc49b69 100644 --- a/app/src/main/java/org/nuclearfog/twidda/window/UserProfile.java +++ b/app/src/main/java/org/nuclearfog/twidda/window/UserProfile.java @@ -189,15 +189,22 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen } private void getContent() { - new Thread(){ + new Thread() { @Override - public void run(){ + public void run() { TweetDatabase mTweet = new TweetDatabase(UserProfile.this, TweetDatabase.USER_TL, userId); - TimelineAdapter tl = new TimelineAdapter(UserProfile.this,mTweet); - homeTweets.setAdapter(tl); TweetDatabase fTweet = new TweetDatabase(UserProfile.this, TweetDatabase.FAV_TL, userId); - TimelineAdapter fl = new TimelineAdapter(UserProfile.this,fTweet); - homeFavorits.setAdapter(fl); + + if(mTweet.getSize() == 0) { + new ProfileAction(UserProfile.this, tool).execute(userId, ProfileAction.GET_TWEETS); + } else { + homeTweets.setAdapter(new TimelineAdapter(UserProfile.this,mTweet)); + } + if(fTweet.getSize() == 0) { + new ProfileAction(UserProfile.this, tool).execute(userId, ProfileAction.GET_FAVS); + } else { + homeFavorits.setAdapter(new TimelineAdapter(UserProfile.this,fTweet)); + } } }.run(); } diff --git a/app/src/main/res/layout/profile.xml b/app/src/main/res/layout/profile.xml index a763e634..42b13dbc 100644 --- a/app/src/main/res/layout/profile.xml +++ b/app/src/main/res/layout/profile.xml @@ -135,13 +135,15 @@