Android Open Source - SimpleNotes Note






From Project

Back to project page SimpleNotes.

License

The source code is released under:

Apache License

If you think the Android project SimpleNotes 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.moysa.simplenotes.core;
// w  ww .j a  v  a2  s.  co  m
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Created by Sergey Moysa on 25.02.14.
 */
public class Note {

    public static final String DATE_FORMAT = "yyyy-MM-dd hh:mm:ss";
    public static final String JUST_DATE_FORMAT = "yyyy-MM-dd";
    public static final String JUST_TIME_FORMAT = "HH:mm";
    private long id;
    private String name;
    private String message;
    private String date;

    public Note(long id, String name, String message) {
        setId(id);
        setName(name);
        setMessage(message);
    }

    public Note(int id, String name, String message, String date) {
        setId(id);
        setName(name);
        setMessage(message);
        setDate(date);
    }

    @Override
    public String toString() {
        return this.name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public long getId() {
        return id;
    }

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

    public void setDate(String date) {
        this.date = date;
    }

    public String getDate() {
        return date;
    }

    public Date getDateFormat() throws ParseException {
        SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT);
        Date date = format.parse(this.date);

        return date;
    }

    public String getTime() throws ParseException {
        String time;

        Calendar calendar = Calendar.getInstance();
        int currentDate = calendar.get(Calendar.DATE);

        Date date = getDateFormat();

        SimpleDateFormat f = new SimpleDateFormat();
        f.setTimeZone(calendar.getTimeZone());

        calendar.setTime(date);

        if (currentDate == calendar.get(Calendar.DATE)) {
            f.applyPattern(JUST_TIME_FORMAT);
        } else {
            f.applyPattern(JUST_DATE_FORMAT);
        }

        time = f.format(date);

        return time;
    }
}




Java Source Code List

com.moysa.simplenotes.core.Note.java
com.moysa.simplenotes.core.NotesComparator.java
com.moysa.simplenotes.core.NotesUtils.java
com.moysa.simplenotes.db.NoteDataBaseHelper.java
com.moysa.simplenotes.ui.activities.MainActivity.java
com.moysa.simplenotes.ui.activities.SettingsActivity.java
com.moysa.simplenotes.ui.adapters.NotesAdapter.java
com.moysa.simplenotes.ui.application.NoteApplication.java
com.moysa.simplenotes.ui.fragments.NavigationDrawerFragment.java
com.moysa.simplenotes.ui.fragments.NoteFragment.java
com.moysa.simplenotes.ui.listeners.ListHeaderAnimationListener.java