// Path: app/src/main/java/com/hippo/util/ExceptionUtils.java
// public final class ExceptionUtils {
// 
//     private static final String TAG = ExceptionUtils.class.getSimpleName();
// 
//     @NonNull
//     public static String getReadableString(@NonNull Context context, @NonNull Exception e) {
//         if (e instanceof ConnectTimeoutException ||
//                 e instanceof SocketTimeoutException) {
//             return context.getString(R.string.em_timeout);
//         } else if (e instanceof UnknownHostException) {
//             return context.getString(R.string.em_unknown_host);
//         } else if (e instanceof ResponseCodeException) {
//             ResponseCodeException responseCodeException = (ResponseCodeException) e;
//             String error = context.getString(R.string.em_response_code, responseCodeException.getResponseCode());
//             if (responseCodeException.isIdentifiedResponseCode()) {
//                 error += ", " + responseCodeException.getMessage();
//             }
//             return error;
//         } else if (e instanceof ProtocolException && e.getMessage().startsWith("Too many follow-up requests:")) {
//             return context.getString(R.string.em_redirection);
//         } else if (e instanceof SocketException) {
//             return context.getString(R.string.em_socket);
//         } else if (e instanceof NMBException) {
//             return e.getMessage();
//         } else {
//             Say.d(TAG, "Can't recognize this Exception", e);
//             return context.getString(R.string.em_unknown);
//         }
//     }
// 
//     public static @Nullable String getReasonString(Context context, Exception e) {
//         /*
//         if (e instanceof UnknownHostException) {
//             return context.getString(R.string.erm_unknown_host);
//         } else {
//             return null;
//         }
//         */
//         return null;
//     }
// }


import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.easyrecyclerview.FastScroller;
import com.hippo.easyrecyclerview.HandlerDrawable;
import com.hippo.easyrecyclerview.LayoutManagerUtils;
import com.hippo.effect.ViewTransition;
import com.hippo.nimingban.R;
import com.hippo.refreshlayout.RefreshLayout;
import com.hippo.util.ExceptionUtils;
import com.hippo.widget.ProgressView;
import com.hippo.yorozuya.IntIdGenerator;
import com.hippo.yorozuya.IntList;
import com.hippo.yorozuya.LayoutUtils;
import com.hippo.yorozuya.ResourcesUtils;
import com.hippo.yorozuya.Say;
import java.util.ArrayList;
import java.util.List;
                        int newIndexEnd = newIndexStart + data.size();
                        mData.addAll(oldIndexStart, data);
                        notifyDataSetChanged();

                        for (int i = mCurrentTaskPage - mStartPage, n = mPageDivider.size(); i < n; i++) {
                            mPageDivider.set(i, mPageDivider.get(i) - oldIndexEnd + newIndexEnd);
                        }

                        if (newIndexEnd > oldIndexEnd && newIndexEnd > 0) {
                            mRecyclerView.stopScroll();
                            LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), newIndexEnd - 1, 0);
                            onScrollToPosition();
                        }
                        break;
                }
            }

            mRefreshLayout.setHeaderRefreshing(false);
            mRefreshLayout.setFooterRefreshing(false);
        }

        public void onGetExpection(int taskId, Exception e) {
            if (mCurrentTaskId == taskId) {
                if (e != null) {
                    e.printStackTrace();
                }

                mRefreshLayout.setHeaderRefreshing(false);
                mRefreshLayout.setFooterRefreshing(false);
                Say.d(TAG, "Get page data failed " + e.getClass().getName() + " " + e.getMessage());
// Path: app/src/main/java/com/hippo/util/ExceptionUtils.java
// public final class ExceptionUtils {
// 
//     private static final String TAG = ExceptionUtils.class.getSimpleName();
// 
//     @NonNull
//     public static String getReadableString(@NonNull Context context, @NonNull Exception e) {
//         if (e instanceof ConnectTimeoutException ||
//                 e instanceof SocketTimeoutException) {
//             return context.getString(R.string.em_timeout);
//         } else if (e instanceof UnknownHostException) {
//             return context.getString(R.string.em_unknown_host);
//         } else if (e instanceof ResponseCodeException) {
//             ResponseCodeException responseCodeException = (ResponseCodeException) e;
//             String error = context.getString(R.string.em_response_code, responseCodeException.getResponseCode());
//             if (responseCodeException.isIdentifiedResponseCode()) {
//                 error += ", " + responseCodeException.getMessage();
//             }
//             return error;
//         } else if (e instanceof ProtocolException && e.getMessage().startsWith("Too many follow-up requests:")) {
//             return context.getString(R.string.em_redirection);
//         } else if (e instanceof SocketException) {
//             return context.getString(R.string.em_socket);
//         } else if (e instanceof NMBException) {
//             return e.getMessage();
//         } else {
//             Say.d(TAG, "Can't recognize this Exception", e);
//             return context.getString(R.string.em_unknown);
//         }
//     }
// 
//     public static @Nullable String getReasonString(Context context, Exception e) {
//         /*
//         if (e instanceof UnknownHostException) {
//             return context.getString(R.string.erm_unknown_host);
//         } else {
//             return null;
//         }
//         */
//         return null;
//     }
// }


// Path: app/src/main/java/com/hippo/nimingban/widget/ContentLayout.java
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.easyrecyclerview.FastScroller;
import com.hippo.easyrecyclerview.HandlerDrawable;
import com.hippo.easyrecyclerview.LayoutManagerUtils;
import com.hippo.effect.ViewTransition;
import com.hippo.nimingban.R;
import com.hippo.refreshlayout.RefreshLayout;
import com.hippo.util.ExceptionUtils;
import com.hippo.widget.ProgressView;
import com.hippo.yorozuya.IntIdGenerator;
import com.hippo.yorozuya.IntList;
import com.hippo.yorozuya.LayoutUtils;
import com.hippo.yorozuya.ResourcesUtils;
import com.hippo.yorozuya.Say;
import java.util.ArrayList;
import java.util.List;

                        int newIndexEnd = newIndexStart + data.size();
                        mData.addAll(oldIndexStart, data);
                        notifyDataSetChanged();

                        for (int i = mCurrentTaskPage - mStartPage, n = mPageDivider.size(); i < n; i++) {
                            mPageDivider.set(i, mPageDivider.get(i) - oldIndexEnd + newIndexEnd);
                        }

                        if (newIndexEnd > oldIndexEnd && newIndexEnd > 0) {
                            mRecyclerView.stopScroll();
                            LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), newIndexEnd - 1, 0);
                            onScrollToPosition();
                        }
                        break;
                }
            }

            mRefreshLayout.setHeaderRefreshing(false);
            mRefreshLayout.setFooterRefreshing(false);
        }

        public void onGetExpection(int taskId, Exception e) {
            if (mCurrentTaskId == taskId) {
                if (e != null) {
                    e.printStackTrace();
                }

                mRefreshLayout.setHeaderRefreshing(false);
                mRefreshLayout.setFooterRefreshing(false);
                Say.d(TAG, "Get page data failed " + e.getClass().getName() + " " + e.getMessage());
                String readableError = ExceptionUtils.getReadableString(getContext(), e);