예제 #1
0
        /// <summary>Gets the value of a string column by name.</summary>
        /// <remarks>Gets the value of a string column by name.</remarks>
        /// <param name="cursor">Cursor to read the value from.</param>
        /// <param name="columnName">The name of the column to read.</param>
        /// <returns>
        /// The value of the given column, or <code>null</null>
        /// if the cursor does not contain the given column.
        /// </returns>
        public static string getColumnString(android.database.Cursor cursor, string columnName
                                             )
        {
            int col = cursor.getColumnIndex(columnName);

            return(getStringOrNull(cursor, col));
        }
예제 #2
0
 public override void changeCursor(android.database.Cursor c)
 {
     if (mClosed)
     {
         android.util.Log.w(LOG_TAG, "Tried to change cursor after adapter was closed.");
         if (c != null)
         {
             c.close();
         }
         return;
     }
     try
     {
         base.changeCursor(c);
         if (c != null)
         {
             mText1Col    = c.getColumnIndex(android.app.SearchManager.SUGGEST_COLUMN_TEXT_1);
             mText2Col    = c.getColumnIndex(android.app.SearchManager.SUGGEST_COLUMN_TEXT_2);
             mText2UrlCol = c.getColumnIndex(android.app.SearchManager.SUGGEST_COLUMN_TEXT_2_URL
                                             );
             mIconName1Col = c.getColumnIndex(android.app.SearchManager.SUGGEST_COLUMN_ICON_1);
             mIconName2Col = c.getColumnIndex(android.app.SearchManager.SUGGEST_COLUMN_ICON_2);
             mFlagsCol     = c.getColumnIndex(android.app.SearchManager.SUGGEST_COLUMN_FLAGS);
         }
     }
     catch (System.Exception e)
     {
         android.util.Log.e(LOG_TAG, "error changing cursor and caching columns", e);
     }
 }
예제 #3
0
 public override android.view.View newView(android.content.Context context, android.database.Cursor
                                           cursor, android.view.ViewGroup parent)
 {
     android.view.View v = base.newView(context, cursor, parent);
     v.setTag(new android.widget.SuggestionsAdapter.ChildViewCache(v));
     return(v);
 }
예제 #4
0
        public override android.database.Cursor runQueryOnBackgroundThread(java.lang.CharSequence
                                                                           constraint)
        {
            string query = (constraint == null) ? string.Empty : constraint.ToString();

            android.database.Cursor cursor = null;
            //mSearchView.getWindow().getDecorView().post(mStartSpinnerRunnable); // TODO:
            try
            {
                cursor = mSearchManager.getSuggestions(mSearchable, query, QUERY_LIMIT);
                // trigger fill window so the spinner stays up until the results are copied over and
                // closer to being ready
                if (cursor != null)
                {
                    cursor.getCount();
                    return(cursor);
                }
            }
            catch (java.lang.RuntimeException e)
            {
                android.util.Log.w(LOG_TAG, "Search suggestions query threw an exception.", e);
            }
            // If cursor is null or an exception was thrown, stop the spinner and return null.
            // changeCursor doesn't get called if cursor is null
            // mSearchView.getWindow().getDecorView().post(mStopSpinnerRunnable); // TODO:
            return(null);
        }
예제 #5
0
 /// <summary>Constructor.</summary>
 /// <remarks>Constructor.</remarks>
 /// <param name="context">
 /// The context where the
 /// <see cref="ExpandableListView">ExpandableListView</see>
 /// associated with this
 /// <see cref="SimpleCursorTreeAdapter">SimpleCursorTreeAdapter</see>
 /// is
 /// running
 /// </param>
 /// <param name="cursor">The database cursor</param>
 /// <param name="collapsedGroupLayout">
 /// The resource identifier of a layout file that
 /// defines the views for a collapsed group. The layout file
 /// should include at least those named views defined in groupTo.
 /// </param>
 /// <param name="expandedGroupLayout">
 /// The resource identifier of a layout file that
 /// defines the views for an expanded group. The layout file
 /// should include at least those named views defined in groupTo.
 /// </param>
 /// <param name="groupFrom">
 /// A list of column names that will be used to display the
 /// data for a group.
 /// </param>
 /// <param name="groupTo">
 /// The group views (from the group layouts) that should
 /// display column in the "from" parameter. These should all be
 /// TextViews or ImageViews. The first N views in this list are
 /// given the values of the first N columns in the from parameter.
 /// </param>
 /// <param name="childLayout">
 /// The resource identifier of a layout file that defines
 /// the views for a child. The layout file
 /// should include at least those named views defined in childTo.
 /// </param>
 /// <param name="childFrom">
 /// A list of column names that will be used to display the
 /// data for a child.
 /// </param>
 /// <param name="childTo">
 /// The child views (from the child layouts) that should
 /// display column in the "from" parameter. These should all be
 /// TextViews or ImageViews. The first N views in this list are
 /// given the values of the first N columns in the from parameter.
 /// </param>
 public SimpleCursorTreeAdapter(android.content.Context context, android.database.Cursor
                                cursor, int collapsedGroupLayout, int expandedGroupLayout, string[] groupFrom,
                                int[] groupTo, int childLayout, string[] childFrom, int[] childTo) : base(context
                                                                                                          , cursor, collapsedGroupLayout, expandedGroupLayout, childLayout)
 {
     init(groupFrom, groupTo, childFrom, childTo);
 }
예제 #6
0
 /// <summary>Standard constructor.</summary>
 /// <remarks>Standard constructor.</remarks>
 /// <param name="context">The context where the ListView associated with this adapter is running
 ///     </param>
 /// <param name="layout">
 /// Resource identifier of a layout file that defines the views
 /// for this list item.  Unless you override them later, this will
 /// define both the item views and the drop down views.
 /// </param>
 /// <param name="c">The cursor from which to get the data.</param>
 /// <param name="flags">
 /// Flags used to determine the behavior of the adapter,
 /// as per
 /// <see cref="CursorAdapter.CursorAdapter(android.content.Context, android.database.Cursor, int)
 ///     ">CursorAdapter.CursorAdapter(android.content.Context, android.database.Cursor, int)
 ///     </see>
 /// .
 /// </param>
 public ResourceCursorAdapter(android.content.Context context, int layout, android.database.Cursor
                              c, int flags) : base(context, c, flags)
 {
     mLayout   = mDropDownLayout = layout;
     mInflater = (android.view.LayoutInflater)context.getSystemService(android.content.Context
                                                                       .LAYOUT_INFLATER_SERVICE);
 }
 protected internal override android.view.View newGroupView(android.content.Context
                                                            context, android.database.Cursor cursor, bool isExpanded, android.view.ViewGroup
                                                            parent)
 {
     return(mInflater.inflate((isExpanded) ? mExpandedGroupLayout : mCollapsedGroupLayout
                              , parent, false));
 }
예제 #8
0
 internal virtual void changeCursor(android.database.Cursor cursor, bool releaseCursors
                                    )
 {
     if (cursor == this.mCursor)
     {
         return;
     }
     this.deactivate();
     this.mCursor = cursor;
     if (cursor != null)
     {
         cursor.registerContentObserver(this.mContentObserver);
         cursor.registerDataSetObserver(this.mDataSetObserver);
         this.mRowIDColumn = cursor.getColumnIndex("_id");
         this.mDataValid   = true;
         // notify the observers about the new cursor
         this._enclosing.notifyDataSetChanged(releaseCursors);
     }
     else
     {
         this.mRowIDColumn = -1;
         this.mDataValid   = false;
         // notify the observers about the lack of a data set
         this._enclosing.notifyDataSetInvalidated();
     }
 }
예제 #9
0
 public SimpleCursorAdapter(android.content.Context context, int layout, android.database.Cursor
                            c, string[] from, int[] to) : base(context, layout, c)
 {
     mTo           = to;
     mOriginalFrom = from;
     findColumns(from);
 }
예제 #10
0
 /// <summary>Sets the children Cursor for a particular group.</summary>
 /// <remarks>
 /// Sets the children Cursor for a particular group. If there is an existing cursor
 /// it will be closed.
 /// <p>
 /// This is useful when asynchronously querying to prevent blocking the UI.
 /// </remarks>
 /// <param name="groupPosition">The group whose children are being set via this Cursor.
 ///     </param>
 /// <param name="childrenCursor">The Cursor that contains the children of the group.</param>
 public virtual void setChildrenCursor(int groupPosition, android.database.Cursor
                                       childrenCursor)
 {
     android.widget.CursorTreeAdapter.MyCursorHelper childrenCursorHelper = getChildrenCursorHelper
                                                                                (groupPosition, false);
     childrenCursorHelper.changeCursor(childrenCursor, false);
 }
예제 #11
0
        public override java.lang.CharSequence convertToString(android.database.Cursor cursor
                                                               )
        {
            if (cursor == null)
            {
                return(null);
            }
            string query = getColumnString(cursor, android.app.SearchManager.SUGGEST_COLUMN_QUERY
                                           );

            if (query != null)
            {
                return(java.lang.CharSequenceProxy.Wrap(query));
            }
            if (mSearchable.shouldRewriteQueryFromData())
            {
                string data = getColumnString(cursor, android.app.SearchManager.SUGGEST_COLUMN_INTENT_DATA
                                              );
                if (data != null)
                {
                    return(java.lang.CharSequenceProxy.Wrap(data));
                }
            }
            if (mSearchable.shouldRewriteQueryFromText())
            {
                string text1 = getColumnString(cursor, android.app.SearchManager.SUGGEST_COLUMN_TEXT_1
                                               );
                if (text1 != null)
                {
                    return(java.lang.CharSequenceProxy.Wrap(text1));
                }
            }
            return(null);
        }
 protected internal override android.view.View newChildView(android.content.Context
                                                            context, android.database.Cursor cursor, bool isLastChild, android.view.ViewGroup
                                                            parent)
 {
     return(mInflater.inflate((isLastChild) ? mLastChildLayout : mChildLayout, parent,
                              false));
 }
예제 #13
0
 public virtual void changeCursor(android.database.Cursor cursor)
 {
     android.database.Cursor old = swapCursor(cursor);
     if (old != null)
     {
         old.close();
     }
 }
예제 #14
0
 internal override void publishResults(java.lang.CharSequence constraint, android.widget.Filter
                                       .FilterResults results)
 {
     android.database.Cursor oldCursor = mClient.getCursor();
     if (results.values != null && results.values != oldCursor)
     {
         mClient.changeCursor((android.database.Cursor)results.values);
     }
 }
예제 #15
0
 public override void bindView(android.view.View view, android.content.Context context
                               , android.database.Cursor cursor)
 {
     android.widget.CheckedTextView text = (android.widget.CheckedTextView)view.findViewById
                                               ([email protected]);
     text.setText(java.lang.CharSequenceProxy.Wrap(cursor.getString(this.mLabelIndex))
                  );
     listView.setItemChecked(cursor.getPosition(), cursor.getInt(this.mIsCheckedIndex)
                             == 1);
 }
예제 #16
0
 protected internal override void bindChildView(android.view.View view, android.content.Context
                                                context, android.database.Cursor cursor, bool isLastChild)
 {
     if (mChildFrom == null)
     {
         mChildFrom = new int[mChildFromNames.Length];
         initFromColumns(cursor, mChildFromNames, mChildFrom);
     }
     bindView(view, context, cursor, mChildFrom, mChildTo);
 }
예제 #17
0
 protected internal override void bindGroupView(android.view.View view, android.content.Context
                                                context, android.database.Cursor cursor, bool isExpanded)
 {
     if (mGroupFrom == null)
     {
         mGroupFrom = new int[mGroupFromNames.Length];
         initFromColumns(cursor, mGroupFromNames, mGroupFrom);
     }
     bindView(view, context, cursor, mGroupFrom, mGroupTo);
 }
예제 #18
0
 private void initFromColumns(android.database.Cursor cursor, string[] fromColumnNames
                              , int[] fromColumns)
 {
     {
         for (int i = fromColumnNames.Length - 1; i >= 0; i--)
         {
             fromColumns[i] = cursor.getColumnIndexOrThrow(fromColumnNames[i]);
         }
     }
 }
예제 #19
0
        private android.graphics.drawable.Drawable getIcon2(android.database.Cursor cursor
                                                            )
        {
            if (mIconName2Col == INVALID_INDEX)
            {
                return(null);
            }
            string value = cursor.getString(mIconName2Col);

            return(getDrawableFromResourceValue(value));
        }
예제 #20
0
 internal virtual void deactivate()
 {
     if (this.mCursor == null)
     {
         return;
     }
     this.mCursor.unregisterContentObserver(this.mContentObserver);
     this.mCursor.unregisterDataSetObserver(this.mDataSetObserver);
     this.mCursor.close();
     this.mCursor = null;
 }
 /// <summary>Constructor.</summary>
 /// <remarks>Constructor.</remarks>
 /// <param name="context">
 /// The context where the ListView associated with this
 /// SimpleListItemFactory is running
 /// </param>
 /// <param name="cursor">The database cursor</param>
 /// <param name="collapsedGroupLayout">
 /// resource identifier of a layout file that
 /// defines the views for collapsed groups.
 /// </param>
 /// <param name="expandedGroupLayout">
 /// resource identifier of a layout file that
 /// defines the views for expanded groups.
 /// </param>
 /// <param name="childLayout">
 /// resource identifier of a layout file that defines the
 /// views for all children but the last..
 /// </param>
 /// <param name="lastChildLayout">
 /// resource identifier of a layout file that defines
 /// the views for the last child of a group.
 /// </param>
 public ResourceCursorTreeAdapter(android.content.Context context, android.database.Cursor
                                  cursor, int collapsedGroupLayout, int expandedGroupLayout, int childLayout, int
                                  lastChildLayout) : base(cursor, context)
 {
     mCollapsedGroupLayout = collapsedGroupLayout;
     mExpandedGroupLayout  = expandedGroupLayout;
     mChildLayout          = childLayout;
     mLastChildLayout      = lastChildLayout;
     mInflater             = (android.view.LayoutInflater)context.getSystemService(android.content.Context
                                                                                   .LAYOUT_INFLATER_SERVICE);
 }
예제 #22
0
 private void init(android.database.Cursor cursor, android.content.Context context
                   , bool autoRequery)
 {
     mContext           = context;
     mHandler           = new android.os.Handler();
     mAutoRequery       = autoRequery;
     mGroupCursorHelper = new android.widget.CursorTreeAdapter.MyCursorHelper(this, cursor
                                                                              );
     mChildrenCursorHelpers = new android.util.SparseArray <android.widget.CursorTreeAdapter
                                                            .MyCursorHelper>();
 }
예제 #23
0
 public virtual global::java.lang.String convertToString(android.database.Cursor arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         return(global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallObjectMethod(this.JvmHandle, global::android.widget.CursorTreeAdapter._convertToString11145, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as java.lang.String);
     }
     else
     {
         return(global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallNonVirtualObjectMethod(this.JvmHandle, global::android.widget.CursorTreeAdapter.staticClass, global::android.widget.CursorTreeAdapter._convertToString11145, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as java.lang.String);
     }
 }
예제 #24
0
 public virtual void changeCursorAndColumns(android.database.Cursor arg0, java.lang.String[] arg1, int[] arg2)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::android.widget.SimpleCursorAdapter._changeCursorAndColumns11932, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.widget.SimpleCursorAdapter.staticClass, global::android.widget.SimpleCursorAdapter._changeCursorAndColumns11932, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2));
     }
 }
예제 #25
0
 public override global::java.lang.CharSequence convertToString(android.database.Cursor arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         return(global::MonoJavaBridge.JavaBridge.WrapIJavaObject <global::java.lang.CharSequence>(@__env.CallObjectMethod(this.JvmHandle, global::android.widget.SimpleCursorAdapter._convertToString11923, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as java.lang.CharSequence);
     }
     else
     {
         return(global::MonoJavaBridge.JavaBridge.WrapIJavaObject <global::java.lang.CharSequence>(@__env.CallNonVirtualObjectMethod(this.JvmHandle, global::android.widget.SimpleCursorAdapter.staticClass, global::android.widget.SimpleCursorAdapter._convertToString11923, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as java.lang.CharSequence);
     }
 }
예제 #26
0
 public override void changeCursor(android.database.Cursor arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::android.widget.SimpleCursorAdapter._changeCursor11922, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.widget.SimpleCursorAdapter.staticClass, global::android.widget.SimpleCursorAdapter._changeCursor11922, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     }
 }
예제 #27
0
 protected override global::android.database.Cursor getChildrenCursor(android.database.Cursor arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         return(global::MonoJavaBridge.JavaBridge.WrapIJavaObject <global::android.database.Cursor>(@__env.CallObjectMethod(this.JvmHandle, global::android.widget.CursorTreeAdapter_._getChildrenCursor11158, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as android.database.Cursor);
     }
     else
     {
         return(global::MonoJavaBridge.JavaBridge.WrapIJavaObject <global::android.database.Cursor>(@__env.CallNonVirtualObjectMethod(this.JvmHandle, global::android.widget.CursorTreeAdapter_.staticClass, global::android.widget.CursorTreeAdapter_._getChildrenCursor11158, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as android.database.Cursor);
     }
 }
예제 #28
0
 public virtual void setChildrenCursor(int arg0, android.database.Cursor arg1)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::android.widget.CursorTreeAdapter._setChildrenCursor11151, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.widget.CursorTreeAdapter.staticClass, global::android.widget.CursorTreeAdapter._setChildrenCursor11151, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
 }
예제 #29
0
        private void updateSpinnerState(android.database.Cursor cursor)
        {
            android.os.Bundle extras = cursor != null?cursor.getExtras() : null;

            // Check if the Cursor indicates that the query is not complete and show the spinner
            if (extras != null && extras.getBoolean(android.app.SearchManager.CURSOR_EXTRA_KEY_IN_PROGRESS
                                                    ))
            {
                // mSearchView.getWindow().getDecorView().post(mStartSpinnerRunnable); // TODO:
                return;
            }
        }
예제 #30
0
 protected virtual void init(android.content.Context arg0, android.database.Cursor arg1, bool arg2)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::android.widget.CursorAdapter._init11106, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.widget.CursorAdapter.staticClass, global::android.widget.CursorAdapter._init11106, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2));
     }
 }
예제 #31
0
		/// <summary>Swap in a new Cursor, returning the old Cursor.</summary>
		/// <remarks>
		/// Swap in a new Cursor, returning the old Cursor.  Unlike
		/// <see cref="changeCursor(android.database.Cursor)">changeCursor(android.database.Cursor)
		/// 	</see>
		/// , the returned old Cursor is <em>not</em>
		/// closed.
		/// </remarks>
		/// <param name="newCursor">The new cursor to be used.</param>
		/// <returns>
		/// Returns the previously set Cursor, or null if there wasa not one.
		/// If the given new Cursor is the same instance is the previously set
		/// Cursor, null is also returned.
		/// </returns>
		public virtual android.database.Cursor swapCursor(android.database.Cursor newCursor
			)
		{
			if (newCursor == mCursor)
			{
				return null;
			}
			android.database.Cursor oldCursor = mCursor;
			if (oldCursor != null)
			{
				if (mChangeObserver != null)
				{
					oldCursor.unregisterContentObserver(mChangeObserver);
				}
				if (mDataSetObserver != null)
				{
					oldCursor.unregisterDataSetObserver(mDataSetObserver);
				}
			}
			mCursor = newCursor;
			if (newCursor != null)
			{
				if (mChangeObserver != null)
				{
					newCursor.registerContentObserver(mChangeObserver);
				}
				if (mDataSetObserver != null)
				{
					newCursor.registerDataSetObserver(mDataSetObserver);
				}
				mRowIDColumn = newCursor.getColumnIndexOrThrow("_id");
				mDataValid = true;
				// notify the observers about the new cursor
				notifyDataSetChanged();
			}
			else
			{
				mRowIDColumn = -1;
				mDataValid = false;
				// notify the observers about the lack of a data set
				notifyDataSetInvalidated();
			}
			return oldCursor;
		}
예제 #32
0
		internal virtual void init(android.content.Context context, android.database.Cursor
			 c, int flags)
		{
			if ((flags & FLAG_AUTO_REQUERY) == FLAG_AUTO_REQUERY)
			{
				flags |= FLAG_REGISTER_CONTENT_OBSERVER;
				mAutoRequery = true;
			}
			else
			{
				mAutoRequery = false;
			}
			bool cursorPresent = c != null;
			mCursor = c;
			mDataValid = cursorPresent;
			mContext = context;
			mRowIDColumn = cursorPresent ? c.getColumnIndexOrThrow("_id") : -1;
			if ((flags & FLAG_REGISTER_CONTENT_OBSERVER) == FLAG_REGISTER_CONTENT_OBSERVER)
			{
				mChangeObserver = new android.widget.CursorAdapter.ChangeObserver(this);
				mDataSetObserver = new android.widget.CursorAdapter.MyDataSetObserver(this);
			}
			else
			{
				mChangeObserver = null;
				mDataSetObserver = null;
			}
			if (cursorPresent)
			{
				if (mChangeObserver != null)
				{
					c.registerContentObserver(mChangeObserver);
				}
				if (mDataSetObserver != null)
				{
					c.registerDataSetObserver(mDataSetObserver);
				}
			}
		}
예제 #33
0
			internal virtual void deactivate()
			{
				if (this.mCursor == null)
				{
					return;
				}
				this.mCursor.unregisterContentObserver(this.mContentObserver);
				this.mCursor.unregisterDataSetObserver(this.mDataSetObserver);
				this.mCursor.close();
				this.mCursor = null;
			}
예제 #34
0
			internal virtual void changeCursor(android.database.Cursor cursor, bool releaseCursors
				)
			{
				if (cursor == this.mCursor)
				{
					return;
				}
				this.deactivate();
				this.mCursor = cursor;
				if (cursor != null)
				{
					cursor.registerContentObserver(this.mContentObserver);
					cursor.registerDataSetObserver(this.mDataSetObserver);
					this.mRowIDColumn = cursor.getColumnIndex("_id");
					this.mDataValid = true;
					// notify the observers about the new cursor
					this._enclosing.notifyDataSetChanged(releaseCursors);
				}
				else
				{
					this.mRowIDColumn = -1;
					this.mDataValid = false;
					// notify the observers about the lack of a data set
					this._enclosing.notifyDataSetInvalidated();
				}
			}
예제 #35
0
			internal MyCursorHelper(CursorTreeAdapter _enclosing, android.database.Cursor cursor
				)
			{
				this._enclosing = _enclosing;
				bool cursorPresent = cursor != null;
				this.mCursor = cursor;
				this.mDataValid = cursorPresent;
				this.mRowIDColumn = cursorPresent ? cursor.getColumnIndex("_id") : -1;
				this.mContentObserver = new android.widget.CursorTreeAdapter.MyCursorHelper.MyContentObserver
					(this);
				this.mDataSetObserver = new android.widget.CursorTreeAdapter.MyCursorHelper.MyDataSetObserver
					(this);
				if (cursorPresent)
				{
					cursor.registerContentObserver(this.mContentObserver);
					cursor.registerDataSetObserver(this.mDataSetObserver);
				}
			}