Android Open Source - tdpforce Development Card






From Project

Back to project page tdpforce.

License

The source code is released under:

Apache License

If you think the Android project tdpforce 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 org.telugudesam.cadre.objects;
//  w  w  w.  j a v  a  2  s. c  o m
import java.util.ArrayList;
import java.util.Date;

import org.json.JSONArray;
import org.json.JSONException;
import org.telugudesam.cadre.util.L;
import org.telugudesam.cadre.util.Utils;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import com.google.gson.Gson;
import com.parse.ParseObject;
import com.turbomanage.storm.api.Entity;
import com.turbomanage.storm.api.Id;

@Entity
public class DevelopmentCard implements Comparable<DevelopmentCard>, Parcelable {

  @Id
  private long id;
  private String picsArray;
  private String title;
  private String subTitle;
  private String notes;
  private String sectionsArray;
  private boolean isDeleted;
  private Date createdAt;
  private Date updatedAt;

  public long getId() {
    return id;
  }

  public void setId(long id) {
    this.id = id;
  }

  public String getPicsArray() {
    return picsArray;
  }

  public ArrayList<String> getPics() {
    ArrayList<String> urls = new ArrayList<String>();
    try {
      if (!TextUtils.isEmpty(picsArray)) {
        JSONArray array = new JSONArray(picsArray);
        for (int i = 0; i < array.length(); i++) {
          urls.add(array.getString(i));
        }
      }
    } catch (JSONException e) {
      L.print(e);
    }
    return urls;
  }

  public void setPicsArray(String picsArray) {
    this.picsArray = picsArray;
  }

  public String getTitle() {
    return title;
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public String getSubTitle() {
    return subTitle;
  }

  public void setSubTitle(String subTitle) {
    this.subTitle = subTitle;
  }

  public String getNotes() {
    return notes;
  }

  public void setNotes(String notes) {
    this.notes = notes;
  }

  public String getSectionsArray() {
    return sectionsArray;
  }

  public void setSectionsArray(String sectionsArray) {
    this.sectionsArray = sectionsArray;
  }

  public ArrayList<String> getSections() {
    ArrayList<String> sections = new ArrayList<String>();
    try {
      JSONArray array = new JSONArray(sectionsArray);
      for (int i = 0; i < array.length(); i++) {
        sections.add(array.getString(i));
      }
    } catch (JSONException e) {
      L.print(e);
    }
    return sections;
  }

  public ParseObject toParseObject() {
    ParseObject object = new ParseObject(this.getClass().getSimpleName());
    object.put("title", title);
    object.put("subTitle", subTitle);
    object.put("notes", notes);
    object.put("picsArray", picsArray);
    object.put("sectionsArray", sectionsArray);
    return object;
  }

  public static DevelopmentCard fromParseObject(ParseObject object) {
    DevelopmentCard card = new DevelopmentCard();
    Utils.printParseObject(object);
    card.id = object.getObjectId().hashCode();
    card.title = object.getString("title");
    card.subTitle = object.getString("subTitle");
    card.notes = object.getString("notes");
    card.picsArray = object.getString("picsArray");
    card.sectionsArray = object.getString("sectionsArray");
    if (object.has("isDeleted")) {
      L.d("setting object as deleted");
      card.isDeleted = object.getBoolean("isDeleted");
    }
    card.updatedAt = object.getUpdatedAt();
    card.createdAt = object.getCreatedAt();
    return card;
  }

  public Date getCreatedAt() {
    return createdAt;
  }

  public void setCreatedAt(Date createdAt) {
    this.createdAt = createdAt;
  }

  public Date getUpdatedAt() {
    return updatedAt;
  }

  public void setUpdatedAt(Date updatedAt) {
    this.updatedAt = updatedAt;
  }

  @Override
  public int compareTo(DevelopmentCard another) {
    return another.updatedAt.compareTo(this.updatedAt);
  }

  @Override
  public String toString() {
    return new Gson().toJson(this);
  }

  public boolean isDeleted() {
    return isDeleted;
  }

  public boolean isIsDeleted() {
    return isDeleted;
  }

  public void setDeleted(boolean isDeleted) {
    this.isDeleted = isDeleted;
  }

  public void setIsDeleted(boolean isDeleted) {
    this.isDeleted = isDeleted;
  }

  protected DevelopmentCard(Parcel in) {
    id = in.readLong();
    picsArray = in.readString();
    title = in.readString();
    subTitle = in.readString();
    notes = in.readString();
    sectionsArray = in.readString();
    isDeleted = in.readByte() != 0x00;
    long tmpCreatedAt = in.readLong();
    createdAt = tmpCreatedAt != -1 ? new Date(tmpCreatedAt) : null;
    long tmpUpdatedAt = in.readLong();
    updatedAt = tmpUpdatedAt != -1 ? new Date(tmpUpdatedAt) : null;
  }

  public DevelopmentCard() {
  }

  @Override
  public int describeContents() {
    return 0;
  }

  @Override
  public void writeToParcel(Parcel dest, int flags) {
    dest.writeLong(id);
    dest.writeString(picsArray);
    dest.writeString(title);
    dest.writeString(subTitle);
    dest.writeString(notes);
    dest.writeString(sectionsArray);
    dest.writeByte((byte) (isDeleted ? 0x01 : 0x00));
    dest.writeLong(createdAt != null ? createdAt.getTime() : -1L);
    dest.writeLong(updatedAt != null ? updatedAt.getTime() : -1L);
  }

  @SuppressWarnings("unused")
  public static final transient Parcelable.Creator<DevelopmentCard> CREATOR = new Parcelable.Creator<DevelopmentCard>() {
    @Override
    public DevelopmentCard createFromParcel(Parcel in) {
      return new DevelopmentCard(in);
    }

    @Override
    public DevelopmentCard[] newArray(int size) {
      return new DevelopmentCard[size];
    }
  };
}




Java Source Code List

com.etsy.android.grid.ClassLoaderSavedState.java
com.etsy.android.grid.ExtendableListView.java
com.etsy.android.grid.HeaderViewListAdapter.java
com.etsy.android.grid.StaggeredGridView.java
com.etsy.android.grid.util.DynamicHeightImageView.java
com.etsy.android.grid.util.DynamicHeightTextView.java
com.polites.android.Animation.java
com.polites.android.Animator.java
com.polites.android.FlingAnimationListener.java
com.polites.android.FlingAnimation.java
com.polites.android.FlingListener.java
com.polites.android.GestureImageViewListener.java
com.polites.android.GestureImageViewTouchListener.java
com.polites.android.GestureImageView.java
com.polites.android.MathUtils.java
com.polites.android.MoveAnimationListener.java
com.polites.android.MoveAnimation.java
com.polites.android.VectorF.java
com.polites.android.ZoomAnimationListener.java
com.polites.android.ZoomAnimation.java
com.readystatesoftware.systembartint.SystemBarTintManager.java
org.telugudesam.cadre.App.java
org.telugudesam.cadre.Config.java
org.telugudesam.cadre.Constants.java
org.telugudesam.cadre.activity.BaseTdpActivity.java
org.telugudesam.cadre.activity.ConversionCounterActivity.java
org.telugudesam.cadre.activity.ConversionRegistrationActivity.java
org.telugudesam.cadre.activity.PreviewActivity.java
org.telugudesam.cadre.activity.TdpMainActivity.java
org.telugudesam.cadre.adapters.DevelopmentCardsAdapter.java
org.telugudesam.cadre.components.MemCache.java
org.telugudesam.cadre.database.DbHelper.java
org.telugudesam.cadre.database.DbUtils.java
org.telugudesam.cadre.database.Tdp_cadre_boxFactory.java
org.telugudesam.cadre.fragments.DevelopmentCardsFragment.java
org.telugudesam.cadre.objects.DevelopmentCard.java
org.telugudesam.cadre.objects.Events.java
org.telugudesam.cadre.objects.Section.java
org.telugudesam.cadre.objects.dao.DevelopmentCardDao.java
org.telugudesam.cadre.objects.dao.DevelopmentCardTable.java
org.telugudesam.cadre.util.L.java
org.telugudesam.cadre.util.SystemUiHiderBase.java
org.telugudesam.cadre.util.SystemUiHiderHoneycomb.java
org.telugudesam.cadre.util.SystemUiHider.java
org.telugudesam.cadre.util.Utils.java