Android Open Source - GalDroid Comment Entity






From Project

Back to project page GalDroid.

License

The source code is released under:

GNU General Public License

If you think the Android project GalDroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.raptor2101.GalDroid.WebGallery.Gallery3.JSON;
/*from  w  ww.  ja  va 2s.c  om*/
import java.util.Date;

import org.json.JSONException;
import org.json.JSONObject;

import de.raptor2101.GalDroid.WebGallery.Interfaces.GalleryObjectComment;

public class CommentEntity implements GalleryObjectComment {
  public enum CommentState {
    Published;
  }

  private final String mId;

  private final Date mCreateDate;
  private final Date mUpdateDate;
  private final String mMessage;
  private final CommentState mCommentState;

  private final String mAuthorId;
  private String mAuthorEmail = null;
  private String mAuthorName = null;
  private String mAuthorUrl = null;

  public CommentEntity(JSONObject jsonObject) throws JSONException {
    jsonObject = jsonObject.getJSONObject("entity");
    mId = jsonObject.getString("id");
    mMessage = jsonObject.getString("text");

    long msElapsed = jsonObject.getLong("created") * 1000;
    mCreateDate = new Date(msElapsed);

    msElapsed = jsonObject.getLong("updated") * 1000;
    mUpdateDate = new Date(msElapsed);

    String state = jsonObject.getString("state");
    if (state.equals("published")) {
      mCommentState = CommentState.Published;
    } else {
      // TODO weitere states auslesen
      mCommentState = CommentState.Published;
    }

    mAuthorId = jsonObject.getString("author_id");
    // TODO prfen ob das wirklich null wird
    if (mAuthorId == null) {
      mAuthorEmail = jsonObject.getString("guest_email");
      mAuthorName = jsonObject.getString("guest_name");
      mAuthorUrl = jsonObject.getString("guest_url");
    }
  }

  public String getId() {
    return mId;
  }

  public Date getCreateDate() {
    return mCreateDate;
  }

  public Date getUpdateDate() {
    return mUpdateDate;
  }

  public String getMessage() {
    return mMessage;
  }

  public CommentState getState() {
    return mCommentState;
  }

  public String getAuthorId() {
    return mAuthorId;
  }

  public String getAuthorEmail() {
    return mAuthorEmail;
  }

  public String getAuthorName() {
    return mAuthorName;
  }

  public String getAuthorUrl() {
    return mAuthorUrl;
  }

  public boolean isAuthorInformationLoaded() {
    return mAuthorName != null;
  }
}




Java Source Code List

de.raptor2101.GalDroid.Activities.EditGalleryActivity.java
de.raptor2101.GalDroid.Activities.GalDroidApp.java
de.raptor2101.GalDroid.Activities.GalleryActivity.java
de.raptor2101.GalDroid.Activities.GalleryListingActivitiy.java
de.raptor2101.GalDroid.Activities.GridViewActivity.java
de.raptor2101.GalDroid.Activities.ImageViewActivity.java
de.raptor2101.GalDroid.Activities.Helpers.ActionBarHider.java
de.raptor2101.GalDroid.Activities.Helpers.ImageAdapter.java
de.raptor2101.GalDroid.Activities.Listeners.ImageViewOnTouchListener.java
de.raptor2101.GalDroid.Activities.Views.GalleryImageViewListener.java
de.raptor2101.GalDroid.Activities.Views.GalleryImageView.java
de.raptor2101.GalDroid.Activities.Views.ImageInformationView.java
de.raptor2101.GalDroid.Config.GalDroidPreference.java
de.raptor2101.GalDroid.Config.GalleryConfig.java
de.raptor2101.GalDroid.WebGallery.DegMinSec.java
de.raptor2101.GalDroid.WebGallery.GalleryFactory.java
de.raptor2101.GalDroid.WebGallery.ImageCache.java
de.raptor2101.GalDroid.WebGallery.ImageInformation.java
de.raptor2101.GalDroid.WebGallery.Stream.java
de.raptor2101.GalDroid.WebGallery.TitleConfig.java
de.raptor2101.GalDroid.WebGallery.Gallery3.DownloadObject.java
de.raptor2101.GalDroid.WebGallery.Gallery3.Gallery3Imp.java
de.raptor2101.GalDroid.WebGallery.Gallery3.ProgressListener.java
de.raptor2101.GalDroid.WebGallery.Gallery3.RestCall.java
de.raptor2101.GalDroid.WebGallery.Gallery3.JSON.AlbumEntity.java
de.raptor2101.GalDroid.WebGallery.Gallery3.JSON.CommentEntity.java
de.raptor2101.GalDroid.WebGallery.Gallery3.JSON.EntityFactory.java
de.raptor2101.GalDroid.WebGallery.Gallery3.JSON.Entity.java
de.raptor2101.GalDroid.WebGallery.Gallery3.JSON.PictureEntity.java
de.raptor2101.GalDroid.WebGallery.Gallery3.Tasks.JSONArrayLoaderTask.java
de.raptor2101.GalDroid.WebGallery.Interfaces.GalleryDownloadObject.java
de.raptor2101.GalDroid.WebGallery.Interfaces.GalleryObjectComment.java
de.raptor2101.GalDroid.WebGallery.Interfaces.GalleryObject.java
de.raptor2101.GalDroid.WebGallery.Interfaces.GalleryProgressListener.java
de.raptor2101.GalDroid.WebGallery.Interfaces.WebGallery.java
de.raptor2101.GalDroid.WebGallery.Tasks.CacheTaskListener.java
de.raptor2101.GalDroid.WebGallery.Tasks.CleanUpCacheTask.java
de.raptor2101.GalDroid.WebGallery.Tasks.GalleryLoaderTaskListener.java
de.raptor2101.GalDroid.WebGallery.Tasks.GalleryLoaderTask.java
de.raptor2101.GalDroid.WebGallery.Tasks.GalleryVerifyTask.java
de.raptor2101.GalDroid.WebGallery.Tasks.ImageInformationLoaderTaskListener.java
de.raptor2101.GalDroid.WebGallery.Tasks.ImageInformationLoaderTask.java
de.raptor2101.GalDroid.WebGallery.Tasks.ImageLoaderTaskListener.java
de.raptor2101.GalDroid.WebGallery.Tasks.ImageLoaderTask.java
de.raptor2101.GalDroid.WebGallery.Tasks.Progress.java
de.raptor2101.GalDroid.WebGallery.Tasks.RepeatingTask.java
de.raptor2101.GalDroid.WebGallery.Tasks.SyncronizeCacheTask.java
de.raptor2101.GalDroid.WebGallery.Tasks.TaskInterface.java