Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Detect scrolling stop and TableLayout updating
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Иван Дунский  
View profile   Translate to Translated (View Original)
 More options Aug 16 2012, 6:26 am
From: Иван Дунский <i.duns...@gmail.com>
Date: Thu, 16 Aug 2012 03:26:08 -0700 (PDT)
Local: Thurs, Aug 16 2012 6:26 am
Subject: Detect scrolling stop and TableLayout updating

I have TableLayout in the ScrollView. I add items there in with the method:

    private void appendRows(int start , int end) {
    final TableLayout table = (TableLayout)findViewById(R.id.table);
    for (int i=start; i<=end; i++)
    {
        TableRow row = new TableRow(this);

        TextView idText = new TextView(this);

        idText.setText(Integer.toString(forPrint.get(i).getOrderid()));

        idText.setPadding(10, 0, 0, 20);
        idText.setTextColor(Color.BLACK);
        row.addView(idText);

        TextView textOne = new TextView(this);
        textOne.setText(forPrint.get(i).getTitle());
        textOne.setSingleLine(false);
        textOne.setPadding(15, 0, 0, 0);
        textOne.setTextColor(Color.BLACK);
        row.addView(textOne);

        TextView textTwo = new TextView(this);
        textTwo.setText(Float.toString(forPrint.get(i).getPrice()));
        textTwo.setPadding(15, 0, 0, 0);
        textTwo.setTextColor(Color.BLACK);
        row.addView(textTwo);

         TextView textThree = new TextView(this);
         textThree.setText(forPrint.get(i).getProcess_status().getProccessStatusTitl e());
         textThree.setPadding(15, 0, 0, 0);
         textThree.setTextColor(Color.BLACK);
        row.addView(textThree);

       table.addView(row, new TableLayout.LayoutParams());
   }
 }

I want to react on user's scroll action and update items in TableLayout
corresponding to scroll events. For example it should be first 10 items of
the list when user opens the activity. Then if he scroll down, it should be
next 10 items of the list. If he scroll up - previous 10 items. I created
such class for this:

class MyGestureListener extends SimpleOnGestureListener implements OnTouchListener
{

public boolean onScroll(MotionEvent e1, MotionEvent e2, float arg2,
        float arg3) {
    mIsScrolling = true;  
    float pos = e2.getY() - e1.getY();
      if (pos<0)
      {
          start +=10;
          end+=10;
      }
      else
      {
          start -=10;
          end -=10;  

      }

   if (e2.getAction() == MotionEvent.ACTION_UP)
   {
       String message = "Helo";
       Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG);
        toast.show();
   }
    return true;

}
}

I want to react on scrolling events - detect pos variable after scrolling
was stopped and update items in TableLayout correspondingly. I tried do it
with

Scroller scroller = new Scroller(getApplicationContext());
scroller.isFinished();

But it detects very sensitivly and also when scrolling wasn't stopped. So
works not properly. Also tried to make it with

  gestureListener = new View.OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {

            if (gestureDetector.onTouchEvent(event)){
                Log.i("qew","qwe");
                return true;}

        if(event.getAction() == MotionEvent.ACTION_UP) {
             if(mIsScrolling )
             {
                Log.d("qwe","OnTouchListener --> onTouch ACTION_UP");
                mIsScrolling  = false;
                handleScrollFinished();
              }

        }

in my onCreate() method but in some reasons this method can't be called. I
tried to put there simple Log.i("qew","qwe");

But it wasn't call. Tell how can I implement it. Appreciate your help.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »