|
@@ -0,0 +1,104 @@
|
|
|
|
|
+package com.sheep.gamegroup.view.activity;
|
|
|
|
|
+
|
|
|
|
|
+import android.support.v7.widget.AppCompatAutoCompleteTextView;
|
|
|
|
|
+import android.view.View;
|
|
|
|
|
+import android.view.ViewGroup;
|
|
|
|
|
+import android.widget.GridView;
|
|
|
|
|
+import android.widget.TextView;
|
|
|
|
|
+
|
|
|
|
|
+import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.TaskReleaseEty;
|
|
|
|
|
+import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
|
|
+import com.sheep.gamegroup.util.ListUtil;
|
|
|
|
|
+import com.sheep.gamegroup.view.adapter.ArrayAdapter;
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.R;
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+import butterknife.BindView;
|
|
|
|
|
+import butterknife.OnClick;
|
|
|
|
|
+import rx.android.schedulers.AndroidSchedulers;
|
|
|
|
|
+import rx.schedulers.Schedulers;
|
|
|
|
|
+
|
|
|
|
|
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.SEARCH_GAME_COMMIT;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * Created by realicing on 2018/04/.
|
|
|
|
|
+ * realicing@sina.com
|
|
|
|
|
+ */
|
|
|
|
|
+public class ActSearchGame extends BaseActivity {
|
|
|
|
|
+
|
|
|
|
|
+ @BindView(R.id.search_game_input)
|
|
|
|
|
+ AppCompatAutoCompleteTextView search_game_input;
|
|
|
|
|
+ @BindView(R.id.search_game_bt)
|
|
|
|
|
+ TextView search_game_bt;
|
|
|
|
|
+ @BindView(R.id.search_game_hot_list)
|
|
|
|
|
+ GridView search_game_hot_list;
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected int getLayoutId() {
|
|
|
|
|
+ return R.layout.act_search_game;
|
|
|
|
|
+ }
|
|
|
|
|
+ private ActSearchGame activity;
|
|
|
|
|
+ private ArrayAdapter<TaskReleaseEty> hotAdapter;
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void initView() {
|
|
|
|
|
+ activity = this;
|
|
|
|
|
+ TitleBarUtils.getInstance()
|
|
|
|
|
+ .setTitle(this, "搜索游戏")
|
|
|
|
|
+ .setTitleFinish(this);
|
|
|
|
|
+ hotAdapter = new ArrayAdapter<TaskReleaseEty>(activity, R.layout.hot_tag_item){
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public boolean convert(int position, View convertView, ViewGroup parent, TaskReleaseEty item) {
|
|
|
|
|
+ if(convertView instanceof TextView){
|
|
|
|
|
+ ((TextView) convertView).setText(item.getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ search_game_hot_list.setAdapter(hotAdapter);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void initListener() {
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<TaskReleaseEty> hotList = new ArrayList<>();
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void initData() {
|
|
|
|
|
+ SheepApp.getInstance().getNetComponent().getApiService()
|
|
|
|
|
+ .releaseTask(1,9,
|
|
|
|
|
+ SheepApp.getInstance().getConnectAddress().getPlatForm(),1,
|
|
|
|
|
+ 0, 0,
|
|
|
|
|
+ "-1", 3)
|
|
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
|
|
+ List<TaskReleaseEty> newList = baseMessage.getDatas(TaskReleaseEty.class);
|
|
|
|
|
+ ListUtil.addAll(hotList, newList);
|
|
|
|
|
+ hotAdapter.notifyDataSetChanged();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @OnClick({R.id.search_game_bt})
|
|
|
|
|
+ public void onViewClicked(View view) {
|
|
|
|
|
+ switch (view.getId()) {
|
|
|
|
|
+ case R.id.search_game_bt:
|
|
|
|
|
+ SEARCH_GAME_COMMIT.onEvent();
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|