예제 #1
0
  /* *
   * 广告栏显示
   * */
  private void AdvertiseLayout() {
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    View infoView;
    if (EatParams.getInstance().getSession().length() > 0) { // 登录状态
      infoView = mLayoutInflater.inflate(R.layout.pernsoninfo, null);
      ImageView hicon = (ImageView) infoView.findViewById(R.id.headIcom);
      if (personImage != null) {
        hicon.setImageBitmap(personImage);
      }
      hicon.setOnClickListener(clickListener);

      ImageView ivedit = (ImageView) infoView.findViewById(R.id.user_edit);
      ivedit.setOnClickListener(clickListener);

      TextView name = (TextView) infoView.findViewById(R.id.usename);
      name.setText(EatParams.getInstance().getUsename());

      TextView addr = (TextView) infoView.findViewById(R.id.addr);
      addr.setText("地址:" + EatParams.getInstance().getAddr());
    } else { // 未登录状态
      infoView = mLayoutInflater.inflate(R.layout.adinfo_main, null);
      ImageView hicon = (ImageView) infoView.findViewById(R.id.headIcom);
      hicon.setOnClickListener(clickListener);

      TextView ivregister = (TextView) infoView.findViewById(R.id.nouser_register);
      ivregister.setOnClickListener(clickListener);

      TextView ivlogin = (TextView) infoView.findViewById(R.id.nouser_login);
      ivlogin.setOnClickListener(clickListener);
    }
    lltopView.addView(infoView, params);
  }
예제 #2
0
  // 定位之后显示页面内容
  private void initLayout() {
    // 初始化广告栏显示
    lltopView = (LinearLayout) findViewById(R.id.lltopView);
    lltopView.removeAllViews();

    // 界面显示
    mdrawer = (SlidingDrawer) findViewById(R.id.slidingdrawer);
    center = (TextView) findViewById(R.id.high_rise);

    AdvertiseLayout();

    // 当前地址
    String localpos = EatParams.getInstance().getGpsAddr();
    if (localpos == null || localpos.length() <= 0) {
      localpos = "未获取到您的位置";
    }
    center.setText(localpos);

    // 抽屉组件
    ListView sligv = (ListView) findViewById(R.id.SlidListView);
    sliAdapter = new SliListViewAdapter(MainActivity.this, helper.getApplyList());
    sligv.setAdapter(sliAdapter);
    sligv.setOnItemClickListener(itemClickListener);

    // 切换位置
    Button changCity = (Button) findViewById(R.id.shop_top_right);
    changCity.setOnClickListener(clickListener);

    drawerlistener(); // 抽屉响应事件

    dataLoad = new DataLoading();
    mScrollLayout = (ScrollLayout) findViewById(R.id.ScrollLayoutTest);

    initial();
  }