/**
   * 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;
              }
            }
          }
        });
  }
 /**
  * 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;
 }
Пример #4
0
  public PtrFrameLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    mPtrIndicator = new PtrIndicator();

    TypedArray arr = context.obtainStyledAttributes(attrs, R.styleable.PtrFrameLayout, 0, 0);
    if (arr != null) {

      mHeaderId = arr.getResourceId(R.styleable.PtrFrameLayout_ptr_header, mHeaderId);
      mContainerId = arr.getResourceId(R.styleable.PtrFrameLayout_ptr_content, mContainerId);

      mPtrIndicator.setResistance(
          arr.getFloat(R.styleable.PtrFrameLayout_ptr_resistance, mPtrIndicator.getResistance()));

      mDurationToClose =
          arr.getInt(R.styleable.PtrFrameLayout_ptr_duration_to_close, mDurationToClose);
      mDurationToCloseHeader =
          arr.getInt(
              R.styleable.PtrFrameLayout_ptr_duration_to_close_header, mDurationToCloseHeader);

      float ratio = mPtrIndicator.getRatioOfHeaderToHeightRefresh();
      ratio = arr.getFloat(R.styleable.PtrFrameLayout_ptr_ratio_of_header_height_to_refresh, ratio);
      mPtrIndicator.setRatioOfHeaderHeightToRefresh(ratio);

      mKeepHeaderWhenRefresh =
          arr.getBoolean(
              R.styleable.PtrFrameLayout_ptr_keep_header_when_refresh, mKeepHeaderWhenRefresh);

      mPullToRefresh = arr.getBoolean(R.styleable.PtrFrameLayout_ptr_pull_to_fresh, mPullToRefresh);
      arr.recycle();
    }

    mScrollChecker = new ScrollChecker();

    final ViewConfiguration conf = ViewConfiguration.get(getContext());
    mPagingTouchSlop = conf.getScaledTouchSlop() * 2;
  }