Android Open Source - SecNote Note






From Project

Back to project page SecNote.

License

The source code is released under:

Apache License

If you think the Android project SecNote 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 com.baraccasoftware.securenotes.object;
//from  w  ww.  j a  va  2 s.c  o  m
import android.os.Parcel;
import android.os.Parcelable;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class Note implements Parcelable {
  private int mId;
  private String mName;
  private String mDesc;
  private Date mDate;
  private byte[] mImage ;

  private DateFormat dateformat;
  private int intDateformat;
  
  public Note(int id, String name, String desc, Date date, byte[] image) {
    setmId(id);
    setDateFormat(2);
    setmName(name);
    setmDesc(desc);
    setmDate(date);    
    setmImage(image);
  }
  
  public Note(int id, String name, String desc, String date, byte[] image) throws ParseException {
    setmId(id);
    setDateFormat(2);
    setmName(name);
    setmDesc(desc);
    setmDate(date);
    setmImage(image);
  }
  
  public Note(Parcel parcel) throws ParseException{
    setDateFormat(parcel.readInt());
    setmId(parcel.readInt());
    setmName(parcel.readString());
    setmDesc(parcel.readString());
    setmDate(parcel.readString());
        int imageLen = parcel.readInt();
    mImage = new byte[imageLen];
    parcel.readByteArray(mImage);
    
  }
  

  public String getmName() {
    return mName;
  }

  public void setmName(String mName) {
    this.mName = mName;
  }

  public String getmDesc() {
    return mDesc;
  }

  public void setmDesc(String mDesc) {
    this.mDesc = mDesc;
  }

  public Date getmDate() {
    return mDate;
  }
  
  
  
  public String getmDataString(){
    return dateformat.format(mDate);
  }


  public void setmDate(Date mDate) {
    this.mDate = mDate;
  }
  
  public void setmDate(String data) throws ParseException{
    Date d = dateformat.parse(data);
    setmDate(d);
  }
  
  public void setDateFormat(int format){
    intDateformat = format;
    if(intDateformat==1){
      this.dateformat = new SimpleDateFormat("yyyy-MM-dd",Locale.US);
    }else{
      this.dateformat = new SimpleDateFormat("dd/MM/yyyy",Locale.ITALIAN);
    }
  }

  public int getmId() {
    return mId;
  }

  public void setmId(int mId) {
    this.mId = mId;
  }
  
  public byte[] getmImage() {
    return mImage;
  }

  public void setmImage(byte[] mImage) {
    this.mImage = mImage;
  }
  

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

  @Override
  public void writeToParcel(Parcel parcel, int flag) {
    parcel.writeInt(intDateformat);
    parcel.writeInt(mId);
    parcel.writeString(mName);
    parcel.writeString(mDesc);
    parcel.writeString(getmDataString());
    parcel.writeInt(mImage.length);
    parcel.writeByteArray(mImage);
  }
  
  

  



  public final static Creator CREATOR = new Creator() {
        @Override
        public Note createFromParcel(Parcel source) {
            try {
        return new Note(source);
      } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return new Note(0,"None", "None", new Date(),new byte[1]);
      }
        }

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

}




Java Source Code List

com.baraccasoftware.securenotes.app.ExportDialogFragment.java
com.baraccasoftware.securenotes.app.ImportDialogFragment.java
com.baraccasoftware.securenotes.app.InfoActivity.java
com.baraccasoftware.securenotes.app.InfoFragment.java
com.baraccasoftware.securenotes.app.LockedAppFragment.java
com.baraccasoftware.securenotes.app.LogInFragment.java
com.baraccasoftware.securenotes.app.MainActivity.java
com.baraccasoftware.securenotes.app.NoteDetailActivity.java
com.baraccasoftware.securenotes.app.NoteDetailFragment.java
com.baraccasoftware.securenotes.app.NoteListActivity.java
com.baraccasoftware.securenotes.app.NoteListFragment.java
com.baraccasoftware.securenotes.app.RegisterFragment.java
com.baraccasoftware.securenotes.app.SetPasswordFragment.java
com.baraccasoftware.securenotes.app.SettingsActivity.java
com.baraccasoftware.securenotes.app.SettingsFragment.java
com.baraccasoftware.securenotes.exception.LoadBitmapException.java
com.baraccasoftware.securenotes.object.ActivityUtilityInterface.java
com.baraccasoftware.securenotes.object.BitmapUtility.java
com.baraccasoftware.securenotes.object.Crypto.java
com.baraccasoftware.securenotes.object.DAO.java
com.baraccasoftware.securenotes.object.Encryptor.java
com.baraccasoftware.securenotes.object.ImageLoader.java
com.baraccasoftware.securenotes.object.NoteUtility.java
com.baraccasoftware.securenotes.object.Note.java
com.baraccasoftware.securenotes.object.PBKDF2Encryptor.java
com.baraccasoftware.securenotes.object.PasswordPreference.java
com.baraccasoftware.securenotes.object.SecureDatabaseHelper.java
com.baraccasoftware.securenotes.widget.NoteAdapter.java
com.baraccasoftware.securenotes.widget.SlidingDrawer.java
com.baraccasoftware.securenotes.widget.SwipeDismissListViewTouchListener.java
com.baraccasoftware.securenotes.widget.UndoBarController.java