/**
   * Constructor that is called when inflating a view from XML. This is called when a view is being
   * constructed from an XML file, supplying attributes that were specified in the XML file. This
   * version uses a default style of 0, so the only attribute values applied are those in the
   * Context's Theme and the given AttributeSet.
   *
   * <p>The method onFinishInflate() will be called after all children have been added.
   *
   * @param context The Context the view is running in, through which it can access the current
   *     theme, resources, etc.
   * @param attrs The attributes of the XML tag that is inflating the view.
   */
  public TableFixHeaders(Context context, AttributeSet attrs) {
    super(context, attrs);

    this.headView = null;
    this.rowViewList = new ArrayList<View>();
    this.columnViewList = new ArrayList<View>();
    this.bodyViewTable = new ArrayList<List<View>>();

    this.needRelayout = true;

    this.shadows = new ImageView[4];
    this.shadows[0] = new ImageView(context);
    this.shadows[0].setImageResource(R.drawable.shadow_left);
    this.shadows[1] = new ImageView(context);
    this.shadows[1].setImageResource(R.drawable.shadow_top);
    this.shadows[2] = new ImageView(context);
    this.shadows[2].setImageResource(R.drawable.shadow_right);
    this.shadows[3] = new ImageView(context);
    this.shadows[3].setImageResource(R.drawable.shadow_bottom);

    //        this.lineView = new View(context);
    //        this.lineView.setTag(R.id.tag_row, -2);

    this.shadowSize = getResources().getDimensionPixelSize(R.dimen.shadow_size);

    this.flinger = new Flinger(context);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    this.touchSlop = configuration.getScaledTouchSlop();
    this.minimumVelocity = configuration.getScaledMinimumFlingVelocity();
    this.maximumVelocity = configuration.getScaledMaximumFlingVelocity();
  }
Пример #2
0
  public ListViewSwipeGesture(ListView listView, TouchCallbacks Callbacks, Activity context) {
    ViewConfiguration vc = ViewConfiguration.get(listView.getContext());
    mSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16;
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mListView = listView;
    activity = context;
    tcallbacks = Callbacks;
    SwipeType = Double;
    GetResourcesValues();

    mListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          @Override
          public void onItemClick(
              AdapterView<?> arg0,
              View arg1,
              int arg2,
              long arg3) { // Invokes OnClick Functionality

            if (!moptionsDisplay && DeltaX == 0.0) {
              tcallbacks.OnClickListView(temp_position);
            } else {
              if (old_mDownView != null && mDownView != old_mDownView) {
                ResetListItem(old_mDownView);
                old_mDownView = null;
                mDownView = null;
              }
            }
          }
        });
  }
Пример #3
0
  void initCustomViewAbove() {
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    mScroller = new Scroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    setInternalPageChangeListener(
        new SimpleOnPageChangeListener() {
          public void onPageSelected(int position) {
            if (mViewBehind != null) {
              switch (position) {
                case 0:
                case 2:
                  mViewBehind.setChildrenEnabled(true);
                  break;
                case 1:
                  mViewBehind.setChildrenEnabled(false);
                  break;
              }
            }
          }
        });

    final float density = context.getResources().getDisplayMetrics().density;
    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
  }
 /**
  * Constructor
  *
  * @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();
   configShortAnimationTime =
       swipeListView
           .getContext()
           .getResources()
           .getInteger(android.R.integer.config_shortAnimTime);
   animationTime = configShortAnimationTime;
   this.swipeListView = swipeListView;
 }