0

I have a PagerAdapter, which includes a 10-element array.

private Object[] pageViewerList;

I fill it ArrayList

ArrayList<View> array = new ArrayList<View>();
pageViewerList[y] = new ArrayList<View>();

Each page contains a scrollview. The scrollview includes a linearLayout. The Linear Layout contains many different element, which references are stored in the aforementioned ArrayList.

@Override
    public void startUpdate(ViewGroup arg0) {
        Log.v(Constans.TAG, "currentCikkElementsPosition: "+FMFramework.currentCikkElementsPosition);

        ArrayList<View> viewList = (ArrayList<View>) pageViewerList[FMFramework.currentCikkElementsPosition];
        if (viewList!=null){
            setFontSizeAndColor(viewList);
        }
    }

private void setFontSizeAndColor(ArrayList<View> viewList){
        double rate = 1.5;
        if (Constans.READ_MODE_DAY.equals(readMode)){
            for (int i = 0; i < viewList.size(); i++) {
                if (viewList.get(i).getTag().equals(TAG_TITLE)){((TextView)viewList.get(i)).setTextColor(Color.BLACK);((TextView)viewList.get(i)).setTextSize((int)(rate*CIKK_CIM_TEXT_SIZE));continue;}
                if (viewList.get(i).getTag().equals(TAG_LEAD)){((TextView)viewList.get(i)).setTextColor(Color.BLACK);((TextView)viewList.get(i)).setTextSize((int)(rate*CIKK_LEAD_TEXT_SIZE));continue;}
                if (viewList.get(i).getTag().equals(TAG_DATE)){((TextView)viewList.get(i)).setTextSize((int)(rate*CIKK_DATUM_TEXT_SIZE));continue;}
            }
        } else {
            for (int i = 0; i < viewList.size(); i++) {
                if (viewList.get(i).getTag().equals(TAG_TITLE)){((TextView)viewList.get(i)).setTextColor(Color.WHITE);((TextView)viewList.get(i)).setTextSize((int)(rate*CIKK_CIM_TEXT_SIZE));continue;}
                if (viewList.get(i).getTag().equals(TAG_LEAD)){((TextView)viewList.get(i)).setTextColor(Color.WHITE);((TextView)viewList.get(i)).setTextSize((int)(rate*CIKK_LEAD_TEXT_SIZE));continue;}

            }
        }
    }

When I change the views background (in the LinearLayout) the screen is refreshing because I use the startUpdate PagerAdapter method.

BUT only the first and last scrollview. If I call the notifyDataSetChanged() method to the Adapter, when I stay on intermediate page, Not working the refresh. But if I scroll top or bottom the refreshing completing. Why don't refresh the screen immediately, when I call notifyDataSetChanged()?

BaluEdo
  • 119
  • 2
  • 11

1 Answers1

0

I forget one thing. I use a own scrollview:

public class LimitScrollView extends ScrollView{

    Context mContext;
    private ImageView bottonImage;
    private ImageView topImage;

    public LimitScrollView(Context context, AttributeSet attrs) {
        super(context,attrs);
        this.mContext = context;
    }

    @Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        View view = (View) getChildAt(getChildCount()-1);


        int diff = (view.getBottom()-(getHeight()+getScrollY()));

        if( diff == 0 ){
            bottonImage.setVisibility(ImageView.GONE);
        } else {
            bottonImage.setVisibility(ImageView.VISIBLE);
        }
        if( getScrollY() == 0 ){
            topImage.setVisibility(ImageView.GONE);
        } else {
            topImage.setVisibility(ImageView.VISIBLE);
        }

    super.onScrollChanged(l, t, oldl, oldt);
    }

}
BaluEdo
  • 119
  • 2
  • 11