导航菜单

页面标题

页面副标题

爱心e站 v1.0.0 - AssistiveDeviceSelectActivity.java 源代码

正在查看: 爱心e站 v1.0.0 应用的 AssistiveDeviceSelectActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.newheyd.JZKFcanjiren.Activity;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Parcel;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.google.gson.Gson;
import com.newheyd.JZKFcanjiren.BaseActivity;
import com.newheyd.JZKFcanjiren.Bean.AssistiveDeviceBean;
import com.newheyd.JZKFcanjiren.Bean.AssistiveDeviceListBean;
import com.newheyd.JZKFcanjiren.Bean.AssistiveMuLuBean;
import com.newheyd.JZKFcanjiren.Bean.DictionaryBean;
import com.newheyd.JZKFcanjiren.R;
import com.newheyd.JZKFcanjiren.Utils.StastisticUtil;
import com.newheyd.JZKFcanjiren.Utils.locationUtil.LocationAddrUtil;
import com.newheyd.JZKFcanjiren.Utils.recycleViewUtils.CommonAdapter;
import com.newheyd.JZKFcanjiren.Utils.recycleViewUtils.MultiItemTypeAdapter;
import com.newheyd.JZKFcanjiren.Utils.recycleViewUtils.base.ViewHolder;
import com.newheyd.JZKFcanjiren.View.TitleView;
import com.newheyd.JZKFcanjiren.model.BaseResult;
import com.newheyd.JZKFcanjiren.net.NewHYTask;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class AssistiveDeviceSelectActivity extends BaseActivity {
    private AssistiveDeviceBean assistiveDeviceBean;
    private AssistiveDeviceListBean assistiveDeviceListBean;
    private CommonAdapter leftAdapter;
    private List<DictionaryBean> leftDataList;
    private RecyclerView leftView;
    private CommonAdapter rightAdapter;
    private List<AssistiveMuLuBean> rightDataList;
    private RecyclerView rightView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_assistive_device_select);
        super.onCreate(savedInstanceState);
        SharedPreferences sharedPreferencesEdite = getSharedPreferences("fuju", 0);
        this.assistiveDeviceListBean = (AssistiveDeviceListBean) new Gson().fromJson(sharedPreferencesEdite.getString("fujulist", ""), AssistiveDeviceListBean.class);
        initRecycleView();
        goStatistics();
    }

    public void goStatistics() {
        HashMap<String, String> map = LocationAddrUtil.getInstance().getLocationParam(this.mContext);
        StastisticUtil.getInstance().onEvent(this.mContext, "AssistiveDeviceSelectActivity", map);
    }

    @Override
    public void onResponseBefore(NewHYTask task) {
    }

    @Override
    public void onResponseAfter(NewHYTask task) {
    }

    @Override
    public void onResponseSuccessful(NewHYTask task, BaseResult object) {
    }

    @Override
    public void onResponseError(NewHYTask task, BaseResult object) {
    }

    @Override
    public void onServerError(NewHYTask task, int failedType) {
    }

    @Override
    public void initViews() {
        TitleView title = (TitleView) findViewById(R.id.titleview);
        title.setOnTitleClik(null, null);
        this.leftView = (RecyclerView) findViewById(R.id.rv_left);
        this.rightView = (RecyclerView) findViewById(R.id.rv_right);
        LinearLayoutManager manager = new LinearLayoutManager(this, 1, false);
        LinearLayoutManager manager2 = new LinearLayoutManager(this, 1, false);
        this.leftView.setLayoutManager(manager);
        this.rightView.setLayoutManager(manager2);
    }

    private void initRecycleView() {
        int i = 2130968718;
        this.leftDataList = new ArrayList();
        this.rightDataList = new ArrayList();
        if (this.assistiveDeviceListBean != null) {
            this.leftDataList.addAll(this.assistiveDeviceListBean.fujumulu);
            this.leftAdapter = new CommonAdapter<DictionaryBean>(this, i, this.leftDataList) {
                @Override
                public void convert(ViewHolder holder, DictionaryBean dictionaryBean, int position) {
                    holder.setText(2131689891, dictionaryBean.getLabel());
                }
            };
            this.rightAdapter = new CommonAdapter<AssistiveMuLuBean>(this, i, this.rightDataList) {
                @Override
                public void convert(ViewHolder holder, AssistiveMuLuBean assistiveMuLuBean, int position) {
                    holder.setText(2131689891, assistiveMuLuBean.name);
                }
            };
            this.leftAdapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() {
                @Override
                public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) {
                    AssistiveDeviceSelectActivity.this.assistiveDeviceBean = new AssistiveDeviceBean(Parcel.obtain());
                    AssistiveDeviceSelectActivity.this.assistiveDeviceBean.setpName(((DictionaryBean) AssistiveDeviceSelectActivity.this.leftDataList.get(position)).getLabel());
                    AssistiveDeviceSelectActivity.this.assistiveDeviceBean.setPid(((DictionaryBean) AssistiveDeviceSelectActivity.this.leftDataList.get(position)).getValue());
                    AssistiveDeviceSelectActivity.this.rightDataList.clear();
                    AssistiveDeviceSelectActivity.this.rightDataList.addAll(AssistiveDeviceSelectActivity.this.getRightList(((DictionaryBean) AssistiveDeviceSelectActivity.this.leftDataList.get(position)).getValue()));
                    AssistiveDeviceSelectActivity.this.rightAdapter.notifyDataSetChanged();
                }

                @Override
                public boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position) {
                    return false;
                }
            });
            this.rightAdapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() {
                @Override
                public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) {
                    Intent intent = new Intent();
                    AssistiveDeviceSelectActivity.this.assistiveDeviceBean.setName(((AssistiveMuLuBean) AssistiveDeviceSelectActivity.this.rightDataList.get(position)).name);
                    AssistiveDeviceSelectActivity.this.assistiveDeviceBean.setAid(((AssistiveMuLuBean) AssistiveDeviceSelectActivity.this.rightDataList.get(position)).id);
                    AssistiveDeviceSelectActivity.this.assistiveDeviceBean.setTopPrice(((AssistiveMuLuBean) AssistiveDeviceSelectActivity.this.rightDataList.get(position)).fixedPrice);
                    AssistiveDeviceSelectActivity.this.assistiveDeviceBean.setId("");
                    AssistiveDeviceSelectActivity.this.assistiveDeviceBean.setDelFlag("0");
                    AssistiveDeviceSelectActivity.this.assistiveDeviceBean.isAdd = false;
                    intent.putExtra("assistiveDeviceBean", AssistiveDeviceSelectActivity.this.assistiveDeviceBean);
                    AssistiveDeviceSelectActivity.this.setResult(-1, intent);
                    AssistiveDeviceSelectActivity.this.finish();
                }

                @Override
                public boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position) {
                    return false;
                }
            });
            this.leftView.setAdapter(this.leftAdapter);
            this.rightView.setAdapter(this.rightAdapter);
        }
    }

    @Override
    public void setListener() {
    }

    public List<AssistiveMuLuBean> getRightList(String value) {
        List<AssistiveMuLuBean> rightList = new ArrayList<>();
        Integer valueInt = Integer.valueOf(value);
        if (this.assistiveDeviceListBean.fujuleibie != null && this.assistiveDeviceListBean.fujuleibie.size() > 0) {
            for (AssistiveMuLuBean assistiveMuLuBean : this.assistiveDeviceListBean.fujuleibie) {
                if (valueInt.intValue() == assistiveMuLuBean.typeId) {
                    rightList.add(assistiveMuLuBean);
                }
            }
        }
        return rightList;
    }
}