Example usage for android.widget ListView setVelocityScale

List of usage examples for android.widget ListView setVelocityScale

Introduction

In this page you can find the example usage for android.widget ListView setVelocityScale.

Prototype

public void setVelocityScale(float scale) 

Source Link

Document

Sets a scale factor for the fling velocity.

Usage

From source file:me.futuretechnology.blops.ui.BookmarksFragment.java

private void initUI() {
    // start out with a progress indicator
    setListShownNoAnimation(false);// w ww.  j a v  a2s .c o m

    ListView listView = getListView();
    listView.setVelocityScale(2.0f);

    FeedsManager feedsManager = FeedsManager.getInstance();

    setEmptyText(getText(feedsManager.getFeedsCount() > 0 ? R.string.empty_bookmarks : R.string.add_feed_info));

    TextView tvEmpty = (TextView) listView.getEmptyView();
    tvEmpty.setTextAppearance(getActivity(), R.style.TextAppearance_AppCompat_Title);

    TypedValue typedValue = new TypedValue();
    Resources.Theme theme = getActivity().getTheme();
    theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
    tvEmpty.setTextColor(getResources().getColor(typedValue.resourceId));

    if (feedsManager.getFeedsCount() == 0) {
        tvEmpty.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent iAdd = new Intent(getActivity(), AddFeedActivity.class);
                getActivity().startActivityForResult(iAdd, 101);
            }
        });
    }
}

From source file:me.futuretechnology.blops.ui.FeedFragment.java

private void initUI() {
    if (getView() == null) {
        return;//from   w w w .  j a v  a 2 s  .co  m
    }

    // start out with a progress indicator
    setListShownNoAnimation(false);

    TypedValue typedValue = new TypedValue();
    Resources.Theme theme = getActivity().getTheme();

    // noinspection ResourceType
    SwipeRefreshLayout swipeLayout = (SwipeRefreshLayout) getView().findViewById(INTERNAL_LIST_CONTAINER_ID);

    theme.resolveAttribute(R.attr.colorPrimary, typedValue, true);
    swipeLayout.setColorSchemeResources(typedValue.resourceId);

    swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            LoaderManager lm = getLoaderManager();
            lm.restartLoader(LoaderIds.ASYNC_GET_FEED + getArguments().getInt("position"), null,
                    loaderCallbacks);
        }
    });

    ListView listView = getListView();
    listView.setVelocityScale(2.0f);

    setEmptyText(getText(R.string.empty_news));

    TextView tvEmpty = (TextView) listView.getEmptyView();
    tvEmpty.setTextAppearance(getActivity(), R.style.TextAppearance_AppCompat_Title);

    theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
    tvEmpty.setTextColor(getResources().getColor(typedValue.resourceId));

    listView.setOnScrollListener(this);

    // listView().setOnCreateContextMenuListener(this);
}