75 lines
2.3 KiB
Java
75 lines
2.3 KiB
Java
package com.gh.gamecenter;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
import android.support.v7.widget.RecyclerView;
|
|
import android.view.View;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
|
|
import com.gh.base.BaseActivity;
|
|
import com.gh.gamecenter.adapter.CommentDetailAdapter;
|
|
|
|
import butterknife.BindView;
|
|
|
|
/**
|
|
* Created by khy on 2017/3/22.
|
|
*/
|
|
public class CommentDetailActivity extends BaseActivity {
|
|
|
|
@BindView(R.id.comment_detail_rv)
|
|
RecyclerView mRecyclerView;
|
|
@BindView(R.id.reuse_none_data)
|
|
LinearLayout mNoData;
|
|
@BindView(R.id.reuse_tv_none_data)
|
|
TextView mNoDataTv;
|
|
|
|
private CommentDetailAdapter mAdapter;
|
|
private LinearLayoutManager mLayoutManager;
|
|
|
|
public static Intent getCommentDetailIntent(Context context, String commentId) {
|
|
Intent intent = new Intent(context, CommentDetailActivity.class);
|
|
intent.putExtra("commentId", commentId);
|
|
return intent;
|
|
}
|
|
|
|
|
|
@Override
|
|
protected int getLayoutId() {
|
|
return R.layout.activity_comment_detail;
|
|
}
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
init(getString(R.string.title_comment_detail));
|
|
|
|
String commentId = getIntent().getExtras().getString("commentId");
|
|
|
|
mAdapter = new CommentDetailAdapter(this, this, commentId);
|
|
mLayoutManager = new LinearLayoutManager(this);
|
|
mRecyclerView.setLayoutManager(mLayoutManager);
|
|
mRecyclerView.setAdapter(mAdapter);
|
|
|
|
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
|
@Override
|
|
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
|
super.onScrollStateChanged(recyclerView, newState);
|
|
if (newState == RecyclerView.SCROLL_STATE_IDLE && !mAdapter.isOver() && !mAdapter.isLoading()) {
|
|
mAdapter.loadData(mAdapter.getItemCount());
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override
|
|
public void loadEmpty() {
|
|
super.loadEmpty();
|
|
mNoData.setVisibility(View.VISIBLE);
|
|
mNoDataTv.setText("天了噜~页面不见了");
|
|
mRecyclerView.setVisibility(View.GONE);
|
|
}
|
|
}
|