aboutsummaryrefslogtreecommitdiff
path: root/WordPress/src/main/java/org/wordpress/android/ui/posts/services/PostEvents.java
blob: 2ac90686e95b7ba7cabbbcc06a6931454cf71d83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package org.wordpress.android.ui.posts.services;

import org.wordpress.android.util.StringUtils;
import org.xmlrpc.android.ApiHelper;

public class PostEvents {

    public static class PostUploadStarted {
        public final int mLocalBlogId;

        PostUploadStarted(int localBlogId) {
            mLocalBlogId = localBlogId;
        }
    }

    public static class PostUploadEnded {
        public final int mLocalBlogId;
        public final boolean mSucceeded;

        PostUploadEnded(boolean succeeded, int localBlogId) {
            mSucceeded = succeeded;
            mLocalBlogId = localBlogId;
        }
    }

    public static class PostMediaInfoUpdated {
        private long mMediaId;
        private String mMediaUrl;

        PostMediaInfoUpdated(long mediaId, String mediaUrl) {
            mMediaId = mediaId;
            mMediaUrl = mediaUrl;
        }
        public long getMediaId() {
            return mMediaId;
        }
        public String getMediaUrl() {
            return StringUtils.notNullStr(mMediaUrl);
        }
    }

    public static class RequestPosts {
        private final int mBlogId;
        private final boolean mIsPage;
        private boolean mCanLoadMore;
        private boolean mFailed;
        private ApiHelper.ErrorType mErrorType = null;

        RequestPosts(int blogId, boolean isPage) {
            mBlogId = blogId;
            mIsPage = isPage;
            mFailed = false;
        }
        public int getBlogId() {
            return mBlogId;
        }
        public boolean isPage() {
            return mIsPage;
        }
        public boolean canLoadMore() {
            return mCanLoadMore;
        }
        public void setCanLoadMore(boolean canLoadMore) {
            mCanLoadMore = canLoadMore;
        }
        public boolean getFailed() {
            return mFailed;
        }
        public ApiHelper.ErrorType getErrorType() {
            return mErrorType;
        }
        public void setErrorType(ApiHelper.ErrorType errorType) {
            mErrorType = errorType;
            mFailed = true;
        }
    }

}