List of usage examples for android.support.v4.widget CursorAdapter getCount
public int getCount()
From source file:com.sip.pwc.sipphone.ui.filters.AccountFiltersListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use custom drag and drop view -- reuse the one of accounts_edit_list View v = inflater.inflate(R.layout.accounts_edit_list, container, false); final DragnDropListView lv = (DragnDropListView) v.findViewById(android.R.id.list); lv.setGrabberId(R.id.grabber);//from ww w . ja v a 2s . com // Setup the drop listener lv.setOnDropListener(new DragnDropListView.DropListener() { @Override public void drop(int from, int to) { Log.d(THIS_FILE, "Drop from " + from + " to " + to); int hvC = lv.getHeaderViewsCount(); from = Math.max(0, from - hvC); to = Math.max(0, to - hvC); int i; // First of all, compute what we get before move ArrayList<Long> orderedList = new ArrayList<Long>(); CursorAdapter ad = (CursorAdapter) getListAdapter(); for (i = 0; i < ad.getCount(); i++) { orderedList.add(ad.getItemId(i)); } // Then, invert in the current list the two items ids Long moved = orderedList.remove(from); orderedList.add(to, moved); // Finally save that in db ContentResolver cr = getActivity().getContentResolver(); for (i = 0; i < orderedList.size(); i++) { Uri uri = ContentUris.withAppendedId(SipManager.FILTER_ID_URI_BASE, orderedList.get(i)); ContentValues cv = new ContentValues(); cv.put(Filter.FIELD_PRIORITY, i); cr.update(uri, cv, null, null); } } }); OnClickListener addClickButtonListener = new OnClickListener() { @Override public void onClick(View v) { onClickAddFilter(); } }; // Header view mHeaderView = inflater.inflate(R.layout.generic_add_header_list, container, false); mHeaderView.setOnClickListener(addClickButtonListener); ((TextView) mHeaderView.findViewById(R.id.text)).setText(R.string.add_filter); // Empty view Button bt = (Button) v.findViewById(android.R.id.empty); bt.setText(R.string.add_filter); bt.setOnClickListener(addClickButtonListener); return v; }
From source file:com.csipsimple.ui.filters.AccountFiltersListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use custom drag and drop view -- reuse the one of accounts_edit_list View v = inflater.inflate(R.layout.accounts_edit_list, container, false); final DragnDropListView lv = (DragnDropListView) v.findViewById(android.R.id.list); lv.setGrabberId(R.id.grabber);/* w w w.j ava 2s . c o m*/ // Setup the drop listener lv.setOnDropListener(new DropListener() { @Override public void drop(int from, int to) { Log.d(THIS_FILE, "Drop from " + from + " to " + to); int hvC = lv.getHeaderViewsCount(); from = Math.max(0, from - hvC); to = Math.max(0, to - hvC); int i; // First of all, compute what we get before move ArrayList<Long> orderedList = new ArrayList<Long>(); CursorAdapter ad = (CursorAdapter) getListAdapter(); for (i = 0; i < ad.getCount(); i++) { orderedList.add(ad.getItemId(i)); } // Then, invert in the current list the two items ids Long moved = orderedList.remove(from); orderedList.add(to, moved); // Finally save that in db ContentResolver cr = getActivity().getContentResolver(); for (i = 0; i < orderedList.size(); i++) { Uri uri = ContentUris.withAppendedId(SipManager.FILTER_ID_URI_BASE, orderedList.get(i)); ContentValues cv = new ContentValues(); cv.put(Filter.FIELD_PRIORITY, i); cr.update(uri, cv, null, null); } } }); OnClickListener addClickButtonListener = new OnClickListener() { @Override public void onClick(View v) { onClickAddFilter(); } }; // Header view mHeaderView = inflater.inflate(R.layout.generic_add_header_list, container, false); mHeaderView.setOnClickListener(addClickButtonListener); ((TextView) mHeaderView.findViewById(R.id.text)).setText(R.string.add_filter); // Empty view Button bt = (Button) v.findViewById(android.R.id.empty); bt.setText(R.string.add_filter); bt.setOnClickListener(addClickButtonListener); return v; }
From source file:com.fututel.ui.filters.AccountFiltersListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use custom drag and drop view -- reuse the one of accounts_edit_list View v = inflater.inflate(R.layout.accounts_edit_list, container, false); final DragnDropListView lv = (DragnDropListView) v.findViewById(android.R.id.list); lv.setGrabberId(R.id.grabber);/*from w w w. j a v a2 s .c om*/ // Setup the drop listener lv.setOnDropListener(new DropListener() { @Override public void drop(int from, int to) { Log.d(THIS_FILE, "Drop from " + from + " to " + to); int hvC = lv.getHeaderViewsCount(); from = Math.max(0, from - hvC); to = Math.max(0, to - hvC); int i; // First of all, compute what we get before move ArrayList<Long> orderedList = new ArrayList<Long>(); CursorAdapter ad = (CursorAdapter) getListAdapter(); for (i = 0; i < ad.getCount(); i++) { orderedList.add(ad.getItemId(i)); } // Then, invert in the current list the two items ids Long moved = orderedList.remove(from); orderedList.add(to, moved); // Finally save that in db ContentResolver cr = getActivity().getContentResolver(); for (i = 0; i < orderedList.size(); i++) { Uri uri = ContentUris.withAppendedId(SipManager.FILTER_ID_URI_BASE, orderedList.get(i)); ContentValues cv = new ContentValues(); cv.put(Filter.FIELD_PRIORITY, i); cr.update(uri, cv, null, null); } } }); OnClickListener addClickButtonListener = new OnClickListener() { @Override public void onClick(View v) { onClickAddFilter(); } }; // Header view mHeaderView = inflater.inflate(R.layout.generic_add_header_list, container, false); mHeaderView.setOnClickListener(addClickButtonListener); //rangdong ((TextView) mHeaderView.findViewById(R.id.text)).setText(R.string.add_filter); // Empty view Button bt = (Button) v.findViewById(android.R.id.empty); bt.setText(R.string.add_filter); bt.setOnClickListener(addClickButtonListener); return v; }
From source file:com.roamprocess1.roaming4world.ui.filters.AccountFiltersListFragment.java
@SuppressLint("WrongViewCast") @Override/* www . j a va 2 s .c o m*/ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use custom drag and drop view -- reuse the one of accounts_edit_list View v = inflater.inflate(R.layout.accounts_edit_list, container, false); final DragnDropListView lv = (DragnDropListView) v.findViewById(android.R.id.list); lv.setGrabberId(R.id.grabber); // Setup the drop listener lv.setOnDropListener(new DropListener() { @Override public void drop(int from, int to) { Log.d(THIS_FILE, "Drop from " + from + " to " + to); int hvC = lv.getHeaderViewsCount(); from = Math.max(0, from - hvC); to = Math.max(0, to - hvC); int i; // First of all, compute what we get before move ArrayList<Long> orderedList = new ArrayList<Long>(); CursorAdapter ad = (CursorAdapter) getListAdapter(); for (i = 0; i < ad.getCount(); i++) { orderedList.add(ad.getItemId(i)); } // Then, invert in the current list the two items ids Long moved = orderedList.remove(from); orderedList.add(to, moved); // Finally save that in db ContentResolver cr = getActivity().getContentResolver(); for (i = 0; i < orderedList.size(); i++) { Uri uri = ContentUris.withAppendedId(SipManager.FILTER_ID_URI_BASE, orderedList.get(i)); ContentValues cv = new ContentValues(); cv.put(Filter.FIELD_PRIORITY, i); cr.update(uri, cv, null, null); } } }); OnClickListener addClickButtonListener = new OnClickListener() { @Override public void onClick(View v) { onClickAddFilter(); } }; // Header view mHeaderView = inflater.inflate(R.layout.generic_add_header_list, container, false); mHeaderView.setOnClickListener(addClickButtonListener); ((TextView) mHeaderView.findViewById(R.id.text)).setText(R.string.add_filter); // Empty view Button bt = (Button) v.findViewById(android.R.id.empty); bt.setText(R.string.add_filter); bt.setOnClickListener(addClickButtonListener); return v; }
From source file:com.abcvoipsip.ui.account.AccountsEditListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use custom drag and drop view View v = inflater.inflate(R.layout.accounts_edit_list, container, false); DragnDropListView lv = (DragnDropListView) v.findViewById(android.R.id.list); lv.setGrabberId(R.id.grabber);/*from w w w.j a va 2 s. com*/ // Setup the drop listener lv.setOnDropListener(new DropListener() { @Override public void drop(int from, int to) { Log.d(THIS_FILE, "Drop from " + from + " to " + to); int i; // First of all, compute what we get before move ArrayList<Long> orderedList = new ArrayList<Long>(); CursorAdapter ad = (CursorAdapter) getListAdapter(); for (i = 0; i < ad.getCount(); i++) { orderedList.add(ad.getItemId(i)); } // Then, invert in the current list the two items ids Long moved = orderedList.remove(from); orderedList.add(to, moved); // Finally save that in db ContentResolver cr = getActivity().getContentResolver(); for (i = 0; i < orderedList.size(); i++) { Uri uri = ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, orderedList.get(i)); ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_PRIORITY, i); cr.update(uri, cv, null, null); } } }); return v; }
From source file:com.roamprocess1.roaming4world.ui.account.AccountsEditListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use custom drag and drop view View v = inflater.inflate(R.layout.accounts_edit_list, container, false); final DragnDropListView lv = (DragnDropListView) v.findViewById(android.R.id.list); lv.setGrabberId(R.id.grabber);// w w w . java 2 s .co m // Setup the drop listener lv.setOnDropListener(new DropListener() { @Override public void drop(int from, int to) { Log.d(THIS_FILE, "Drop from " + from + " to " + to); int hvC = lv.getHeaderViewsCount(); from = Math.max(0, from - hvC); to = Math.max(0, to - hvC); int i; // First of all, compute what we get before move ArrayList<Long> orderedList = new ArrayList<Long>(); CursorAdapter ad = (CursorAdapter) getListAdapter(); for (i = 0; i < ad.getCount(); i++) { orderedList.add(ad.getItemId(i)); } // Then, invert in the current list the two items ids Long moved = orderedList.remove(from); orderedList.add(to, moved); // Finally save that in db if (getActivity() != null) { ContentResolver cr = getActivity().getContentResolver(); for (i = 0; i < orderedList.size(); i++) { Uri uri = ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, orderedList.get(i)); ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_PRIORITY, i); cr.update(uri, cv, null, null); } } } }); // OnClickListener addClickButtonListener = new OnClickListener() { // @Override // public void onClick(View v) { //onClickAddAccount(); // } // }; // Header view //mHeaderView = inflater.inflate(R.layout.generic_add_header_list, container, false); //mHeaderView.setOnClickListener(addClickButtonListener); // Empty view //Button bt = (Button) v.findViewById(android.R.id.empty); //bt.setOnClickListener(addClickButtonListener); return v; }
From source file:com.sip.pwc.sipphone.ui.account.AccountsEditListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use custom drag and drop view View v = inflater.inflate(R.layout.accounts_edit_list, container, false); final DragnDropListView lv = (DragnDropListView) v.findViewById(android.R.id.list); lv.setGrabberId(R.id.grabber);/*from w ww .j a v a2 s . c o m*/ // Setup the drop listener lv.setOnDropListener(new DragnDropListView.DropListener() { @Override public void drop(int from, int to) { Log.d(THIS_FILE, "Drop from " + from + " to " + to); int hvC = lv.getHeaderViewsCount(); from = Math.max(0, from - hvC); to = Math.max(0, to - hvC); int i; // First of all, compute what we get before move ArrayList<Long> orderedList = new ArrayList<Long>(); CursorAdapter ad = (CursorAdapter) getListAdapter(); for (i = 0; i < ad.getCount(); i++) { orderedList.add(ad.getItemId(i)); } // Then, invert in the current list the two items ids Long moved = orderedList.remove(from); orderedList.add(to, moved); // Finally save that in db if (getActivity() != null) { ContentResolver cr = getActivity().getContentResolver(); for (i = 0; i < orderedList.size(); i++) { Uri uri = ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, orderedList.get(i)); ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_PRIORITY, i); cr.update(uri, cv, null, null); } } } }); OnClickListener addClickButtonListener = new OnClickListener() { @Override public void onClick(View v) { onClickAddAccount(); } }; // Header view mHeaderView = inflater.inflate(R.layout.generic_add_header_list, container, false); mHeaderView.setOnClickListener(addClickButtonListener); // Empty view Button bt = (Button) v.findViewById(android.R.id.empty); bt.setOnClickListener(addClickButtonListener); return v; }
From source file:com.csipsimple.ui.account.AccountsEditListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use custom drag and drop view View v = inflater.inflate(R.layout.accounts_edit_list, container, false); final DragnDropListView lv = (DragnDropListView) v.findViewById(android.R.id.list); lv.setGrabberId(R.id.grabber);//from w ww. ja v a2 s . c om // Setup the drop listener lv.setOnDropListener(new DropListener() { @Override public void drop(int from, int to) { Log.d(THIS_FILE, "Drop from " + from + " to " + to); int hvC = lv.getHeaderViewsCount(); from = Math.max(0, from - hvC); to = Math.max(0, to - hvC); int i; // First of all, compute what we get before move ArrayList<Long> orderedList = new ArrayList<Long>(); CursorAdapter ad = (CursorAdapter) getListAdapter(); for (i = 0; i < ad.getCount(); i++) { orderedList.add(ad.getItemId(i)); } // Then, invert in the current list the two items ids Long moved = orderedList.remove(from); orderedList.add(to, moved); // Finally save that in db if (getActivity() != null) { ContentResolver cr = getActivity().getContentResolver(); for (i = 0; i < orderedList.size(); i++) { Uri uri = ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, orderedList.get(i)); ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_PRIORITY, i); cr.update(uri, cv, null, null); } } } }); OnClickListener addClickButtonListener = new OnClickListener() { @Override public void onClick(View v) { onClickAddAccount(); } }; // Header view mHeaderView = inflater.inflate(R.layout.generic_add_header_list, container, false); mHeaderView.setOnClickListener(addClickButtonListener); // Empty view Button bt = (Button) v.findViewById(android.R.id.empty); bt.setOnClickListener(addClickButtonListener); return v; }
From source file:com.fututel.ui.account.AccountsEditListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use custom drag and drop view View v = inflater.inflate(R.layout.accounts_edit_list, container, false); final DragnDropListView lv = (DragnDropListView) v.findViewById(android.R.id.list); lv.setGrabberId(R.id.grabber);/*from w ww . j a v a 2 s . co m*/ // Setup the drop listener lv.setOnDropListener(new DropListener() { @Override public void drop(int from, int to) { Log.d(THIS_FILE, "Drop from " + from + " to " + to); int hvC = lv.getHeaderViewsCount(); from = Math.max(0, from - hvC); to = Math.max(0, to - hvC); int i; // First of all, compute what we get before move ArrayList<Long> orderedList = new ArrayList<Long>(); CursorAdapter ad = (CursorAdapter) getListAdapter(); for (i = 0; i < ad.getCount(); i++) { orderedList.add(ad.getItemId(i)); } // Then, invert in the current list the two items ids Long moved = orderedList.remove(from); orderedList.add(to, moved); // Finally save that in db if (getActivity() != null) { ContentResolver cr = getActivity().getContentResolver(); for (i = 0; i < orderedList.size(); i++) { Uri uri = ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, orderedList.get(i)); ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_PRIORITY, i); cr.update(uri, cv, null, null); } } } }); OnClickListener addClickButtonListener = new OnClickListener() { @Override public void onClick(View v) { onClickAddAccount(); } }; // Header view //mHeaderView = inflater.inflate(R.layout.generic_add_header_list, container, false); //mHeaderView.setOnClickListener(addClickButtonListener); //rangdong // Empty view Button bt = (Button) v.findViewById(android.R.id.empty); bt.setOnClickListener(addClickButtonListener); return v; }
From source file:net.voxcorp.voxmobile.ui.account.AccountsEditListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use custom drag and drop view View v = inflater.inflate(R.layout.accounts_edit_list, container, false); final DragnDropListView lv = (DragnDropListView) v.findViewById(android.R.id.list); lv.setGrabberId(R.id.grabber);// ww w . ja va 2 s .co m // Setup the drop listener lv.setOnDropListener(new DropListener() { @Override public void drop(int from, int to) { Log.d(THIS_FILE, "Drop from " + from + " to " + to); int hvC = lv.getHeaderViewsCount(); from = Math.max(0, from - hvC); to = Math.max(0, to - hvC); int i; // First of all, compute what we get before move ArrayList<Long> orderedList = new ArrayList<Long>(); CursorAdapter ad = (CursorAdapter) getListAdapter(); for (i = 0; i < ad.getCount(); i++) { orderedList.add(ad.getItemId(i)); } // Then, invert in the current list the two items ids Long moved = orderedList.remove(from); orderedList.add(to, moved); // Finally save that in db if (getActivity() != null) { ContentResolver cr = getActivity().getContentResolver(); for (i = 0; i < orderedList.size(); i++) { Uri uri = ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, orderedList.get(i)); ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_PRIORITY, i); cr.update(uri, cv, null, null); } } } }); OnClickListener addClickButtonListener = new OnClickListener() { @Override public void onClick(View v) { onClickAddAccount(true); } }; // Header view mHeaderView = inflater.inflate(R.layout.generic_add_header_list, container, false); mHeaderView.setOnClickListener(addClickButtonListener); // Empty view Button bt = (Button) v.findViewById(android.R.id.empty); bt.setOnClickListener(addClickButtonListener); return v; }