当前位置: 首页>>代码示例>>Java>>正文


Java OnLongClickListener类代码示例

本文整理汇总了Java中android.view.View.OnLongClickListener的典型用法代码示例。如果您正苦于以下问题:Java OnLongClickListener类的具体用法?Java OnLongClickListener怎么用?Java OnLongClickListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OnLongClickListener类属于android.view.View包,在下文中一共展示了OnLongClickListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bindEvent

import android.view.View.OnLongClickListener; //导入依赖的package包/类
/**
 * 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;
		}
	});
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:29,代码来源:RecyclerViewAdapter.java

示例2: ServerViewHolder

import android.view.View.OnLongClickListener; //导入依赖的package包/类
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);
}
 
开发者ID:OpenSageTV,项目名称:sagetv-miniclient,代码行数:22,代码来源:ServerItemPresenter.java

示例3: setupChildView

import android.view.View.OnLongClickListener; //导入依赖的package包/类
@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;
  }
 
开发者ID:Daniele-Comi,项目名称:System-Monitor,代码行数:22,代码来源:GeneralInfoCard.java

示例4: bindText

import android.view.View.OnLongClickListener; //导入依赖的package包/类
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;
		}
	});
}
 
开发者ID:Gotye-QPlus,项目名称:GotyeSDK-Android,代码行数:23,代码来源:GotyeMessageListAdapter.java

示例5: getView

import android.view.View.OnLongClickListener; //导入依赖的package包/类
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;
 }
 
开发者ID:sechat,项目名称:android_chat,代码行数:27,代码来源:MessageAdapter.java

示例6: init

import android.view.View.OnLongClickListener; //导入依赖的package包/类
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;
		}
	});
}
 
开发者ID:simplelifetian,项目名称:GomeOnline,代码行数:17,代码来源:ReplyMediaRecordActivity.java

示例7: handleInitPackageResources

import android.view.View.OnLongClickListener; //导入依赖的package包/类
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;			
					}
				}
			});
        }
    });
}
 
开发者ID:DHM47,项目名称:Native-Clip-Board,代码行数:26,代码来源:XposedMod.java

示例8: setAbilityWidgetListener

import android.view.View.OnLongClickListener; //导入依赖的package包/类
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;
    }
  });
}
 
开发者ID:aniketschneider,项目名称:dw-charsheet,代码行数:17,代码来源:CharacterSheetFragment.java

示例9: showTutorial

import android.view.View.OnLongClickListener; //导入依赖的package包/类
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;
            }
        });
    }
}
 
开发者ID:SecrecySupportTeam,项目名称:secrecy,代码行数:25,代码来源:VaultsListFragment.java

示例10: setEditTextLongClick

import android.view.View.OnLongClickListener; //导入依赖的package包/类
/**
 * 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;
        }
    });
}
 
开发者ID:yankovskiy,项目名称:PhotoTools,代码行数:26,代码来源:SunsetFragment.java

示例11: getTab

import android.view.View.OnLongClickListener; //导入依赖的package包/类
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;
}
 
开发者ID:tallnato,项目名称:EmentasUA,代码行数:25,代码来源:EmentasUA.java

示例12: onCreate

import android.view.View.OnLongClickListener; //导入依赖的package包/类
@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();
}
 
开发者ID:selendroid,项目名称:selendroid,代码行数:17,代码来源:HomeScreenActivity.java

示例13: buildBottomBarButton

import android.view.View.OnLongClickListener; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:41,代码来源:CustomButtonParams.java

示例14: initTimeAndBody

import android.view.View.OnLongClickListener; //导入依赖的package包/类
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);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:12,代码来源:BaseTimelineAdapter.java

示例15: onDualModeSet

import android.view.View.OnLongClickListener; //导入依赖的package包/类
@Override
public void onDualModeSet(View tileView, boolean enabled) {
    if (enabled) {
        View bgView = (View) XposedHelpers.getObjectField(tileView, "mTopBackgroundView");
        bgView.setOnLongClickListener((OnLongClickListener) 
                XposedHelpers.getObjectField(tileView, "mLongClick"));
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:9,代码来源:BaseTile.java


注:本文中的android.view.View.OnLongClickListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。