Search in sources :

Example 6 with OnResponseListener

use of org.mazhuang.guanggoo.data.OnResponseListener in project guanggoo-android by mzlogin.

the class SplashActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    NetworkTaskScheduler.getInstance().execute(new AuthCheckTask(new OnResponseListener<String>() {

        @Override
        public void onSucceed(String data) {
            startHome();
        }

        @Override
        public void onFailed(String msg) {
            startHome();
        }
    }));
}
Also used : OnResponseListener(org.mazhuang.guanggoo.data.OnResponseListener) AuthCheckTask(org.mazhuang.guanggoo.data.task.AuthCheckTask)

Example 7 with OnResponseListener

use of org.mazhuang.guanggoo.data.OnResponseListener in project guanggoo-android by mzlogin.

the class NewTopicPresenter method newTopic.

@Override
public void newTopic(String title, String content) {
    mView.startLoading();
    title = EmojiParser.parseToAliases(title);
    content = EmojiParser.parseToAliases(content);
    NetworkTaskScheduler.getInstance().execute(new NewTopicTask(mView.getUrl(), title, content, new OnResponseListener<String>() {

        @Override
        public void onSucceed(String data) {
            mView.stopLoading();
            mView.onNewTopicSucceed();
        }

        @Override
        public void onFailed(String msg) {
            mView.stopLoading();
            mView.onNewTopicFailed(msg);
        }
    }));
}
Also used : NewTopicTask(org.mazhuang.guanggoo.data.task.NewTopicTask) OnResponseListener(org.mazhuang.guanggoo.data.OnResponseListener)

Example 8 with OnResponseListener

use of org.mazhuang.guanggoo.data.OnResponseListener in project guanggoo-android by mzlogin.

the class NodesCloudPresenter method getNodesCloud.

@Override
public void getNodesCloud() {
    mView.startLoading();
    NetworkTaskScheduler.getInstance().execute(new GetNodesCloudTask(new OnResponseListener<List<NodeCategory>>() {

        @Override
        public void onSucceed(List<NodeCategory> data) {
            mView.stopLoading();
            mView.onGetNodesCloudSucceed(data);
        }

        @Override
        public void onFailed(String msg) {
            mView.stopLoading();
            mView.onGetNodesCloudFailed(msg);
        }
    }));
}
Also used : OnResponseListener(org.mazhuang.guanggoo.data.OnResponseListener) NodeCategory(org.mazhuang.guanggoo.data.entity.NodeCategory) List(java.util.List) GetNodesCloudTask(org.mazhuang.guanggoo.data.task.GetNodesCloudTask)

Example 9 with OnResponseListener

use of org.mazhuang.guanggoo.data.OnResponseListener in project guanggoo-android by mzlogin.

the class TopicListPresenter method getTopicList.

@Override
public void getTopicList() {
    if (mCurrentTask != null) {
        mCurrentTask.cancel();
    }
    mCurrentTask = new GetTopicListTask(mView.getUrl(), new OnResponseListener<TopicList>() {

        @Override
        public void onSucceed(TopicList data) {
            mView.onGetTopicListSucceed(data);
            mCurrentTask = null;
        }

        @Override
        public void onFailed(String msg) {
            mView.onGetTopicListFailed(msg);
            mCurrentTask = null;
        }
    });
    NetworkTaskScheduler.getInstance().execute(mCurrentTask);
}
Also used : GetTopicListTask(org.mazhuang.guanggoo.data.task.GetTopicListTask) OnResponseListener(org.mazhuang.guanggoo.data.OnResponseListener) TopicList(org.mazhuang.guanggoo.data.entity.TopicList)

Example 10 with OnResponseListener

use of org.mazhuang.guanggoo.data.OnResponseListener in project guanggoo-android by mzlogin.

the class UserProfilePresenter method getUserProfile.

@Override
public void getUserProfile(String url) {
    mView.startLoading();
    NetworkTaskScheduler.getInstance().execute(new GetUserProfileTask(url, new OnResponseListener<UserProfile>() {

        @Override
        public void onSucceed(UserProfile data) {
            mView.stopLoading();
            mView.onGetUserProfileSucceed(data);
        }

        @Override
        public void onFailed(String msg) {
            mView.stopLoading();
            mView.onGetUserProfileFailed(msg);
        }
    }));
}
Also used : GetUserProfileTask(org.mazhuang.guanggoo.data.task.GetUserProfileTask) OnResponseListener(org.mazhuang.guanggoo.data.OnResponseListener) UserProfile(org.mazhuang.guanggoo.data.entity.UserProfile)

Aggregations

OnResponseListener (org.mazhuang.guanggoo.data.OnResponseListener)12 TopicList (org.mazhuang.guanggoo.data.entity.TopicList)2 FavouriteTask (org.mazhuang.guanggoo.data.task.FavouriteTask)2 GetTopicListTask (org.mazhuang.guanggoo.data.task.GetTopicListTask)2 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 List (java.util.List)1 JSONException (org.json.JSONException)1 JSONObject (org.json.JSONObject)1 Connection (org.jsoup.Connection)1 NodeCategory (org.mazhuang.guanggoo.data.entity.NodeCategory)1 TopicDetail (org.mazhuang.guanggoo.data.entity.TopicDetail)1 UserProfile (org.mazhuang.guanggoo.data.entity.UserProfile)1 AuthCheckTask (org.mazhuang.guanggoo.data.task.AuthCheckTask)1 CommentTask (org.mazhuang.guanggoo.data.task.CommentTask)1 GetNodesCloudTask (org.mazhuang.guanggoo.data.task.GetNodesCloudTask)1 GetTopicDetailTask (org.mazhuang.guanggoo.data.task.GetTopicDetailTask)1 GetUserProfileTask (org.mazhuang.guanggoo.data.task.GetUserProfileTask)1 LoginTask (org.mazhuang.guanggoo.data.task.LoginTask)1 NewTopicTask (org.mazhuang.guanggoo.data.task.NewTopicTask)1