Example usage for android.view ViewConfiguration getScaledTouchSlop

List of usage examples for android.view ViewConfiguration getScaledTouchSlop

Introduction

In this page you can find the example usage for android.view ViewConfiguration getScaledTouchSlop.

Prototype

public int getScaledTouchSlop() 

Source Link

Usage

From source file:com.example.client.activity.imported.ViewPagerTab2Activity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_viewpagertab2);

    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));

    ViewCompat.setElevation(findViewById(R.id.header), getResources().getDimension(R.dimen.toolbar_elevation));
    mToolbarView = findViewById(R.id.toolbar);
    mPagerAdapter = new NavigationAdapter(getSupportFragmentManager());
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mPagerAdapter);//from   w  w w .j  a v  a  2s. c  om
    // Padding for ViewPager must be set outside the ViewPager itself
    // because with padding, EdgeEffect of ViewPager become strange.
    final int tabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
    findViewById(R.id.pager_wrapper).setPadding(0, getActionBarSize() + tabHeight, 0, 0);

    SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
    slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
    slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
    slidingTabLayout.setDistributeEvenly(true);
    slidingTabLayout.setViewPager(mPager);

    ViewConfiguration vc = ViewConfiguration.get(this);
    mSlop = vc.getScaledTouchSlop();
    mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.container);
    mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
}

From source file:com.github.ksoichiro.android.observablescrollview.test.ViewPagerTab2Activity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_viewpagertab2);

    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));

    mToolbarView = findViewById(R.id.toolbar);
    mPagerAdapter = new NavigationAdapter(getSupportFragmentManager());
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mPagerAdapter);//from  w  w  w  .j  a v a  2s .  c o m
    // Padding for ViewPager must be set outside the ViewPager itself
    // because with padding, EdgeEffect of ViewPager become strange.
    final int tabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
    findViewById(R.id.pager_wrapper).setPadding(0, getActionBarSize() + tabHeight, 0, 0);

    SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
    slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
    slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
    slidingTabLayout.setDistributeEvenly(true);
    slidingTabLayout.setViewPager(mPager);

    ViewConfiguration vc = ViewConfiguration.get(this);
    mSlop = vc.getScaledTouchSlop();
    mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.container);
    mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
}

From source file:edu.ucuccs.ucufreshmenguide.StudOrgListViewPagerTabFragmentParentFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_viewpagertabfragment_parent, container, false);

    AppCompatActivity parentActivity = (AppCompatActivity) getActivity();
    mPagerAdapter = new NavigationAdapter(getChildFragmentManager());
    mPager = (ViewPager) view.findViewById(R.id.pager);
    mPager.setAdapter(mPagerAdapter);/*from  w  ww  .  jav  a  2 s.c  om*/

    SlidingTabLayout slidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
    slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
    slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.myAccentColor));
    slidingTabLayout.setDistributeEvenly(true);
    slidingTabLayout.setViewPager(mPager);

    ViewConfiguration vc = ViewConfiguration.get(parentActivity);
    mSlop = vc.getScaledTouchSlop();
    mInterceptionLayout = (TouchInterceptionFrameLayout) view.findViewById(R.id.container);
    mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);

    return view;
}

From source file:com.example.client.fragment.imported.ViewPagerTabFragmentParentFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_viewpagertabfragment_parent, container, false);

    AppCompatActivity parentActivity = (AppCompatActivity) getActivity();
    mPagerAdapter = new NavigationAdapter(getChildFragmentManager());
    mPager = (ViewPager) view.findViewById(R.id.pager);
    mPager.setAdapter(mPagerAdapter);/* www  .ja  v  a2 s . co  m*/

    SlidingTabLayout slidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
    slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
    slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
    slidingTabLayout.setDistributeEvenly(true);
    slidingTabLayout.setViewPager(mPager);

    ViewConfiguration vc = ViewConfiguration.get(parentActivity);
    mSlop = vc.getScaledTouchSlop();
    mInterceptionLayout = (TouchInterceptionFrameLayout) view.findViewById(R.id.container);
    mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);

    return view;
}

From source file:com.zms.materialdesign.observablescrollview.activity.ViewPagerTabFragmentParentFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_viewpagertabfragment_parent, container, false);

    ActionBarActivity parentActivity = (ActionBarActivity) getActivity();
    mPagerAdapter = new NavigationAdapter(getChildFragmentManager());
    mPager = (ViewPager) view.findViewById(R.id.pager);
    mPager.setAdapter(mPagerAdapter);/* w w  w . java  2 s.  co  m*/

    SlidingTabLayout slidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
    slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
    slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
    slidingTabLayout.setDistributeEvenly(true);
    slidingTabLayout.setViewPager(mPager);

    ViewConfiguration vc = ViewConfiguration.get(parentActivity);
    mSlop = vc.getScaledTouchSlop();
    mInterceptionLayout = (TouchInterceptionFrameLayout) view.findViewById(R.id.container);
    mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);

    return view;
}

From source file:com.sj.android.appusage.ui.widgets.listview.SwipeListViewTouchListener.java

/**
 * Constructor//from  www .  j  a  va2  s. c om
 *
 * @param swipeListView  SwipeListView
 * @param swipeFrontView front view Identifier
 * @param swipeBackView  back view Identifier
 */
public SwipeListViewTouchListener(SwipeListView swipeListView, int swipeFrontView, int swipeBackView) {
    this.swipeFrontView = swipeFrontView;
    this.swipeBackView = swipeBackView;
    ViewConfiguration vc = ViewConfiguration.get(swipeListView.getContext());
    slop = vc.getScaledTouchSlop();
    minFlingVelocity = vc.getScaledMinimumFlingVelocity();
    maxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    this.swipeListView = swipeListView;
}

From source file:com.ymt.demo1.plates.eduPlane.myStudy.MyStudyFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_my_study, container, false);

    ActionBarActivity parentActivity = (ActionBarActivity) getActivity();
    mPagerAdapter = new NavigationAdapter(getChildFragmentManager());
    mPager = (ViewPager) view.findViewById(R.id.pager);
    mPager.setAdapter(mPagerAdapter);//from   w  w w  .ja v  a 2 s.com

    PagerSlidingTabStrip tabStrip = (PagerSlidingTabStrip) view.findViewById(R.id.sliding_tabs);
    tabStrip.setIndicatorColor(getResources().getColor(android.R.color.holo_blue_light));
    tabStrip.setIndicatorHeight(5);
    tabStrip.setDividerColor(getResources().getColor(android.R.color.holo_blue_bright));

    mPager.setAdapter(mPagerAdapter);
    mPager.setOffscreenPageLimit(4);
    tabStrip.setViewPager(mPager); //////////////////

    ViewConfiguration vc = ViewConfiguration.get(parentActivity);
    mSlop = vc.getScaledTouchSlop();
    mInterceptionLayout = (TouchInterceptionFrameLayout) view.findViewById(R.id.container);
    mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);

    CircleImageView header = (CircleImageView) view.findViewById(R.id.personal_icon_btn);
    TextView userName = (TextView) view.findViewById(R.id.user_name);

    header.setImageBitmap(AppContext.headerPic);
    userName.setText(AppContext.now_user_name);

    return view;
}

From source file:com.ymt.demo1.plates.personal.PersonalPagerTabParentFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_personal_center_pagertabfragment_parent, container, false);

    ActionBarActivity parentActivity = (ActionBarActivity) getActivity();
    mPagerAdapter = new NavigationAdapter(getChildFragmentManager());
    mPager = (ViewPager) view.findViewById(R.id.pager);
    mPager.setAdapter(mPagerAdapter);/*from www  .  j ava 2 s.  co m*/

    PagerSlidingTabStrip tabStrip = (PagerSlidingTabStrip) view.findViewById(R.id.sliding_tabs);
    tabStrip.setIndicatorColor(getResources().getColor(android.R.color.holo_blue_light));
    tabStrip.setIndicatorHeight(5);
    tabStrip.setDividerColor(getResources().getColor(android.R.color.holo_blue_bright));

    mPager.setAdapter(mPagerAdapter);
    mPager.setOffscreenPageLimit(4);
    tabStrip.setViewPager(mPager); //////////////////

    ViewConfiguration vc = ViewConfiguration.get(parentActivity);
    mSlop = vc.getScaledTouchSlop();
    mInterceptionLayout = (TouchInterceptionFrameLayout) view.findViewById(R.id.container);
    mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);

    header = (CircleImageView) view.findViewById(R.id.personal_icon_btn);
    header.setImageBitmap(AppContext.headerPic);
    nameView = (TextView) view.findViewById(R.id.personal_name);
    nameView.setText(AppContext.now_user_name);

    return view;
}

From source file:com.kerkr.edu.recycleView.SwipeToDismissTouchListener.java

/**
 * Constructs a new swipe-to-dismiss OnItemTouchListener for RecyclerView
 *
 * @param recyclerView RecyclerView//from   w  w w .j a v a2s.  c o  m
 * @param callbacks    The callback to trigger when the user has indicated that she would like to
 *                     dismiss this view.
 */
public SwipeToDismissTouchListener(RecyclerView recyclerView, DismissCallbacks callbacks) {
    ViewConfiguration vc = ViewConfiguration.get(recyclerView.getContext());
    mSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 4;
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mAnimationTime = recyclerView.getContext().getResources()
            .getInteger(android.R.integer.config_shortAnimTime);
    mRecyclerView = recyclerView;
    mCallbacks = callbacks;
}

From source file:com.ymt.demo1.plates.hub.MyHubMainFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_my_hub_main, container, false);

    ActionBarActivity parentActivity = (ActionBarActivity) getActivity();
    mPagerAdapter = new NavigationAdapter(getChildFragmentManager());
    mPager = (ViewPager) view.findViewById(R.id.pager);
    mPager.setAdapter(mPagerAdapter);//  w ww .  ja  v  a  2s.  c  o  m

    PagerSlidingTabStrip tabStrip = (PagerSlidingTabStrip) view.findViewById(R.id.sliding_tabs);
    tabStrip.setIndicatorColor(getResources().getColor(android.R.color.holo_blue_light));
    tabStrip.setIndicatorHeight(5);
    tabStrip.setDividerColor(getResources().getColor(android.R.color.holo_blue_bright));

    mPager.setAdapter(mPagerAdapter);
    mPager.setOffscreenPageLimit(3);
    tabStrip.setViewPager(mPager); //////////////////

    ViewConfiguration vc = ViewConfiguration.get(parentActivity);
    mSlop = vc.getScaledTouchSlop();
    mInterceptionLayout = (TouchInterceptionFrameLayout) view.findViewById(R.id.container);
    mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);

    CircleImageView header = (CircleImageView) view.findViewById(R.id.personal_icon_btn);
    header.setImageBitmap(AppContext.headerPic);

    //??
    TextView userName = (TextView) view.findViewById(R.id.user_name);
    userReplyCount = (TextView) view.findViewById(R.id.user_reply_count);
    userPostCount = (TextView) view.findViewById(R.id.user_post_count);
    userName.setText(AppContext.now_user_name);

    return view;
}