// Path: src/main/java/de/e621/rebane/components/listadapter/CoverListAdapter.java
// public class CoverListAdapter extends XMLListAdapter {
// 
//     public int getLastPage(int pagesize) {
//         return Integer.MAX_VALUE;
//     } //can't be retrieved
//     String listType;
// 
//     public CoverListAdapter(Context context, int textViewResourceId, List<XMLNode> rowDataList, String quality, String type) {
//         super(context, textViewResourceId, rowDataList);
//         listType = type;
//         svNumPosts = Integer.MAX_VALUE; //can't be computed
//     }
// 
//     public View getView(final int position, View convertView, ViewGroup parent) {
//         CoverViewHolder holder = new CoverViewHolder();
// 
//         LayoutInflater inflator = LayoutInflater.from(parent.getContext());
//         convertView = inflator.inflate(R.layout.cover_layout, parent, false);
// 
//         holder.populate(position, convertView, list.get(position), listType);
// 
//         return convertView;
//     }
// }


import android.annotation.SuppressLint;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.SearchView;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import com.itwookie.XMLreader.XMLNode;
import java.net.URLDecoder;
import de.e621.rebane.a621.R;
import de.e621.rebane.components.listadapter.CoverListAdapter;

package de.e621.rebane.activities;





public class PoolsActivity extends PaginatedListActivity
        implements SwipeRefreshLayout.OnRefreshListener, View.OnClickListener {

    Menu menu = null;

    @Override
    @SuppressLint("MissingSuperCall")
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(R.layout.content_cover_list, savedInstanceState);
        //setContentView(R.layout.activity_posts);
        postLayoutInflated(this.getClass());
    }

    void setPagesize() {
        pagesize=20; //hardcoded
    }

    @Override
    void handleIntent(Intent intent) {
        super.handleIntent(intent);
        //page = intent.getIntExtra(SEARCHQUERYPAGE,1); //done by super
        if (!Intent.ACTION_SEARCH.equals(intent.getAction())) { //true case handled by super
            query = "";
        }

        if (results==null) searchPosts(query, page);
    }

    @Override
    void searchPosts(String escapedQuery, int page) {
        API_URI = "pool/index.xml?query="+escapedQuery+"&page="+ page;
        API_LOGIN = false;   //for vote meta search

        super.searchPosts(escapedQuery, page);
    }

    void onSearchResult(XMLNode result, String query, int page) {
        openDB();
        String quality = database.getValue(SettingsActivity.SETTINGPREVIEWQUALITY); //i would really like to display thumbnails, a bit like a bookshelf


// Path: src/main/java/de/e621/rebane/components/listadapter/CoverListAdapter.java
// public class CoverListAdapter extends XMLListAdapter {
// 
//     public int getLastPage(int pagesize) {
//         return Integer.MAX_VALUE;
//     } //can't be retrieved
//     String listType;
// 
//     public CoverListAdapter(Context context, int textViewResourceId, List<XMLNode> rowDataList, String quality, String type) {
//         super(context, textViewResourceId, rowDataList);
//         listType = type;
//         svNumPosts = Integer.MAX_VALUE; //can't be computed
//     }
// 
//     public View getView(final int position, View convertView, ViewGroup parent) {
//         CoverViewHolder holder = new CoverViewHolder();
// 
//         LayoutInflater inflator = LayoutInflater.from(parent.getContext());
//         convertView = inflator.inflate(R.layout.cover_layout, parent, false);
// 
//         holder.populate(position, convertView, list.get(position), listType);
// 
//         return convertView;
//     }
// }


// Path: src/main/java/de/e621/rebane/activities/PoolsActivity.java
import android.annotation.SuppressLint;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.SearchView;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import com.itwookie.XMLreader.XMLNode;
import java.net.URLDecoder;
import de.e621.rebane.a621.R;
import de.e621.rebane.components.listadapter.CoverListAdapter;

package de.e621.rebane.activities;





public class PoolsActivity extends PaginatedListActivity
        implements SwipeRefreshLayout.OnRefreshListener, View.OnClickListener {

    Menu menu = null;

    @Override
    @SuppressLint("MissingSuperCall")
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(R.layout.content_cover_list, savedInstanceState);
        //setContentView(R.layout.activity_posts);
        postLayoutInflated(this.getClass());
    }

    void setPagesize() {
        pagesize=20; //hardcoded
    }

    @Override
    void handleIntent(Intent intent) {
        super.handleIntent(intent);
        //page = intent.getIntExtra(SEARCHQUERYPAGE,1); //done by super
        if (!Intent.ACTION_SEARCH.equals(intent.getAction())) { //true case handled by super
            query = "";
        }

        if (results==null) searchPosts(query, page);
    }

    @Override
    void searchPosts(String escapedQuery, int page) {
        API_URI = "pool/index.xml?query="+escapedQuery+"&page="+ page;
        API_LOGIN = false;   //for vote meta search

        super.searchPosts(escapedQuery, page);
    }

    void onSearchResult(XMLNode result, String query, int page) {
        openDB();
        String quality = database.getValue(SettingsActivity.SETTINGPREVIEWQUALITY); //i would really like to display thumbnails, a bit like a bookshelf


        results = new CoverListAdapter(this, R.id.txtMid, result.getChildren(), quality, "pool");
