Ejemplo n.º 1
0
  @Override
  public void initBusiness() {
    TitleBar bar = new TitleBar(activity).setTitle("宝宝辅食");
    bar.iv_back.setVisibility(View.VISIBLE);
    bar.iv_back.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            //                WebBackForwardList hisList = web_view.copyBackForwardList();
            //                if (hisList.getSize() == 1) {
            //                    finish();
            //                } else if (web_view.canGoBack()) {
            //                    web_view.goBack();
            //                } else {
            //                    finish();
            //                }

            finish();
          }
        });
    web_view.getSettings().setJavaScriptEnabled(true);

    web_view.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
    web_view.setScrollContainer(true);
    web_view.setWebChromeClient(new WebChromeClient());
    web_view.getSettings().setJavaScriptEnabled(true);
    if (AppUtils.checkNet(activity)) {
      web_view.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    } else {
      web_view.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    }
    web_view.setWebViewClient(new WebViewClient() {});

    web_view.loadUrl(Const.BABY_FOODS);
  }
Ejemplo n.º 2
0
  @Override
  protected void setListener() {

    EventBus.getDefault().register(this);
    adapter = new CircleAdapter(activity, new ArrayList<CircleVo.ItemCircle>());
    list_circle.addFooter(adapter);
    list_circle.setAdapter(adapter);

    list_circle.setRefreshHeaderMode(list_circle.MODE_CLASSICDEFAULT_HEADER);
    list_circle.setLayoutManager(new LinearLayoutManager(activity));
    list_circle.setOnLoadMoreListener(
        new UltimateRecyclerView.OnLoadMoreListener() {
          @Override
          public void loadMore(int i, int i1) {
            if (list_circle.canLoadMore()) {
              query(false);
            }
          }
        });
    list_circle.setOnCustomRefreshListener(
        new CustomRecyclerView.OnCustomRefreshListener() {
          @Override
          public void OnCustomRefresh(PtrFrameLayout frame) {
            pageNum = 1;
            query(false);
          }
        });

    View header = activity.makeView(R.layout.view_circle_header);
    ll_label = (LinearLayout) header.findViewById(R.id.ll_label);
    RelativeLayout rl_more_tag = (RelativeLayout) header.findViewById(R.id.rl_more_tag);
    rl_more_tag.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            activity.skip(MoreTagsActivity.class);
          }
        });

    LinearLayout.LayoutParams lp =
        new LinearLayout.LayoutParams(
            AppUtils.getWidth(activity) + 10, LinearLayout.LayoutParams.WRAP_CONTENT);
    header.setLayoutParams(lp);
    lp.rightMargin = -5;
    UltimateRecyclerView.CustomRelativeWrapper wrapper =
        new UltimateRecyclerView.CustomRelativeWrapper(activity);
    wrapper.addView(header);
    adapter.setCustomHeaderView(wrapper);

    query(true);
  }
Ejemplo n.º 3
0
  @Override
  public void initBusiness() {
    type = (String) getVo("0");
    startBaiduLocation();
    int width = (AppUtils.getWidth(activity) - 80) / 3;
    View view = makeView(R.layout.item_photo);
    ImageView iv_image = (ImageView) view.findViewById(R.id.iv_image);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(width, width);
    lp.leftMargin = 18;
    view.setLayoutParams(lp);

    iv_image.setImageResource(R.drawable.icon_addzhaopian);
    view.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            GalleryConfig.Builder builder = new GalleryConfig.Builder(activity);
            builder.imageloader(new GlideImageLoader());
            builder.singleSelect();
            builder.enableEdit();
            builder.enableRotate();
            builder.showCamera();
            GalleryConfig config = builder.build();
            GalleryFinal.open(config);
          }
        });
    fl_pics.addView(view);
    if ("0".equals(type)) {
      tv_label.setTag(R.id.tag_first, "1");
      rl_label.setVisibility(View.GONE);
    } else if ("1".equals(type)) {
      tv_label.setTag(R.id.tag_first, "3");
      rl_label.setVisibility(View.GONE);
      tb_notify.setChecked(false);
    } else {
      rl_time.setVisibility(View.GONE);
    }
  }
Ejemplo n.º 4
0
  /** 显示label的popupwindow */
  private void showLabel() {
    if (Utils.isEmpty(tags)) {
      queryLabel();
      return;
    } else {
      //            if(type.equals("0")){
      //                CircleTagVo tag1 = new CircleTagVo();
      //                tag1.setTitle("普通日记");
      //                tag1.setType("1");
      //            }else if(type.equals("1")){
      //                CircleTagVo tag3 = new CircleTagVo();
      //                tag3.setTitle("疾病记录");
      //                tag3.setType("3");
      //            }
      //            CircleTagVo tag1 = new CircleTagVo();
      //            tag1.setTitle("普通日记");
      //            tag1.setType("1");
      //            CircleTagVo tag3 = new CircleTagVo();
      //            tag3.setTitle("疾病记录");
      //            tag3.setType("3");
      //            tags.add(tag1);
      //            tags.add(tag3);
    }

    if (popupView == null) {
      popupView = makeView(R.layout.pupopwindow_selectlabel);
      Rect rect = new Rect();
      this.getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
      int statusBarHeight = rect.top;
      popupWindow =
          new PopupWindow(
              popupView,
              WindowManager.LayoutParams.MATCH_PARENT,
              AppUtils.getHeight(activity) - statusBarHeight);
      LinearLayout window = (LinearLayout) popupView.findViewById(R.id.ll_top);
      LinearLayout content = (LinearLayout) popupView.findViewById(R.id.ll_bottom);
      TextView tv_cancel = (TextView) popupView.findViewById(R.id.tv_cancel);
      TextView tv_submit = (TextView) popupView.findViewById(R.id.tv_submit);
      GridViewPage gridViewPage = (GridViewPage) popupView.findViewById(R.id.viewpage_label);

      // 载入数据到gridViewPage中
      loadDataToGridViewPage(gridViewPage, tags);

      tv_cancel.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
              popupWindow.dismiss();
            }
          });
      tv_submit.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
              tv_label.setText(tags.get(selectLabelIndex).getTitle());
              if (Utils.isEmpty(tags.get(selectLabelIndex).getId())) {
                tv_label.setTag(R.id.tag_first, tags.get(selectLabelIndex).getType());
              } else {
                tv_label.setTag(R.id.tag_two, tags.get(selectLabelIndex).getId());
              }
              popupWindow.dismiss();
            }
          });

      window.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
              popupWindow.dismiss();
            }
          });
      content.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {}
          });
    }
    if (popupWindow.isShowing()) {
      popupWindow.dismiss();
    } else {
      popupWindow.showAtLocation(ll_publish, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
    }
  }