diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2015-09-21 18:30:32 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2015-09-21 18:30:32 +0900 |
commit | c0a2acb9bbcb4b97189b64d5b4bf1eb02723017f (patch) | |
tree | 9f4ca9d63ce07f01cda6e26da3984be2d151034d /app/src/main/java/net/lacolaco/smileessence/view/dialog/TalkChainDialogFragment.java | |
parent | 85a3626036785148c75ee6453e17c7efc74bece7 (diff) | |
download | SmileEssence-c0a2acb9bbcb4b97189b64d5b4bf1eb02723017f.tar.gz |
[WIP] BackgroundTask を導入
Diffstat (limited to 'app/src/main/java/net/lacolaco/smileessence/view/dialog/TalkChainDialogFragment.java')
-rw-r--r-- | app/src/main/java/net/lacolaco/smileessence/view/dialog/TalkChainDialogFragment.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/TalkChainDialogFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/dialog/TalkChainDialogFragment.java index 12dcc01c..f31d6930 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/TalkChainDialogFragment.java +++ b/app/src/main/java/net/lacolaco/smileessence/view/dialog/TalkChainDialogFragment.java @@ -35,6 +35,7 @@ import net.lacolaco.smileessence.activity.MainActivity; import net.lacolaco.smileessence.entity.Account; import net.lacolaco.smileessence.entity.Tweet; import net.lacolaco.smileessence.twitter.task.GetTalkTask; +import net.lacolaco.smileessence.util.UIHandler; import net.lacolaco.smileessence.view.adapter.StatusListAdapter; import net.lacolaco.smileessence.viewmodel.StatusViewModel; @@ -64,20 +65,16 @@ public class TalkChainDialogFragment extends StackableDialogFragment { public Dialog onCreateDialog(Bundle savedInstanceState) { MainActivity activity = (MainActivity) getActivity(); final Account account = activity.getCurrentAccount(); - Twitter twitter = account.getTwitter(); + View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_talk_list, null); ListView listView = (ListView) view.findViewById(R.id.listview_dialog_talk_list); final StatusListAdapter adapter = new StatusListAdapter(getActivity()); listView.setAdapter(adapter); - new GetTalkTask(twitter, getStatusID()) { - @Override - protected void onProgressUpdate(Tweet... tweets) { - Tweet tweet = tweets[0]; - adapter.addToBottom(new StatusViewModel(tweet)); - adapter.updateForce(); - } - }.execute(); + new GetTalkTask(account, getStatusID()).onProgressUI(tweet -> { + adapter.addToBottom(new StatusViewModel(tweet)); + adapter.updateForce(); + }).execute(); return new AlertDialog.Builder(activity) .setTitle(R.string.dialog_title_talk_chain) |