Search in sources :

Example 1 with AutoScrollListView

use of com.android.contacts.common.list.AutoScrollListView in project packages_apps_Contacts by AOKP.

the class GroupBrowseListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        mSelectedGroupUri = savedInstanceState.getParcelable(EXTRA_KEY_GROUP_URI);
        if (mSelectedGroupUri != null) {
            // The selection may be out of screen, if rotated from portrait to landscape,
            // so ensure it's visible.
            mSelectionToScreenRequested = true;
        }
    }
    mRootView = inflater.inflate(R.layout.group_browse_list_fragment, null);
    mEmptyView = (TextView) mRootView.findViewById(R.id.empty);
    mAdapter = new GroupBrowseListAdapter(mContext);
    mAdapter.setSelectionVisible(mSelectionVisible);
    mAdapter.setSelectedGroup(mSelectedGroupUri);
    mListView = (AutoScrollListView) mRootView.findViewById(R.id.list);
    mListView.setOnFocusChangeListener(this);
    mListView.setOnTouchListener(this);
    mListView.setAdapter(mAdapter);
    mListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            GroupListItemViewCache groupListItem = (GroupListItemViewCache) view.getTag();
            if (groupListItem != null) {
                viewGroup(groupListItem.getUri());
            }
        }
    });
    mListView.setEmptyView(mEmptyView);
    configureVerticalScrollbar();
    mAddAccountsView = mRootView.findViewById(R.id.add_accounts);
    mAddAccountButton = mRootView.findViewById(R.id.add_account_button);
    mAddAccountButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
            intent.putExtra(Settings.EXTRA_AUTHORITIES, new String[] { ContactsContract.AUTHORITY });
            ImplicitIntentsUtil.startActivityOutsideApp(getActivity(), intent);
        }
    });
    setAddAccountsVisibility(!ContactsUtils.areGroupWritableAccountsAvailable(mContext));
    return mRootView;
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) GroupListItemViewCache(com.android.contacts.group.GroupBrowseListAdapter.GroupListItemViewCache) OnClickListener(android.view.View.OnClickListener) Intent(android.content.Intent) AutoScrollListView(com.android.contacts.common.list.AutoScrollListView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 2 with AutoScrollListView

use of com.android.contacts.common.list.AutoScrollListView in project packages_apps_Contacts by AOKP.

the class ContactBrowseListFragment method requestSelectionToScreen.

protected void requestSelectionToScreen(int selectedPosition) {
    if (selectedPosition != -1) {
        AutoScrollListView listView = (AutoScrollListView) getListView();
        listView.requestPositionToScreen(selectedPosition + listView.getHeaderViewsCount(), mSmoothScrollRequested);
        mSelectionToScreenRequested = false;
    }
}
Also used : AutoScrollListView(com.android.contacts.common.list.AutoScrollListView)

Aggregations

AutoScrollListView (com.android.contacts.common.list.AutoScrollListView)2 Intent (android.content.Intent)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 GroupListItemViewCache (com.android.contacts.group.GroupBrowseListAdapter.GroupListItemViewCache)1