Java Code Examples for android.widget.LinearLayout.setOnLongClickListener()

The following are Jave code examples for showing how to use setOnLongClickListener() of the android.widget.LinearLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: buildAPKsApps   File: LinkSettingRenderer.java   View Source Code Vote up 6 votes
public View getView(LayoutInflater inflater, Setting setting, View convertView, Context context) {
	
	if (mView != null) return mView;
	mView = convertView = inflater.inflate(R.layout.row_setting_link, null);
	
	// re-initialize views
	mTitle = (TextView) convertView.findViewById(R.id.title_view);
	mDescr = (TextView) convertView.findViewById(R.id.descr_view);
	mIcon = (ImageView) convertView.findViewById(R.id.icon_view);
	LinearLayout clicableLeft = (LinearLayout) convertView.findViewById(R.id.clickable_left);

	// set values
	mSetting = setting;
	
	// set listeners
	clicableLeft.setOnClickListener(this);
	clicableLeft.setOnLongClickListener(setting.prefs == null ? null : this);

	// update view
	updateView();
	
	return convertView;
}
 
Example 2
Project: IdeaTrackerPlus   File: HorizontalAdapter.java   View Source Code Vote up 6 votes
private void setupIdeaTile(MyViewHolder holder, LinearLayout container) {
    holder.txtView.setSingleLine();
    holder.txtView.setText(mIdea);
    holder.txtView.setGravity(Gravity.CENTER_VERTICAL | Gravity.START);

    if (mDarkTheme) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            container.setBackgroundResource(R.drawable.grey_ripple);
        } else {
            container.setBackgroundResource(R.color.md_grey_800);
        }
        holder.txtView.setTextColor(Color.WHITE);
    } else {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            container.setBackgroundResource(R.drawable.white_ripple);
        } else {
            container.setBackgroundResource(R.color.white);
        }
        holder.txtView.setTextColor(Color.BLACK);
    }

    //Listeners
    RecyclerOnClickListener listener = new RecyclerOnClickListener(mRecyclerView, mTabNumber);
    container.setOnClickListener(listener);
    container.setOnLongClickListener(mListener);
}
 
Example 3
Project: DailyZhiHu   File: DownloadAdapter.java   View Source Code Vote up 6 votes
public ContentRecyclerViewHolder(View itemView) {
    super(itemView);
    textView = (TextView) itemView.findViewById(R.id.recycler_title);
    bodyText = (TextView) itemView.findViewById(R.id.tv_content_id);
    imageView = (ImageView) itemView.findViewById(R.id.recycler_img);
    itemLayout = (LinearLayout) itemView.findViewById(R.id.recycler_item);

    itemLayout.setOnClickListener(this);
    itemLayout.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            titleData.remove(textView.getText().toString());
            notifyDataSetChanged();
            DataSupport.deleteAll(Artical.class, "articalTitle = ?" , textView.getText().toString());
            Toast.makeText(context, "删除成功", Toast.LENGTH_SHORT).show();
            return true;
        }
    });
}
 
Example 4
Project: Mire   File: AdapterWallpaper.java   View Source Code Vote up 5 votes
ViewHolder(View itemView)
{
	super(itemView);
	
	image = (SquareImageView)itemView.findViewById(R.id.id_image);
	layout_container = (LinearLayout)itemView.findViewById(R.id.id_container);
	title = (TextView)itemView.findViewById(R.id.id_title);
	text = (TextView)itemView.findViewById(R.id.id_text);
	open_image = (LinearLayout)itemView.findViewById(R.id.id_open_image);
	
	open_image.setOnClickListener(this);
	open_image.setOnLongClickListener(this);
}
 
Example 5
Project: buildAPKsApps   File: ToggleSettingRenderer.java   View Source Code Vote up 5 votes
public View getView(LayoutInflater inflater, Setting setting, View convertView, Context context) {

		// reuse if view exists
		if (mView != null) return mView;
		
		// create new view always. this is important for "dialog" mode
		mView = convertView = inflater.inflate(R.layout.row_setting_toggle, null); // inflate view of needed type
		
		// re-initialize views
		mTitle = (TextView) convertView.findViewById(R.id.title_view);
		mDescr = (TextView) convertView.findViewById(R.id.descr_view);
		mToggle = (ToggleButton) convertView.findViewById(R.id.clicable_right);
		mIcon = (ImageView) convertView.findViewById(R.id.icon_view);
		
		ImageButton button = (ImageButton) convertView.findViewById(R.id.popup_button);
		button.setVisibility(setting.hasPopup ? View.VISIBLE : View.GONE);
		LinearLayout clicableLeft = (LinearLayout) convertView.findViewById(R.id.clickable_left);
		
		// set listeners
		mToggle.setOnClickListener(this);
		button.setOnClickListener(this);
		clicableLeft.setOnClickListener(this);
		clicableLeft.setOnLongClickListener(setting.prefs == null ? null : this);

		// set values
		mSetting = setting;
		
		// update view
		updateView();
		
		return convertView;
	}