parent
5dcc6f39ec
commit
fc4c3d9d64
|
@ -69,7 +69,7 @@ public class MainPage extends AsyncTask<Integer, Void, Integer> {
|
|||
timelineAdapter = (TimelineAdapter) timelineList.getAdapter();
|
||||
if(timelineAdapter != null && timelineAdapter.getCount() != 0) {
|
||||
id = timelineAdapter.getItemId(0);
|
||||
timelineAdapter.getData().add(mTwitter.getHome(page,id));
|
||||
timelineAdapter.getData().insert(mTwitter.getHome(page,id),true);
|
||||
} else {
|
||||
TweetDatabase mTweets = new TweetDatabase(mTwitter.getHome(page,id), context,TweetDatabase.HOME_TL,0);
|
||||
timelineAdapter = new TimelineAdapter(context,mTweets);
|
||||
|
@ -84,7 +84,7 @@ public class MainPage extends AsyncTask<Integer, Void, Integer> {
|
|||
mentionAdapter = (TimelineAdapter) mentionList.getAdapter();
|
||||
if(mentionAdapter != null && mentionAdapter.getCount() != 0) {
|
||||
id = mentionAdapter.getItemId(0);
|
||||
mentionAdapter.getData().add(mTwitter.getMention(page,id));
|
||||
mentionAdapter.getData().insert(mTwitter.getMention(page,id),true);
|
||||
} else {
|
||||
TweetDatabase mention = new TweetDatabase(mTwitter.getMention(page,id), context,TweetDatabase.GET_MENT,0);
|
||||
mentionAdapter = new TimelineAdapter(context,mention);
|
||||
|
|
|
@ -122,7 +122,7 @@ public class ProfileLoader extends AsyncTask<Long,Void,Long> {
|
|||
homeTl = new TimelineAdapter(context,hTweets);
|
||||
} else {
|
||||
id = homeTl.getItemId(0);
|
||||
homeTl.getData().add(mTwitter.getUserTweets(userId,args[2],id));
|
||||
homeTl.getData().insert(mTwitter.getUserTweets(userId,args[2],id),true);
|
||||
}
|
||||
}
|
||||
else if(MODE == GET_FAVS)
|
||||
|
@ -130,7 +130,7 @@ public class ProfileLoader extends AsyncTask<Long,Void,Long> {
|
|||
homeFav = (TimelineAdapter) profileFavorits.getAdapter();
|
||||
if(homeFav != null) {
|
||||
id = homeFav.getItemId(0);
|
||||
homeFav.getData().add(mTwitter.getUserFavs(userId,args[2],id));
|
||||
homeFav.getData().insert(mTwitter.getUserFavs(userId,args[2],id),true);
|
||||
} else {
|
||||
TweetDatabase fTweets = new TweetDatabase(mTwitter.getUserFavs(userId,args[2],id),context,TweetDatabase.FAV_TL,userId);
|
||||
homeFav = new TimelineAdapter(context,fTweets);
|
||||
|
|
|
@ -262,7 +262,7 @@ public class StatusLoader extends AsyncTask<Long, Void, Long> {
|
|||
replyList.setAdapter(tlAdp);
|
||||
} else {
|
||||
TweetDatabase twDb = tlAdp.getData();
|
||||
twDb.addHot(answers);
|
||||
twDb.insert(answers,false);
|
||||
tlAdp.notifyDataSetChanged();
|
||||
ansReload.setRefreshing(false);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class TwitterSearch extends AsyncTask<String, Void, Void> {
|
|||
tlAdp = (TimelineAdapter) tweetSearch.getAdapter();
|
||||
if(tlAdp != null) {
|
||||
id = tlAdp.getItemId(0);
|
||||
tlAdp.getData().addHot(mTwitter.searchTweets(get,id));
|
||||
tlAdp.getData().insert(mTwitter.searchTweets(get,id),false);
|
||||
} else {
|
||||
tlAdp = new TimelineAdapter(context, new TweetDatabase(mTwitter.searchTweets(get,id),context));
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
@ -26,9 +25,9 @@ public class TweetDatabase {
|
|||
private List<Long> userId,tweetId,timeMillis;
|
||||
private List<Integer> noRT,noFav, verify;
|
||||
private boolean toggleImg;
|
||||
private int limit;
|
||||
private int size = 0;
|
||||
private int mode = 0;
|
||||
private int limit;
|
||||
private long CurrentId = 0;
|
||||
|
||||
/**
|
||||
|
@ -67,24 +66,18 @@ public class TweetDatabase {
|
|||
*/
|
||||
public TweetDatabase(List<Status> stats, Context context) {
|
||||
initialize(context);
|
||||
insert(stats);
|
||||
add(stats);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new Elements to the Lists and store into Database
|
||||
* Add new Elements to the List
|
||||
* @param stats List of Tweets
|
||||
* @param store if True, data will be stored in SQL
|
||||
*/
|
||||
public void add(List<Status> stats) {
|
||||
public void insert(List<Status> stats, boolean store) {
|
||||
if(store)
|
||||
store(stats);
|
||||
insertNew(stats);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new Elements without storing
|
||||
* @param stats list of Tweets
|
||||
*/
|
||||
public void addHot(List<Status> stats) {
|
||||
insertNew(stats);
|
||||
addFirst(stats);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -276,7 +269,7 @@ public class TweetDatabase {
|
|||
initArray();
|
||||
}
|
||||
|
||||
private void insert(List<Status> stats) {
|
||||
private void add(List<Status> stats) {
|
||||
for(Status stat: stats) {
|
||||
Status rtStat = stat.getRetweetedStatus();
|
||||
User usr = stat.getUser();
|
||||
|
@ -285,7 +278,7 @@ public class TweetDatabase {
|
|||
stat = rtStat;
|
||||
usr = rtStat.getUser();
|
||||
} else {
|
||||
retweeter.add(" ");
|
||||
retweeter.add("\0");
|
||||
}
|
||||
user.add(usr.getName());
|
||||
scrname.add('@'+usr.getScreenName());
|
||||
|
@ -301,7 +294,7 @@ public class TweetDatabase {
|
|||
}
|
||||
}
|
||||
|
||||
private void insertNew(List<Status> stats) {
|
||||
private void addFirst(List<Status> stats) {
|
||||
for(int index = stats.size()-1 ; index >=0 ; index--) {
|
||||
Status stat = stats.get(index);
|
||||
Status rtStat = stat.getRetweetedStatus();
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:text="@string/register_link" />
|
||||
android:text="@string/register_link"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -46,6 +47,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_margin="30dp"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:text="@string/verifierbutton" />
|
||||
android:text="@string/verifierbutton"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -72,9 +72,10 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/profile_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="2dp" />
|
||||
android:layout_marginBottom="2dp"
|
||||
android:singleLine="true" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -94,9 +95,10 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/profile_screenname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="2dp" />
|
||||
android:layout_marginBottom="2dp"
|
||||
android:singleLine="true" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -166,7 +168,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@string/location"
|
||||
android:visibility="invisible"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/location" />
|
||||
|
||||
<TextView
|
||||
|
@ -181,7 +183,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="10dp"
|
||||
android:contentDescription="@string/link"
|
||||
android:visibility="invisible"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/link" />
|
||||
|
||||
<TextView
|
||||
|
@ -199,6 +201,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:singleLine="true"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="5dp"
|
||||
android:singleLine="true"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -62,7 +62,8 @@
|
|||
<TextView
|
||||
android:id="@+id/screenname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -39,12 +39,14 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:singleLine="true"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/answer_reference_detail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textSize="12sp"
|
||||
android:visibility="invisible" />
|
||||
</LinearLayout>
|
||||
|
@ -84,12 +86,14 @@
|
|||
<TextView
|
||||
android:id="@+id/scrnamedetail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/timedetail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -108,6 +112,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:linksClickable="false"
|
||||
android:singleLine="true"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Button
|
||||
|
@ -151,11 +156,14 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/no_ans_detail"
|
||||
android:layout_width="64dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:ems="10" />
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:singleLine="true"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/rt_button_detail"
|
||||
|
@ -165,11 +173,14 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/no_rt_detail"
|
||||
android:layout_width="64dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:ems="10" />
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:singleLine="true"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/fav_button_detail"
|
||||
|
@ -179,16 +190,19 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/no_fav_detail"
|
||||
android:layout_width="64dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:ems="10" />
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:singleLine="true"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/delete"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:background="@drawable/cross"
|
||||
android:visibility="invisible" />
|
||||
|
||||
|
|
Loading…
Reference in New Issue