@SuppressLint("InflateParams")
 private MyQrodeDialog(Context context, int defStyle) {
   super(context, defStyle);
   View contentView = getLayoutInflater().inflate(R.layout.dialog_my_qr_code, null);
   mIvCode = (ImageView) contentView.findViewById(R.id.iv_qr_code);
   try {
     bitmap =
         QrCodeUtils.Create2DCode(
             String.format("http://my.oschina.net/u/%s", AppContext.getInstance().getLoginUid()));
     mIvCode.setImageBitmap(bitmap);
   } catch (WriterException e) {
     e.printStackTrace();
   }
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   contentView.setOnLongClickListener(
       new OnLongClickListener() {
         @Override
         public boolean onLongClick(View v) {
           dismiss();
           if (FileUtils.bitmapToFile(
               bitmap, FileUtils.getSavePath("OSChina") + "/myqrcode.png")) {
             AppContext.showToast("二维码已保存到oschina文件夹下");
           } else {
             AppContext.showToast("SD卡不可写,二维码保存失败");
           }
           return false;
         }
       });
   super.setContentView(contentView);
 }
Exemplo n.º 2
0
    public PredictionsAdapterViewHolder(View view) {
      super(view);
      mBackground = view.findViewById(R.id.list_item_background);
      mSwipeLeft = view.findViewById(R.id.list_item_bg_swipe_left);
      mSwipeRight = view.findViewById(R.id.list_item_bg_swipe_right);
      mContainer = view.findViewById(R.id.list_item_container);
      mQuestion = (TextView) view.findViewById(R.id.list_item_prediction_question);
      mDetail = (TextView) view.findViewById(R.id.list_item_prediction_detail);
      mAnswer = (TextView) view.findViewById(R.id.list_item_prediction_answer);
      mCredence = (TextView) view.findViewById(R.id.list_item_prediction_credence);
      mCreationDate = (TextView) view.findViewById(R.id.list_item_prediction_creation_date);
      mActionRight = view.findViewById(R.id.list_item_expanded_button_right);
      mActionWrong = view.findViewById(R.id.list_item_expanded_button_wrong);
      mActionReopen = view.findViewById(R.id.list_item_expanded_button_reopen);
      mActionDelete = view.findViewById(R.id.list_item_expanded_button_delete);
      view.setOnClickListener(this);
      view.setOnLongClickListener(this);

      if (mActionRight != null
          && mActionWrong != null
          && mActionReopen != null
          && mActionDelete != null) {
        (mResultFilter == PredictionsFragment.RESULT_FILTER_WRONG
                ? mActionWrong
                : mResultFilter == PredictionsFragment.RESULT_FILTER_RIGHT
                    ? mActionRight
                    : mActionReopen)
            .setVisibility(View.GONE);
        mActionRight.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                dismiss(PredictionsAdapterViewHolder.this, SWIPE_DIRECTION_RIGHT);
              }
            });
        mActionWrong.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                dismiss(PredictionsAdapterViewHolder.this, SWIPE_DIRECTION_WRONG);
              }
            });
        mActionReopen.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                reopen(PredictionsAdapterViewHolder.this);
              }
            });
        mActionDelete.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                delete(PredictionsAdapterViewHolder.this);
              }
            });
      }

      mLongClickDialog = makeLongClickDialog();
    }
Exemplo n.º 3
0
 @Override
 public viewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
   View itemView =
       LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.card_layout, viewGroup, false);
   itemView.setOnLongClickListener(new LongPressListener());
   return new viewHolder(itemView);
 }
  /**
   * Sets current item's front view
   *
   * @param frontView Front view
   */
  private void setFrontView(View frontView, final int childPosition) {
    this.frontView = frontView;
    frontView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            swipeRecyclerView.onClickFrontView(downPosition);
          }
        });

    frontView.setOnLongClickListener(
        new View.OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
            if (swipeOpenOnLongPress) {
              if (downPosition >= 0) {
                openAnimate(childPosition);
              }
            } else {
              swapChoiceState(childPosition);
            }
            return false;
          }
        });
  }
Exemplo n.º 5
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    sharedPrefs =
        context.getSharedPreferences(
            "com.daiv.android.twitter_world_preferences",
            Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE);
    settings = AppSettings.getInstance(context);

    layout = inflater.inflate(R.layout.trends_list_view, null);

    listView = (AsyncListView) layout.findViewById(R.id.listView);

    if (DrawerActivity.translucent) {
      if (Utils.hasNavBar(context)) {
        View footer = new View(context);
        footer.setOnClickListener(null);
        footer.setOnLongClickListener(null);
        ListView.LayoutParams params =
            new ListView.LayoutParams(
                ListView.LayoutParams.MATCH_PARENT, Utils.getNavBarHeight(context));
        footer.setLayoutParams(params);
        listView.addFooterView(footer);
        listView.setFooterDividersEnabled(false);
      }
    }

    getTrends();

    return layout;
  }
Exemplo n.º 6
0
  private static void setListener(
      Object injectedSource, Field field, String methodName, Method method) throws Exception {
    if (methodName == null || methodName.trim().length() == 0) return;

    Object obj = field.get(injectedSource);

    switch (method) {
      case Click:
        if (obj instanceof View) {
          ((View) obj).setOnClickListener(new EventListener(injectedSource).click(methodName));
        }
        break;
      case ItemClick:
        if (obj instanceof AbsListView) {
          ((AbsListView) obj)
              .setOnItemClickListener(new EventListener(injectedSource).itemClick(methodName));
        }
        break;
      case LongClick:
        if (obj instanceof View) {
          ((View) obj)
              .setOnLongClickListener(new EventListener(injectedSource).longClick(methodName));
        }
        break;
      case itemLongClick:
        if (obj instanceof AbsListView) {
          ((AbsListView) obj)
              .setOnItemLongClickListener(
                  new EventListener(injectedSource).itemLongClick(methodName));
        }
        break;
      default:
        break;
    }
  }
Exemplo n.º 7
0
 public DefaultViewHolder(DefaultRecyelerAdater<T> adapter, View itemView, RecyclerItem item) {
   super(itemView);
   mAdapter = adapter;
   mItem = item;
   itemView.setOnClickListener(this);
   itemView.setOnLongClickListener(this);
 }
Exemplo n.º 8
0
  /**
   * 设置view的监听器.
   *
   * @param field the field
   * @param methodName the method name
   * @param method the method
   * @throws Exception the exception
   */
  private void setListener(Field field, String methodName, int method) throws Exception {
    if (methodName == null || methodName.trim().length() == 0) return;

    Object obj = field.get(this);

    switch (method) {
      case AbIocEventListener.CLICK:
        if (obj instanceof View) {
          ((View) obj).setOnClickListener(new AbIocEventListener(this).click(methodName));
        }
        break;
      case AbIocEventListener.ITEMCLICK:
        if (obj instanceof AbsListView) {
          ((AbsListView) obj)
              .setOnItemClickListener(new AbIocEventListener(this).itemClick(methodName));
        }
        break;
      case AbIocEventListener.LONGCLICK:
        if (obj instanceof View) {
          ((View) obj).setOnLongClickListener(new AbIocEventListener(this).longClick(methodName));
        }
        break;
      case AbIocEventListener.ITEMLONGCLICK:
        if (obj instanceof AbsListView) {
          ((AbsListView) obj)
              .setOnItemLongClickListener(new AbIocEventListener(this).itemLongClick(methodName));
        }
        break;
      default:
        break;
    }
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View view;
    LayoutInflater inflater = ((Activity) context).getLayoutInflater();

    if (convertView == null) {
      view = new View(context);
      view = inflater.inflate(R.layout.row_grid, null);
      ImageView imageView = (ImageView) view.findViewById(R.id.image);
      TextView textView = (TextView) view.findViewById(R.id.text);

      String url = list.get(position);
      Picasso.with(context).load(url).into(imageView);
      textView.setText(url);
    } else {
      view = (View) convertView;
    }

    view.setOnLongClickListener(
        new OnLongClickListener() {
          public boolean onLongClick(View v) {
            String text = ((TextView) v.findViewById(R.id.text)).getText().toString();
            longPressItem = text;
            longPresseItemView = v;
            showDialog(text);
            return false;
          }
        });

    return view;
  }
Exemplo n.º 10
0
  public static void bindOnLongClick(final Object obj, Object... viewsAndMethod) {
    final Class<?> clazz = obj.getClass();
    String method = viewsAndMethod[viewsAndMethod.length - 1].toString();
    try {
      final Method m = findMethod(clazz, method);
      m.setAccessible(true);
      View.OnLongClickListener listener =
          new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {
              try {
                return Boolean.parseBoolean(m.invoke(obj).toString());
              } catch (InvocationTargetException e) {

              } catch (IllegalAccessException e) {

              }

              return false;
            }
          };

      for (Object o : viewsAndMethod) {
        if (o instanceof View) {
          ((View) o).setOnLongClickListener(listener);
        }
      }
    } catch (NoSuchMethodException e) {

    }
  }
Exemplo n.º 11
0
 @Override
 public View getChildView(
     int groupPosition,
     int childPosition,
     boolean isLastChild,
     View convertView,
     ViewGroup parent) {
   Kind k =
       ((Map<String, Kind>) getChild(groupPosition, childPosition))
           .get("child"); // 获取当前项的Pattern实例
   View view = LayoutInflater.from(this.context).inflate(this.childLayoutId, null);
   TextView textView = (TextView) view.findViewById(R.id.kindChildTo);
   switch (childPosition) {
     case 0:
       textView.setText("类别编号:" + k.getKindId());
       break;
     case 1:
       textView.setText("商品类别:" + k.getKindname());
       break;
     case 2:
       textView.setText("备注:" + k.getRemarks());
       break;
     default:
       break;
   }
   view.setOnLongClickListener(new KindGroupLongClickListener(groupPosition, this, this.context));
   return view;
 }
Exemplo n.º 12
0
    ListItemHolder(View view) {
      super(view);

      title = (TextView) itemView.findViewById(R.id.settings_item_title);
      subtitle = (TextView) itemView.findViewById(R.id.settings_item_subtitle);
      view.setOnClickListener(this);
      view.setOnLongClickListener(this);
    }
Exemplo n.º 13
0
 private void setupFrameLayoutButton(
     @NonNull final View root, @IdRes final int buttonId, @IdRes final int imageId) {
   final View frameButton = root.findViewById(buttonId);
   final ImageView buttonImage = (ImageView) root.findViewById(imageId);
   frameButton.setOnClickListener(this);
   frameButton.setOnLongClickListener(this);
   buttonImage.setColorFilter(mIconColor, PorterDuff.Mode.SRC_IN);
 }
Exemplo n.º 14
0
 protected void setOnLongClickListener(View view) {
   view.setOnLongClickListener(
       new OnLongClickListener() {
         public boolean onLongClick(View view) {
           return proxy.fireEvent(TiC.EVENT_LONGCLICK, null);
         }
       });
 }
Exemplo n.º 15
0
  @Test
  public void performLongClick_shouldClickOnView() throws Exception {
    TestOnLongClickListener clickListener = new TestOnLongClickListener();
    view.setOnLongClickListener(clickListener);
    shadowOf(view).performLongClick();

    assertTrue(clickListener.clicked);
  }
Exemplo n.º 16
0
 public ViewHolder(View itemView) {
   super(itemView);
   itemView.setOnClickListener(this);
   itemView.setOnLongClickListener(this);
   this.textView = (TextView) itemView.findViewById(R.id.text);
   this.checkBox = (CheckBox) itemView.findViewById(R.id.checkbox);
   this.checkBox.setOnClickListener(this);
 }
 @Override
 public View getChildView(
     int groupPosition,
     int childPosition,
     boolean isLastChild,
     View convertView,
     ViewGroup parent) {
   CellHolder cell = null;
   if (convertView == null) {
     cell = new CellHolder();
     convertView = inflater.inflate(R.layout.index_cell, null);
     cell.titleView = (TextView) convertView.findViewById(R.id.title);
     cell.desView = (TextView) convertView.findViewById(R.id.des);
     convertView.setTag(cell);
   } else {
     cell = (CellHolder) convertView.getTag();
   }
   final PhoneIntroEntity model = (PhoneIntroEntity) getChild(groupPosition, childPosition);
   if (groupPosition == 4) {
     cell.desView.setText(model.content);
     cell.desView.setText(String.format("%s氏   人数:%s", model.family_name, model.member));
   } else if (groupPosition == 5) {
     cell.desView.setText(model.content);
     cell.desView.setText(model.family_intro);
   } else if (groupPosition == 0) {
     cell.desView.setText(String.format("人数:%s   点击数:%s", model.member, model.hits));
   } else if (groupPosition == 1) {
     cell.desView.setText(String.format("人数:%s   发起人:%s", model.member, model.creator));
   } else if (groupPosition == 2) { // activity created
     cell.desView.setText(String.format("点击数:%s   参加人数:%s", model.hits, model.member));
   } else if (groupPosition == 3) { // activity took part
     cell.desView.setText(String.format("聚会时间:%s   参加人数:%s", model.begin_at, model.member));
   }
   cell.titleView.setText(model.title);
   convertView.setTag(R.id.title, groupPosition);
   convertView.setTag(R.id.des, childPosition);
   convertView.setOnLongClickListener(
       new OnLongClickListener() {
         @Override
         public boolean onLongClick(View arg0) {
           ((Index) context).showSharePre(false, null, model);
           return false;
         }
       });
   convertView.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View v) {
           if (model.phoneSectionType.equals(CommonValue.PhoneSectionType.OwnedSectionType)
               || model.phoneSectionType.equals(CommonValue.PhoneSectionType.JoinedSectionType)) {
             ((Index) context).showPhoneViewWeb(model);
           } else {
             ((Index) context).showActivityViewWeb(model);
           }
         }
       });
   return convertView;
 }
Exemplo n.º 18
0
 /**
  * Sets up a cheat sheet (tooltip) for the given view by setting its {@link
  * android.view.View.OnLongClickListener}. When the view is long-pressed, a {@link Toast} with the
  * given text will be shown either above (default) or below the view (if there isn't room above
  * it).
  *
  * @param view The view to add a cheat sheet for.
  * @param text The text to show on long-press.
  */
 public static void setup(View view, final CharSequence text) {
   view.setOnLongClickListener(
       new View.OnLongClickListener() {
         @Override
         public boolean onLongClick(View view) {
           return showCheatSheet(view, text);
         }
       });
 }
Exemplo n.º 19
0
 /**
  * Sets up a cheat sheet (tooltip) for the given view by setting its {@link
  * android.view.View.OnLongClickListener}. When the view is long-pressed, a {@link Toast} with the
  * given text will be shown either above (default) or below the view (if there isn't room above
  * it).
  *
  * @param view The view to add a cheat sheet for.
  * @param textResId The string resource containing the text to show on long-press.
  */
 public static void setup(View view, final int textResId) {
   view.setOnLongClickListener(
       new View.OnLongClickListener() {
         @Override
         public boolean onLongClick(View view) {
           return showCheatSheet(view, view.getContext().getString(textResId));
         }
       });
 }
Exemplo n.º 20
0
 /**
  * Sets up a cheat sheet (tooltip) for the given view by setting its {@link
  * android.view.View.OnLongClickListener}. When the view is long-pressed, a {@link Toast} with the
  * view's {@link android.view.View#getContentDescription() content description} will be shown
  * either above (default) or below the view (if there isn't room above it).
  *
  * @param view The view to add a cheat sheet for.
  */
 public static void setup(View view) {
   view.setOnLongClickListener(
       new View.OnLongClickListener() {
         @Override
         public boolean onLongClick(View view) {
           return showCheatSheet(view, view.getContentDescription());
         }
       });
 }
Exemplo n.º 21
0
 @Override
 public void onChildViewAttachedToWindow(View view) {
   if (mOnItemClickListener != null) {
     view.setOnClickListener(mOnClickListener);
   }
   if (mOnItemLongClickListener != null) {
     view.setOnLongClickListener(mOnLongClickListener);
   }
 }
Exemplo n.º 22
0
 public AdapterViewHolder(View itemView) {
   super(itemView);
   this.v = itemView;
   // this.pos = (TextView) itemView.findViewById(R.id.row_pos);
   this.name = (TextView) itemView.findViewById(R.id.row_user);
   this.name.setTypeface(EasyFonts.cac_champagne(context));
   this.score = (TextView) itemView.findViewById(R.id.row_score);
   itemView.setOnLongClickListener(this);
 }
Exemplo n.º 23
0
 @Override
 public ComicViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
   View v =
       LayoutInflater.from(viewGroup.getContext())
           .inflate(R.layout.whatif_overview, viewGroup, false);
   v.setOnClickListener(new CustomOnClickListener());
   v.setOnLongClickListener(new CustomOnLongClickListener());
   return new ComicViewHolder(v);
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    UserHolder holder = null;
    View row = convertView;

    final User user = data.get(position);
    Typeface type = Typeface.createFromAsset(context.getAssets(), "century_gothic.TTF");

    if (row == null) {
      LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      row = inflater.inflate(resource, parent, false);

      holder = new UserHolder();
      holder.username = (TextView) row.findViewById(R.id.username);

      holder.toot = (FrameLayout) row.findViewById(R.id.button_horn);
      holder.omw = (FrameLayout) row.findViewById(R.id.button_car);
      holder.beer = (FrameLayout) row.findViewById(R.id.button_beer);

      holder.beerButton = (ImageButton) row.findViewById(R.id.beer_icon);
      holder.omwButton = (ImageButton) row.findViewById(R.id.car_icon);
      holder.tootButton = (ImageButton) row.findViewById(R.id.horn_icon);

      row.setTag(holder);
      row.setTag(R.id.button_car, holder.omw);
      row.setTag(R.id.button_horn, holder.toot);
      row.setTag(R.id.button_beer, holder.beer);
      row.setTag(R.id.beer_icon, holder.beerButton);
      row.setTag(R.id.car_icon, holder.omwButton);
      row.setTag(R.id.horn_icon, holder.tootButton);

    } else {
      holder = (UserHolder) row.getTag();
    }

    holder.dialog = DialogUtil.getProgressDialog(context, "Sending toot...");

    holder.username.setText(user.getUsername());
    holder.username.setTypeface(type);
    holder.username.setOnClickListener(
        new UsernameOnClickListener(user.getUsername(), holder.dialog));

    holder.toot.setOnClickListener(new TootOnClickListener(user.get_id(), holder.dialog));
    holder.omw.setOnClickListener(new OmwOnClickListener(user.get_id(), holder.dialog));
    holder.beer.setOnClickListener(new BeerOnClickListener(user.get_id(), holder.dialog));

    holder.omwButton.setOnClickListener(new OmwOnClickListener(user.get_id(), holder.dialog));
    holder.tootButton.setOnClickListener(new TootOnClickListener(user.get_id(), holder.dialog));
    holder.beerButton.setOnClickListener(new BeerOnClickListener(user.get_id(), holder.dialog));

    holder.username.setOnLongClickListener(new RemoveUserOnClickListener(user.get_id()));
    row.setOnLongClickListener(new RemoveUserOnClickListener(user.get_id()));

    return row;
  }
  private View inflateCallInfoLine(CTCall call) {
    View rowLayout = inflater.inflate(R.layout.call_manager_line, null, false);
    View rowView = (RelativeLayout) rowLayout.findViewById(R.id.CallMngLine);
    rowView.setTag(call);
    if (call.iIsOnHold) rowView.setBackgroundResource(R.drawable.call_mng_hold);

    rowView.setOnLongClickListener(
        new OnLongClickListener() {
          public boolean onLongClick(View view) {
            addRemoveConf(view);
            return true;
          }
        });
    rowView.setOnClickListener(
        new OnClickListener() {
          public void onClick(View view) {
            CTCall call = (CTCall) view.getTag();
            switchCallHold(call, view);
            view.invalidate();
          }
        });
    TextView textView = (TextView) rowLayout.findViewById(R.id.CallMngCallerName);
    textView.setText(call.getNameFromAB());

    textView = (TextView) rowLayout.findViewById(R.id.CallMngCallerNumber);
    textView.setText(call.bufPeer.toString());

    textView = (TextView) rowLayout.findViewById(R.id.CallMngSecState);
    textView.setText(call.bufSecureMsg.toString());

    textView = (TextView) rowLayout.findViewById(R.id.CallMngSas);
    textView.setText(call.bufSAS.toString());

    ImageButton btn = (ImageButton) rowLayout.findViewById(R.id.CallMngEndCall);
    Utilities.setCallerImage(call, (ImageView) rowLayout.findViewById(R.id.CallMngImage));
    btn.setTag(call);
    btn.setOnClickListener(
        new OnClickListener() {
          public void onClick(View view) {
            endCall(true, (CTCall) view.getTag());
          }
        });
    if (call.mustShowAnswerBT()) {
      btn = (ImageButton) rowLayout.findViewById(R.id.CallMngAnswerCall);
      btn.setTag(call);
      btn.setVisibility(View.VISIBLE);
      btn.setEnabled(true);
      btn.setOnClickListener(
          new OnClickListener() {
            public void onClick(View view) {
              answerCall(true, (CTCall) view.getTag());
            }
          });
    }
    return rowView;
  }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      if (dataMonitorings != null && dataMonitorings.size() > 0) {

        DataMonitoring dataMonitoring = dataMonitorings.get(position);

        if (dataMonitoring == null) return null;

        LayoutInflater inflater =
            (LayoutInflater) daftarMonitoring.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        View rowView = inflater.inflate(resource, parent, false);

        TextView keterangan = (TextView) rowView.findViewById(R.id.daftarMonitoringText);
        keterangan.setText(dataMonitoring.getKeterangan());

        rowView.setOnClickListener(new DaftarMonitoringClick(daftarMonitoring, dataMonitoring));
        if (!daftarMonitoring.justView) {
          rowView.setOnLongClickListener(
              new DaftarMonitoringLongClick(daftarMonitoring, dataMonitoring));
        }

        LinearLayout llBackground = (LinearLayout) rowView.findViewById(R.id.background);

        Button btnAktifMonitoring = (Button) rowView.findViewById(R.id.daftarMonitoringButtonStart);
        btnAktifMonitoring.setOnClickListener(
            new BtnStartOnClick(daftarMonitoring, dataMonitoring));

        Button btnDeAktifMonitoring =
            (Button) rowView.findViewById(R.id.daftarMonitoringButtonStop);
        btnDeAktifMonitoring.setOnClickListener(
            new BtnStopOnClick(daftarMonitoring, dataMonitoring));

        LinearLayout llAktifMonitoring =
            (LinearLayout) rowView.findViewById(R.id.daftarMonitoringStatusAktif);

        LinearLayout llDeAktifMonitoring =
            (LinearLayout) rowView.findViewById(R.id.daftarMonitoringStatusDeaktif);

        if (dataMonitoring.isAktif()) {
          llBackground.setBackgroundResource(R.drawable.back_menu_green);
          llDeAktifMonitoring.setVisibility(View.GONE);

          llAktifMonitoring.setVisibility(View.VISIBLE);
        } else {
          llBackground.setBackgroundResource(R.drawable.back_menu);
          llAktifMonitoring.setVisibility(View.GONE);
          llDeAktifMonitoring.setVisibility(View.VISIBLE);
        }

        return rowView;
      } else {
        return null;
      }
    }
Exemplo n.º 27
0
  /**
   * 语音的路径,判断收发的状态 展现的状态 播放动画相关 获取语音的读取状态/ 语音长按事件
   *
   * @param position
   * @param convertView
   * @param parent
   * @param isMine
   * @return
   */
  private View audioMsgRender(
      final int position, View convertView, final ViewGroup parent, final boolean isMine) {
    AudioRenderView audioRenderView;
    final AudioMessage audioMessage = (AudioMessage) msgObjectList.get(position);
    UserEntity entity = imService.getContactManager().findContact(audioMessage.getFromId());
    if (null == convertView) {
      audioRenderView = AudioRenderView.inflater(ctx, parent, isMine);
    } else {
      audioRenderView = (AudioRenderView) convertView;
    }
    final String audioPath = audioMessage.getAudioPath();

    final View messageLayout = audioRenderView.getMessageLayout();
    if (!TextUtils.isEmpty(audioPath)) {
      // 播放的路径为空,这个消息应该如何展示
      messageLayout.setOnLongClickListener(
          new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
              MessageOperatePopup popup =
                  getPopMenu(parent, new OperateItemClickListener(audioMessage, position));
              boolean bResend = audioMessage.getStatus() == MessageConstant.MSG_FAILURE;
              popup.show(messageLayout, DBConstant.SHOW_AUDIO_TYPE, bResend, isMine);
              return true;
            }
          });
    }

    audioRenderView
        .getMessageFailed()
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View arg0) {
                MessageOperatePopup popup =
                    getPopMenu(parent, new OperateItemClickListener(audioMessage, position));
                popup.show(messageLayout, DBConstant.SHOW_AUDIO_TYPE, true, isMine);
              }
            });

    audioRenderView.setBtnImageListener(
        new AudioRenderView.BtnImageListener() {
          @Override
          public void onClickUnread() {
            logger.d("chat#audio#set audio meessage read status");
            audioMessage.setReadStatus(MessageConstant.AUDIO_READED);
            imService.getDbInterface().insertOrUpdateMessage(audioMessage);
          }

          @Override
          public void onClickReaded() {}
        });
    audioRenderView.render(audioMessage, entity, ctx);
    return audioRenderView;
  }
Exemplo n.º 28
0
    public ItemAdapterViewHolder(View itemView) {
      super(itemView);
      wrapper = itemView.findViewById(R.id.rl_poi_wrapper);
      title = (TextView) itemView.findViewById(R.id.tv_point_of_interest_title);
      address = (TextView) itemView.findViewById(R.id.tv_point_of_interest_address);
      visited = (CheckBox) itemView.findViewById(R.id.cb_visited);

      itemView.setOnClickListener(this);
      itemView.setOnLongClickListener(this);
      visited.setOnCheckedChangeListener(this);
    }
Exemplo n.º 29
0
 @Override
 public Dialog onCreateDialog(Bundle savedInstanceState) {
   AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
   LayoutInflater layoutInflater =
       (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   View root = layoutInflater.inflate(R.layout.fragment_share, null);
   View qr = root.findViewById(R.id.qr);
   qr.setOnClickListener(this);
   qr.setOnLongClickListener(this);
   builder.setView(root);
   return builder.create();
 }
Exemplo n.º 30
0
  @Override
  public void setStatusClickListener(StatusClickListener listener) {
    statusClickListener = listener;
    ((View) itemContent).setOnClickListener(eventListener);
    ((View) itemContent).setOnLongClickListener(eventListener);

    itemMenu.setOnClickListener(eventListener);
    profileImageView.setOnClickListener(eventListener);
    replyView.setOnClickListener(eventListener);
    retweetView.setOnClickListener(eventListener);
    favoriteView.setOnClickListener(eventListener);
  }