aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/miz_hi/smileessence/talkchase/TalkChaser.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/miz_hi/smileessence/talkchase/TalkChaser.java')
-rw-r--r--src/net/miz_hi/smileessence/talkchase/TalkChaser.java87
1 files changed, 0 insertions, 87 deletions
diff --git a/src/net/miz_hi/smileessence/talkchase/TalkChaser.java b/src/net/miz_hi/smileessence/talkchase/TalkChaser.java
deleted file mode 100644
index c2328013..00000000
--- a/src/net/miz_hi/smileessence/talkchase/TalkChaser.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package net.miz_hi.smileessence.talkchase;
-
-import net.miz_hi.smileessence.cache.TweetCache;
-import net.miz_hi.smileessence.model.status.tweet.TweetModel;
-import net.miz_hi.smileessence.model.statuslist.StatusList;
-import net.miz_hi.smileessence.model.statuslist.impl.TalkList;
-import net.miz_hi.smileessence.notification.Notificator;
-import net.miz_hi.smileessence.status.TweetUtils;
-import net.miz_hi.smileessence.statuslist.StatusListManager;
-import net.miz_hi.smileessence.view.fragment.impl.TalkFragment;
-
-public class TalkChaser
-{
-
- public TalkFragment fragment;
- public long chasingId;
- public StatusList talkList;
-
- public TalkChaser(TalkFragment fragment)
- {
- this.talkList = new TalkList();
- this.fragment = fragment;
- }
-
- public void hitNewTweet(TweetModel tweet)
- {
- this.talkList.addToTop(tweet.getOriginal());
- updateChasingId(tweet.getOriginal().statusId);
- }
-
- private void updateChasingId(long id)
- {
- this.chasingId = id;
- fragment.setChasingId(chasingId);
- }
-
- /**
- * Call on Network Thread
- */
- public void startRelation(long statusId)
- {
- TweetModel start = TweetUtils.getOrCreateStatusModel(statusId);
- if (start == null)
- {
- Notificator.alert("ツイートの取得に失敗しました");
- return;
- }
- talkList.addToTop(start);
-
- //Load older
- long inReplyTo = start.getInReplyToStatusId();
- while (inReplyTo > 0)
- {
- TweetModel older = TweetUtils.getOrCreateStatusModel(inReplyTo);
- talkList.addToBottom(older);
- inReplyTo = older.getInReplyToStatusId();
- }
-
- //Load newer
- inReplyTo = start.statusId;
- while (true)
- {
- long before = inReplyTo;
- for (TweetModel newer : TweetCache.getList())
- {
- if (newer.getInReplyToStatusId() == inReplyTo)
- {
- talkList.addToTop(newer);
- inReplyTo = newer.statusId;
- break;
- }
- }
- if (before == inReplyTo)
- {
- break;
- }
- }
-
- updateChasingId(((TweetModel) talkList.getStatus(0)).statusId);
- StatusListManager.getAdapter(talkList).forceNotifyAdapter();
- }
-
- public void stopRelation()
- {
- TalkManager.removeTalkChaser(this);
- }
-}