// Path: samples/pushchat/src/main/java/org/onepf/pushchat/db/ContentDescriptor.java
// public static final String MESSAGE = "message";
// 
// Path: samples/pushchat/src/main/java/org/onepf/pushchat/db/ContentDescriptor.java
// public static final String RECEIVED_TIME = "received_time";
// 
// Path: samples/pushchat/src/main/java/org/onepf/pushchat/db/ContentDescriptor.java
// public static final String SENDER_NAME = "sender_name";
// 
// Path: samples/pushchat/src/main/java/org/onepf/pushchat/db/ContentDescriptor.java
// public static final String SENDER_UUID = "sender_uuid";


import static org.onepf.pushchat.db.ContentDescriptor.MessagesContract.MessageEntry.RECEIVED_TIME;
import static org.onepf.pushchat.db.ContentDescriptor.MessagesContract.MessageEntry.SENDER_NAME;
import static org.onepf.pushchat.db.ContentDescriptor.MessagesContract.MessageEntry.SENDER_UUID;
import android.content.Context;
import android.database.Cursor;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;
import org.onepf.pushchat.R;
import java.util.Date;
import static org.onepf.pushchat.db.ContentDescriptor.MessagesContract.MessageEntry.MESSAGE;
    }

    @Override
    public int getViewTypeCount() {
        return TYPE_COUNT;
    }

    @Override
    public View newView(final Context context, final Cursor cursor, final ViewGroup parent) {
        final View view = LayoutInflater.from(context).inflate(R.layout.item_message, parent, false);

        if (getItemViewType(cursor.getPosition()) == ODD_ITEM) {
            view.setBackgroundResource(R.drawable.odd_message_item_selector);
        }

        return view;
    }

    @Override
    public void bindView(final View view, final Context context, final Cursor cursor) {
        final String senderUuid = cursor.getString(cursor.getColumnIndexOrThrow(SENDER_UUID));
        final String senderName = cursor.getString(cursor.getColumnIndexOrThrow(SENDER_NAME));
        final String message = cursor.getString(cursor.getColumnIndexOrThrow(MESSAGE));
        final long time = cursor.getLong(cursor.getColumnIndexOrThrow(RECEIVED_TIME));

        final TextView senderTextView = (TextView) view.findViewById(R.id.sender);
        final TextView messageTextView = (TextView) view.findViewById(R.id.message_text);
        final TextView timeTextView = (TextView) view.findViewById(R.id.time);

        if (TextUtils.isEmpty(senderName)) {
// Path: samples/pushchat/src/main/java/org/onepf/pushchat/db/ContentDescriptor.java
// public static final String MESSAGE = "message";
// 
// Path: samples/pushchat/src/main/java/org/onepf/pushchat/db/ContentDescriptor.java
// public static final String RECEIVED_TIME = "received_time";
// 
// Path: samples/pushchat/src/main/java/org/onepf/pushchat/db/ContentDescriptor.java
// public static final String SENDER_NAME = "sender_name";
// 
// Path: samples/pushchat/src/main/java/org/onepf/pushchat/db/ContentDescriptor.java
// public static final String SENDER_UUID = "sender_uuid";


// Path: samples/pushchat/src/main/java/org/onepf/pushchat/ui/adapter/MessagesCursorAdapter.java
import static org.onepf.pushchat.db.ContentDescriptor.MessagesContract.MessageEntry.RECEIVED_TIME;
import static org.onepf.pushchat.db.ContentDescriptor.MessagesContract.MessageEntry.SENDER_NAME;
import static org.onepf.pushchat.db.ContentDescriptor.MessagesContract.MessageEntry.SENDER_UUID;
import android.content.Context;
import android.database.Cursor;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;
import org.onepf.pushchat.R;
import java.util.Date;
import static org.onepf.pushchat.db.ContentDescriptor.MessagesContract.MessageEntry.MESSAGE;

    }

    @Override
    public int getViewTypeCount() {
        return TYPE_COUNT;
    }

    @Override
    public View newView(final Context context, final Cursor cursor, final ViewGroup parent) {
        final View view = LayoutInflater.from(context).inflate(R.layout.item_message, parent, false);

        if (getItemViewType(cursor.getPosition()) == ODD_ITEM) {
            view.setBackgroundResource(R.drawable.odd_message_item_selector);
        }

        return view;
    }

    @Override
    public void bindView(final View view, final Context context, final Cursor cursor) {
        final String senderUuid = cursor.getString(cursor.getColumnIndexOrThrow(SENDER_UUID));
        final String senderName = cursor.getString(cursor.getColumnIndexOrThrow(SENDER_NAME));
        final String message = cursor.getString(cursor.getColumnIndexOrThrow(MESSAGE));
        final long time = cursor.getLong(cursor.getColumnIndexOrThrow(RECEIVED_TIME));

        final TextView senderTextView = (TextView) view.findViewById(R.id.sender);
        final TextView messageTextView = (TextView) view.findViewById(R.id.message_text);
        final TextView timeTextView = (TextView) view.findViewById(R.id.time);

        if (TextUtils.isEmpty(senderName)) {
            senderTextView.setText(context.getString(R.string.sender_uuid_fmt, senderUuid));