Ejemplo n.º 1
0
        public void handleMessage(android.os.Message msg) {
          switch (msg.what) {
            case 0:
              gridItemEntity gie = (gridItemEntity) msg.obj;
              if (gie != null) {

                int num = displayHeight / itemh;
                num = num == 0 ? 1 : num;

                LinearLayout ll;
                if ((currentCount - 1) % num > 0) {
                  ll = (LinearLayout) data.findViewWithTag("columnId_" + currentConlumID);
                } else {
                  ll = (LinearLayout) mInflater.inflate(R.layout.item_column, null);
                  currentConlumID--;
                  ll.setTag("columnId_" + currentConlumID);
                  for (int j = 0; j < num; j++) {
                    LinearLayout child = new LinearLayout(GridImageView.this);
                    child.setLayoutParams(new LayoutParams(itemw, itemh));
                    child.setTag("item_" + j);
                    ll.addView(child);
                  }
                  data.addView(ll);
                }

                int step = currentCount % num - 1;
                if (step == -1) {
                  step = num - 1;
                }
                LinearLayout child = (LinearLayout) ll.findViewWithTag("item_" + step);
                // child.setBackgroundColor(R.color.bright_text_dark_focused);
                child.setBackgroundResource(R.drawable.grid_selector);
                child.setTag(gie);
                child.setOnClickListener(imageClick);
                child.setPadding(10, 10, 10, 10);
                //
                ImageView v = new ImageView(GridImageView.this);
                // v.setLayoutParams(new LayoutParams(itemw,itemh));
                v.setImageDrawable(gie.image);
                child.addView(v);
                currentCount++;
              }
              break;

            default:
              break;
          }
          //			removeMessages(msg.what);
        }
  public static WaitDialog showNormalWithHintProgress(Context mContext, String hint, boolean show) {
    LinearLayout ll = null;
    if (show) {
      ll = new LinearLayout(mContext);
      ll.setBackgroundColor(Color.TRANSPARENT);
      ll.setOrientation(LinearLayout.VERTICAL);

      ImageView iv = new ImageView(mContext);
      iv.setImageResource(R.drawable.spin_black_70);
      iv.setPadding(20, 20, 20, 20);
      ll.addView(
          iv,
          new LinearLayout.LayoutParams(
              ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
      ll.setTag(iv);

      TextView tv = new TextView(mContext);
      tv.setText(hint);
      ll.addView(
          tv,
          new LinearLayout.LayoutParams(
              ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

      ll.setGravity(Gravity.CENTER);
    } else ll = null;
    return showProgress(mContext, show, ll);
  }
Ejemplo n.º 3
0
  private LinearLayout getRowView(Item item) {
    LinearLayout wrapper = new LinearLayout(getContext());
    LinearLayout rowLayout = new LinearLayout(getContext());

    int textStyle = item.hasShortDesc() ? Typeface.BOLD : Typeface.NORMAL;
    TextView textView = util.createTamilTextView(0xFF000000, 18, textStyle);
    textView.setText(item.getText());
    textView.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 1));
    rowLayout.addView(textView);

    if (!item.getChildren().isEmpty()) {
      TextView arrow = util.createTamilTextView(0xFF000000, 18, Typeface.NORMAL);
      arrow.setText(">");
      rowLayout.addView(arrow);
      wrapper.setOnClickListener(getClickListener());
      wrapper.setOnTouchListener(getHighlightListener());
    }

    wrapper.setOrientation(LinearLayout.VERTICAL);
    setRowStyle(wrapper);
    wrapper.setTag(item);
    wrapper.addView(rowLayout);

    if (item.hasShortDesc()) {
      TextView desc = util.createTamilTextView(0xFF000000, 14, Typeface.NORMAL);
      desc.setText(item.getShortDesc());
      wrapper.addView(desc);
    }

    return wrapper;
  }
Ejemplo n.º 4
0
 @Override
 public void httpUpdate(String response) {
   if (feedDatas == null) feedDatas = new ArrayList<>();
   feedDatas.clear();
   try {
     JSONArray jsonArray = new JSONArray(response);
     for (int i = 0; i < jsonArray.length(); i++) {
       JSONObject jsonObject = (JSONObject) jsonArray.get(i);
       TaskData taskData =
           ProjectManager.getInstance().getTaskData(String.valueOf(jsonObject.get("task")));
       UserData userData =
           ProjectManager.getInstance().getUserData(String.valueOf(jsonObject.get("user")));
       String id = String.valueOf(jsonObject.get("id"));
       String summary = (String) jsonObject.get("summary");
       FeedData feedData = new FeedData(taskData, userData, id, summary);
       feedDatas.add(feedData);
     }
   } catch (JSONException e) {
     e.printStackTrace();
   }
   LinearLayout feed_layout = (LinearLayout) res_layout.findViewById(R.id.feed_layout);
   feed_layout.removeAllViews();
   for (FeedData feedData : feedDatas) {
     FeedView feedView = new FeedView(context, feedData);
     LinearLayout new_layout = feedView.getLayout(feed_layout);
     new_layout.setTag(feedView);
     feed_layout.addView(new_layout);
   }
 }
Ejemplo n.º 5
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      LinearLayout ll;
      SpinnerRes res = getItem(position);
      if (convertView == null) {
        ll = new LinearLayout(context);
        ll.setOnClickListener(spinner);

        View v = createItemView(_layoutInflater, position, null, parent, res);
        if (v != null) {
          ll.addView(v);
        }
      } else {
        ll = (LinearLayout) convertView;
        createItemView(_layoutInflater, position, ll.getChildAt(0), parent, res);
      }
      ll.setId(ITEM_ID);
      ll.setTag(position + "");

      if (getItem(position).isDefSelected()) {
        ll.setBackgroundResource(selectedBackground);
        selectedIndex = position;
        spinner.setText(getItem(position).getValue());
      } else {
        ll.setBackgroundResource(childBackground);
      }
      return ll;
    }
Ejemplo n.º 6
0
  public StickerAdapter(Context context, EmojiKeyboard keyboard, final ScrollTo scrollTo) {
    super(context);
    this.context = context;
    this.keyboard = keyboard;
    if (stickersCache == null) {
      stickersCache = new HashMap<Long, StickerView>();
    }
    this.scrollTo = scrollTo;

    // Build sticker lines
    stickerIndicatorContainer = keyboard.getStickerIndicatorContainer();
    stickerIndicatorContainer.setTag(TAG_KEY, 0);

    stickerInLine = (Screen.getWidth() / STICKER_SIZE);
    leftPadding = (Screen.getWidth() - (stickerInLine * STICKER_SIZE)) / 2;

    packFirstLineMap = new HashMap<Integer, Integer>();

    stickerSwitchLp = new LinearLayout.LayoutParams(Screen.dp(48), Screen.dp(48));
    padding = Screen.dp(8);

    packs = messenger().getOwnStickerPacks();

    ((BaseActivity) context)
        .bind(
            packs,
            new ValueChangedListener<ArrayList<StickerPackVM>>() {
              @Override
              public void onChanged(
                  ArrayList<StickerPackVM> val, Value<ArrayList<StickerPackVM>> valueModel) {
                buildStickerLines(scrollTo);
                notifyDataSetChanged();
              }
            });
  }
Ejemplo n.º 7
0
  public void initModifications(Modification[] modifications) {
    this.modifications = modifications;
    LayoutInflater inflater =
        (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.modification_menu, null);
    LinearLayout rootPopupView = (LinearLayout) view.findViewById(R.id.modification_root_layout);
    int size = modifications.length;
    Stream.of(modifications)
        .forEach(
            modification -> {
              LinearLayout headerLayout =
                  (LinearLayout) inflater.inflate(R.layout.modification_item, null);
              headerLayout.setTag(modification.id);
              TextView headerText = (TextView) headerLayout.findViewById(R.id.modification_title);
              headerText.setText(modification.title);
              TextView valueText = (TextView) headerLayout.findViewById(R.id.modification_value);
              valueText.setText(modification.getDefaultTitle());
              rootPopupView.addView(headerLayout);

              headerLayout.setOnClickListener(
                  e -> {
                    initDialog(modification);
                  });
            });

    if (size > 0) {
      setDividerGone(view, modifications[size - 1]);
    }

    this.addView(view);
  }
Ejemplo n.º 8
0
  public void addCrumb(@NonNull Crumb crumb, boolean refreshLayout) {
    LinearLayout view =
        (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.bread_crumb, this, false);
    view.setTag(mCrumbs.size());
    view.setOnClickListener(this);

    ImageView iv = (ImageView) view.getChildAt(1);
    Drawable arrow = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_right_arrow, null);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      assert arrow != null;
      arrow.setAutoMirrored(true);
    }

    iv.setImageDrawable(arrow);
    iv.setVisibility(View.GONE);

    mChildFrame.addView(
        view,
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mCrumbs.add(crumb);
    if (refreshLayout) {
      mActive = mCrumbs.size() - 1;
      requestLayout();
    }
    invalidateActivatedAll();
  }
Ejemplo n.º 9
0
 public static LinearLayout createMethodView(
     String text, GlobReply entry, LayoutInflater inflater) {
   LinearLayout methodView = (LinearLayout) inflater.inflate(R.layout.method_item, null);
   methodView.setTag(entry);
   ((TextView) methodView.findViewById(R.id.name)).setText(text);
   return methodView;
 }
Ejemplo n.º 10
0
    @Override
    public void bind(StickerLine data, int position, Context context) {
      ll.removeAllViews();
      ll.setTag(TAG_KEY, data.getPackCount());
      for (final Sticker s : data.getLine()) {
        StickerView sv;
        if (s != null && s.getFileReference256() != null) {

          sv = stickersCache.get(s.getFileReference128().getFileId());
          if (sv == null) {
            sv = new StickerView(context);
            sv.setPadding(STICKER_PADDING, STICKER_PADDING, STICKER_PADDING, STICKER_PADDING);
            sv.bind(s.getFileReference128(), STICKER_SIZE);
            stickersCache.put(s.getFileReference128().getFileId(), sv);

          } else if (sv.isLoaded()) {
            if (sv.getParent() != null) {
              ((LinearLayout) sv.getParent()).removeView(sv);
            }
            sv.shortenFade();
          }

          sv.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                  keyboard.onStickerClicked(s);
                }
              });
          ll.addView(sv, stikerlp);
        }
      }
    }
Ejemplo n.º 11
0
 public static LinearLayout createObjectView(
     String text, GlobReply entry, LayoutInflater inflater) {
   LinearLayout objView = (LinearLayout) inflater.inflate(R.layout.object_item, null);
   objView.setTag(entry);
   ((TextView) objView.findViewById(R.id.name)).setText(text);
   updateObjectView(objView, false);
   return objView;
 }
Ejemplo n.º 12
0
 public static LinearLayout createDirectoryView(
     String text, GlobReply entry, LayoutInflater inflater) {
   LinearLayout dirView = (LinearLayout) inflater.inflate(R.layout.directory_item, null);
   dirView.setTag(entry);
   ((TextView) dirView.findViewById(R.id.name)).setText(text);
   updateDirectoryView(dirView, false);
   return dirView;
 }
Ejemplo n.º 13
0
  public DropDownMenu(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    setOrientation(VERTICAL);

    // 为DropDownMenu添加自定义属性
    int menuBackgroundColor = 0xffffffff;
    int underlineColor = 0xffcccccc;
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DropDownMenu);
    underlineColor = a.getColor(R.styleable.DropDownMenu_ddunderlineColor, underlineColor);
    dividerColor = a.getColor(R.styleable.DropDownMenu_dddividerColor, dividerColor);
    textSelectedColor = a.getColor(R.styleable.DropDownMenu_ddtextSelectedColor, textSelectedColor);
    textUnselectedColor =
        a.getColor(R.styleable.DropDownMenu_ddtextUnselectedColor, textUnselectedColor);
    menuBackgroundColor =
        a.getColor(R.styleable.DropDownMenu_ddmenuBackgroundColor, menuBackgroundColor);
    maskColor = a.getColor(R.styleable.DropDownMenu_ddmaskColor, maskColor);
    menuTextSize = a.getDimensionPixelSize(R.styleable.DropDownMenu_ddmenuTextSize, menuTextSize);
    menuSelectedIcon =
        a.getResourceId(R.styleable.DropDownMenu_ddmenuSelectedIcon, menuSelectedIcon);
    menuUnselectedIcon =
        a.getResourceId(R.styleable.DropDownMenu_ddmenuUnselectedIcon, menuUnselectedIcon);
    stickyTag = a.getString(R.styleable.DropDownMenu_ddmenuTag);
    a.recycle();

    //        setTag(stickyTag);
    // 初始化tabMenuView并添加到tabMenuView
    tabMenuView = new LinearLayout(context);

    if (!TextUtils.isEmpty(stickyTag)) {
      tabMenuView.setTag(stickyTag);
    }
    LayoutParams params =
        new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    tabMenuView.setOrientation(HORIZONTAL);
    tabMenuView.setBackgroundColor(menuBackgroundColor);
    tabMenuView.setLayoutParams(params);
    addView(tabMenuView, 0);

    // 为tabMenuView添加下划线
    View underLine = new View(getContext());
    underLine.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dpTpPx(1.0f)));
    underLine.setBackgroundColor(underlineColor);
    addView(underLine, 1);

    // 初始化containerView并将其添加到DropDownMenu
    containerView = new FrameLayout(context);
    //        containerView.setTag(stickyTag);
    FrameLayout.LayoutParams params1 =
        new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
    //        params1.height = 1000;
    containerView.setLayoutParams(params1);
    //        containerView.setBackgroundDrawable(new ColorDrawable(Color.RED));

    addView(containerView, 2);
  }
Ejemplo n.º 14
0
 @Override
 public View newView(LayoutInflater inflater, ViewGroup parent) {
   ViewHolder holder = new ViewHolder();
   LinearLayout rootView = new LinearLayout(mContext);
   rootView.setOrientation(LinearLayout.VERTICAL);
   holder.interest = rootView;
   rootView.setTag(holder);
   return rootView;
 }
Ejemplo n.º 15
0
 public void onScroll(View view) {
   if (view != null) {
     if (stickerIndicatorContainer.getTag(TAG_KEY) != null
         && !stickerIndicatorContainer.getTag(TAG_KEY).equals(view.getTag(TAG_KEY))) {
       stickerIndicatorContainer.setTag(TAG_KEY, view.getTag(TAG_KEY));
       position = view.getTag(TAG_KEY);
       selectCurrentPack((Integer) position);
     }
   }
 }
Ejemplo n.º 16
0
 @Override
 protected View newGroupView(
     Context context, Cursor cursor, boolean isExpanded, ViewGroup parent) {
   // TODO Auto-generated method stub
   LinearLayout rlayout =
       (LinearLayout) D.curStyle.inflater.inflate(R.layout.mail_list_group_item, parent, false);
   MailListGroupItem groupItem = new MailListGroupItem(rlayout);
   rlayout.setTag(R.string.tag_item_object, groupItem);
   return rlayout;
 }
Ejemplo n.º 17
0
  /**
   * 绘制线条框架
   *
   * <p>绘制日历,没有数据
   *
   * @param oneCalendar 日历(一个LinearLayout的container)
   */
  private void drawFrame(LinearLayout oneCalendar) {
    // 初始化cells,用于记录格子
    cells = new RelativeLayout[ROWS_TOTAL][COLS_TOTAL];

    // 添加日历布局
    LinearLayout content =
        createLinearLayout(LinearLayout.VERTICAL, LayoutParams.MATCH_PARENT, 0, 7f); // 宽度充满,高度0,权重7
    drawRow(content); // 画行
    oneCalendar.addView(content);
    oneCalendar.setTag(cells);
  }
Ejemplo n.º 18
0
 private LinearLayout loadingFooter() {
   LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(35, 35);
   ProgressBar pb = new ProgressBar(getContext());
   pb.setIndeterminateDrawable(getContext().getResources().getDrawable(R.drawable.progress));
   pb.setLayoutParams(params);
   LinearLayout loading = new LinearLayout(currentContext);
   loading.addView(pb);
   loading.setPadding(0, 10, 0, 10);
   loading.setGravity(Gravity.CENTER);
   loading.setTag(2000);
   return loading;
 }
Ejemplo n.º 19
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    CommentMyListItem commentMyListItem = null;
    if (convertView == null) {
      commentMyListItem = new CommentMyListItem();
      convertView = this.inflater.inflate(R.layout.comment_my_list, null);
      commentMyListItem.userheader = (ImageView) convertView.findViewById(R.id.user_comment_header);
      commentMyListItem.username = (TextView) convertView.findViewById(R.id.user_name);
      commentMyListItem.time = (TextView) convertView.findViewById(R.id.comment_ctime);
      commentMyListItem.content = (TextView) convertView.findViewById(R.id.comment_content);
      commentMyListItem.myComment = (TextView) convertView.findViewById(R.id.comment_receive_me);
      convertView.setTag(commentMyListItem);
    } else {
      commentMyListItem = (CommentMyListItem) convertView.getTag();
    }
    LinearLayout layout = (LinearLayout) convertView.findViewById(R.id.weibo_data);
    // this.loadingHeader(position, commentMyListItem.userheader);
    ReceiveComment comment = this.getItem(position);

    // mHeadImageFetcher.loadImage(comment.getHeadUrl(), commentMyListItem.userheader);
    mNetComTools.loadNetImage(
        commentMyListItem.userheader,
        comment.getHeadUrl(),
        R.drawable.header,
        mHeadImageSize,
        mHeadImageSize);
    layout.setTag(comment.getStatus());
    commentMyListItem.username.setText(comment.getUname());
    try {
      commentMyListItem.time.setText(TimeHelper.friendlyTimeFromeStringTime(comment.getcTime()));
      System.out.println(" ctime" + comment.getcTime());
    } catch (Exception e) {
      commentMyListItem.time.setText(comment.getcTime());
    }
    SpannableString ss = new SpannableString(SociaxUIUtils.filterHtml(comment.getContent()));
    SociaxUIUtils.highlightContent(mContext, ss);
    commentMyListItem.content.setText(ss);

    if (comment.isNullForReplyComment()) {
      SpannableString ss1 =
          new SpannableString(
              "回复我的微博:" + SociaxUIUtils.filterHtml(comment.getStatus().getContent()));
      SociaxUIUtils.highlightContent(mContext, ss1);
      commentMyListItem.myComment.setText(ss1);
    } else {
      SpannableString ss2 =
          new SpannableString(
              "回复我的评论:" + SociaxUIUtils.filterHtml(comment.getReplyComment().getContent()));
      SociaxUIUtils.highlightContent(mContext, ss2);
      commentMyListItem.myComment.setText(ss2);
    }
    return convertView;
  }
Ejemplo n.º 20
0
 @Override
 protected View newChildView(
     Context context, Cursor cursor, boolean isLastChild, ViewGroup parent) {
   // TODO Auto-generated method stub
   LinearLayout rlayout =
       (LinearLayout)
           D.curStyle.inflater.inflate(R.layout.contact_list_item_child, parent, false);
   ContactItemLLayout childItem = new ContactItemLLayout(rlayout);
   childItem.cbox.setOnCheckedChangeListener(MailContactActivity.this);
   rlayout.setTag(R.string.tag_item_object, childItem);
   return rlayout;
 }
Ejemplo n.º 21
0
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewWrapper wrap = null;
    View row = convertView;

    if (convertView == null) {
      LinearLayout layout = new LinearLayout(ctxt);
      RatingBar rate = new RatingBar(ctxt);

      rate.setNumStars(3);
      rate.setStepSize(1.0f);

      View guts = delegate.getView(position, null, parent);

      layout.setOrientation(LinearLayout.HORIZONTAL);

      rate.setLayoutParams(
          new LinearLayout.LayoutParams(
              LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.FILL_PARENT));
      guts.setLayoutParams(
          new LinearLayout.LayoutParams(
              LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT));

      RatingBar.OnRatingBarChangeListener l =
          new RatingBar.OnRatingBarChangeListener() {
            public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromTouch) {
              rates[(Integer) ratingBar.getTag()] = rating;
            }
          };

      rate.setOnRatingBarChangeListener(l);

      layout.addView(rate);
      layout.addView(guts);

      wrap = new ViewWrapper(layout);
      wrap.setGuts(guts);
      layout.setTag(wrap);

      rate.setTag(new Integer(position));
      rate.setRating(rates[position]);

      row = layout;
    } else {
      wrap = (ViewWrapper) convertView.getTag();
      wrap.setGuts(delegate.getView(position, wrap.getGuts(), parent));
      wrap.getRatingBar().setTag(new Integer(position));
      wrap.getRatingBar().setRating(rates[position]);
    }

    return (row);
  }
    /** 传入数据未定 */
    public void setData(int position) {
      if (shareList.get(position).coverUrl != null
          && !TextUtils.isEmpty(shareList.get(position).coverUrl))
        Picasso.with(mcontext)
            .load(shareList.get(position).coverUrl)
            .placeholder(R.drawable.img_default)
            .into(iv_cover);
      else iv_cover.setImageResource(R.drawable.img_default);
      tv_coverNum.setText(shareList.get(position).totalPageNumber + "");
      tv_coverTitle.setText(shareList.get(position).title);
      tv_coverTime.setText(shareList.get(position).getDateDescription() + "");
      tv_praise.setText(shareList.get(position).praiseNum + "");
      tv_evaluate.setText(shareList.get(position).commentNum + "");

      iv_cover.setTag(position);
      tv_coverTitle.setTag(position);
      ll_praise.setTag(position);
      ll_evaluate.setTag(position);
      iv_cover.setOnClickListener(PersonDisplayAdapter.this);
      tv_coverTitle.setOnClickListener(PersonDisplayAdapter.this);
      ll_praise.setOnClickListener(PersonDisplayAdapter.this);
      ll_evaluate.setOnClickListener(PersonDisplayAdapter.this);
    }
Ejemplo n.º 23
0
  private void addItemView() {
    /*
     * 在addItemView()方法中调用日志输出方法:Log.i(String, String,
     * Throwable),可以在让程序在日志控制台中以栈的形式列出程序是怎么执行到该方法
     */
    Log.i(TAG, "How Go To Here", new Exception("Stack Way"));

    View itemView = mInflater.inflate(R.layout.dynamic_add_view_v_item, null);
    itemView.setId(mItemViewIndex);

    TextView textTitleIndex = (TextView) itemView.findViewById(R.id.dynamic_addView_title_index);
    textTitleIndex.setText(mActivity.getString(R.string.table_item_index, (mItemViewIndex + 1)));

    TextView btnDeleteView = (TextView) itemView.findViewById(R.id.dynamic_addView_delete_view);
    btnDeleteView.setTag(itemView);
    btnDeleteView.setOnClickListener(mClickListener);
    if (mItemViewIndex == 0) { // 第一个条目不显示删除按钮
      btnDeleteView.setVisibility(View.GONE);
    }

    LinearLayout beginTimeLayout = (LinearLayout) itemView.findViewById(R.id.begin_time_layout);
    beginTimeLayout.setOnClickListener(mClickListener);
    LinearLayout endTimeLayout = (LinearLayout) itemView.findViewById(R.id.end_time_layout);
    endTimeLayout.setOnClickListener(mClickListener);
    // 开始时间和结束时间相互设置Tag用于当初始化其中任何一个时,另一个跟着变化
    beginTimeLayout.setTag(endTimeLayout);
    endTimeLayout.setTag(beginTimeLayout);

    mDynamicContainer.addView(
        itemView,
        mItemViewIndex++,
        new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

    // 第一次添加ItemView后,若马上在此处获取ItemView的高度,则mItemViewHeight为零
    // mItemViewHeight = mDynamicContainer.getMeasuredHeight();
    // Log.i(TAG, "mItemViewHeight = " + mItemViewHeight);
  }
Ejemplo n.º 24
0
  private void displayCall(Resources resources, LinphoneCall call, int index) {
    String sipUri = call.getRemoteAddress().asStringUriOnly();
    LinphoneAddress lAddress;
    try {
      lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
    } catch (LinphoneCoreException e) {
      Log.e("Incall activity cannot parse remote address", e);
      lAddress =
          LinphoneCoreFactory.instance().createLinphoneAddress("uknown", "unknown", "unkonown");
    }

    // Control Row
    LinearLayout callView =
        (LinearLayout) inflater.inflate(R.layout.active_call_control_row, container, false);
    callView.setId(index + 1);
    setContactName(callView, lAddress, sipUri, resources);
    displayCallStatusIconAndReturnCallPaused(callView, call);
    setRowBackground(callView, index);
    registerCallDurationTimer(callView, call);
    callsList.addView(callView);

    // Image Row
    LinearLayout imageView =
        (LinearLayout) inflater.inflate(R.layout.active_call_image_row, container, false);
    Contact contact =
        ContactsManager.getInstance()
            .findContactWithAddress(imageView.getContext().getContentResolver(), lAddress);
    if (contact != null) {
      displayOrHideContactPicture(
          imageView, contact.getPhotoUri(), contact.getThumbnailUri(), false);
    } else {
      displayOrHideContactPicture(imageView, null, null, false);
    }
    callsList.addView(imageView);

    callView.setTag(imageView);
    callView.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            if (v.getTag() != null) {
              View imageView = (View) v.getTag();
              if (imageView.getVisibility() == View.VISIBLE) imageView.setVisibility(View.GONE);
              else imageView.setVisibility(View.VISIBLE);
              callsList.invalidate();
            }
          }
        });
  }
  private void deactivateDay(int index, LinearLayout dayLayout, boolean check) {
    weekDays[index] = false;

    dayLayout.setTag(false);

    dayLayout.setBackgroundResource(0);

    TextView dayText = (TextView) dayLayout.findViewById(R.id.day);
    int colour = ContextCompat.getColor(getBaseContext(), R.color.colorPrimary);
    dayText.setTextColor(colour);

    if (check) {
      checkDays();
    }
  }
Ejemplo n.º 26
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   // map to song layout
   LinearLayout songLay = (LinearLayout) songInf.inflate(R.layout.song, parent, false);
   // get title and artist views
   TextView songView = (TextView) songLay.findViewById(R.id.song_title);
   TextView artistView = (TextView) songLay.findViewById(R.id.song_artist);
   // get song using position
   Song currSong = songs.get(position);
   // get title and artist strings
   songView.setText(currSong.getTitle());
   artistView.setText(currSong.getArtist());
   // set position as tag
   songLay.setTag(position);
   return songLay;
 }
  private void activateDay(int index, LinearLayout dayLayout, boolean check) {
    weekDays[index] = true;

    dayLayout.setTag(true);

    Drawable bg =
        ContextCompat.getDrawable(
            getBaseContext(), ernestoyaquello.com.verticalstepperform.R.drawable.circle_step_done);
    int colorPrimary = ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary);
    bg.setColorFilter(new PorterDuffColorFilter(colorPrimary, PorterDuff.Mode.SRC_IN));
    dayLayout.setBackground(bg);

    TextView dayText = (TextView) dayLayout.findViewById(R.id.day);
    dayText.setTextColor(Color.rgb(255, 255, 255));

    if (check) {
      checkDays();
    }
  }
  public static WaitDialog showNormalProgress(Context mContext, boolean show) {
    LinearLayout linearLayout = null;
    if (show) {
      linearLayout = new LinearLayout(mContext);
      linearLayout.setBackgroundColor(Color.TRANSPARENT);
      linearLayout.setOrientation(LinearLayout.VERTICAL);

      ImageView iv = new ImageView(mContext);
      iv.setImageResource(R.drawable.spin_black_70);
      iv.setPadding(60, 60, 60, 60);
      linearLayout.addView(
          iv,
          new LinearLayout.LayoutParams(
              ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
      linearLayout.setTag(iv);
    } else {
      linearLayout = null;
    }
    return showProgress(mContext, show, linearLayout);
  }
  /**
   * Creates or finds a view.
   *
   * <p>The view includes an image, which is provided to the view from the <code>imageCache</code>.
   *
   * @param position the position in the <code>List<T></code>
   * @param convertView the view to be presented
   * @param parent the parent of the view to be presented
   * @return the view to be presented
   */
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    LinearLayout itemView;

    if (convertView == null) {
      itemView = new LinearLayout(context);
      String inflater = Context.LAYOUT_INFLATER_SERVICE;
      LayoutInflater li;
      li = (LayoutInflater) context.getSystemService(inflater);
      li.inflate(resource, itemView, true);

      LinearLayout.LayoutParams linearLayoutParams =
          new LinearLayout.LayoutParams(
              parent.getWidth() / ConstantsHelper.NUMBER_OF_COLUMNS_IN_GRID,
              parent.getWidth() / ConstantsHelper.NUMBER_OF_COLUMNS_IN_GRID);
      itemView.setLayoutParams(new GridView.LayoutParams(linearLayoutParams));
      itemView.setPadding(5, 5, 5, 5);
    } else {
      itemView = (LinearLayout) convertView;
    }

    Advertisement advertisement = getItem(position);

    itemView.setTag(advertisement.id);
    TextView titleView = (TextView) itemView.findViewById(R.id.advertisement_title);
    ImageView imageView = (ImageView) itemView.findViewById(R.id.advertisement_image);

    titleView.setText(advertisement.title);

    String imagePath = advertisement.url;

    if (imagePath.matches("^http.*")) imagePath = "http";

    Bitmap bitmap;
    synchronized (imageCache) {
      bitmap = imageCache.get(imagePath);
    }

    imageView.setImageBitmap(bitmap);
    return itemView;
  }
Ejemplo n.º 30
0
    private void init() {
      int dp_10 = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 10);
      int scrW = getResources().getDisplayMetrics().widthPixels;
      iconWidth = (scrW - dp_10 * 2) / 3 - dp_10 * 4;

      setOrientation(VERTICAL);

      int size = platforms == null ? 0 : platforms.length;
      int lineSize = size / 3;
      if (size % 3 > 0) {
        lineSize++;
      }
      LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
      lp.weight = 1;
      for (int i = 0; i < lines; i++) {
        LinearLayout llLine = new LinearLayout(getContext());
        llLine.setLayoutParams(lp);
        addView(llLine);

        if (i >= lineSize) {
          continue;
        }

        for (int j = 0; j < 3; j++) {
          final int index = i * 3 + j;
          if (index >= size) {
            LinearLayout llItem = new LinearLayout(getContext());
            llItem.setLayoutParams(lp);
            llLine.addView(llItem);
            continue;
          }

          final LinearLayout llItem = getView(index, getContext());
          llItem.setTag(platforms[index]);
          llItem.setOnClickListener(callback);
          llItem.setLayoutParams(lp);
          llLine.addView(llItem);
        }
      }
    }