List of usage examples for android.view View setOnTouchListener
public void setOnTouchListener(OnTouchListener l)
From source file:com.aqtx.app.common.ui.viewpager.PagerSlidingTabStrip.java
private void addTabDoubleTapListener(final int position, View tab) { final GestureDetector gd = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() { @Override/*from w w w . ja v a 2s .c o m*/ public boolean onDoubleTap(MotionEvent e) { if (onTabDoubleTapListener != null) onTabDoubleTapListener.onCurrentTabDoubleTap(position); return true; } }); tab.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return gd.onTouchEvent(event); } }); }
From source file:com.admin.control.ab.AbSlidingPlayView.java
/** * ???./*w ww . j av a 2s .c o m*/ * * @param views the views */ public void addViews(List<View> views) { mListViews.addAll(views); for (View view : views) { view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mOnItemClickListener != null) { mOnItemClickListener.onClick(position); } } }); view.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent event) { if (mAbOnTouchListener != null) { mAbOnTouchListener.onTouch(event); } return false; } }); } mAbViewPagerAdapter.notifyDataSetChanged(); creatIndex(); }
From source file:com.rks.musicx.ui.fragments.PlayingViews.Playing2Fragment.java
@Override protected void ui(View rootView) { blur_artowrk = (ImageView) rootView.findViewById(R.id.blur_artwork); Pager = (ViewPager) rootView.findViewById(R.id.pagerPlaying4); songTitle = (TextView) rootView.findViewById(song_title); songArtist = (TextView) rootView.findViewById(song_artist); moreMenu = (ImageButton) rootView.findViewById(R.id.menu_button); favButton = (ImageButton) rootView.findViewById(R.id.action_favorite); queuerv = (RecyclerView) rootView.findViewById(R.id.commonrv); View coverView = LayoutInflater.from(getContext()).inflate(R.layout.playing2_coverview, null); View lyricsView = LayoutInflater.from(getContext()).inflate(R.layout.lyricsview, null); mPlayLayout = (PlayLayout) coverView.findViewById(R.id.revealView); lrcView = (TextView) lyricsView.findViewById(R.id.lyrics); coverView.setOnTouchListener(new GestureListerner() { @Override/*from w w w.j a va 2s . c o m*/ public void onRightToLeft() { } @Override public void onLeftToRight() { } @Override public void onBottomToTop() { } @Override public void onTopToBottom() { } @Override public void doubleClick() { if (getActivity() == null) { return; } ((PlayingActivity) getActivity()).onBackPressed(); } @Override public void singleClick() { } @Override public void otherFunction() { } }); Playing4PagerDetails = new ArrayList<>(2); Playing4PagerDetails.add(coverView); Playing4PagerDetails.add(lyricsView); PlayingPagerAdapter = new PlayingPagerAdapter(Playing4PagerDetails); Pager.setAdapter(PlayingPagerAdapter); }
From source file:de.sourcestream.movieDB.controller.TVDetailsInfo.java
/** * Called to have the fragment instantiate its user interface view. * * @param inflater sets the layout for the current view. * @param container the container which holds the current view. * @param savedInstanceState If non-null, this fragment is being re-constructed from a previous saved state as given here. * Return the View for the fragment's UI, or null. *//*w w w.ja v a 2 s .c o m*/ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); rootView = inflater.inflate(R.layout.tvdetailsinfo, container, false); activity = ((MainActivity) getActivity()); backDropPath = (ImageView) rootView.findViewById(R.id.backDropPath); title = (TextView) rootView.findViewById(R.id.title); posterPath = (ImageView) rootView.findViewById(R.id.posterPath); statusText = (TextView) rootView.findViewById(R.id.status); typeText = (TextView) rootView.findViewById(R.id.type); episodeRuntime = (TextView) rootView.findViewById(R.id.episodeRuntime); numberOfEpisodesText = (TextView) rootView.findViewById(R.id.numberOfEpisodes); numberOfSeasonsText = (TextView) rootView.findViewById(R.id.numberOfSeasons); firstAirDateText = (TextView) rootView.findViewById(R.id.firstAirDate); lastAirDateText = (TextView) rootView.findViewById(R.id.lastAirDate); genres = (TextView) rootView.findViewById(R.id.genres); countries = (TextView) rootView.findViewById(R.id.countries); companies = (TextView) rootView.findViewById(R.id.companies); ratingBar = (RatingBar) rootView.findViewById(R.id.ratingBar); voteCount = (TextView) rootView.findViewById(R.id.voteCount); homeIcon = (CircledImageView) rootView.findViewById(R.id.homeIcon); homeIcon.setVisibility(View.INVISIBLE); homeIcon.bringToFront(); galleryIcon = (CircledImageView) rootView.findViewById(R.id.galleryIcon); galleryIcon.setVisibility(View.INVISIBLE); galleryIcon.bringToFront(); // Highest Z-index has to be declared last moreIcon = (CircledImageView) rootView.findViewById(R.id.moreIcon); moreIcon.bringToFront(); scrollView = (ObservableParallaxScrollView) rootView.findViewById(R.id.tvdetailsinfo); tvDetailsSimilarGrid = (GridView) rootView.findViewById(R.id.tvDetailsSimilarGrid); similarHolder = rootView.findViewById(R.id.similarHolder); View detailsLayout = rootView.findViewById(R.id.detailsLayout); ViewCompat.setElevation(detailsLayout, 2 * getResources().getDisplayMetrics().density); ViewCompat.setElevation(moreIcon, 2 * getResources().getDisplayMetrics().density); ViewCompat.setElevation(homeIcon, 2 * getResources().getDisplayMetrics().density); ViewCompat.setElevation(galleryIcon, 2 * getResources().getDisplayMetrics().density); // Prevent event bubbling else if you touch on the details layout when the info tab is scrolled it will open gallery view detailsLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); return rootView; }
From source file:com.syncedsynapse.kore2.ui.NowPlayingFragment.java
private void setupVolumeRepeatButton(View button, final ApiMethod<Integer> action) { button.setOnTouchListener(new RepeatListener(UIUtils.initialButtonRepeatInterval, UIUtils.buttonRepeatInterval, new View.OnClickListener() { @Override//from w ww . ja v a 2 s . c om public void onClick(View v) { action.execute(hostManager.getConnection(), defaultIntActionCallback, callbackHandler); } })); }
From source file:com.kircherelectronics.accelerationfilter.activity.AccelerationPlotActivity.java
/** * Initialize the plots.//from ww w .jav a 2s . co m */ private void initPlots() { View view = findViewById(R.id.ScrollView01); view.setOnTouchListener(this); // Create the graph plot XYPlot plot = (XYPlot) findViewById(R.id.plot_sensor); plot.setTitle("Acceleration"); dynamicPlot = new DynamicLinePlot(plot); dynamicPlot.setMaxRange(21); dynamicPlot.setMinRange(-21); // setup the APR Levels plot: XYPlot noiseLevelsPlot = (XYPlot) findViewById(R.id.plot_noise); noiseLevelsPlot.setTitle("Noise"); barPlot = new DynamicBarPlot(noiseLevelsPlot, "Sensor Noise"); addAccelerationPlot(); addLPFPlot(); addMeanFilterPlot(); }
From source file:com.google.android.apps.muzei.MuzeiActivity.java
@TargetApi(Build.VERSION_CODES.KITKAT) private void setupOverflowButton() { final View overflowButton = findViewById(R.id.overflow_button); mOverflowMenu = new PopupMenu(this, overflowButton); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { overflowButton.setOnTouchListener(mOverflowMenu.getDragToOpenListener()); }/*from w w w . ja v a 2s. c o m*/ overflowButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mOverflowMenuVisible = true; mOverflowMenu.show(); } }); mOverflowMenu.setOnDismissListener(new PopupMenu.OnDismissListener() { @Override public void onDismiss(PopupMenu popupMenu) { mOverflowMenuVisible = false; } }); mOverflowMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { int id = mOverflowSourceActionMap.get(menuItem.getItemId()); if (id > 0) { mSourceManager.sendAction(id); return true; } switch (menuItem.getItemId()) { case R.id.action_settings: startActivity(new Intent(MuzeiActivity.this, SettingsActivity.class)); return true; } return false; } }); }
From source file:com.linkbubble.ui.BubbleFlowView.java
public void add(View view, boolean insertNextToCenterItem) { //view.setBackgroundColor(mViews.size() % 2 == 0 ? 0xff660066 : 0xff666600); view.setOnClickListener(mViewOnClickListener); view.setOnTouchListener(mViewOnTouchListener); int centerIndex = getCenterIndex(); int insertAtIndex = insertNextToCenterItem ? centerIndex + 1 : mViews.size(); if (view.getParent() != null) { ((ViewGroup) view.getParent()).removeView(view); }//from w ww. j a v a 2 s . c om FrameLayout.LayoutParams lp = new LayoutParams(mItemWidth, mItemHeight, Gravity.TOP | Gravity.LEFT); lp.leftMargin = mEdgeMargin + insertAtIndex * mItemWidth; mContent.addView(view, lp); mContent.invalidate(); if (insertNextToCenterItem) { mViews.add(centerIndex + 1, view); } else { mViews.add(view); } updatePositions(); updateScales(getScrollX()); if (insertNextToCenterItem) { TranslateAnimation slideOnAnim = new TranslateAnimation(0, 0, -mItemHeight, 0); slideOnAnim.setDuration(Constant.BUBBLE_FLOW_ANIM_TIME); slideOnAnim.setFillAfter(true); view.startAnimation(slideOnAnim); for (int i = centerIndex + 2; i < mViews.size(); i++) { View viewToShift = mViews.get(i); TranslateAnimation slideRightAnim = new TranslateAnimation(-mItemWidth, 0, 0, 0); slideRightAnim.setDuration(Constant.BUBBLE_FLOW_ANIM_TIME); slideRightAnim.setFillAfter(true); viewToShift.startAnimation(slideRightAnim); } } ViewGroup.LayoutParams contentLP = mContent.getLayoutParams(); contentLP.width = (mViews.size() * mItemWidth) + mItemWidth + (2 * mEdgeMargin); mContent.setLayoutParams(contentLP); }
From source file:de.sourcestream.movieDB.controller.MovieDetailsInfo.java
/** * Called to have the fragment instantiate its user interface view. * * @param inflater sets the layout for the current view. * @param container the container which holds the current view. * @param savedInstanceState If non-null, this fragment is being re-constructed from a previous saved state as given here. * Return the View for the fragment's UI, or null. *//*w w w . ja va 2 s . c om*/ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); rootView = inflater.inflate(R.layout.moviedetailsinfo, container, false); activity = ((MainActivity) getActivity()); backDropPath = (ImageView) rootView.findViewById(R.id.backDropPath); titleText = (TextView) rootView.findViewById(R.id.title); releaseDate = (TextView) rootView.findViewById(R.id.releaseDate); posterPath = (ImageView) rootView.findViewById(R.id.posterPath); tagline = (TextView) rootView.findViewById(R.id.tagline); statusText = (TextView) rootView.findViewById(R.id.status); runtime = (TextView) rootView.findViewById(R.id.runtime); genres = (TextView) rootView.findViewById(R.id.genres); countries = (TextView) rootView.findViewById(R.id.countries); companies = (TextView) rootView.findViewById(R.id.companies); ratingBar = (RatingBar) rootView.findViewById(R.id.ratingBar); voteCount = (TextView) rootView.findViewById(R.id.voteCount); homeIcon = (CircledImageView) rootView.findViewById(R.id.homeIcon); homeIcon.setVisibility(View.INVISIBLE); homeIcon.bringToFront(); galleryIcon = (CircledImageView) rootView.findViewById(R.id.galleryIcon); galleryIcon.setVisibility(View.INVISIBLE); galleryIcon.bringToFront(); trailerIcon = (CircledImageView) rootView.findViewById(R.id.trailerIcon); trailerIcon.setVisibility(View.INVISIBLE); trailerIcon.bringToFront(); // Highest Z-index has to be declared last moreIcon = (CircledImageView) rootView.findViewById(R.id.moreIcon); moreIcon.bringToFront(); movieDetailsSimilarGrid = (GridView) rootView.findViewById(R.id.movieDetailsSimilarGrid); similarHolder = rootView.findViewById(R.id.similarHolder); scrollView = (ObservableParallaxScrollView) rootView.findViewById(R.id.moviedetailsinfo); View detailsLayout = rootView.findViewById(R.id.detailsLayout); ViewCompat.setElevation(detailsLayout, 2 * getResources().getDisplayMetrics().density); ViewCompat.setElevation(moreIcon, 2 * getResources().getDisplayMetrics().density); ViewCompat.setElevation(homeIcon, 2 * getResources().getDisplayMetrics().density); ViewCompat.setElevation(galleryIcon, 2 * getResources().getDisplayMetrics().density); ViewCompat.setElevation(trailerIcon, 2 * getResources().getDisplayMetrics().density); // Prevent event bubbling else if you touch on the details layout when the info tab is scrolled it will open gallery view detailsLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); return rootView; }
From source file:com.admin.control.ab.AbSlidingPlayView.java
/** * ???.//from w w w.ja va 2 s . co m * * @param view the view */ public void addView(View view) { mListViews.add(view); if (view instanceof AbsListView) { } else { view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mOnItemClickListener != null) { mOnItemClickListener.onClick(position); } } }); view.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent event) { if (mAbOnTouchListener != null) { mAbOnTouchListener.onTouch(event); } return false; } }); } mAbViewPagerAdapter.notifyDataSetChanged(); creatIndex(); }