List of usage examples for android.appwidget AppWidgetHostView setOnLongClickListener
public void setOnLongClickListener(@Nullable OnLongClickListener l)
From source file:com.launcher.silverfish.HomeScreenFragment.java
private void placeWidget(AppWidgetHostView hostView) { FrameLayout widget_area = (FrameLayout) rootView.findViewById(R.id.widget_area); widget_area.removeAllViews();/* w w w . j a v a2 s.com*/ widget_area.addView(hostView); // Let the widget host view take control of the long click action. hostView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { selectWidget(); return true; } }); hostView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent event) { switch (MotionEventCompat.getActionMasked(event)) { case MotionEvent.ACTION_DOWN: updateTouchDown(event); break; case MotionEvent.ACTION_MOVE: tryConsumeSwipe(event); break; } return touchConsumed; } }); }
From source file:com.launcher.silverfish.launcher.homescreen.HomeScreenFragment.java
private void placeWidget(AppWidgetHostView hostView) { FrameLayout widget_area = (FrameLayout) rootView.findViewById(R.id.widget_area); widget_area.removeAllViews();//from w ww .ja v a 2 s . c o m widget_area.addView(hostView); // Let the widget host view take control of the long click action. hostView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { popupSelectWidget(); return true; } }); hostView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent event) { switch (MotionEventCompat.getActionMasked(event)) { case MotionEvent.ACTION_DOWN: updateTouchDown(event); break; case MotionEvent.ACTION_MOVE: tryConsumeSwipe(event); break; } return touchConsumed; } }); }