Major Enhancements

This commit is contained in:
NudeDude 2017-12-24 18:08:00 +01:00
parent 0b144b9b7d
commit 33aabeeae8
5 changed files with 7 additions and 19 deletions

View File

@ -51,12 +51,10 @@ public class TwitterEngine extends AsyncTask<Integer, Void, Void>
case (0): // Home Timeline
TweetDatabase mTweets = new TweetDatabase(twitter.getHomeTimeline(), context,TweetDatabase.HOME_TL);
timelineAdapter = new TimelineAdapter(context,R.layout.tweet,mTweets);
break;
break;
case(1): // Trends
TrendDatabase trend = new TrendDatabase(twitter.getPlaceTrends(23424829),context); //Germany by default
trendsAdapter = new TrendsAdapter(context,R.layout.tweet,trend);
break;
case(2): // Mentions
// TODO
@ -65,7 +63,6 @@ public class TwitterEngine extends AsyncTask<Integer, Void, Void>
TweetDatabase hTweets = new TweetDatabase(twitter.getUserTimeline(), context,TweetDatabase.USER_TL);
timelineAdapter = new TimelineAdapter(context,R.layout.tweet,hTweets);
break;
}
} catch (TwitterException e) {
Toast.makeText(context, ERR_MSG, Toast.LENGTH_SHORT).show();
@ -83,11 +80,9 @@ public class TwitterEngine extends AsyncTask<Integer, Void, Void>
public void run(){
if(timelineAdapter != null) {
list.setAdapter(timelineAdapter);
//timelineAdapter.notifyDataSetChanged();
}
else if(trendsAdapter != null) {
list.setAdapter(trendsAdapter);
//trendsAdapter.notifyDataSetChanged();
}
if(refresh != null)
refresh.setRefreshing(false);

View File

@ -176,7 +176,7 @@ public class MainActivity extends AppCompatActivity
switch(currentTab){
case "timeline":
TweetDatabase tweetDeck = new TweetDatabase(con,TweetDatabase.HOME_TL);
TimelineAdapter tlAdapt = new TimelineAdapter (con,R.layout.tweet,tweetDeck);
TimelineAdapter tlAdapt = new TimelineAdapter (MainActivity.this,R.layout.tweet,tweetDeck);
list.setAdapter(tlAdapt);
tlAdapt.notifyDataSetChanged();
break;

View File

@ -22,6 +22,8 @@ public class TimelineAdapter extends ArrayAdapter {
this.context = context;
}
public void setDatabase(TweetDatabase mTweets){this.mTweets=mTweets;}
@Override
public int getCount() {
return mTweets.getSize();

View File

@ -70,11 +70,6 @@ public class Profile extends AppCompatActivity {
}
private void loadContent() {
}
/**
* Init Tab Listener
*/

View File

@ -20,8 +20,7 @@
<ImageView
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="32dp"
android:contentDescription="banner"
android:layout_height="wrap_content"
app:srcCompat="@android:color/holo_red_dark" />
<LinearLayout
@ -33,13 +32,11 @@
android:id="@+id/profile_img"
android:layout_width="96dp"
android:layout_height="96dp"
android:contentDescription="profile picture"
app:srcCompat="@color/soylentgreen" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
@ -63,8 +60,7 @@
<TextView
android:id="@+id/bio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"