Add comment gallery, add Announcer

This commit is contained in:
seven332 committed 2016-02-06 15:02:44 +08:00
1 parent 596966b4ab
commit 875509be68
18 files changed
+497 -55

No files matched your search

@@ -20,6 +20,7 @@ import android.support.annotation.Nullable;
import android.util.Log;
import android.util.Pair;
import com.hippo.ehviewer.client.data.GalleryComment;
import com.hippo.ehviewer.client.data.GalleryDetail;
import com.hippo.ehviewer.client.data.GalleryInfo;
import com.hippo.ehviewer.client.data.LargePreviewSet;
@@ -312,5 +313,34 @@ public class EhEngine {
}
}
public static Call prepareCommentGallery(OkHttpClient okHttpClient,
EhConfig ehConfig, String url, String comment) {
FormBody.Builder builder = new FormBody.Builder()
.add("commenttext", comment)
.add("postcomment", "Post New");
Log.d(TAG, url);
Request request = new EhRequestBuilder(url, ehConfig)
.post(builder.build())
.build();
return okHttpClient.newCall(request);
}
public static GalleryComment[] doCommentGallery(Call call) throws Exception {
String body = null;
Headers headers = null;
int code = -1;
try {
Response response = call.execute();
code = response.code();
headers = response.headers();
body = response.body().string();
return GalleryDetailParser.parseComment(body);
} catch (Exception e) {
throwException(call, code, headers, body, e);
throw e;
}
}
// TODO Add get gallery api info
}