|
|
@@ -10,14 +10,24 @@ import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
+import com.google.gson.Gson;
|
|
|
+import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
+import com.sheep.gamegroup.model.entity.MessageReplyEntity;
|
|
|
+import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
+import com.sheep.gamegroup.util.LogUtil;
|
|
|
import com.sheep.gamegroup.view.adapter.MessageInteractionAdapter;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
+import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
import butterknife.ButterKnife;
|
|
|
import butterknife.OnClick;
|
|
|
+import rx.android.schedulers.AndroidSchedulers;
|
|
|
+import rx.schedulers.Schedulers;
|
|
|
|
|
|
/**
|
|
|
* created on:2018/8/28 on 17:15
|
|
|
@@ -30,7 +40,9 @@ public class MessageInteractionDetailActivity extends AppCompatActivity {
|
|
|
@BindView(R.id.recycle_view)
|
|
|
RecyclerView recyclerView;
|
|
|
private MessageInteractionAdapter adapter;
|
|
|
- private List<?> mList;
|
|
|
+ private List<MessageReplyEntity> mList = new ArrayList<>();
|
|
|
+ private MessageReplyEntity entity=null;
|
|
|
+ private String id="";
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
@@ -43,6 +55,9 @@ public class MessageInteractionDetailActivity extends AppCompatActivity {
|
|
|
recyclerView.setLayoutManager(manager);
|
|
|
adapter = new MessageInteractionAdapter(this, mList);
|
|
|
recyclerView.setAdapter(adapter);
|
|
|
+ entity = (MessageReplyEntity) getIntent().getSerializableExtra("message");
|
|
|
+ id=getIntent().getIntExtra("position",-1)+"";
|
|
|
+ loadData(id + "");
|
|
|
}
|
|
|
|
|
|
@OnClick({R.id.img_baseactivity_title})
|
|
|
@@ -53,4 +68,28 @@ public class MessageInteractionDetailActivity extends AppCompatActivity {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ private void loadData(String id) {
|
|
|
+ if (id.equals(-1 + "")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ SheepApp.getInstance()
|
|
|
+ .getNetComponent()
|
|
|
+ .getApiService()
|
|
|
+ .getMessageReplyItem(id)
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
|
|
|
+ @Override
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
+ LogUtil.logI("loadData-onNext----"+new Gson().toJson(baseMessage));
|
|
|
+ mList.addAll(baseMessage.getDataList(MessageReplyEntity.class));
|
|
|
+ tvTitle.setText(entity.getTitle());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
+ LogUtil.logI("loadData-onError----"+new Gson().toJson(baseMessage));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|