Ejemplo n.º 1
0
 public void a(a parama, boolean paramBoolean) {
   LinearLayout localLinearLayout = (LinearLayout) g.a(b).inflate(2130903189, null);
   a(localLinearLayout, parama, a.size());
   a.add(parama);
   ESImageView localESImageView;
   if (((LinearLayout) c).getChildCount() != 0) {
     localESImageView = new ESImageView(b);
     localESImageView.setBackgroundResource(2130838205);
     if (paramBoolean) {
       ((LinearLayout) c).addView(localESImageView, new ViewGroup.LayoutParams(-1, 1));
     }
   } else {
     if (!paramBoolean) {
       break label174;
     }
     ((LinearLayout) c).addView(localLinearLayout);
   }
   for (; ; ) {
     localLinearLayout.setOnClickListener(new ip(this, localLinearLayout, parama));
     localLinearLayout.setOnLongClickListener(new iq(this, parama));
     localLinearLayout.setFocusable(true);
     return;
     ((LinearLayout) c).addView(localESImageView, 0, new ViewGroup.LayoutParams(-1, 1));
     break;
     label174:
     ((LinearLayout) c).addView(localLinearLayout, 0);
   }
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder;
    // for each string, inflate an enter_person_item then set the fields appropriately, then add it
    if (convertView == null) {
      viewHolder = new ViewHolder();
      LinearLayout linearLayout = new LinearLayout(cx);
      linearLayout.setOnLongClickListener(peopleListActivity);
      linearLayout.setOnClickListener(peopleListActivity);
      convertView = (LinearLayout) li.inflate(R.layout.list_person_item, linearLayout);
      TextView textView = (TextView) convertView.findViewById(R.id.textView1);
      textView.setWidth(nameTextViewWidth);
      Log.v("TeamLeader", "setting first Name text view width to: " + nameTextViewWidth);

      TextView lastNameTextView = (TextView) convertView.findViewById(R.id.textView2);
      lastNameTextView.setWidth(lastNameTextViewWidth);

      TextView cityTextView = (TextView) convertView.findViewById(R.id.textView3);
      cityTextView.setWidth(cityTextViewWidth);

      viewHolder.ll = (LinearLayout) convertView;
      viewHolder.nameTextView = textView;
      viewHolder.cityTextView = cityTextView;
      viewHolder.lastNameTextView = lastNameTextView;
      viewHolder.person = peopleList.get(position);
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }
    viewHolder.nameTextView.setText(peopleList.get(position).getName());
    viewHolder.lastNameTextView.setText(((Person) peopleList.get(position)).getSurname());
    viewHolder.cityTextView.setText(peopleList.get(position).getCity());
    return (convertView);
  }
Ejemplo n.º 3
0
  public LinearLayout getLayout(ViewGroup parent) {
    res_layout = (LinearLayout) layoutInflater.inflate(R.layout.task_layout, parent, false);

    TextView task_user = (TextView) res_layout.findViewById(R.id.task_user);
    task_user.setText(taskData.userData.name);

    TextView title_text = (TextView) res_layout.findViewById(R.id.title_text);
    title_text.setText(taskData.name);

    TextView dueDay_text = (TextView) res_layout.findViewById(R.id.dueDay_text);
    dueDay = getDueDay();
    if (dueDay > 0) {
      dueDay_text.setText("D-" + dueDay);
      if (dueDay < 10) {
        dueDay_text.setTextColor(Color.RED);
      }
    } else if (dueDay == 0) {
      dueDay_text.setText("오늘");
    } else {
      dueDay_text.setText("만료");
    }

    TextView task_summary = (TextView) res_layout.findViewById(R.id.task_summary);
    task_summary.setText(taskData.summary);

    final LinearLayout task_layout = (LinearLayout) res_layout.findViewById(R.id.task_layout);
    task_layout.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            MainActivity mainActivity = (MainActivity) context;
            if (!mainActivity.hideInsertLayout(res_layout)) {
              mainActivity.showInsertLayout(res_layout);
              requestFeedList();
            }
          }
        });
    task_layout.setOnLongClickListener(
        new View.OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
            ModifyTaskDialog modifyTaskDialog = new ModifyTaskDialog(context);
            modifyTaskDialog.show();
            return false;
          }
        });

    return res_layout;
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   final LinearLayout loginEntryView =
       (LinearLayout) getLayoutInflater().inflate(R.layout.renren_sdk_login_entry, null);
   loginEntryView.setOnClickListener(null);
   loginEntryView.setOnTouchListener(null);
   loginEntryView.setOnLongClickListener(null);
   loginEntryView.setOnKeyListener(null);
   ViewGroup.LayoutParams params =
       new ViewGroup.LayoutParams(
           ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
   addContentView(loginEntryView, params);
   initViews(loginEntryView);
 }
    @Override
    public View getView(final int position, View convertView, final ViewGroup parent) {
      ViewHolder holder = null;
      if (convertView == null) {
        holder = new ViewHolder();
        convertView = LayoutInflater.from(getContext()).inflate(res, null);
        holder.imageView = (ImageView) convertView.findViewById(RHelper.get("id.iv_avatar"));
        holder.textView = (TextView) convertView.findViewById(RHelper.get("id.tv_name"));
        holder.badgeDeleteView =
            (ImageView) convertView.findViewById(RHelper.get("id.badge_delete"));
        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }
      final LinearLayout button =
          (LinearLayout) convertView.findViewById(RHelper.get("id.button_avatar"));
      // 最后一个item,减人按钮
      if (position == getCount() - 1) {
        holder.textView.setText("");
        // 设置成删除按钮
        holder.imageView.setImageResource(RHelper.get("drawabledrawable.em_smiley_minus_btn"));
        //				button.setCompoundDrawablesWithIntrinsicBounds(0,
        // RHelper.get("drawabledrawable.smiley_minus_btn"), 0, 0);
        // 如果不是创建者或者没有相应权限,不提供加减人按钮
        if (!group.getOwner().equals(EMChatManager.getInstance().getCurrentUser())) {
          // if current user is not group admin, hide add/remove btn
          convertView.setVisibility(View.INVISIBLE);
        } else { // 显示删除按钮
          if (isInDeleteMode) {
            // 正处于删除模式下,隐藏删除按钮
            convertView.setVisibility(View.INVISIBLE);
          } else {
            // 正常模式
            convertView.setVisibility(View.VISIBLE);
            convertView.findViewById(RHelper.get("id.badge_delete")).setVisibility(View.INVISIBLE);
          }
          final String st10 =
              getResources().getString(RHelper.get("string.The_delete_button_is_clicked"));
          button.setOnClickListener(
              new OnClickListener() {
                @Override
                public void onClick(View v) {
                  EMLog.d(TAG, st10);
                  isInDeleteMode = true;
                  notifyDataSetChanged();
                }
              });
        }
      } else if (position == getCount() - 2) { // 添加群组成员按钮
        holder.textView.setText("");
        holder.imageView.setImageResource(RHelper.get("drawable.em_smiley_add_btn"));
        //				button.setCompoundDrawablesWithIntrinsicBounds(0,
        // RHelper.get("drawable.smiley_add_btn"), 0, 0);
        // 如果不是创建者或者没有相应权限
        if (!group.isAllowInvites()
            && !group.getOwner().equals(EMChatManager.getInstance().getCurrentUser())) {
          // if current user is not group admin, hide add/remove btn
          convertView.setVisibility(View.INVISIBLE);
        } else {
          // 正处于删除模式下,隐藏添加按钮
          if (isInDeleteMode) {
            convertView.setVisibility(View.INVISIBLE);
          } else {
            convertView.setVisibility(View.VISIBLE);
            convertView.findViewById(RHelper.get("id.badge_delete")).setVisibility(View.INVISIBLE);
          }
          final String st11 =
              getResources().getString(RHelper.get("string.Add_a_button_was_clicked"));
          button.setOnClickListener(
              new OnClickListener() {
                @Override
                public void onClick(View v) {
                  EMLog.d(TAG, st11);
                  // 进入选人页面
                  startActivityForResult(
                      (new Intent(GroupDetailsActivity.this, GroupPickContactsActivity.class)
                          .putExtra("groupId", groupId)),
                      REQUEST_CODE_ADD_USER);
                }
              });
        }
      } else { // 普通item,显示群组成员
        final String username = getItem(position);
        convertView.setVisibility(View.VISIBLE);
        button.setVisibility(View.VISIBLE);
        //				Drawable avatar = getResources().getDrawable(R.drawable.default_avatar);
        //				avatar.setBounds(0, 0, referenceWidth, referenceHeight);
        //				button.setCompoundDrawables(null, avatar, null, null);
        EaseUserUtils.setUserNick(username, holder.textView);
        EaseUserUtils.setUserAvatar(getContext(), username, holder.imageView);
        if (isInDeleteMode) {
          // 如果是删除模式下,显示减人图标
          convertView.findViewById(RHelper.get("id.badge_delete")).setVisibility(View.VISIBLE);
        } else {
          convertView.findViewById(RHelper.get("id.badge_delete")).setVisibility(View.INVISIBLE);
        }
        final String st12 = getResources().getString(RHelper.get("string.not_delete_myself"));
        final String st13 = getResources().getString(RHelper.get("string.Are_removed"));
        final String st14 = getResources().getString(RHelper.get("string.Delete_failed"));
        final String st15 = getResources().getString(RHelper.get("string.confirm_the_members"));
        button.setOnClickListener(
            new OnClickListener() {
              @Override
              public void onClick(View v) {
                if (isInDeleteMode) {
                  // 如果是删除自己,return
                  if (EMChatManager.getInstance().getCurrentUser().equals(username)) {
                    new EaseAlertDialog(GroupDetailsActivity.this, st12).show();
                    return;
                  }
                  if (!NetUtils.hasNetwork(getApplicationContext())) {
                    Toast.makeText(
                            getApplicationContext(),
                            getString(RHelper.get("string.network_unavailable")),
                            0)
                        .show();
                    return;
                  }
                  EMLog.d("group", "remove user from group:" + username);
                  deleteMembersFromGroup(username);
                } else {
                  // 正常情况下点击user,可以进入用户详情或者聊天页面等等
                  // startActivity(new
                  // Intent(GroupDetailsActivity.this,
                  // ChatActivity.class).putExtra("userId",
                  // user.getUsername()));

                }
              }

              /**
               * 删除群成员
               *
               * @param username
               */
              protected void deleteMembersFromGroup(final String username) {
                final ProgressDialog deleteDialog = new ProgressDialog(GroupDetailsActivity.this);
                deleteDialog.setMessage(st13);
                deleteDialog.setCanceledOnTouchOutside(false);
                deleteDialog.show();
                new Thread(
                        new Runnable() {

                          @Override
                          public void run() {
                            try {
                              // 删除被选中的成员
                              EMGroupManager.getInstance().removeUserFromGroup(groupId, username);
                              isInDeleteMode = false;
                              runOnUiThread(
                                  new Runnable() {

                                    @Override
                                    public void run() {
                                      deleteDialog.dismiss();
                                      refreshMembers();
                                      ((TextView) findViewById(RHelper.get("id.group_name")))
                                          .setText(
                                              group.getGroupName()
                                                  + "("
                                                  + group.getAffiliationsCount()
                                                  + st);
                                    }
                                  });
                            } catch (final Exception e) {
                              deleteDialog.dismiss();
                              runOnUiThread(
                                  new Runnable() {
                                    public void run() {
                                      Toast.makeText(
                                              getApplicationContext(), st14 + e.getMessage(), 1)
                                          .show();
                                    }
                                  });
                            }
                          }
                        })
                    .start();
              }
            });

        button.setOnLongClickListener(
            new OnLongClickListener() {

              @Override
              public boolean onLongClick(View v) {
                if (EMChatManager.getInstance().getCurrentUser().equals(username)) return true;
                if (group.getOwner().equals(EMChatManager.getInstance().getCurrentUser())) {
                  new EaseAlertDialog(
                          GroupDetailsActivity.this,
                          null,
                          st15,
                          null,
                          new AlertDialogUser() {

                            @Override
                            public void onResult(boolean confirmed, Bundle bundle) {
                              if (confirmed) {
                                addUserToBlackList(username);
                              }
                            }
                          },
                          true)
                      .show();
                }
                return false;
              }
            });
      }
      return convertView;
    }
Ejemplo n.º 6
0
    public MyViewHolder(View itemView) {
      super(itemView);
      tvNoteTitle = (TextView) itemView.findViewById(R.id.tvNoteTitle);
      tvNoteContent = (TextView) itemView.findViewById(R.id.tvNoteContent);
      ivPhoto = (ImageView) itemView.findViewById(R.id.ivPhoto);

      llRvItem = (LinearLayout) itemView.findViewById(R.id.llRvItem);
      LinearLayout.LayoutParams params =
          new LinearLayout.LayoutParams(
              ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
      llRvItem.setLayoutParams(params);
      llRvItem.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Note note = mNoteList.get(getAdapterPosition());
              Intent intent = new Intent(MainActivity.this, ViewNoteActivity.class);
              intent.putExtra("note", note);
              startActivity(intent);
            }
          });
      llRvItem.setOnLongClickListener(
          new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {

              final Note note = mNoteList.get(getAdapterPosition());
              setClickedNote(note);

              AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
              builder.setItems(
                  new CharSequence[] {"Edit", "Delete"},
                  new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                      // The 'which' argument contains the index position
                      // of the selected item
                      if (which == 0) {
                        Intent intent = new Intent(MainActivity.this, EditNoteActivity.class);
                        intent.putExtra("note", note);
                        startActivity(intent);
                      }

                      if (which == 1) {
                        //                            DbHelper dbHelper = new
                        // DbHelper(MainActivity.this);
                        //                            System.out.println(note.getId());
                        new Thread() {
                          @Override
                          public void run() {
                            boolean delete = mDbHelper.delete(note);
                            if (delete) {
                              runOnUiThread(
                                  new Runnable() {
                                    @Override
                                    public void run() {
                                      UIUtils.showToast(MainActivity.this, "Delete Success.");
                                      mNoteList.remove(note);
                                      mAdapter.notifyDataSetChanged();
                                    }
                                  });
                            } else {
                              runOnUiThread(
                                  new Runnable() {
                                    @Override
                                    public void run() {
                                      UIUtils.showToast(MainActivity.this, "Delete Fail.");
                                    }
                                  });
                            }
                          }
                        }.start();
                      }
                    }
                  });

              builder.show();

              return true;
            }
          });
    }
Ejemplo n.º 7
0
  protected void buildRow(
      final View view,
      Drawable icon,
      final String text,
      final String textPrefix,
      int textColor,
      boolean isWiki,
      boolean isText,
      boolean needLinks) {
    boolean light = app.getSettings().isLightContent();

    if (!isFirstRow()) {
      buildRowDivider(view, false);
    }

    final String txt;
    if (!Algorithms.isEmpty(textPrefix)) {
      txt = textPrefix + ": " + text;
    } else {
      txt = text;
    }

    LinearLayout ll = new LinearLayout(view.getContext());
    ll.setOrientation(LinearLayout.HORIZONTAL);
    LinearLayout.LayoutParams llParams =
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    ll.setLayoutParams(llParams);
    ll.setBackgroundResource(
        resolveAttribute(view.getContext(), android.R.attr.selectableItemBackground));
    ll.setOnLongClickListener(
        new View.OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
            copyToClipboard(txt, view.getContext());
            return true;
          }
        });

    // Icon
    LinearLayout llIcon = new LinearLayout(view.getContext());
    llIcon.setOrientation(LinearLayout.HORIZONTAL);
    llIcon.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(72f), dpToPx(48f)));
    llIcon.setGravity(Gravity.CENTER_VERTICAL);
    ll.addView(llIcon);

    ImageView iconView = new ImageView(view.getContext());
    LinearLayout.LayoutParams llIconParams =
        new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f));
    llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(32f), dpToPx(12f));
    llIconParams.gravity = Gravity.CENTER_VERTICAL;
    iconView.setLayoutParams(llIconParams);
    iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    iconView.setImageDrawable(icon);
    llIcon.addView(iconView);

    // Text
    LinearLayout llText = new LinearLayout(view.getContext());
    llText.setOrientation(LinearLayout.VERTICAL);
    ll.addView(llText);

    TextView textView = new TextView(view.getContext());
    LinearLayout.LayoutParams llTextParams =
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    llTextParams.setMargins(0, dpToPx(8f), 0, dpToPx(8f));
    textView.setLayoutParams(llTextParams);
    textView.setTextSize(16);
    textView.setTextColor(
        app.getResources()
            .getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark));

    if (needLinks) {
      textView.setAutoLinkMask(Linkify.ALL);
      textView.setLinksClickable(true);
    }
    textView.setEllipsize(TextUtils.TruncateAt.END);
    if (isWiki) {
      textView.setMinLines(1);
      textView.setMaxLines(15);
    } else if (isText) {
      textView.setMinLines(1);
      textView.setMaxLines(10);
    }
    textView.setText(txt);
    if (textColor > 0) {
      textView.setTextColor(view.getResources().getColor(textColor));
    }

    LinearLayout.LayoutParams llTextViewParams =
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    llTextViewParams.setMargins(0, 0, dpToPx(10f), 0);
    llTextViewParams.gravity = Gravity.CENTER_VERTICAL;
    llText.setLayoutParams(llTextViewParams);
    llText.addView(textView);

    ((LinearLayout) view).addView(ll);

    if (isWiki) {
      ll.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              POIMapLayer.showWikipediaDialog(view.getContext(), app, amenity);
            }
          });
    } else if (isText && text.length() > 200) {
      ll.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              POIMapLayer.showDescriptionDialog(view.getContext(), app, text, textPrefix);
            }
          });
    }

    rowBuilt();
  }
Ejemplo n.º 8
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    setTheme();
    setContentView(R.layout.zram_settings);

    if (savedInstanceState != null) {
      showinfo = savedInstanceState.getBoolean("showinfo");
    }

    nf = NumberFormat.getInstance();
    nf.setMaximumFractionDigits(2);

    Intent i = getIntent();
    curdisk =
        i.getIntExtra("curdisk", mPreferences.getInt(PREF_ZRAM, Math.round(maxdisk * 18 / 100)));

    mdisksize = (SeekBar) findViewById(R.id.val1);
    mdisksize.setOnSeekBarChangeListener(this);
    mdisksize.setMax(max - min);
    final int percent = Math.round(curdisk * 100 / maxdisk);
    mdisksize.setProgress(percent - min);
    tval1 = (TextView) findViewById(R.id.tval1);
    tval1.setText(
        getString(R.string.zram_disk_size, Helpers.ReadableByteCount(curdisk * 1024 * 1024))
            + " ("
            + String.valueOf(percent)
            + "%)");

    cur = (TextView) findViewById(R.id.cur);
    t1 = (TextView) findViewById(R.id.t1);
    t2 = (TextView) findViewById(R.id.t2);
    t3 = (TextView) findViewById(R.id.t3);
    t4 = (TextView) findViewById(R.id.t4);
    t5 = (TextView) findViewById(R.id.t5);

    set_values();

    start_btn = (Button) findViewById(R.id.apply);
    start_btn.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View arg0) {
            if (is_zram_on()) {
              new StopZramOperation().execute();
            } else {
              new StartZramOperation().execute();
            }
          }
        });
    LinearLayout prev = (LinearLayout) findViewById(R.id.preview);

    prev.setOnLongClickListener(
        new View.OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
            if (curcpu >= (ncpus - 1)) curcpu = 0;
            else curcpu++;
            return true;
          }
        });

    if (is_zram_on()) {
      start_btn.setText(getString(R.string.mt_stop));
      mdisksize.setEnabled(false);
      if (showinfo) {
        Toast.makeText(context, getString(R.string.ps_zram_info), Toast.LENGTH_LONG).show();
        showinfo = false;
      }
    } else {
      start_btn.setText(getString(R.string.mt_start));
      mdisksize.setEnabled(true);
    }
  }
Ejemplo n.º 9
0
  @Override
  public View getView() throws ElementFailureException {
    if (elementView != null) return elementView;

    LinearLayout v = new LinearLayout(Utils.mainActivity);
    v.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    v.setOrientation(LinearLayout.VERTICAL);
    elementView = v;

    /** Nesting another element's view in our own for title and description. */
    LinearLayout descriptionFrame = new LinearLayout(Utils.mainActivity);
    LayoutParams dfl = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    descriptionFrame.setOrientation(LinearLayout.VERTICAL);
    final int leftMargin = (int) (2 * Utils.density + 0.5f);
    dfl.setMargins(leftMargin, 0, 0, 0);
    descriptionFrame.setLayoutParams(dfl);
    elementView.addView(descriptionFrame);

    if (titleObj != null) {
      TextView titleView = (TextView) titleObj.getView();
      titleView.setBackground(null);
      descriptionFrame.addView(titleView);
    }

    if (descriptionObj != null) descriptionFrame.addView(descriptionObj.getView());

    textView = new TextView(Utils.mainActivity);
    textView.setLayoutParams(
        new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setTextColor(Color.parseColor("#AAAAAA"));
    textView.setId(tv_id);
    elementView.addView(textView);

    v.setOnLongClickListener(this);
    textView.setOnLongClickListener(this);

    elementFrame = new LinearLayout(Utils.mainActivity);
    elementFrame.setLayoutParams(
        new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    elementFrame.setOrientation(LinearLayout.VERTICAL);

    selectorFrame = new FrameLayout(Utils.mainActivity);
    LayoutParams sfl =
        new LayoutParams((int) (15 * Utils.density + 0.5f), LayoutParams.MATCH_PARENT);
    int margin = (int) (Utils.density + 0.5f);
    sfl.setMargins(0, margin, 0, margin);
    selectorFrame.setLayoutParams(sfl);

    selectorFrame.setBackgroundColor(Color.DKGRAY);
    selectorFrame.setVisibility(View.GONE);

    elementFrame.addView(selectorFrame);
    elementFrame.addView(v);

    elementView = elementFrame;

    String initialLive = getLiveValue();
    if (getStoredValue() == null) {
      Utils.db.setValue(command, initialLive);
      stored = lastLive;
    }

    lastEdit = lastLive;

    if (original == null) original = lastLive;

    textView.setOnClickListener(this);
    textView.setText(lastLive.toString());

    valueCheck();

    return elementView;
  }
Ejemplo n.º 10
0
  @Override
  public void prepareItemView() {
    messageView = (TextViewWithSpoilers) findViewById(R.id.messageView);
    SharedPreferences prefs = DobroApplication.getApplicationStatic().getDefaultPrefs();
    int font_size = Integer.parseInt(prefs.getString("font_size", "16"));
    if (font_size < 10) font_size = 10;
    messageView.setTextSize(TypedValue.COMPLEX_UNIT_SP, font_size);
    metadataLeftView = (TextView) findViewById(R.id.metadataLeftView);
    metadataRightView = (TextView) findViewById(R.id.metadataRightView);
    numberView = (TextView) findViewById(R.id.postNumber);
    imagesLayout = (LinearLayout) findViewById(R.id.imagesLayout);
    ViewGroup.LayoutParams p = imagesLayout.getLayoutParams();
    mImageHeight = Integer.parseInt(prefs.getString("images_size", "200"));
    if (mImageHeight <= 0 || mImageHeight > 200) mImageHeight = 200;
    p.height = mImageHeight;
    imagesLayout.setLayoutParams(p);
    titleView = (TextView) findViewById(R.id.titleView);
    metadataLayout = (LinearLayout) findViewById(R.id.metadataLayout);
    //		refsView = (TextView) findViewById(R.id.refsView);
    refsButton = (TextView) findViewById(R.id.refsButton);
    refsButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            IPostsList activity = null;
            try {
              activity = (IPostsList) getContext();
            } catch (ClassCastException e) {
            }
            if (activity == null) return;
            activity.openLinks(dobroitem.post.getRefs());
          }
        });
    // QA
    messageView.setOnLongClickListener(
        new OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
            DobroPostItemView.this.onShowBar(v);
            return true;
          }
        });

    metadataLayout.setOnLongClickListener(
        new OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
            DobroPostItemView.this.onShowBar(v);
            return true;
          }
        });

    titleView.setOnLongClickListener(
        new OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
            DobroPostItemView.this.onShowBar(v);
            return true;
          }
        });

    metadataLayout.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            DobroPostItemView.this.onAnyViewClick(v);
            if (!DobroApplication.getApplicationStatic().show_spoilers) messageView.performClick();
          }
        });

    titleView.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            DobroPostItemView.this.onAnyViewClick(v);
          }
        });
  }