// Path: app/src/main/java/com/dxjia/doubantop/datas/SearchHistory.java
// public class SearchHistory extends Model {
//     protected CharField meal_name;
//     protected DateField date;
// 
//     public SearchHistory() {
//         super(true);
//         meal_name = new CharField();
//         date = new DateField();
//     }
// 
//     public static SearchHistory create(String mealName, Date mDate) {
//         SearchHistory searchHistory = new SearchHistory();
//         searchHistory.setName(mealName);
//         searchHistory.setDate(mDate);
//         searchHistory.save();
//         return searchHistory;
//     }
// 
//     public String getName() {
//         return meal_name.get();
//     }
// 
//     public void setName(String count) {
//         meal_name.set(count);
//     }
// 
//     public void setDate(Date d) {
//         date.set(d);
//     }
// 
//     public Date getDate() {
//         return date.get();
//     }
// 
//     private static String formatProjectForQuery(String name) {
//         String name1 = name;
//         return name1;
//     }
// 
//     public static List<SearchHistory> logSortByProjectType(String Key_) {
//         String query_string = formatProjectForQuery(Key_);
//         Filter filter = new Filter();
//         filter.contains("meal_name", query_string);
//         return SearchHistory.objects().filter(filter).orderBy("meal_name").toList();
//     }
// 
//     public boolean save() {
//         int id = SearchHistory.objects(getAppContext(), SearchHistory.class).all().count() + 1;
//         return this.save(getAppContext(), id);
//     }
// 
//     public boolean edit() {
//         return this.save(getAppContext());
//     }
// 
//     public boolean delete() {
//         return this.delete(getAppContext());
//     }
// 
//     public static List<SearchHistory> all() {
//         return SearchHistory.objects().all().orderBy("-date").toList();
//     }
// 
//     public static List<SearchHistory> filterByName(String name) {
//         Filter filter = new Filter();
//         filter.contains("meal_name", name);
//         return SearchHistory.objects().filter(filter).orderBy("meal_name").toList();
//     }
// 
//     public static QuerySet<SearchHistory> objects() {
//         return SearchHistory.objects(getAppContext(), SearchHistory.class);
//     }
// 
//     private static Context getAppContext() {
//         return DoubanTopApplication.getContext();
//     }
// }
// 
// Path: app/src/main/java/com/dxjia/doubantop/views/SearchHistoryRowView.java
// public class SearchHistoryRowView extends LinearLayout {
//     Context mContext;
//     SearchHistory mLog;
// 
//     public SearchHistoryRowView(Context context) {
//         super(context);
//         mContext = context;
//         init();
//     }
// 
//     public SearchHistoryRowView(Context context, AttributeSet attrs) {
//         super(context, attrs);
//         mContext = context;
//         init();
//     }
// 
//     private void init() {
//         LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//         inflater.inflate(R.layout.search_history_row, this);
//     }
// 
//     public void setLog(SearchHistory log) {
//         mLog = log;
//         TextView text = (TextView) findViewById(R.id.textView);
//         text.setText(mLog.getName());
//     }
// }


import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import com.dxjia.doubantop.datas.SearchHistory;
import com.dxjia.doubantop.views.SearchHistoryRowView;
import java.util.List;
package com.dxjia.doubantop.adapters;




/**
 * Created by 德祥 on 2015/6/30.
 */
public class SearchHistoryAdapter extends ArrayAdapter<SearchHistory> {
    Context mContext;
    public static List<SearchHistory> mLogs;

    public SearchHistoryAdapter(Context context, int resource, List<SearchHistory> logs) {
        super(context, resource);
        mContext = context;
        mLogs = logs;
    }

    public void setLogs(List<SearchHistory> logs) {
        mLogs = logs;
    }

    public List<SearchHistory> getLogs() {
        return mLogs;
    }

    public void add(SearchHistory log) {
        mLogs.add(log);
    }

    public void remove(SearchHistory log) {
        this.mLogs.remove(log);
    }

    public int getCount() {
        return mLogs.size();
    }

    public SearchHistory getItem(int position) {
        return mLogs.get(position);
    }

    public View getView(int position, View convertView, ViewGroup parent) {
// Path: app/src/main/java/com/dxjia/doubantop/datas/SearchHistory.java
// public class SearchHistory extends Model {
//     protected CharField meal_name;
//     protected DateField date;
// 
//     public SearchHistory() {
//         super(true);
//         meal_name = new CharField();
//         date = new DateField();
//     }
// 
//     public static SearchHistory create(String mealName, Date mDate) {
//         SearchHistory searchHistory = new SearchHistory();
//         searchHistory.setName(mealName);
//         searchHistory.setDate(mDate);
//         searchHistory.save();
//         return searchHistory;
//     }
// 
//     public String getName() {
//         return meal_name.get();
//     }
// 
//     public void setName(String count) {
//         meal_name.set(count);
//     }
// 
//     public void setDate(Date d) {
//         date.set(d);
//     }
// 
//     public Date getDate() {
//         return date.get();
//     }
// 
//     private static String formatProjectForQuery(String name) {
//         String name1 = name;
//         return name1;
//     }
// 
//     public static List<SearchHistory> logSortByProjectType(String Key_) {
//         String query_string = formatProjectForQuery(Key_);
//         Filter filter = new Filter();
//         filter.contains("meal_name", query_string);
//         return SearchHistory.objects().filter(filter).orderBy("meal_name").toList();
//     }
// 
//     public boolean save() {
//         int id = SearchHistory.objects(getAppContext(), SearchHistory.class).all().count() + 1;
//         return this.save(getAppContext(), id);
//     }
// 
//     public boolean edit() {
//         return this.save(getAppContext());
//     }
// 
//     public boolean delete() {
//         return this.delete(getAppContext());
//     }
// 
//     public static List<SearchHistory> all() {
//         return SearchHistory.objects().all().orderBy("-date").toList();
//     }
// 
//     public static List<SearchHistory> filterByName(String name) {
//         Filter filter = new Filter();
//         filter.contains("meal_name", name);
//         return SearchHistory.objects().filter(filter).orderBy("meal_name").toList();
//     }
// 
//     public static QuerySet<SearchHistory> objects() {
//         return SearchHistory.objects(getAppContext(), SearchHistory.class);
//     }
// 
//     private static Context getAppContext() {
//         return DoubanTopApplication.getContext();
//     }
// }
// 
// Path: app/src/main/java/com/dxjia/doubantop/views/SearchHistoryRowView.java
// public class SearchHistoryRowView extends LinearLayout {
//     Context mContext;
//     SearchHistory mLog;
// 
//     public SearchHistoryRowView(Context context) {
//         super(context);
//         mContext = context;
//         init();
//     }
// 
//     public SearchHistoryRowView(Context context, AttributeSet attrs) {
//         super(context, attrs);
//         mContext = context;
//         init();
//     }
// 
//     private void init() {
//         LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//         inflater.inflate(R.layout.search_history_row, this);
//     }
// 
//     public void setLog(SearchHistory log) {
//         mLog = log;
//         TextView text = (TextView) findViewById(R.id.textView);
//         text.setText(mLog.getName());
//     }
// }


// Path: app/src/main/java/com/dxjia/doubantop/adapters/SearchHistoryAdapter.java
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import com.dxjia.doubantop.datas.SearchHistory;
import com.dxjia.doubantop.views.SearchHistoryRowView;
import java.util.List;

package com.dxjia.doubantop.adapters;




/**
 * Created by 德祥 on 2015/6/30.
 */
public class SearchHistoryAdapter extends ArrayAdapter<SearchHistory> {
    Context mContext;
    public static List<SearchHistory> mLogs;

    public SearchHistoryAdapter(Context context, int resource, List<SearchHistory> logs) {
        super(context, resource);
        mContext = context;
        mLogs = logs;
    }

    public void setLogs(List<SearchHistory> logs) {
        mLogs = logs;
    }

    public List<SearchHistory> getLogs() {
        return mLogs;
    }

    public void add(SearchHistory log) {
        mLogs.add(log);
    }

    public void remove(SearchHistory log) {
        this.mLogs.remove(log);
    }

    public int getCount() {
        return mLogs.size();
    }

    public SearchHistory getItem(int position) {
        return mLogs.get(position);
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        SearchHistoryRowView view = (SearchHistoryRowView) convertView;