Java 类android.view.View.OnLongClickListener 实例源码

项目:android-project-gallery    文件:RecyclerViewAdapter.java   
/**
 * Bind events(touch, click, longclick etc).
 * 
 * @param listener
 * @param view
 */
public void bindEvent(final View view, final OnLongClickListener listener)
{
    if (view == null)
    {
        throw new NullPointerException("Can not bind event to null view.");
    }

    view.setOnLongClickListener(new OnLongClickListener()
    {

        @Override
        public boolean onLongClick(View v)
        {
            if (listener != null)
            {
                return listener.onLongClick(v);
            }

            return false;
        }
    });
}
项目:sagetv-miniclient    文件:ServerItemPresenter.java   
public ServerViewHolder(View view) {
    super(view);
    view.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(final View v) {
            PopupMenu menu = ServerInfoUtil.createContextMenu(context, v, new OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    return ServerInfoUtil.onMenuItemClick(context, item, serverInfo, after);
                }
            });
            menu.show();
            return true;
        }
    });
    icon = (ImageView) view.findViewById(R.id.icon);
    serverName = (TextView) view.findViewById(R.id.server_name);
    serverAddress = (TextView) view.findViewById(R.id.server_address);
    serverLocator = (TextView) view.findViewById(R.id.server_locator_id);
    serverLastConnected = (TextView) view.findViewById(R.id.server_last_connect);
}
项目:System-Monitor    文件:GeneralInfoCard.java   
@Override
  public View setupChildView(int childPosition, ListObject object, View convertView, ViewGroup parent)
  {
      final TextView infoText=(TextView)convertView.findViewById(R.id.card_info_title),
                   valueText =(TextView)convertView.findViewById(R.id.card_info_value);
      InfoObject infoObject=(InfoObject)object;
      infoText.setText(infoObject.info);
      valueText.setText(infoObject.value);
      infoTextViews.add(valueText);
      convertView.setOnLongClickListener(new OnLongClickListener() {

    @Override
    public boolean onLongClick(View v) {
        ClipboardManager clipboard=(ClipboardManager)context.getSystemService(Context.CLIPBOARD_SERVICE);
        clipboard.setText(valueText.getText().toString());
        Toast.makeText(context,"Copied to clipboard",Toast.LENGTH_SHORT).show();
        return false;
    }
});
      return  convertView;
  }
项目:GotyeSDK-Android    文件:GotyeMessageListAdapter.java   
private void bindText(Context context, int position, TextHolder holder, View convertView, final GotyeTextMessageProxy msg){
    if(msg.get().getText().length() < 5){
        holder.contentView.setGravity(Gravity.CENTER);
    }else {
        holder.contentView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
    }

    CharSequence sqe = msg.getTextCharSeq();
    if(sqe == null){
        msg.setTextCharSeq(SmileyUtil.replace(context, context.getResources(), msg.get().getText()));
    }

    holder.contentView.setText(msg.getTextCharSeq());
    holder.contentView.setOnLongClickListener(new OnLongClickListener() {

        @Override
        public boolean onLongClick(View v) {
            activity.showMessagePannel(v, msg);
            return true;
        }
    });
}
项目:android_chat    文件:MessageAdapter.java   
public View getView(int position, View convertView, ViewGroup parent) {
     View vi = convertView;
     final Discussion entry = data.get(position);

     if (entry.getMe()) vi = inflater.inflate(R.layout.message_list_out, null);
     else vi = inflater.inflate(R.layout.message_list_in, null);

     LinearLayout list = (LinearLayout)vi.findViewById(R.id.messageList);
     TextView time = (TextView)vi.findViewById(R.id.time);
     TextView message = (TextView)vi.findViewById(R.id.message);

     list.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View arg0) {
    ClipboardManager cm = (ClipboardManager) activity
        .getSystemService(Context.CLIPBOARD_SERVICE);
       cm.setText(entry.getMessage());
       th.sendNotification(activity, "Copied to clipboard");
    return true;
}
     });
     message.setText(entry.getMessage());
     Timestamp timestamp = entry.getTimestamp();
     time.setText(timestamp.getHours()+":"+timestamp.getMinutes());
     return vi;
 }
项目:GomeOnline    文件:ReplyMediaRecordActivity.java   
void init() {
    setState(STATE_IDLE);
    mVUMeterViewL.setOrientation(false);
    mSoundRecorder.setVUMMax(VUM_MAX_NUM);
    mCusImage.setOnClickListener(mListener);
    mTvShow.setOnClickListener(mListener);
    mTvCancel.setOnClickListener(mListener);
    mCusImage.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            Logger.info("", "开始录音");
            clickMain();
            return true;
        }
    });
}
项目:Native-Clip-Board    文件:XposedMod.java   
public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable {
    resparam.res.hookLayout("android", "layout", "text_edit_action_popup_text", new XC_LayoutInflated() {
        @Override
        public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
            final TextView text = (TextView) liparam.view;
            text.setOnLongClickListener(new OnLongClickListener() {
                @Override
                public boolean onLongClick(View v) {
                    if(Resources.getSystem().getString(android.R.string.paste).equals(text.getText().toString())){
                        if(pref.getBoolean("pastefunction", false))
                            Etextview.onTextContextMenuItem(android.R.id.paste);
                        else {
                            Open(text.getContext(),Etextview);
                            WaitforClip(text.getContext(), Etextview);
                            }
                        return true;
                    }else {
                        Toast.makeText(text.getContext(), "Long Clicked "+text.getText().toString(), Toast.LENGTH_SHORT).show();
                        return false;           
                    }
                }
            });
        }
    });
}
项目:dw-charsheet    文件:CharacterSheetFragment.java   
private void setAbilityWidgetListener(final AbilityScoreView widget) {
  widget.setOnLongClickListener(new OnLongClickListener() {
    @Override
    public boolean onLongClick(View v) {
      AbilityScorePickerFragment fragment = AbilityScorePickerFragment.newInstance(
          widget.getAbility(),
          widget.getScore());
      FragmentManager fm = getActivity().getSupportFragmentManager();

      fragment.setTargetFragment(CharacterSheetFragment.this, REQUEST_SCORE);
      fragment.show(fm, SCORE_DIALOG_TAG);

      return true;
    }
  });
}
项目:secrecy    文件:VaultsListFragment.java   
void showTutorial() {
    if ((adapter.getCount() > 0
            && PreferenceManager.getDefaultSharedPreferences(context)
            .getBoolean("showVaultLongClickTutorial", true))) {
        final View mView =
                context.getLayoutInflater().inflate(R.layout.vault_item_tutorial, mLinearView, false);
        TextView mInstructions = (TextView) mView.findViewById(R.id.Tutorial__instruction);
        if (mInstructions != null)
            mInstructions.setText(R.string.Tutorial__long_click_to_rename);
        mLinearView.addView(mView, 0);
        mView.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {
                mLinearView.removeView(mView);
                SharedPreferences.Editor editor
                        = PreferenceManager.getDefaultSharedPreferences(context).edit();
                editor.putBoolean("showVaultLongClickTutorial", false);
                editor.apply();

                return true;
            }
        });
    }
}
项目:PhotoTools    文件:SunsetFragment.java   
/**
 * Sets long click listener for one EditText
 *
 * @param editText EditText for sets long click listener
 */
private void setEditTextLongClick(final EditText editText) {
    Log.message("Enter");
    editText.setOnLongClickListener(new OnLongClickListener() {

        @Override
        public boolean onLongClick(View arg0) {
            Log.message("Enter");
            switch (arg0.getId()) {
                case R.id.sunset_editText_date:
                    initDate();
                    updateDate();
                    break;
                case R.id.sunset_editText_location:
                    handleCurrentLocation();
                    break;
            }
            return true;
        }
    });
}
项目:EmentasUA    文件:EmentasUA.java   
public TextView getTab(final int position, SwipeyTabs root) {
    final TextView view = (TextView) LayoutInflater.from(mContext).inflate(R.layout.swipey_tab_indicator, root, false);
    view.setText(TITLES[position]);

    view.setOnClickListener(new OnClickListener() {
        public void onClick(View arg0) {
            mViewPager.setCurrentItem(position);
        }
    });

    view.setOnLongClickListener(new OnLongClickListener() {
        public boolean onLongClick(View v) {

            Intent i = new Intent(getApplicationContext(), InfoCanteens.class);
            i.putExtra("canteens", view.getText());

            startActivity(i);

            return true;
        }
    });

    return view;
}
项目:selendroid    文件:HomeScreenActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  Log.i(TAG, "onCreate");
  setContentView(io.selendroid.testapp.R.layout.homescreen);
  Button button = (Button) findViewById(io.selendroid.testapp.R.id.buttonTest);
  button.setOnLongClickListener(new OnLongClickListener() {
    @Override
    public boolean onLongClick(View v) {
      showDialog(DIALOG_LONG_PRESS);
      return true;
    }
  });
  initExceptionTestButton();
  initExceptionTestField();
}
项目:chromium-for-android-56-debug-video    文件:CustomButtonParams.java   
/**
 * Builds an {@link ImageButton} from the data in this params. Generated buttons should be
 * placed on the bottom bar. The button's tag will be its id.
 * @param parent The parent that the inflated {@link ImageButton}.
 * @param listener {@link OnClickListener} that should be used with the button.
 * @return Parsed list of {@link CustomButtonParams}, which is empty if the input is invalid.
 */
ImageButton buildBottomBarButton(Context context, ViewGroup parent, OnClickListener listener) {
    if (mIsOnToolbar) return null;

    ImageButton button = (ImageButton) LayoutInflater.from(context)
            .inflate(R.layout.custom_tabs_bottombar_item, parent, false);
    button.setId(mId);
    button.setImageBitmap(mIcon);
    button.setContentDescription(mDescription);
    if (mPendingIntent == null) {
        button.setEnabled(false);
    } else {
        button.setOnClickListener(listener);
    }
    button.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {
            final int screenWidth = view.getResources().getDisplayMetrics().widthPixels;
            final int screenHeight = view.getResources().getDisplayMetrics().heightPixels;
            final int[] screenPos = new int[2];
            view.getLocationOnScreen(screenPos);
            final int width = view.getWidth();

            Toast toast = Toast.makeText(
                    view.getContext(), view.getContentDescription(), Toast.LENGTH_SHORT);
            toast.setGravity(Gravity.BOTTOM | Gravity.END,
                    screenWidth - screenPos[0] - width / 2,
                    screenHeight - screenPos[1]);
            toast.show();
            return true;
        }
    });
    return button;
}
项目:boohee_v5.6    文件:BaseTimelineAdapter.java   
protected void initTimeAndBody(TextView timeText, TextView bodyText, final Post post) {
    timeText.setText(DateHelper.timezoneFormat(post.created_at, "MM-dd HH:mm"));
    bodyText.setOnLongClickListener(new OnLongClickListener() {
        public boolean onLongClick(View v) {
            TimeLineUtility.copyText(BaseTimelineAdapter.this.activity, post.body);
            Helper.showToast(BaseTimelineAdapter.this.activity, (CharSequence) "内容已复制到剪切板");
            return true;
        }
    });
    TimeLineUtility.addLinksWithShowMore(bodyText, post);
}
项目:GravityBox    文件:BaseTile.java   
@Override
public void onDualModeSet(View tileView, boolean enabled) {
    if (enabled) {
        View bgView = (View) XposedHelpers.getObjectField(tileView, "mTopBackgroundView");
        bgView.setOnLongClickListener((OnLongClickListener) 
                XposedHelpers.getObjectField(tileView, "mLongClick"));
    }
}
项目:TAG    文件:MessageAdapter.java   
/**
 * 文本消息
 * 
 * @param message
 * @param holder
 * @param position
 */
private void handleTextMessage(EMMessage message, ViewHolder holder, final int position) {
    TextMessageBody txtBody = (TextMessageBody) message.getBody();
    Spannable span = SmileUtils.getSmiledText(context, txtBody.getMessage());
    holder.tv.setText(span, BufferType.SPANNABLE);
    holder.tv.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            activity.startActivityForResult(
                    (new Intent(activity, ContextMenu.class)).putExtra("position", position).putExtra("type",
                            EMMessage.Type.TXT.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU);
            return true;
        }
    });
    if (message.direct == EMMessage.Direct.SEND) {
        switch (message.status) {
        case SUCCESS:
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        case FAIL:
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.VISIBLE);
            break;
        case INPROGRESS: //发送中
            holder.pb.setVisibility(View.VISIBLE);
            break;
        default:
            sendMsgInBackground(message, holder);
        }
    }
}
项目:TAG    文件:MessageAdapter.java   
/**
 * 处理位置消息
 * 
 * @param message
 * @param holder
 * @param position
 * @param convertView
 */
private void handleLocationMessage(final EMMessage message, final ViewHolder holder, final int position, View convertView) {
    TextView locationView = ((TextView) convertView.findViewById(R.id.tv_location));
    LocationMessageBody locBody = (LocationMessageBody) message.getBody();
    locationView.setText(locBody.getAddress());
    LatLng loc = new LatLng(locBody.getLatitude(), locBody.getLongitude());
    locationView.setOnClickListener(new MapClickListener(loc, locBody.getAddress()));
    locationView.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            activity.startActivityForResult(
                    (new Intent(activity, ContextMenu.class)).putExtra("position", position).putExtra("type",
                            EMMessage.Type.LOCATION.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU);
            return false;
        }
    });

    if (message.direct == EMMessage.Direct.RECEIVE) {
        return;
    }
    // deal with send message
    switch (message.status) {
    case SUCCESS:
        holder.pb.setVisibility(View.GONE);
        holder.staus_iv.setVisibility(View.GONE);
        break;
    case FAIL:
        holder.pb.setVisibility(View.GONE);
        holder.staus_iv.setVisibility(View.VISIBLE);
        break;
    case INPROGRESS:
        holder.pb.setVisibility(View.VISIBLE);
        break;
    default:
        sendMsgInBackground(message, holder);
    }
}
项目:TAG    文件:MessageAdapter_0907.java   
/**
 * 文本消息
 * 
 * @param message
 * @param holder
 * @param position
 */
private void handleTextMessage(EMMessage message, ViewHolder holder, final int position) {
    TextMessageBody txtBody = (TextMessageBody) message.getBody();
    Spannable span = SmileUtils.getSmiledText(context, txtBody.getMessage());
    holder.tv.setText(span, BufferType.SPANNABLE);
    holder.tv.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            activity.startActivityForResult(
                    (new Intent(activity, ContextMenu.class)).putExtra("position", position).putExtra("type",
                            EMMessage.Type.TXT.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU);
            return true;
        }
    });
    if (message.direct == EMMessage.Direct.SEND) {
        switch (message.status) {
        case SUCCESS:
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        case FAIL:
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.VISIBLE);
            break;
        case INPROGRESS: //发送中
            holder.pb.setVisibility(View.VISIBLE);
            break;
        default:
            sendMsgInBackground(message, holder);
        }
    }
}
项目:TAG    文件:MessageAdapter_0907.java   
/**
 * 处理位置消息
 * 
 * @param message
 * @param holder
 * @param position
 * @param convertView
 */
private void handleLocationMessage(final EMMessage message, final ViewHolder holder, final int position, View convertView) {
    TextView locationView = ((TextView) convertView.findViewById(R.id.tv_location));
    LocationMessageBody locBody = (LocationMessageBody) message.getBody();
    locationView.setText(locBody.getAddress());
    LatLng loc = new LatLng(locBody.getLatitude(), locBody.getLongitude());
    locationView.setOnClickListener(new MapClickListener(loc, locBody.getAddress()));
    locationView.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            activity.startActivityForResult(
                    (new Intent(activity, ContextMenu.class)).putExtra("position", position).putExtra("type",
                            EMMessage.Type.LOCATION.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU);
            return false;
        }
    });

    if (message.direct == EMMessage.Direct.RECEIVE) {
        return;
    }
    // deal with send message
    switch (message.status) {
    case SUCCESS:
        holder.pb.setVisibility(View.GONE);
        holder.staus_iv.setVisibility(View.GONE);
        break;
    case FAIL:
        holder.pb.setVisibility(View.GONE);
        holder.staus_iv.setVisibility(View.VISIBLE);
        break;
    case INPROGRESS:
        holder.pb.setVisibility(View.VISIBLE);
        break;
    default:
        sendMsgInBackground(message, holder);
    }
}
项目:AndroidChromium    文件:CustomButtonParams.java   
/**
 * Builds an {@link ImageButton} from the data in this params. Generated buttons should be
 * placed on the bottom bar. The button's tag will be its id.
 * @param parent The parent that the inflated {@link ImageButton}.
 * @param listener {@link OnClickListener} that should be used with the button.
 * @return Parsed list of {@link CustomButtonParams}, which is empty if the input is invalid.
 */
ImageButton buildBottomBarButton(Context context, ViewGroup parent, OnClickListener listener) {
    if (mIsOnToolbar) return null;

    ImageButton button = (ImageButton) LayoutInflater.from(context)
            .inflate(R.layout.custom_tabs_bottombar_item, parent, false);
    button.setId(mId);
    button.setImageBitmap(mIcon);
    button.setContentDescription(mDescription);
    if (mPendingIntent == null) {
        button.setEnabled(false);
    } else {
        button.setOnClickListener(listener);
    }
    button.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {
            final int screenWidth = view.getResources().getDisplayMetrics().widthPixels;
            final int screenHeight = view.getResources().getDisplayMetrics().heightPixels;
            final int[] screenPos = new int[2];
            view.getLocationOnScreen(screenPos);
            final int width = view.getWidth();

            Toast toast = Toast.makeText(
                    view.getContext(), view.getContentDescription(), Toast.LENGTH_SHORT);
            toast.setGravity(Gravity.BOTTOM | Gravity.END,
                    screenWidth - screenPos[0] - width / 2,
                    screenHeight - screenPos[1]);
            toast.show();
            return true;
        }
    });
    return button;
}
项目:AbacusUtil    文件:Observer.java   
public Disposable onLongClick(final OnLongClickListener onNext, final Consumer<? super Exception> onError, final Runnable onComplete) {
    N.requireNonNull(onNext, "onNext");
    N.requireNonNull(onError, "onError");
    N.requireNonNull(onComplete, "onComplete");

    dispatcher.append(new DispatcherBase<Object>(onError, onComplete) {
        @Override
        public void onNext(Object param) {
            final View tmp = (View) param;

            if (Fu.isUiThread()) {
                onNext.onLongClick(tmp);
            } else {
                UIExecutor.execute(new Runnable() {
                    @Override
                    public void run() {
                        onNext.onLongClick(tmp);
                    }
                });
            }
        }
    });

    _view.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {
            dispatcher.onNext(view);
            return true;
        };
    });

    disposeActions.add(new Runnable() {
        @Override
        public void run() {
            _view.setOnLongClickListener(null);
        }
    });

    return this;
}
项目:info_demo    文件:MessageAdapter.java   
/**
 * 文本消息
 * 
 * @param message
 * @param holder
 * @param position
 */
private void handleTextMessage(EMMessage message, ViewHolder holder, final int position) {
    TextMessageBody txtBody = (TextMessageBody) message.getBody();
    Spannable span = HXSmileUtils.getSmiledText(context, txtBody.getMessage());
    // 设置内容
    holder.tv.setText(span, BufferType.SPANNABLE);
    // 设置长按事件监听
    holder.tv.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            activity.startActivityForResult(
                    (new Intent(activity, ContextMenu.class)).putExtra("position", position).putExtra("type",
                            EMMessage.Type.TXT.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU);
            return true;
        }
    });

    if (message.direct == EMMessage.Direct.SEND) {
        switch (message.status) {
        case SUCCESS: // 发送成功
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        case FAIL: // 发送失败
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.VISIBLE);
            break;
        case INPROGRESS: // 发送中
            holder.pb.setVisibility(View.VISIBLE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        default:
            // 发送消息
            sendMsgInBackground(message, holder);
        }
    }
}
项目:info_demo    文件:MessageAdapter.java   
/**
     * 处理位置消息
     * 
     * @param message
     * @param holder
     * @param position
     * @param convertView
     */
    private void handleLocationMessage(final EMMessage message, final ViewHolder holder, final int position, View convertView) {
        TextView locationView = ((TextView) convertView.findViewById(R.id.tv_location));
        LocationMessageBody locBody = (LocationMessageBody) message.getBody();
        locationView.setText(locBody.getAddress());
        LatLng loc = new LatLng(locBody.getLatitude(), locBody.getLongitude());
//      locationView.setOnClickListener(new MapClickListener(loc, locBody.getAddress()));
        locationView.setOnLongClickListener(new OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                activity.startActivityForResult(
                        (new Intent(activity, ContextMenu.class)).putExtra("position", position).putExtra("type",
                                EMMessage.Type.LOCATION.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU);
                return false;
            }
        });

        if (message.direct == EMMessage.Direct.RECEIVE) {
            return;
        }
        // deal with send message
        switch (message.status) {
        case SUCCESS:
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        case FAIL:
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.VISIBLE);
            break;
        case INPROGRESS:
            holder.pb.setVisibility(View.VISIBLE);
            break;
        default:
            sendMsgInBackground(message, holder);
        }
    }
项目:lr_dialer    文件:AbstractAQuery.java   
/**
 * Register a callback method for when the view is long clicked.
 *
 * @param listener The callback method.
 * @return self
 */
public T longClicked(OnLongClickListener listener)
{
    if (view != null)
    {
        view.setOnLongClickListener(listener);
    }
    return self();
}
项目:ExoPlayerDemo    文件:AbstractAQuery.java   
/**
 * Register a callback method for when the view is long clicked. 
 *
 * @param listener The callback method.
 * @return self
 */
public T longClicked(OnLongClickListener listener){

    if(view != null){                       
        view.setOnLongClickListener(listener);
    }

    return self();
}
项目:AndroidAdapters    文件:AbstractExpandableListAdapter.java   
/**
 * Creates and returns an {@link OnLongClickListener}, which is invoked, when a group item of
 * the adapter has been long-clicked.
 *
 * @param groupIndex
 *         The index of the group item, which has been long-clicked, as an {@link Integer}
 *         value
 * @return The listener, which has been created, as an instance of the type {@link
 * OnLongClickListener}
 */
private OnLongClickListener createRecyclerViewOnGroupLongClickListener(final int groupIndex) {
    return new OnLongClickListener() {

        @Override
        public boolean onLongClick(final View v) {
            GroupType group = getGroup(groupIndex);
            return notifyOnGroupLongClicked(group, groupIndex);
        }

    };
}
项目:AndroidAdapters    文件:AbstractExpandableListAdapter.java   
/**
 * Creates and returns an {@link OnLongClickListener}, which is invoked, when a child item of
 * the adapter has been long-clicked.
 *
 * @param groupIndex
 *         The index of the group, the child item, which has been long-clicked, belongs to, as
 *         an {@link Integer} value
 * @param childIndex
 *         The index of the child item which has been long-clicked, as an {@link Integer} value
 * @return The listener, which has been created, as an instance of the type {@link
 * OnLongClickListener}
 */
private OnLongClickListener createRecyclerViewOnChildLongClickListener(final int groupIndex,
                                                                       final int childIndex) {
    return new OnLongClickListener() {

        @Override
        public boolean onLongClick(final View v) {
            GroupType group = getGroup(groupIndex);
            ChildType child = getChild(groupIndex, childIndex);
            return notifyOnChildLongClicked(child, childIndex, group, groupIndex);
        }

    };
}
项目:AndroidAdapters    文件:AbstractListAdapter.java   
/**
 * Creates and returns an {@link OnClickListener}, which is invoked, when a specific item has
 * been long-clicked.
 *
 * @param index
 *         The index of the item, wihch should cause the listener to be invoked, when
 *         long-clicked, as an {@link Integer} value
 * @return The listener, which has been created, as an instance of the type {@link
 * OnLongClickListener}
 */
private OnLongClickListener createItemOnLongClickListener(final int index) {
    return new OnLongClickListener() {

        @Override
        public boolean onLongClick(final View v) {
            return notifyOnItemLongClicked(getItem(index), index);
        }

    };
}
项目:FMTech    文件:MyAppsLibraryAdapter.java   
public MyAppsLibraryAdapter(AuthenticatedActivity paramAuthenticatedActivity, NavigationManager paramNavigationManager, DfeToc paramDfeToc, Libraries paramLibraries, PackageStateRepository paramPackageStateRepository, Installer paramInstaller, BitmapLoader paramBitmapLoader, View.OnClickListener paramOnClickListener, PlayCardViewMyApps.OnArchiveActionListener paramOnArchiveActionListener, View.OnLongClickListener paramOnLongClickListener, PlayStoreUiElementNode paramPlayStoreUiElementNode)
{
  super(paramAuthenticatedActivity, paramNavigationManager);
  this.mBitmapLoader = paramBitmapLoader;
  this.mOnClickListener = paramOnClickListener;
  this.mOnArchiveActionListener = paramOnArchiveActionListener;
  this.mOnLongClickListener = paramOnLongClickListener;
  this.mParentNode = paramPlayStoreUiElementNode;
  this.mIsMultiChoiceMode = false;
  this.mToc = paramDfeToc;
  this.mLibraries = paramLibraries;
  this.mPackageStateRepository = paramPackageStateRepository;
  this.mInstaller = paramInstaller;
  this.mLeadingSpacerHeight = FinskyHeaderListLayout.getMinimumHeaderHeight$3047fd86(paramAuthenticatedActivity, 0);
}
项目:FMTech    文件:NewsstandArticleRenderer.java   
private NewsstandArticleRenderer(Context paramContext, byte paramByte)
{
  super(paramContext, null, 0);
  setWebChromeClient(new WebChromeClient());
  setWebViewClient(new NewsstandWebViewClient((byte)0));
  WebSettings localWebSettings = getSettings();
  localWebSettings.setAllowFileAccess(false);
  localWebSettings.setAppCacheEnabled(false);
  localWebSettings.setCacheMode(2);
  localWebSettings.setDatabaseEnabled(false);
  localWebSettings.setDomStorageEnabled(true);
  localWebSettings.setJavaScriptEnabled(true);
  localWebSettings.setPluginState(WebSettings.PluginState.OFF);
  localWebSettings.setSupportZoom(true);
  localWebSettings.setUseWideViewPort(true);
  localWebSettings.setLoadWithOverviewMode(false);
  localWebSettings.setUserAgentString(localWebSettings.getUserAgentString() + " OnyxArticleView/1.0");
  if (!sDidSetRenderPriority)
  {
    sDidSetRenderPriority = true;
    localWebSettings.setRenderPriority(WebSettings.RenderPriority.HIGH);
  }
  setOnLongClickListener(new View.OnLongClickListener()
  {
    public final boolean onLongClick(View paramAnonymousView)
    {
      return true;
    }
  });
}
项目:DroidShows    文件:ViewSerie.java   
public void posterView(View v) {
    if (!posterLoaded) {
        posterView = (WebView) findViewById(R.id.posterView);
        if (posterURL.isEmpty() || posterURL.equalsIgnoreCase("null")) {
            if (!fanartURL.isEmpty() && !fanartURL.equalsIgnoreCase("null")) {
                posterURL = fanartURL;
            } else {
                return;
            }
        }
        if (fanartURL.isEmpty() || fanartURL.equalsIgnoreCase("null"))
            fanartURL = posterURL;

        posterView.getSettings().setBuiltInZoomControls(true);
        posterView.getSettings().setLoadWithOverviewMode(true);
        posterView.getSettings().setUseWideViewPort(true);
        posterView.loadData(getURL(posterURL, "ds:fanart"), "text/html", "UTF-8");
        posterView.setBackgroundColor(Color.BLACK);
        posterView.setInitialScale(1);
        posterView.setOverScrollMode(View.OVER_SCROLL_NEVER);
        posterView.setWebViewClient(new WebViewHandler());
        posterView.setLongClickable(true);
        posterView.setOnLongClickListener(new OnLongClickListener() {
            public boolean onLongClick(View arg0) {
                HitTestResult hit = posterView.getHitTestResult();
                if (hit.getType() == HitTestResult.IMAGE_TYPE ||
                        hit.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
                    Intent extViewIntent = new Intent();
                    extViewIntent.setAction(Intent.ACTION_VIEW);
                    extViewIntent.setDataAndType(Uri.parse(hit.getExtra()), "image/*");
                    startActivity(extViewIntent);
                }
                return true;
            }
        });
        posterLoaded = true;
    }
    posterView.setVisibility(View.VISIBLE);
}
项目:flying-photo-booth    文件:KioskActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mKioskModeHelper = new KioskModeHelper(this);
    mPreferencesHelper = new PreferencesHelper();
    mCurrentFrame = 1;
    mTotalFrames = mPreferencesHelper.getPhotoStripTemplate(this).getNumPhotos();

    // Show on top of lock screen.
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);

    setContentView(R.layout.activity_kiosk);

    // Configure button to exit Kiosk mode.
    ImageView exitButton = (ImageView) findViewById(R.id.kiosk_exit_button);
    mFlashScreen = findViewById(R.id.flash_screen);
    exitButton.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            if (mKioskModeHelper.isPasswordRequired()) {
                showDialogFragment(KioskPasswordDialogFragment.newInstance());
            } else {
                exitKioskMode();
            }
            return true;
        }
    });
}
项目:365browser    文件:CustomButtonParams.java   
/**
 * Builds an {@link ImageButton} from the data in this params. Generated buttons should be
 * placed on the bottom bar. The button's tag will be its id.
 * @param parent The parent that the inflated {@link ImageButton}.
 * @param listener {@link OnClickListener} that should be used with the button.
 * @return Parsed list of {@link CustomButtonParams}, which is empty if the input is invalid.
 */
ImageButton buildBottomBarButton(Context context, ViewGroup parent, OnClickListener listener) {
    if (mIsOnToolbar) return null;

    ImageButton button = (ImageButton) LayoutInflater.from(context)
            .inflate(R.layout.custom_tabs_bottombar_item, parent, false);
    button.setId(mId);
    button.setImageBitmap(mIcon);
    button.setContentDescription(mDescription);
    if (mPendingIntent == null) {
        button.setEnabled(false);
    } else {
        button.setOnClickListener(listener);
    }
    button.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {
            final int screenWidth = view.getResources().getDisplayMetrics().widthPixels;
            final int screenHeight = view.getResources().getDisplayMetrics().heightPixels;
            final int[] screenPos = new int[2];
            view.getLocationOnScreen(screenPos);
            final int width = view.getWidth();

            Toast toast = Toast.makeText(
                    view.getContext(), view.getContentDescription(), Toast.LENGTH_SHORT);
            toast.setGravity(Gravity.BOTTOM | Gravity.END,
                    screenWidth - screenPos[0] - width / 2,
                    screenHeight - screenPos[1]);
            toast.show();
            return true;
        }
    });
    return button;
}
项目:Decor    文件:OnLongClickDecorator.java   
@Override
protected void apply(View view, final TypedArray typedArray) {
    view.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            onAction(typedArray.getString(R.styleable.OnLongClickDecorator_decorOnLongClick));
            return true;
        }
    });
}
项目:school_shop    文件:MessageAdapter.java   
/**
 * 文本消息
 * 
 * @param message
 * @param holder
 * @param position
 */
private void handleTextMessage(EMMessage message, ViewHolder holder, final int position) {
    TextMessageBody txtBody = (TextMessageBody) message.getBody();
    Spannable span = SmileUtils.getSmiledText(context, txtBody.getMessage());
    // 设置内容
    holder.tv.setText(span, BufferType.SPANNABLE);
    // 设置长按事件监听
    holder.tv.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            activity.startActivityForResult(
                    (new Intent(activity, ContextMenu.class)).putExtra("position", position).putExtra("type",
                            EMMessage.Type.TXT.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU);
            return true;
        }
    });

    if (message.direct == EMMessage.Direct.SEND) {
        switch (message.status) {
        case SUCCESS: // 发送成功
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        case FAIL: // 发送失败
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.VISIBLE);
            break;
        case INPROGRESS: // 发送中
            holder.pb.setVisibility(View.VISIBLE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        default:
            // 发送消息
            sendMsgInBackground(message, holder);
        }
    }
}
项目:Overchan-Android    文件:FixedLinkMovementMethod.java   
@Override
public void initialize(TextView widget, final Spannable text) {
    widget.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            skipNextClick = true;
            Selection.removeSelection(text);
            return false;
        }
    });
    super.initialize(widget, text);
}
项目:connectedteam-android    文件:TabLayout.java   
private void updateTextAndIcon(TabLayout.Tab tab, TextView textView, ImageView iconView) {
    Drawable icon = tab.getIcon();
    CharSequence text = tab.getText();
    if(iconView != null) {
        if(icon != null) {
            iconView.setImageDrawable(icon);
            iconView.setVisibility(0);
            this.setVisibility(0);
        } else {
            iconView.setVisibility(8);
            iconView.setImageDrawable((Drawable)null);
        }

        iconView.setContentDescription(tab.getContentDescription());
    }

    boolean hasText = !TextUtils.isEmpty(text);
    if(textView != null) {
        if(hasText) {
            textView.setText(text);
            textView.setContentDescription(tab.getContentDescription());
            textView.setVisibility(0);
            this.setVisibility(0);
        } else {
            textView.setVisibility(8);
            textView.setText((CharSequence)null);
        }
    }

    if(!hasText && !TextUtils.isEmpty(tab.getContentDescription())) {
        this.setOnLongClickListener(this);
    } else {
        this.setOnLongClickListener((OnLongClickListener)null);
        this.setLongClickable(false);
    }

}
项目:android-discourse    文件:HintedImageBtn.java   
@Override
public void setOnLongClickListener(OnLongClickListener l) {
    if (l == this) {
        super.setOnLongClickListener(l);
        return;
    }

    mOnLongClickListener = l;
}
项目:here    文件:MessageAdapter.java   
/**
 * 文本消息
 * 
 * @param message
 * @param holder
 * @param position
 */
private void handleTextMessage(EMMessage message, ViewHolder holder, final int position) {
    TextMessageBody txtBody = (TextMessageBody) message.getBody();
    Spannable span = SmileUtils.getSmiledText(context, txtBody.getMessage());
    // 设置内容
    holder.tv.setText(span, BufferType.SPANNABLE);
    // 设置长按事件监听
    holder.tv.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            activity.startActivityForResult(
                    (new Intent(activity, ContextMenu.class)).putExtra("position", position).putExtra("type",
                            Type.TXT.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU);
            return true;
        }
    });

    if (message.direct == Direct.SEND) {
        switch (message.status) {
        case SUCCESS: // 发送成功
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        case FAIL: // 发送失败
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.VISIBLE);
            break;
        case INPROGRESS: // 发送中
            holder.pb.setVisibility(View.VISIBLE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        default:
            // 发送消息
            sendMsgInBackground(message, holder);
        }
    }
}
项目:here    文件:MessageAdapter.java   
/**
 * 处理位置消息
 * 
 * @param message
 * @param holder
 * @param position
 * @param convertView
 */
private void handleLocationMessage(final EMMessage message, final ViewHolder holder, final int position, View convertView) {
    TextView locationView = ((TextView) convertView.findViewById(R.id.tv_location));
    LocationMessageBody locBody = (LocationMessageBody) message.getBody();
    locationView.setText(locBody.getAddress());
    LatLng loc = new LatLng(locBody.getLatitude(), locBody.getLongitude());
    locationView.setOnClickListener(new MapClickListener(loc, locBody.getAddress()));
    locationView.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            activity.startActivityForResult(
                    (new Intent(activity, ContextMenu.class)).putExtra("position", position).putExtra("type",
                            Type.LOCATION.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU);
            return false;
        }
    });

    if (message.direct == Direct.RECEIVE) {
        return;
    }
    // deal with send message
    switch (message.status) {
    case SUCCESS:
        holder.pb.setVisibility(View.GONE);
        holder.staus_iv.setVisibility(View.GONE);
        break;
    case FAIL:
        holder.pb.setVisibility(View.GONE);
        holder.staus_iv.setVisibility(View.VISIBLE);
        break;
    case INPROGRESS:
        holder.pb.setVisibility(View.VISIBLE);
        break;
    default:
        sendMsgInBackground(message, holder);
    }
}