Android Open Source - SQLite-Simple-Android F T S Adapter






From Project

Back to project page SQLite-Simple-Android.

License

The source code is released under:

Apache License

If you think the Android project SQLite-Simple-Android 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 garin.artemiy.sqlitesimple.example.adapters;
//w ww  . ja  v  a2s . c  o  m
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import garin.artemiy.sqlitesimple.R;
import garin.artemiy.sqlitesimple.example.dao.RecordsDAO;
import garin.artemiy.sqlitesimple.example.models.Record;
import garin.artemiy.sqlitesimple.library.model.FTSModel;

/**
 * Author: Artemiy Garin
 * Date: 07.04.13
 */
@SuppressWarnings("CanBeFinal")
public class FTSAdapter extends ArrayAdapter<FTSModel> {

    private RecordsDAO recordsDAO;

    public FTSAdapter(Context context, RecordsDAO recordsDAO) {
        super(context, R.layout.item_record);
        this.recordsDAO = recordsDAO;
    }

    @SuppressLint("InflateParams")
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null)
            convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_record, null);

        FTSModel ftsModel = getItem(position);
        TextView recordText = (TextView) convertView.findViewById(R.id.recordTextView);
        Record record = recordsDAO.readWhere(Record.COLUMN_ID, ftsModel.getId());

        if (record != null) recordText.setText(record.getRecordText());

        return convertView;
    }

}




Java Source Code List

garin.artemiy.sqlitesimple.example.MainActivity.java
garin.artemiy.sqlitesimple.example.MainApplication.java
garin.artemiy.sqlitesimple.example.adapters.FTSAdapter.java
garin.artemiy.sqlitesimple.example.adapters.RecordAdapter.java
garin.artemiy.sqlitesimple.example.dao.InternalDAO.java
garin.artemiy.sqlitesimple.example.dao.RecordsDAO.java
garin.artemiy.sqlitesimple.example.models.InternalRecord.java
garin.artemiy.sqlitesimple.example.models.Record.java
garin.artemiy.sqlitesimple.library.SQLiteSimpleDAO.java
garin.artemiy.sqlitesimple.library.SQLiteSimpleFTS.java
garin.artemiy.sqlitesimple.library.SQLiteSimpleHelper.java
garin.artemiy.sqlitesimple.library.SQLiteSimple.java
garin.artemiy.sqlitesimple.library.annotations.Column.java
garin.artemiy.sqlitesimple.library.annotations.Table.java
garin.artemiy.sqlitesimple.library.model.FTSModel.java
garin.artemiy.sqlitesimple.library.util.ColumnType.java
garin.artemiy.sqlitesimple.library.util.SimpleConstants.java
garin.artemiy.sqlitesimple.library.util.SimpleDatabaseUtil.java
garin.artemiy.sqlitesimple.library.util.SimplePreferencesHelper.java