// Path: src/main/java/de/e621/rebane/activities/PostsActivity.java
// public class PostsActivity extends PaginatedListActivity
//         implements SwipeRefreshLayout.OnRefreshListener, View.OnClickListener {
// 
//     Menu menu = null;
// 
//     @Override
//     @SuppressLint("MissingSuperCall")
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(R.layout.content_posts, savedInstanceState);
//         //setContentView(R.layout.activity_posts);
//         postLayoutInflated(this.getClass());
//     }
// 
//     void setPagesize() {
//         String pgsize = database.getValue(SettingsActivity.SETTINGPOSTSPERPAGE);
//         if (pgsize == null || pgsize.isEmpty()) {
//             pagesize = 15;
//             database.setValue(SettingsActivity.SETTINGPOSTSPERPAGE, "15");
//         } else {
//             try {
//                 pagesize = Integer.valueOf(pgsize);
//             } catch (Exception e) {
//                 pagesize = 15;
//                 database.setValue(SettingsActivity.SETTINGPOSTSPERPAGE, "15");
//             }
//             if (pagesize < 1 || pagesize > 100) {
//                 pagesize = 15;
//                 database.setValue(SettingsActivity.SETTINGPOSTSPERPAGE, "15");
//             }
//         }
//     }
// 
//     @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
//             openDB();
//             query = database.getValue(SettingsActivity.SETTINGDEFAULTSEARCH);
//             if (query == null) query = "";
//         }
// 
//         if (results==null) searchPosts(query, page);
//     }
// 
//     @Override
//     void searchPosts(String escapedQuery, int page) {
//         API_URI = "post/index.xml?tags="+escapedQuery+"&page="+ page + "&limit="+pagesize;
//         API_LOGIN = true;   //for vote meta search
// 
//         super.searchPosts(escapedQuery, page);
//     }
// 
//     void onSearchResult(XMLNode result, String query, int page) {
//         openDB();
//         String quality = database.getValue(SettingsActivity.SETTINGPREVIEWQUALITY);
// 
//         results = new PostListAdapter(this, R.id.txtMid, blacklist.proxyBlacklist(result.getChildren()), quality);
//         results.svNumPosts = (result.attributes().contains("count") ? Integer.valueOf(result.getAttribute("count").orElse("")) : 0);
//         PostsActivity.this.query = query; PostsActivity.this.page = page;
// 
//         ActionBar ab = getSupportActionBar();
//         ab.setTitle(getResources().getString(R.string.title_posts) + " | " + page);
//         ab.setSubtitle(URLDecoder.decode(query));
//         //setTitle(getResources().getString(R.string.title_posts) + " " + _page + (_query.equals("")?" | *":" | "+XMLUtils.unescapeXML(_query)));
//     }
// 
//     MenuItem searchMenuItem = null;
//     @Override
//     public boolean onCreateOptionsMenu(Menu menu) {
//         // Inflate the menu; this adds items to the action bar if it is present.
//         getMenuInflater().inflate(R.menu.posts, menu);
//         this.menu = menu;
// 
//         // Get the SearchView and set the searchable configuration
//         SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
//         SearchView searchView = (SearchView) (searchMenuItem = menu.findItem(R.id.action_search)).getActionView();
//         if (searchView != null) {
//             searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
//             searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
//                 @Override
//                 public boolean onQueryTextSubmit(String query) {
//                     MenuItem searchMenuItem = PostsActivity.this.searchMenuItem;
//                     if (searchMenuItem != null) {
//                         searchMenuItem.collapseActionView();
//                     }
//                     return false;
//                 }
//                 @Override
//                 public boolean onQueryTextChange(String newText) {
//                     return true;
//                 }
//             });
//         }
//         else Toast.makeText(getApplicationContext(), "Could not enable Search!", Toast.LENGTH_LONG).show();
// 
//         return true;
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         int id = item.getItemId();
// 
//         //noinspection SimplifiableIfStatement
//         if (id == R.id.action_search) {
//             SearchView sv = (SearchView)item.getActionView();
//             item.expandActionView();
//             sv.setQuery(URLDecoder.decode(query), false);
//         }
// 
//         return super.onOptionsItemSelected(item);
//     }
// 
// }


import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.itwookie.XMLreader.XMLNode;
import java.util.List;
import de.e621.rebane.a621.R;
import de.e621.rebane.activities.PostsActivity;

package de.e621.rebane.components.listadapter;





public class PostListAdapter extends XMLListAdapter {
    private String quality;
    private int pageoffset;
    private String escapedQuery;


// Path: src/main/java/de/e621/rebane/activities/PostsActivity.java
// public class PostsActivity extends PaginatedListActivity
//         implements SwipeRefreshLayout.OnRefreshListener, View.OnClickListener {
// 
//     Menu menu = null;
// 
//     @Override
//     @SuppressLint("MissingSuperCall")
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(R.layout.content_posts, savedInstanceState);
//         //setContentView(R.layout.activity_posts);
//         postLayoutInflated(this.getClass());
//     }
// 
//     void setPagesize() {
//         String pgsize = database.getValue(SettingsActivity.SETTINGPOSTSPERPAGE);
//         if (pgsize == null || pgsize.isEmpty()) {
//             pagesize = 15;
//             database.setValue(SettingsActivity.SETTINGPOSTSPERPAGE, "15");
//         } else {
//             try {
//                 pagesize = Integer.valueOf(pgsize);
//             } catch (Exception e) {
//                 pagesize = 15;
//                 database.setValue(SettingsActivity.SETTINGPOSTSPERPAGE, "15");
//             }
//             if (pagesize < 1 || pagesize > 100) {
//                 pagesize = 15;
//                 database.setValue(SettingsActivity.SETTINGPOSTSPERPAGE, "15");
//             }
//         }
//     }
// 
//     @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
//             openDB();
//             query = database.getValue(SettingsActivity.SETTINGDEFAULTSEARCH);
//             if (query == null) query = "";
//         }
// 
//         if (results==null) searchPosts(query, page);
//     }
// 
//     @Override
//     void searchPosts(String escapedQuery, int page) {
//         API_URI = "post/index.xml?tags="+escapedQuery+"&page="+ page + "&limit="+pagesize;
//         API_LOGIN = true;   //for vote meta search
// 
//         super.searchPosts(escapedQuery, page);
//     }
// 
//     void onSearchResult(XMLNode result, String query, int page) {
//         openDB();
//         String quality = database.getValue(SettingsActivity.SETTINGPREVIEWQUALITY);
// 
//         results = new PostListAdapter(this, R.id.txtMid, blacklist.proxyBlacklist(result.getChildren()), quality);
//         results.svNumPosts = (result.attributes().contains("count") ? Integer.valueOf(result.getAttribute("count").orElse("")) : 0);
//         PostsActivity.this.query = query; PostsActivity.this.page = page;
// 
//         ActionBar ab = getSupportActionBar();
//         ab.setTitle(getResources().getString(R.string.title_posts) + " | " + page);
//         ab.setSubtitle(URLDecoder.decode(query));
//         //setTitle(getResources().getString(R.string.title_posts) + " " + _page + (_query.equals("")?" | *":" | "+XMLUtils.unescapeXML(_query)));
//     }
// 
//     MenuItem searchMenuItem = null;
//     @Override
//     public boolean onCreateOptionsMenu(Menu menu) {
//         // Inflate the menu; this adds items to the action bar if it is present.
//         getMenuInflater().inflate(R.menu.posts, menu);
//         this.menu = menu;
// 
//         // Get the SearchView and set the searchable configuration
//         SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
//         SearchView searchView = (SearchView) (searchMenuItem = menu.findItem(R.id.action_search)).getActionView();
//         if (searchView != null) {
//             searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
//             searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
//                 @Override
//                 public boolean onQueryTextSubmit(String query) {
//                     MenuItem searchMenuItem = PostsActivity.this.searchMenuItem;
//                     if (searchMenuItem != null) {
//                         searchMenuItem.collapseActionView();
//                     }
//                     return false;
//                 }
//                 @Override
//                 public boolean onQueryTextChange(String newText) {
//                     return true;
//                 }
//             });
//         }
//         else Toast.makeText(getApplicationContext(), "Could not enable Search!", Toast.LENGTH_LONG).show();
// 
//         return true;
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         int id = item.getItemId();
// 
//         //noinspection SimplifiableIfStatement
//         if (id == R.id.action_search) {
//             SearchView sv = (SearchView)item.getActionView();
//             item.expandActionView();
//             sv.setQuery(URLDecoder.decode(query), false);
//         }
// 
//         return super.onOptionsItemSelected(item);
//     }
// 
// }


// Path: src/main/java/de/e621/rebane/components/listadapter/PostListAdapter.java
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.itwookie.XMLreader.XMLNode;
import java.util.List;
import de.e621.rebane.a621.R;
import de.e621.rebane.activities.PostsActivity;

package de.e621.rebane.components.listadapter;





public class PostListAdapter extends XMLListAdapter {
    private String quality;
    private int pageoffset;
    private String escapedQuery;


    public PostListAdapter(PostsActivity context, int textViewResourceId, List<XMLNode> rowDataList, String quality) {
