// Path: src/main/java/de/e621/rebane/components/listadapter/DMailListAdapter.java
// public class DMailListAdapter extends XMLListAdapter {
// 
//     public int getLastPage(int pagesize) {
//         return 100;
//     } //can't be computed
// 
//     public DMailListAdapter(Context context, int textViewResourceId, List<XMLNode> rowDataList) {
//         super(context, textViewResourceId, rowDataList);
//         svNumPosts = Integer.MAX_VALUE; //can't be computed
//     }
// 
//     public View getView(final int position, View convertView, ViewGroup parent) {
//         DMailViewHolder holder = new DMailViewHolder(Integer.parseInt(list.get(position).getFirstChildContent("id").orElse("")));
// 
//         LayoutInflater inflator = LayoutInflater.from(parent.getContext());
//         convertView = inflator.inflate(R.layout.twolined_listentry, parent, false);
// 
//         SQLiteDB db = new SQLiteDB(getContext().getApplicationContext());
//         db.open();
//         LoginManager lm = LoginManager.getInstance(getContext().getApplicationContext(), db);
//         XMLNode tmp = list.get(position);
//         //Logger.getLogger("a621").info(tmp.toString());
// 
//         holder.populate(position, convertView, tmp, lm);
// 
//         return convertView;
//     }
// }


import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import com.itwookie.XMLreader.XMLNode;
import java.net.HttpURLConnection;
import java.net.URL;
import de.e621.rebane.a621.R;
import de.e621.rebane.components.listadapter.DMailListAdapter;


        return super.onOptionsItemSelected(item);
    }

    @Override void setPagesize() {
        pagesize = 30; //given by API
    }

    @Override
    public void onSaveInstanceState(Bundle outState){
        super.onSaveInstanceState(outState);
        outState.putInt(FORUMQUERYPAGE, page);
    }

    @Override
    void handleIntent(Intent intent) {
        super.handleIntent(intent);
        page = intent.getIntExtra(FORUMQUERYPAGE,1);

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

    @Override void searchPosts(String escapedQuery, int page) {
        API_URI = "dmail/inbox.xml?page="+page;
        API_LOGIN = true;

        super.searchPosts(escapedQuery, page);
    }

    @Override void onSearchResult(XMLNode result, String query, int page) {

// Path: src/main/java/de/e621/rebane/components/listadapter/DMailListAdapter.java
// public class DMailListAdapter extends XMLListAdapter {
// 
//     public int getLastPage(int pagesize) {
//         return 100;
//     } //can't be computed
// 
//     public DMailListAdapter(Context context, int textViewResourceId, List<XMLNode> rowDataList) {
//         super(context, textViewResourceId, rowDataList);
//         svNumPosts = Integer.MAX_VALUE; //can't be computed
//     }
// 
//     public View getView(final int position, View convertView, ViewGroup parent) {
//         DMailViewHolder holder = new DMailViewHolder(Integer.parseInt(list.get(position).getFirstChildContent("id").orElse("")));
// 
//         LayoutInflater inflator = LayoutInflater.from(parent.getContext());
//         convertView = inflator.inflate(R.layout.twolined_listentry, parent, false);
// 
//         SQLiteDB db = new SQLiteDB(getContext().getApplicationContext());
//         db.open();
//         LoginManager lm = LoginManager.getInstance(getContext().getApplicationContext(), db);
//         XMLNode tmp = list.get(position);
//         //Logger.getLogger("a621").info(tmp.toString());
// 
//         holder.populate(position, convertView, tmp, lm);
// 
//         return convertView;
//     }
// }


// Path: src/main/java/de/e621/rebane/activities/DMailsActivity.java
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import com.itwookie.XMLreader.XMLNode;
import java.net.HttpURLConnection;
import java.net.URL;
import de.e621.rebane.a621.R;
import de.e621.rebane.components.listadapter.DMailListAdapter;


        return super.onOptionsItemSelected(item);
    }

    @Override void setPagesize() {
        pagesize = 30; //given by API
    }

    @Override
    public void onSaveInstanceState(Bundle outState){
        super.onSaveInstanceState(outState);
        outState.putInt(FORUMQUERYPAGE, page);
    }

    @Override
    void handleIntent(Intent intent) {
        super.handleIntent(intent);
        page = intent.getIntExtra(FORUMQUERYPAGE,1);

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

    @Override void searchPosts(String escapedQuery, int page) {
        API_URI = "dmail/inbox.xml?page="+page;
        API_LOGIN = true;

        super.searchPosts(escapedQuery, page);
    }

    @Override void onSearchResult(XMLNode result, String query, int page) {

        results = new DMailListAdapter(getApplicationContext(), R.id.lblTitle, result.getChildren());
