Android Open Source - LheidoSMS Message






From Project

Back to project page LheidoSMS.

License

The source code is released under:

GNU General Public License

If you think the Android project LheidoSMS 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.lheidosms.utils;
//from   w w  w. j  a  v a  2s  . c o  m
import android.content.Context;
import android.net.Uri;
import android.text.format.Time;

import com.lheidosms.app.R;

public class Message {
    private String sender = null;
    private String body_ = null;
    private Uri img_ = null;
    private Time date_ = null;
    private boolean read_ = false;
    private long _id = -1;

    public Message(){}

    public Message(long _id, String body, String sender, int deli,Time t){
        if(_id != -1)
            this._id = _id;
        this.body_ = body;
        this.date_ = t;
        this.sender = sender;
        if(deli == 0) this.read_ = true;
        else this.read_ = false;
    }

    public static String formatDate(Context context, Time date){
        int time_dd = date.monthDay;
        int time_MM = date.month;
        Time now = new Time();
        now.setToNow();
        int c_dd = now.monthDay;
        int c_MM = now.month;
        if(time_MM == c_MM){
            if(time_dd == c_dd)
                return date.format(context.getResources().getString(R.string.date_format_today));
            else
                return date.format(context.getResources().getString(R.string.date_format_current_month));
        }
        return date.format(context.getResources().getString(R.string.date_format));
    }

    public void setDate(Time date){
        this.date_ = date;
    }
    public String getDate(Context context){
        return formatDate(context, this.date_);
    }

    public long getDateNormalize(){
        return this.date_.normalize(false);
    }

    public void setBody(String string) {
        this.body_ = string != null ? string : "";
    }

    public String getBody() {
        return this.body_;
    }

    public Uri getUriPicture() {
        return this.img_;
    }

    public void setUriPicture(Uri pict){
        this.img_ = pict;
    }

    public String getSender(){
        return this.sender;
    }

    public void setSender(String s){
        this.sender = s;
    }

    public boolean isRead() {
        return this.read_;
    }

    public void setRead(boolean b) {
        this.read_ = b;
    }

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

    public long getId(){
        return this._id;
    }
}




Java Source Code List

com.lheidosms.adapter.ContactsListAdapter.java
com.lheidosms.adapter.ConversationAdapter.java
com.lheidosms.adapter.ListeConversationsAdapter.java
com.lheidosms.adapter.MMSAdapter.java
com.lheidosms.adapter.SmsAdapter.java
com.lheidosms.adapter.SmsBaseAdapter.java
com.lheidosms.adapter.ViewPagerAdapter.java
com.lheidosms.app.AutoComplete.java
com.lheidosms.app.Global.java
com.lheidosms.app.MainLheidoSMS.java
com.lheidosms.fragment.MMSFragment.java
com.lheidosms.fragment.NavigationDrawerFragment.java
com.lheidosms.fragment.SMSFragment.java
com.lheidosms.fragment.SmsBaseFragment.java
com.lheidosms.preference.LheidoSMSPreferenceOldApi.java
com.lheidosms.preference.LheidoSMSPreference.java
com.lheidosms.preference.PrefConversationFragment.java
com.lheidosms.preference.PrefGeneralFragment.java
com.lheidosms.preference.PrefListConversationsFragment.java
com.lheidosms.preference.PrefReceiveFragment.java
com.lheidosms.receiver.BootReceiver.java
com.lheidosms.receiver.LheidoBaseReceiver.java
com.lheidosms.receiver.MainServiceReceiver.java
com.lheidosms.receiver.MmsFragmentReceiver.java
com.lheidosms.receiver.SmsFragmentReceiver.java
com.lheidosms.receiver.SmsReceiver.java
com.lheidosms.service.DeleteOldSMSService.java
com.lheidosms.service.LheidoSMSService.java
com.lheidosms.service.MainService.java
com.lheidosms.service.RemoveConversationService.java
com.lheidosms.utils.BuildFragment.java
com.lheidosms.utils.LheidoContact.java
com.lheidosms.utils.LheidoUtils.java
com.lheidosms.utils.Message.java