导航菜单

页面标题

页面副标题

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

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

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


package com.example.baidumap;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.baidu.mapapi.search.route.TransitRouteLine;
import java.util.List;

public class LinesShowActivity extends Activity {
    private List<TransitRouteLine.TransitStep> allStep;
    private TextView back;
    private ListView listView;
    private MyListAdapter myListAdapter;
    private TextView title;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_lines_show);
        TransitRouteLine lines = (TransitRouteLine) getIntent().getParcelableExtra("lines");
        this.allStep = lines.getAllStep();
        initViews();
    }

    public void initViews() {
        this.listView = (ListView) findViewById(R.id.lv_list_show);
        this.myListAdapter = new MyListAdapter();
        this.listView.setAdapter((ListAdapter) this.myListAdapter);
        this.back = (TextView) findViewById(R.id.tv_titleview_back);
        this.title = (TextView) findViewById(R.id.tv_titleview_toptitle);
        setListeners();
    }

    private void setListeners() {
        this.back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                LinesShowActivity.this.finish();
            }
        });
        this.title.setText("线路详情");
    }

    public class MyListAdapter extends BaseAdapter {
        public MyListAdapter() {
        }

        @Override
        public int getCount() {
            return LinesShowActivity.this.allStep.size();
        }

        @Override
        public Object getItem(int position) {
            return LinesShowActivity.this.allStep.get(position);
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            Viewholder viewholder;
            if (convertView == null) {
                convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_list_text_view, parent, false);
                viewholder = new Viewholder(convertView);
                convertView.setTag(viewholder);
            } else {
                viewholder = (Viewholder) convertView.getTag();
            }
            viewholder.tvContent.setText(((TransitRouteLine.TransitStep) LinesShowActivity.this.allStep.get(position)).getInstructions());
            return convertView;
        }

        class Viewholder {
            TextView tvContent;

            public Viewholder(View itemView) {
                this.tvContent = (TextView) itemView.findViewById(R.id.tv_content);
            }
        }
    }
}