diff --git a/src/com/imaginea/android/sugarcrm/AccountListActivity.java b/src/com/imaginea/android/sugarcrm/AccountListActivity.java deleted file mode 100644 index 0c35a06f..00000000 --- a/src/com/imaginea/android/sugarcrm/AccountListActivity.java +++ /dev/null @@ -1,340 +0,0 @@ -package com.imaginea.android.sugarcrm; - -import android.app.ListActivity; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.database.Cursor; -import android.os.AsyncTask; -import android.os.Bundle; -import android.preference.PreferenceManager; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.view.Window; -import android.widget.AdapterView; -import android.widget.BaseAdapter; -import android.widget.ListView; -import android.widget.TextView; - -import com.imaginea.android.sugarcrm.util.RestUtil; -import com.imaginea.android.sugarcrm.util.SugarBean; -import com.imaginea.android.sugarcrm.util.Util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; - -/** - * AccountListActivity, not used. See ContactListActivity - * - * @author vasavi - */ -public class AccountListActivity extends ListActivity { - - public final static String LOG_TAG = "AccounttListActivity"; - - private AccountsAdapter mAdapter; - - private boolean mBusy = false; - - private boolean mStopLoading = false; - - private LoadAccountsTask mTask; - - private ListView mListView; - - private View mEmpty; - - private TextView mStatus; - - private String mSessionId; - - private int mCurrentOffset = 0; - - private String[] mSelectFields = { ModuleFields.NAME, ModuleFields.EMAIL1 }; - - private HashMap> mLinkNameToFieldsArray = new HashMap>(); - - // we don't make this final as we may want to use the sugarCRM value dynamically - public static int mMaxResults = 20; - - /** {@inheritDoc} */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - requestWindowFeature(Window.FEATURE_NO_TITLE); - setContentView(R.layout.common_list); - - Intent intent = getIntent(); - Bundle extras = intent.getExtras(); - String moduleName = "Contacts"; - if (extras != null) - moduleName = extras.getString(RestUtilConstants.MODULE_NAME); - - TextView tv = (TextView) findViewById(R.id.headerText); - tv.setText(Util.ACCOUNTS); - mStatus = (TextView) findViewById(R.id.status); - // mStatus.setText("Idle"); - - // Use an existing ListAdapter that will map an array - // of strings to TextViews - mAdapter = new AccountsAdapter(this); - mListView = getListView(); - - // mListView.setOnScrollListener(this); - mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { - - @Override - public void onItemClick(AdapterView arg0, View view, int position, long id) { - // openDetailScreen(position); - Log.i(LOG_TAG, "item " + position + " clicked!"); - openDetailScreen(position); - } - }); - - // button code in the layout - 1.6 SDK feature to specify onClick - mListView.setItemsCanFocus(true); - mListView.setFocusable(true); - mEmpty = findViewById(R.id.empty); - mListView.setEmptyView(mEmpty); - // registerForContextMenu(getListView()); - mTask = new LoadAccountsTask(); - mTask.execute(null); - } - - /** - * opens the Detail Screen - * - * @param position - */ - void openDetailScreen(int position) { - Intent detailIntent = new Intent(AccountListActivity.this, AccountDetailsActivity.class); - - Cursor cursor = (Cursor) getListAdapter().getItem(position); - if (cursor == null) { - // For some reason the requested item isn't available, do nothing - return; - } - // SugarBean bean = (SugarBean) getListView().getItemAtPosition(position); - Log.d(LOG_TAG, "beanId:" + cursor.getString(1)); - detailIntent.putExtra(RestUtilConstants.ID, cursor.getString(0)); - startActivity(detailIntent); - } - - /** {@inheritDoc} */ - @Override - protected void onPause() { - super.onPause(); - - // cancel the task if we are running - if (mTask != null && mTask.getStatus() == AsyncTask.Status.RUNNING) { - mTask.cancel(true); - } - } - - void fetchMoreItemsForList() { - if (mBusy && !mStopLoading) { - - /* - * do not load the accounts again till the previous call has not finished, this ensures - * that we have the sorting order in place as the tasks are asynchronous - */ - if (mTask == null || (mTask != null && mTask.getStatus() == AsyncTask.Status.FINISHED)) { - mTask = new LoadAccountsTask(); - mCurrentOffset = mCurrentOffset + mMaxResults; - mTask.execute(mCurrentOffset); - } - } - } - - /** - * LoadAccountsTask - */ - class LoadAccountsTask extends AsyncTask { - - @Override - protected void onPreExecute() { - super.onPreExecute(); - - if (mAdapter.getCount() == 0) - mListView.setVisibility(View.GONE); - mEmpty.findViewById(R.id.progress).setVisibility(View.VISIBLE); - TextView tv = (TextView) (mEmpty.findViewById(R.id.mainText)); - tv.setVisibility(View.GONE); - // tv.setText(R.string.loading); - // we are reusing - so remove the other views - } - - @Override - protected Object doInBackground(Object... params) { - try { - SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); - String url = pref.getString("URL", getString(R.string.defaultUrl)); - String userName = pref.getString("USER_NAME", getString(R.string.defaultUser)); - String password = pref.getString("PASSWORD", getString(R.string.defaultPwd)); - Log.i(LOG_TAG, url + userName + password); - // SugarCrmApp app = - // mSessionId = ((SugarCrmApp) getApplication()).getSessionId(); - if (mSessionId == null) { - mSessionId = RestUtil.loginToSugarCRM(url, userName, password); - } - - // RestUtil.getModuleFields(url, mSessionId, moduleName, fields); - String query = "", orderBy = ModuleFields.NAME; - - int offset = 0; - if (params != null) - offset = (Integer) params[0]; - - int deleted = 0; - - SugarBean[] sBeans = RestUtil.getEntryList(url, mSessionId, Util.ACCOUNTS, query, orderBy, offset - + "", mSelectFields, mLinkNameToFieldsArray, mMaxResults - + "", deleted + ""); - mAdapter.setSugarBeanArray(sBeans); - // We can stop loading once we do not get the - if (sBeans.length < mMaxResults) - mStopLoading = true; - - } catch (Exception e) { - Log.e(LOG_TAG, e.getMessage(), e); - return Util.FETCH_FAILED; - } - - return Util.REFRESH_LIST; - } - - @Override - protected void onCancelled() { - super.onCancelled(); - } - - @Override - protected void onPostExecute(Object result) { - super.onPostExecute(result); - if (isCancelled()) - return; - int retVal = (Integer) result; - - switch (retVal) { - case Util.FETCH_FAILED: - - mEmpty.findViewById(R.id.progress).setVisibility(View.GONE); - TextView tv = (TextView) (mEmpty.findViewById(R.id.mainText)); - tv.setVisibility(View.VISIBLE); - tv.setText(R.string.loadFailed); - TextView footer = (TextView) findViewById(R.id.status); - footer.setVisibility(View.VISIBLE); - footer.setText(R.string.loadFailed); - - break; - - case Util.REFRESH_LIST: - mBusy = false; - mStatus.setVisibility(View.GONE); - mListView.setVisibility(View.VISIBLE); - int firstPos = getListView().getFirstVisiblePosition(); - setListAdapter(mAdapter); - getListView().setSelection(firstPos); - mAdapter.notifyDataSetChanged(); - break; - default: - - } - } - - } - - /** - * Will not bind views while the list is scrolling - * - */ - private class AccountsAdapter extends BaseAdapter { - - /** - * Remember our context so we can use it when constructing views. - */ - private Context mContext; - - private ArrayList sugarBeanList = new ArrayList(); - - private LayoutInflater mInflater; - - private TextView footer; - - public AccountsAdapter(Context context) { - mContext = context; - mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - footer = (TextView) findViewById(R.id.status); - } - - /** - * The number of items in the list is determined by the number of speeches in our array. - * - * @see android.widget.ListAdapter#getCount() - */ - public int getCount() { - return sugarBeanList.size(); - } - - public void setSugarBeanArray(SugarBean[] sbArray) { - sugarBeanList.addAll(Arrays.asList(sbArray)); - } - - /** - * Since the data comes from an array, just returning the index is sufficient to get at the - * data. If we were using a more complex data structure, we would return whatever object - * represents one row in the list. - * - * @see android.widget.ListAdapter#getItem(int) - */ - public SugarBean getItem(int position) { - return sugarBeanList.get(position); - } - - /** - * Use the array index as a unique id. - * - * @see android.widget.ListAdapter#getItemId(int) - */ - public long getItemId(int position) { - return position; - } - - /** - * Make a view to hold each row. - * - * @see android.widget.ListAdapter#getView(int, android.view.View, android.view.ViewGroup) - */ - public View getView(int position, View convertView, ViewGroup parent) { - TextView text; - - if (convertView == null) { - text = (TextView) mInflater.inflate(android.R.layout.simple_list_item_1, parent, false); - } else { - text = (TextView) convertView; - } - - if (position == getCount() - 1) { - Log.d(LOG_TAG, "last item:" + position); - mBusy = true; - fetchMoreItemsForList(); - } - - if (mBusy) { - footer.setVisibility(View.VISIBLE); - footer.setText("Loading..."); - // Non-null tag means the view still needs to load it's data - // text.setTag(this); - } - SugarBean bean = sugarBeanList.get(position); - String name = bean.getFieldValue(ModuleFields.NAME); - text.setText(name); - return text; - } - } - -} diff --git a/src/com/imaginea/android/sugarcrm/ContactListActivity.java b/src/com/imaginea/android/sugarcrm/ContactListActivity.java index 81abda05..050b604a 100644 --- a/src/com/imaginea/android/sugarcrm/ContactListActivity.java +++ b/src/com/imaginea/android/sugarcrm/ContactListActivity.java @@ -37,16 +37,14 @@ import com.imaginea.android.sugarcrm.util.ModuleField; import com.imaginea.android.sugarcrm.util.Util; -import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; /** * ContactListActivity, lists the view projections for all the modules. * - * Note: Ideally we would have to rename the file, but to preserve CVS history - * we have chosen not to rename the file. Cannot use CVS rename command as we - * are still using an old CVS server + * Note: Ideally we would have to rename the file, but to preserve CVS history we have chosen not to + * rename the file. Cannot use CVS rename command as we are still using an old CVS server * * @author chander */ @@ -68,7 +66,7 @@ public class ContactListActivity extends ListActivity { private Uri mModuleUri; - private boolean mStopLoading = false; + // private boolean mStopLoading = false; private Uri mIntentUri; @@ -77,7 +75,7 @@ public class ContactListActivity extends ListActivity { // we don't make this final as we may want to use the sugarCRM value // dynamically, but prevent // others from modiying anyway - private static int mMaxResults = 20; + // private static int mMaxResults = 20; private DatabaseHelper mDbHelper; @@ -120,8 +118,7 @@ public void onCreate(Bundle savedInstanceState) { // If the list is a list of related items, hide the filterImage and // allItems image - if (intent.getData() != null - && intent.getData().getPathSegments().size() >= 3) { + if (intent.getData() != null && intent.getData().getPathSegments().size() >= 3) { findViewById(R.id.filterImage).setVisibility(View.GONE); findViewById(R.id.allItems).setVisibility(View.GONE); } @@ -135,10 +132,9 @@ public void onCreate(Bundle savedInstanceState) { // mListView.setOnScrollListener(this); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override - public void onItemClick(AdapterView arg0, View view, - int position, long id) { - Log.e(LOG_TAG, "item clicked"); - addToRecent(position); + public void onItemClick(AdapterView arg0, View view, int position, long id) { + Log.e(LOG_TAG, "item clicked"); + addToRecent(position); openDetailScreen(position); } }); @@ -151,7 +147,6 @@ public void onItemClick(AdapterView arg0, View view, registerForContextMenu(getListView()); if (Log.isLoggable(LOG_TAG, Log.DEBUG)) { - Log.d(LOG_TAG, "Instance count:" + getInstanceCount()); Log.d(LOG_TAG, "ModuleName:-->" + mModuleName); } @@ -166,7 +161,7 @@ public void onItemClick(AdapterView arg0, View view, // detail projection // here, just do a list projection Cursor cursor = managedQuery(getIntent().getData(), mDbHelper.getModuleProjections(mModuleName), mSelections, mSelectionArgs, getSortOrder()); - + // CRMContentObserver observer = new CRMContentObserver() // cursor.registerContentObserver(observer); String[] moduleSel = mDbHelper.getModuleListSelections(mModuleName); @@ -203,8 +198,7 @@ public void onItemClick(AdapterView arg0, View view, /** * GenericCursorAdapter */ - private final class GenericCursorAdapter extends SimpleCursorAdapter - implements Filterable { + private final class GenericCursorAdapter extends SimpleCursorAdapter implements Filterable { private int realoffset = 0; @@ -212,8 +206,7 @@ private final class GenericCursorAdapter extends SimpleCursorAdapter private ContentResolver mContent; - public GenericCursorAdapter(Context context, int layout, Cursor c, - String[] from, int[] to) { + public GenericCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) { super(context, layout, c, from, to); mContent = context.getContentResolver(); } @@ -229,8 +222,7 @@ public View getView(int position, View convertView, ViewGroup parent) { realoffset += count; // Uri uri = getIntent().getData(); // TODO - fix this, this is no longer used - Uri newUri = Uri.withAppendedPath(Contacts.CONTENT_URI, realoffset - + "/" + limit); + Uri newUri = Uri.withAppendedPath(Contacts.CONTENT_URI, realoffset + "/" + limit); Log.d(LOG_TAG, "Changing cursor:" + newUri.toString()); final Cursor cursor = managedQuery(newUri, Contacts.LIST_PROJECTION, null, null, Contacts.DEFAULT_SORT_ORDER); CRMContentObserver observer = new CRMContentObserver(new Handler() { @@ -239,8 +231,8 @@ public View getView(int position, View convertView, ViewGroup parent) { public void handleMessage(Message msg) { super.handleMessage(msg); Log.d(LOG_TAG, "Changing cursor: in handler"); - if (cursor.getCount() < mMaxResults) - mStopLoading = true; + // if (cursor.getCount() < mMaxResults) + // mStopLoading = true; changeCursor(cursor); mListFooterText.setVisibility(View.GONE); mListFooterProgress.setVisibility(View.GONE); @@ -400,43 +392,6 @@ public boolean onSearchRequested() { return true; } - // We can stop loading once we do not get the - // if (sBeans.length < mMaxResults) - // mStopLoading = true; - // @Override - // protected void onPostExecute(Object result) { - // super.onPostExecute(result); - // if (isCancelled()) - // return; - // int retVal = (Integer) result; - // - // switch (retVal) { - // case Util.FETCH_FAILED: - // - // mEmpty.findViewById(R.id.progress).setVisibility(View.GONE); - // TextView tv = (TextView) (mEmpty.findViewById(R.id.mainText)); - // tv.setVisibility(View.VISIBLE); - // tv.setText(R.string.loadFailed); - // TextView footer = (TextView) findViewById(R.id.status); - // footer.setVisibility(View.VISIBLE); - // footer.setText(R.string.loadFailed); - // - // break; - // - // case Util.REFRESH_LIST: - // mBusy = false; - // mStatus.setVisibility(View.GONE); - // mListView.setVisibility(View.VISIBLE); - // int firstPos = getListView().getFirstVisiblePosition(); - // setListAdapter(mAdapter); - // getListView().setSelection(firstPos); - // mAdapter.notifyDataSetChanged(); - // break; - // default: - // - // } - // } - /** {@inheritDoc} */ @Override public boolean onPrepareOptionsMenu(Menu menu) { @@ -448,8 +403,7 @@ public boolean onPrepareOptionsMenu(Menu menu) { // get the module fields for the module Map map = mDbHelper.getModuleFields(mModuleName); if (map == null) { - Log.w(LOG_TAG, "Cannot prepare Options as Map is null for module:" - + mModuleName); + Log.w(LOG_TAG, "Cannot prepare Options as Map is null for module:" + mModuleName); return false; } mModuleFieldsChoice = new String[mModuleFields.length]; @@ -542,8 +496,7 @@ public void onClick(DialogInterface dialog, int whichButton) { }); builder.setNegativeButton(R.string.descending, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { - String sortOrder = mModuleFields[mSortColumnIndex] - + " DESC"; + String sortOrder = mModuleFields[mSortColumnIndex] + " DESC"; sortList(sortOrder); } }); @@ -569,8 +522,7 @@ public void onClick(DialogInterface dialog, int whichButton) { /** {@inheritDoc} */ @Override - public void onCreateContextMenu(ContextMenu menu, View v, - ContextMenuInfo menuInfo) { + public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { menu.setHeaderTitle(R.string.options); AdapterView.AdapterContextMenuInfo info; try { @@ -618,9 +570,9 @@ public boolean onContextItemSelected(MenuItem item) { return false; } int position = info.position; - + addToRecent(position); - + switch (item.getItemId()) { case R.string.view: openDetailScreen(position); @@ -647,7 +599,7 @@ public boolean onContextItemSelected(MenuItem item) { return super.onOptionsItemSelected(item); } - + private void sortList(String sortOrder) { String selection = null; if (MODE == Util.ASSIGNED_ITEMS_MODE) { @@ -659,33 +611,34 @@ private void sortList(String sortOrder) { mAdapter.changeCursor(cursor); mAdapter.notifyDataSetChanged(); } - void addToRecent(int position) { - ContentValues modifiedValues = new ContentValues(); - // push the selected record into recent table + + void addToRecent(int position) { + ContentValues modifiedValues = new ContentValues(); + // push the selected record into recent table Cursor cursor = (Cursor) getListAdapter().getItem(position); - + String[] moduleSel = mDbHelper.getModuleListSelections(mModuleName); Log.e(LOG_TAG, "Name1:" + cursor.getString(2)); if (moduleSel.length >= 2) - Log.e(LOG_TAG, "Name2:" + cursor.getString(3)); - //now insert into recent table + Log.e(LOG_TAG, "Name2:" + cursor.getString(3)); + // now insert into recent table Log.e(LOG_TAG, "Inserting:" + cursor.getString(2)); - modifiedValues.put(Recent.ACTUAL_ID, cursor.getInt(0)+""); + modifiedValues.put(Recent.ACTUAL_ID, cursor.getInt(0) + ""); modifiedValues.put(Recent.BEAN_ID, cursor.getString(1)); modifiedValues.put(Recent.NAME_1, cursor.getString(2)); modifiedValues.put(Recent.NAME_2, cursor.getString(3)); modifiedValues.put(Recent.REF_MODULE_NAME, mModuleName); modifiedValues.put(Recent.DELETED, "0"); Uri insertResultUri = getApplicationContext().getContentResolver().insert(Recent.CONTENT_URI, modifiedValues); - /* values.put(SugarCRMContent.SUGAR_BEAN_ID, "Sync" + UUID.randomUUID()); - Uri insertResultUri = mContext.getContentResolver().insert(mUri, values); - // after success url insertion, we set the updatedRow to 1 so we don't get a - // fail msg - updatedRows = 1;*/ + /* + * values.put(SugarCRMContent.SUGAR_BEAN_ID, "Sync" + UUID.randomUUID()); Uri + * insertResultUri = mContext.getContentResolver().insert(mUri, values); // after success + * url insertion, we set the updatedRow to 1 so we don't get a // fail msg updatedRows = 1; + */ Log.i(LOG_TAG, "insertResultURi - " + insertResultUri); - - } - + + } + /** *

* showAssignedItems @@ -698,8 +651,7 @@ public void showAssignedItems(View view) { MODE = Util.ASSIGNED_ITEMS_MODE; // TODO: get the user name from Account Manager String userName = SugarCrmSettings.getUsername(ContactListActivity.this); - String selection = ModuleFields.ASSIGNED_USER_NAME + "='" + userName - + "'"; + String selection = ModuleFields.ASSIGNED_USER_NAME + "='" + userName + "'"; Cursor cursor = managedQuery(getIntent().getData(), mDbHelper.getModuleProjections(mModuleName), selection, null, getSortOrder()); mAdapter.changeCursor(cursor); mAdapter.notifyDataSetChanged(); @@ -760,8 +712,7 @@ public void callNumber(int position) { String number = cursor.getString(index); if (Log.isLoggable(LOG_TAG, Log.DEBUG)) Log.d(LOG_TAG, "Work number to call:" + number); - Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" - + number)); + Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + number)); startActivity(intent); } @@ -784,8 +735,7 @@ public void sendMail(int position) { String emailAddress = cursor.getString(index); if (Log.isLoggable(LOG_TAG, Log.DEBUG)) Log.d(LOG_TAG, "email :" + emailAddress); - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:" - + emailAddress)); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:" + emailAddress)); startActivity(intent); } } diff --git a/src/com/imaginea/android/sugarcrm/RecentListActivity.java b/src/com/imaginea/android/sugarcrm/RecentListActivity.java index 90c082a5..5cea2880 100644 --- a/src/com/imaginea/android/sugarcrm/RecentListActivity.java +++ b/src/com/imaginea/android/sugarcrm/RecentListActivity.java @@ -26,13 +26,14 @@ import com.imaginea.android.sugarcrm.provider.DatabaseHelper; import com.imaginea.android.sugarcrm.provider.SugarCRMContent.Contacts; import com.imaginea.android.sugarcrm.util.Util; + /** * RecentListActivity, lists the view projections for all the Recently accessed records. * * * @author Jagadeeshwaran K */ -public class RecentListActivity extends ListActivity{ +public class RecentListActivity extends ListActivity { private ListView mListView; @@ -50,15 +51,12 @@ public class RecentListActivity extends ListActivity{ private Uri mModuleUri; - private boolean mStopLoading = false; - private Uri mIntentUri; - // we don't make this final as we may want to use the sugarCRM value // dynamically, but prevent // others from modiying anyway - private static int mMaxResults = 20; + // private static int mMaxResults = 20; private DatabaseHelper mDbHelper; @@ -91,8 +89,7 @@ public void onCreate(Bundle savedInstanceState) { // If the list is a list of related items, hide the filterImage and // allItems image - if (intent.getData() != null - && intent.getData().getPathSegments().size() >= 3) { + if (intent.getData() != null && intent.getData().getPathSegments().size() >= 3) { findViewById(R.id.filterImage).setVisibility(View.GONE); findViewById(R.id.allItems).setVisibility(View.GONE); } @@ -106,9 +103,8 @@ public void onCreate(Bundle savedInstanceState) { // mListView.setOnScrollListener(this); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override - public void onItemClick(AdapterView arg0, View view, - int position, long id) { - + public void onItemClick(AdapterView arg0, View view, int position, long id) { + openDetailScreen(position); } }); @@ -121,7 +117,6 @@ public void onItemClick(AdapterView arg0, View view, registerForContextMenu(getListView()); if (Log.isLoggable(LOG_TAG, Log.DEBUG)) { - Log.d(LOG_TAG, "Instance count:" + getInstanceCount()); Log.d(LOG_TAG, "ModuleName:-->" + mModuleName); } @@ -173,8 +168,7 @@ public void onItemClick(AdapterView arg0, View view, /** * GenericCursorAdapter */ - private final class GenericCursorAdapter extends SimpleCursorAdapter - implements Filterable { + private final class GenericCursorAdapter extends SimpleCursorAdapter implements Filterable { private int realoffset = 0; @@ -182,8 +176,7 @@ private final class GenericCursorAdapter extends SimpleCursorAdapter private ContentResolver mContent; - public GenericCursorAdapter(Context context, int layout, Cursor c, - String[] from, int[] to) { + public GenericCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) { super(context, layout, c, from, to); mContent = context.getContentResolver(); } @@ -199,8 +192,7 @@ public View getView(int position, View convertView, ViewGroup parent) { realoffset += count; // Uri uri = getIntent().getData(); // TODO - fix this, this is no longer used - Uri newUri = Uri.withAppendedPath(Contacts.CONTENT_URI, realoffset - + "/" + limit); + Uri newUri = Uri.withAppendedPath(Contacts.CONTENT_URI, realoffset + "/" + limit); Log.d(LOG_TAG, "Changing cursor:" + newUri.toString()); final Cursor cursor = managedQuery(newUri, Contacts.LIST_PROJECTION, null, null, Contacts.DEFAULT_SORT_ORDER); CRMContentObserver observer = new CRMContentObserver(new Handler() { @@ -209,8 +201,6 @@ public View getView(int position, View convertView, ViewGroup parent) { public void handleMessage(Message msg) { super.handleMessage(msg); Log.d(LOG_TAG, "Changing cursor: in handler"); - if (cursor.getCount() < mMaxResults) - mStopLoading = true; changeCursor(cursor); mListFooterText.setVisibility(View.GONE); mListFooterProgress.setVisibility(View.GONE); @@ -269,8 +259,9 @@ void openDetailScreen(int position) { // For some reason the requested item isn't available, do nothing return; } - Log.d(LOG_TAG, "rowId:" + cursor.getString(1)+"BEAN_ID:" + cursor.getString(2)+"MODULE_NAME:" + cursor.getString(3)); - //use the details available from cursor to open detailed view + Log.d(LOG_TAG, "rowId:" + cursor.getString(1) + "BEAN_ID:" + cursor.getString(2) + + "MODULE_NAME:" + cursor.getString(3)); + // use the details available from cursor to open detailed view detailIntent.putExtra(Util.ROW_ID, cursor.getString(1)); detailIntent.putExtra(RestUtilConstants.BEAN_ID, cursor.getString(2)); detailIntent.putExtra(RestUtilConstants.MODULE_NAME, cursor.getString(3)); @@ -278,10 +269,6 @@ void openDetailScreen(int position) { startActivity(detailIntent); } - - - - /** {@inheritDoc} */ @Override protected void onPause() { @@ -289,10 +276,9 @@ protected void onPause() { } public void showAssignedItems(View view) { - //keep this empty as the header is used from list view + // keep this empty as the header is used from list view } - /** *

* showAllItems @@ -329,7 +315,4 @@ private String getSortOrder() { return sortOrder; } - - - }