显示数据(公告通知详细界面)

package com.avicsafety.dangerous_chemicals;

import java.util.ArrayList;
import java.util.List;

import org.xutils.x;
import org.xutils.http.RequestParams;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;

import com.avicsafety.conf.Constants;
import com.avicsafety.interfaces.OnSearchResultListener;
import com.avicsafety.lib.CustomView.AvicTextView;
import com.avicsafety.lib.tools.tools;
import com.avicsafety.model.M_LoginInfo;
import com.avicsafety.model.M_Notice;
import com.avicsafety.model.P_Whp_Sgal;
import com.avicsafety.service.Info_AccidentCaseManager;
import com.avicsafety.service.LoginManager;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

@ContentView(R.layout.activity_gonggaotwo)
public class GonggaoTowActivity extends BaseActivity {

    private String id;
    private String userName;// 用户名
    private String passWord;// 用户密码
    private Info_AccidentCaseManager accidentmanager;
    private OnSearchResultListener searchResultListener;// 访问服务器的监听事件

    @Override
    protected void InitializeComponent() {
        // TODO Auto-generated method stub
        super.InitializeComponent();
        this.setTitle("公告通知详细");
    }

    @Override
    protected void InitializeData() {
        // TODO Auto-generated method stub
        super.InitializeData();

        accidentmanager = new Info_AccidentCaseManager();

        //Intent接收上个界面传过来的数据
        Intent intent = getIntent();
        id = intent.getStringExtra("id");

        M_LoginInfo loginInfo = LoginManager.getLoginInfo();
        userName = loginInfo.getUserName();
        passWord = loginInfo.getPassword();
        // 设置网络访问的监听事件
        searchResultListener = new OnSearchResultListener() {
            // 请求网络数据成功
            @Override
            public void onSuccess(List list) {
                // 刷新页面
                progressDialog.dismiss();
                if (list != null && list.size() > 0) {
                    //获取成功后list有一条数据
                    M_Notice model = (M_Notice) list.get(0);
                    tv_notice_detail_context.setText(model.getContent());
                    atv_notice_detail_titile.setText(model.getTitle());
                    atv_notice_detail_time.setText(model.getCreated_at());
                }

            }

            // 请求网络数据失败
            @Override
            public void onFail(String promat) {
                // 提示访问失败
                progressDialog.dismiss();
                Toast.makeText(oThis, promat, Toast.LENGTH_SHORT).show();
            }
        };

        // 显示下载数据的时候的进度条的内容
        progressDialog.setMessage(getString(R.string.down_accident_list));
        progressDialog.show();
        // 设置请求网络的参数
        RequestParams rp = getParams(userName, passWord, "");
        // 发送请求获取服务器数据
        accidentmanager.Notic(rp);

    }

    @Override
    protected void InitializeEvent() {
        // TODO Auto-generated method stub
        super.InitializeEvent();
        accidentmanager.setOnSearchResultListener(searchResultListener);
    }

    // 设置请求服务器的参数
    private RequestParams getParams(String username, String password,
            String modelClass) {
        RequestParams rp = new RequestParams(Constants.NOTICE);
        // rp.setHeader("text/html;","charset=utf-8" );
        rp.setConnectTimeout(60000);
        rp.addQueryStringParameter("userName", username);
        rp.addQueryStringParameter("password", password);
        rp.addQueryStringParameter("classname", "Whp_ggtz");
        rp.addQueryStringParameter("pagesize", "20");
        rp.addQueryStringParameter("pageIndex", "1");
        rp.addQueryStringParameter("message_id", id);
        return rp;
    }

    @ViewInject(R.id.atv_notice_detail_titile)
    public AvicTextView atv_notice_detail_titile;

    @ViewInject(R.id.atv_notice_detail_time)
    public AvicTextView atv_notice_detail_time;

    @ViewInject(R.id.tv_notice_detail_context)
    public TextView tv_notice_detail_context;

    private M_Notice mn;

}
 

转载于:https://my.oschina.net/u/3213186/blog/822743

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值