android.widget.AbsListView#post ( )源码实例Demo

下面列出了android.widget.AbsListView#post ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: AgentWebX5   文件: ScrollingUtil.java
public static void scrollToBottom(final AbsListView absListView) {
    if (absListView != null) {
        if (absListView.getAdapter() != null && absListView.getAdapter().getCount() > 0) {
            absListView.post(new Runnable() {
                @Override
                public void run() {
                    absListView.setSelection(absListView.getAdapter().getCount() - 1);
                }
            });
        }
    }
}
 
源代码2 项目: TwinklingRefreshLayout   文件: ScrollingUtil.java
public static void scrollToBottom(final AbsListView absListView) {
    if (absListView != null) {
        if (absListView.getAdapter() != null && absListView.getAdapter().getCount() > 0) {
            absListView.post(new Runnable() {
                @Override
                public void run() {
                    absListView.setSelection(absListView.getAdapter().getCount() - 1);
                }
            });
        }
    }
}
 
源代码3 项目: Pas   文件: ScrollingUtil.java
public static void scrollToBottom(final AbsListView absListView) {
    if (absListView != null) {
        if (absListView.getAdapter() != null && absListView.getAdapter().getCount() > 0) {
            absListView.post(new Runnable() {
                @Override
                public void run() {
                    absListView.setSelection(absListView.getAdapter().getCount() - 1);
                }
            });
        }
    }
}
 
源代码4 项目: moviedb-android   文件: MovieSlideTab.java
@Override
public void onPageSelected(int position) {
    // Finds the current fragment and updates the list if needed
    // On orientation change loses reference to fragments, that's why every time we find our fragment.
    if (MainActivity.getMaxMem() / 1048576 <= 20) {
        if (currPos != position) {
            // Find the old fragment and clear the list to save up memory
            MovieList oldFragment = (MovieList) getFragmentManager().findFragmentByTag(getFragmentTag(currPos));
            oldFragment.cleanUp();
            oldFragment.setFragmentActive(false);
        }
    }
    currPos = position;
    activity.setCurrentMovViewPagerPos(position);
    boolean load = true;
    if (savedInstanceState != null)
        load = savedInstanceState.getBoolean("load");

    fragment = (MovieList) getFragmentManager().findFragmentByTag(getFragmentTag(position));
    if (fragment != null) {
        fragment.setFragmentActive(true);
        if (fragment.getMoviesList() != null && fragment.getMoviesList().size() > 0) {
            final AbsListView listView = fragment.getListView();
            final View toolbarView = activity.findViewById(R.id.toolbar);
            if (listView != null) {
                listView.post(new Runnable() {
                    @Override
                    public void run() {
                        // check if toolbar is hidden and minThreshold to scroll
                        if (toolbarView.getTranslationY() == -toolbarView.getHeight() && ((Scrollable) listView).getCurrentScrollY() < minThreshold) {
                            if (phone)
                                listView.smoothScrollBy((int) (56 * scale), 0);
                            else
                                listView.smoothScrollBy((int) (59 * scale), 0);
                        }
                    }
                });
            }
        }

        if (load) {
            if (fragment.getBackState() == 0)
                fragment.updateList();
            else
                fragment.setAdapter();

        } else savedInstanceState.putBoolean("load", true);
    }


}
 
源代码5 项目: moviedb-android   文件: TVSlideTab.java
@Override
public void onPageSelected(int position) {
    // Finds the current fragment and updates the list if needed
    // On orientation change loses reference to fragments, that's why every time we find our fragment.
    if (MainActivity.getMaxMem() / 1048576 <= 20) {
        if (currPos != position) {
            // Find the old fragment and clear the list to save up memory
            TVList oldFragment = (TVList) getFragmentManager().findFragmentByTag(getFragmentTag(currPos));
            oldFragment.cleanUp();
            oldFragment.setFragmentActive(false);
        }
    }
    currPos = position;
    activity.setCurrentTVViewPagerPos(position);
    boolean load = true;
    if (savedInstanceState != null)
        load = savedInstanceState.getBoolean("load");

    fragment = (TVList) getFragmentManager().findFragmentByTag(getFragmentTag(position));
    if (fragment != null) {
        fragment.setFragmentActive(true);
        if (fragment.getTVList() != null && fragment.getTVList().size() > 0) {
            final AbsListView listView = fragment.getListView();
            final View toolbarView = activity.findViewById(R.id.toolbar);
            if (listView != null) {
                listView.post(new Runnable() {
                    @Override
                    public void run() {
                        // check if toolbar is hidden and minThreshold to scroll
                        if (toolbarView.getTranslationY() == -toolbarView.getHeight() && ((Scrollable) listView).getCurrentScrollY() < minThreshold) {
                            if (phone)
                                listView.smoothScrollBy((int) (56 * scale), 0);
                            else
                                listView.smoothScrollBy((int) (59 * scale), 0);
                        }
                    }
                });
            }
        }

        if (load) {
            if (fragment.getBackState() == 0)
                fragment.updateList();
            else
                fragment.setAdapter();

        } else savedInstanceState.putBoolean("load", true);
    }


}