Exemplo n.º 1
0
		public virtual void setCharSequence(java.lang.CharSequence charSequence, int start
			, int end)
		{
			mOffsetShift = System.Math.Max(0, start - WINDOW_WIDTH);
			int windowEnd = System.Math.Min(charSequence.Length, end + WINDOW_WIDTH);
			mString = Sharpen.StringHelper.Substring(charSequence.ToString(), mOffsetShift, windowEnd
				);
			mIterator.setText(mString);
		}
Exemplo n.º 2
0
		public static int convertValueToInt(java.lang.CharSequence charSeq, int defaultValue
			)
		{
			if (null == charSeq)
			{
				return defaultValue;
			}
			string nm = charSeq.ToString();
			// XXX This code is copied from Integer.decode() so we don't
			// have to instantiate an Integer!
			int value;
			int sign = 1;
			int index = 0;
			int len = nm.Length;
			int @base = 10;
			if ('-' == nm[0])
			{
				sign = -1;
				index++;
			}
			if ('0' == nm[index])
			{
				//  Quick check for a zero by itself
				if (index == (len - 1))
				{
					return 0;
				}
				char c = nm[index + 1];
				if ('x' == c || 'X' == c)
				{
					index += 2;
					@base = 16;
				}
				else
				{
					index++;
					@base = 8;
				}
			}
			else
			{
				if ('#' == nm[index])
				{
					index++;
					@base = 16;
				}
			}
			return System.Convert.ToInt32(Sharpen.StringHelper.Substring(nm, index), @base) *
				 sign;
		}
Exemplo n.º 3
0
		internal SpannableStringInternal(java.lang.CharSequence source, int start, int end
			)
		{
			if (start == 0 && end == source.Length)
			{
				mText = source.ToString();
			}
			else
			{
				mText = Sharpen.StringHelper.Substring(source.ToString(), start, end);
			}
			int initial = [email protected](0);
			mSpans = new object[initial];
			mSpanData = new int[initial * 3];
			if (source is android.text.Spanned)
			{
				android.text.Spanned sp = (android.text.Spanned)source;
				object[] spans = sp.getSpans<object>(start, end);
				{
					for (int i = 0; i < spans.Length; i++)
					{
						int st = sp.getSpanStart(spans[i]);
						int en = sp.getSpanEnd(spans[i]);
						int fl = sp.getSpanFlags(spans[i]);
						if (st < start)
						{
							st = start;
						}
						if (en > end)
						{
							en = end;
						}
						setSpan(spans[i], st - start, en - start, fl);
					}
				}
			}
		}
Exemplo n.º 4
0
		private void onTextChanged(java.lang.CharSequence newText)
		{
			java.lang.CharSequence text = ((android.text.Editable)mQueryTextView.getText());
			mUserQuery = text;
			bool hasText = !android.text.TextUtils.isEmpty(text);
			if (isSubmitButtonEnabled())
			{
				updateSubmitButton(hasText);
			}
			updateVoiceButton(!hasText);
			updateCloseButton();
			updateSubmitArea();
			if (mOnQueryChangeListener != null && !android.text.TextUtils.equals(newText, mOldQueryText
				))
			{
				mOnQueryChangeListener.onQueryTextChange(newText.ToString());
			}
			mOldQueryText = java.lang.CharSequenceProxy.Wrap(newText.ToString());
		}
Exemplo n.º 5
0
			internal override android.widget.Filter.FilterResults performFiltering(java.lang.CharSequence
				 prefix)
			{
				android.widget.Filter.FilterResults results = new android.widget.Filter.FilterResults
					();
				if (this._enclosing.mUnfilteredData == null)
				{
					this._enclosing.mUnfilteredData = new java.util.ArrayList<java.util.Map<string, object
						>>(this._enclosing.mData);
				}
				if (prefix == null || prefix.Length == 0)
				{
					java.util.ArrayList<java.util.Map<string, object>> list = this._enclosing.mUnfilteredData;
					results.values = list;
					results.count = list.size();
				}
				else
				{
					string prefixString = prefix.ToString().ToLower();
					java.util.ArrayList<java.util.Map<string, object>> unfilteredValues = this._enclosing
						.mUnfilteredData;
					int count = unfilteredValues.size();
					java.util.ArrayList<java.util.Map<string, object>> newValues = new java.util.ArrayList
						<java.util.Map<string, object>>(count);
					{
						for (int i = 0; i < count; i++)
						{
							java.util.Map<string, object> h = unfilteredValues.get(i);
							if (h != null)
							{
								int len = this._enclosing.mTo.Length;
								{
									for (int j = 0; j < len; j++)
									{
										string str = (string)h.get(this._enclosing.mFrom[j]);
										string[] words = XobotOS.Runtime.Util.SplitStringRegex(str, " ");
										int wordCount = words.Length;
										{
											for (int k = 0; k < wordCount; k++)
											{
												string word = words[k];
												if (word.ToLower().StartsWith(prefixString))
												{
													newValues.add(h);
													break;
												}
											}
										}
									}
								}
							}
						}
					}
					results.values = newValues;
					results.count = newValues.size();
				}
				return results;
			}
 /// <exception cref="System.IO.IOException"/>
 /// <exception cref="com.fasterxml.jackson.core.JsonGenerationException"/>
 public override void writeNumber(java.math.BigDecimal value)
 {
     // Don't really know max length for big decimal, no point checking
     _verifyValueWrite(WRITE_NUMBER);
     if (value == null)
     {
         _writeNull();
     }
     else
     {
         if (_cfgNumbersAsStrings)
         {
             string raw = isEnabled(com.fasterxml.jackson.core.JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN
                 ) ? value.toPlainString() : value.ToString();
             _writeQuotedRaw(raw);
         }
         else
         {
             if (isEnabled(com.fasterxml.jackson.core.JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN
                 ))
             {
                 writeRaw(value.toPlainString());
             }
             else
             {
                 writeRaw(value.ToString());
             }
         }
     }
 }
Exemplo n.º 7
0
		/// <summary>Render a run of all LTR or all RTL text, with shaping.</summary>
		/// <remarks>
		/// Render a run of all LTR or all RTL text, with shaping. This does not run
		/// bidi on the provided text, but renders it as a uniform right-to-left or
		/// left-to-right run, as indicated by dir. Alignment of the text is as
		/// determined by the Paint's TextAlign value.
		/// </remarks>
		/// <param name="text">the text to render</param>
		/// <param name="start">
		/// the start of the text to render. Data before this position
		/// can be used for shaping context.
		/// </param>
		/// <param name="end">
		/// the end of the text to render. Data at or after this
		/// position can be used for shaping context.
		/// </param>
		/// <param name="x">the x position at which to draw the text</param>
		/// <param name="y">the y position at which to draw the text</param>
		/// <param name="dir">the run direction, either 0 for LTR or 1 for RTL.</param>
		/// <param name="paint">the paint</param>
		/// <hide></hide>
		public virtual void drawTextRun(java.lang.CharSequence text, int start, int end, 
			int contextStart, int contextEnd, float x, float y, int dir, android.graphics.Paint
			 paint)
		{
			if (text == null)
			{
				throw new System.ArgumentNullException("text is null");
			}
			if (paint == null)
			{
				throw new System.ArgumentNullException("paint is null");
			}
			if ((start | end | end - start | text.Length - end) < 0)
			{
				throw new System.IndexOutOfRangeException();
			}
			int flags = dir == 0 ? 0 : 1;
			if (java.lang.CharSequenceProxy.IsStringProxy(text) || text is android.text.SpannedString
				 || text is android.text.SpannableString)
			{
				native_drawTextRun(mNativeCanvas, text.ToString(), start, end, contextStart, contextEnd
					, x, y, flags, paint.mNativePaint);
			}
			else
			{
				if (text is android.text.GraphicsOperations)
				{
					((android.text.GraphicsOperations)text).drawTextRun(this, start, end, contextStart
						, contextEnd, x, y, flags, paint);
				}
				else
				{
					int contextLen = contextEnd - contextStart;
					int len = end - start;
					char[] buf = android.graphics.TemporaryBuffer.obtain(contextLen);
					android.text.TextUtils.getChars(text, contextStart, contextEnd, buf, 0);
					native_drawTextRun(mNativeCanvas, buf, start - contextStart, len, 0, contextLen, 
						x, y, flags, paint.mNativePaint);
					android.graphics.TemporaryBuffer.recycle(buf);
				}
			}
		}
Exemplo n.º 8
0
		/// <summary>
		/// Inserts the specified CharSequence into this buffer at the specified
		/// index.
		/// </summary>
		/// <remarks>
		/// Inserts the specified CharSequence into this buffer at the specified
		/// index.
		/// <p>
		/// If the specified CharSequence is
		/// <code>null</code>
		/// , the string
		/// <code>"null"</code>
		/// is inserted, otherwise the contents of the CharSequence.
		/// </remarks>
		/// <param name="index">The index at which to insert.</param>
		/// <param name="s">The char sequence to insert.</param>
		/// <returns>this buffer.</returns>
		/// <exception cref="IndexOutOfRangeException">
		/// if
		/// <code>index &lt; 0</code>
		/// or
		/// <code>index &gt; length()</code>
		/// .
		/// </exception>
		/// <since>1.5</since>
		public java.lang.StringBuffer insert(int index, java.lang.CharSequence s)
		{
			lock (this)
			{
				insert0(index, s == null ? "null" : s.ToString());
				return this;
			}
		}
Exemplo n.º 9
0
		public static int parseUnsignedIntAttribute(java.lang.CharSequence charSeq)
		{
			string value = charSeq.ToString();
			long bits;
			int index = 0;
			int len = value.Length;
			int @base = 10;
			if ('0' == value[index])
			{
				//  Quick check for zero by itself
				if (index == (len - 1))
				{
					return 0;
				}
				char c = value[index + 1];
				if ('x' == c || 'X' == c)
				{
					//  check for hex
					index += 2;
					@base = 16;
				}
				else
				{
					//  check for octal
					index++;
					@base = 8;
				}
			}
			else
			{
				if ('#' == value[index])
				{
					index++;
					@base = 16;
				}
			}
			return (int)Sharpen.Util.ParseLong(Sharpen.StringHelper.Substring(value, index), 
				@base);
		}
Exemplo n.º 10
0
		/// <summary>
		/// Constructs an instance that's initialized with the contents of the
		/// specified
		/// <code>CharSequence</code>
		/// . The capacity of the new builder will be
		/// the length of the
		/// <code>CharSequence</code>
		/// plus 16.
		/// </summary>
		/// <param name="seq">
		/// the
		/// <code>CharSequence</code>
		/// to copy into the builder.
		/// </param>
		/// <exception cref="ArgumentNullException">
		/// if
		/// <code>seq</code>
		/// is
		/// <code>null</code>
		/// .
		/// </exception>
		public StringBuilder(java.lang.CharSequence seq) : base(seq.ToString())
		{
		}
Exemplo n.º 11
0
		public override void setTitle (java.lang.CharSequence title)
		{
			this.title = title.ToString ();
			XobotActivityManager.MainForm.Text = title.ToString ();
		}
Exemplo n.º 12
0
		public virtual java.io.PrintStream append(java.lang.CharSequence charSequence)
		{
			if (charSequence == null)
			{
				print("null");
			}
			else
			{
				print(charSequence.ToString());
			}
			return this;
		}
Exemplo n.º 13
0
		/// <summary>Returns the next cursor position in the run.</summary>
		/// <remarks>
		/// Returns the next cursor position in the run.  This avoids placing the
		/// cursor between surrogates, between characters that form conjuncts,
		/// between base characters and combining marks, or within a reordering
		/// cluster.
		/// <p>ContextStart, contextEnd, and offset are relative to the start of
		/// text.  The context is the shaping context for cursor movement, generally
		/// the bounds of the metric span enclosing the cursor in the direction of
		/// movement.
		/// <p>If cursorOpt is
		/// <see cref="CURSOR_AT">CURSOR_AT</see>
		/// and the offset is not a valid
		/// cursor position, this returns -1.  Otherwise this will never return a
		/// value before contextStart or after contextEnd.
		/// </remarks>
		/// <param name="text">the text</param>
		/// <param name="contextStart">the start of the context</param>
		/// <param name="contextEnd">the end of the context</param>
		/// <param name="flags">
		/// either
		/// <see cref="DIRECTION_RTL">DIRECTION_RTL</see>
		/// or
		/// <see cref="DIRECTION_LTR">DIRECTION_LTR</see>
		/// </param>
		/// <param name="offset">the cursor position to move from</param>
		/// <param name="cursorOpt">
		/// how to move the cursor, one of
		/// <see cref="CURSOR_AFTER">CURSOR_AFTER</see>
		/// ,
		/// <see cref="CURSOR_AT_OR_AFTER">CURSOR_AT_OR_AFTER</see>
		/// ,
		/// <see cref="CURSOR_BEFORE">CURSOR_BEFORE</see>
		/// ,
		/// <see cref="CURSOR_AT_OR_BEFORE">CURSOR_AT_OR_BEFORE</see>
		/// , or
		/// <see cref="CURSOR_AT">CURSOR_AT</see>
		/// </param>
		/// <returns>the offset of the next position, or -1</returns>
		/// <hide></hide>
		public virtual int getTextRunCursor(java.lang.CharSequence text, int contextStart
			, int contextEnd, int flags, int offset, int cursorOpt)
		{
			if (java.lang.CharSequenceProxy.IsStringProxy(text) || text is android.text.SpannedString
				 || text is android.text.SpannableString)
			{
				return getTextRunCursor(text.ToString(), contextStart, contextEnd, flags, offset, 
					cursorOpt);
			}
			if (text is android.text.GraphicsOperations)
			{
				return ((android.text.GraphicsOperations)text).getTextRunCursor(contextStart, contextEnd
					, flags, offset, cursorOpt, this);
			}
			int contextLen = contextEnd - contextStart;
			char[] buf = android.graphics.TemporaryBuffer.obtain(contextLen);
			android.text.TextUtils.getChars(text, contextStart, contextEnd, buf, 0);
			int result = getTextRunCursor(buf, 0, contextLen, flags, offset - contextStart, cursorOpt
				);
			android.graphics.TemporaryBuffer.recycle(buf);
			return result;
		}
Exemplo n.º 14
0
		/// <summary>
		/// Convenience overload that takes a CharSequence instead of a
		/// String.
		/// </summary>
		/// <remarks>
		/// Convenience overload that takes a CharSequence instead of a
		/// String.
		/// </remarks>
		/// <seealso cref="getTextRunAdvances(string, int, int, int, int, int, float[], int)"
		/// 	>getTextRunAdvances(string, int, int, int, int, int, float[], int)</seealso>
		/// <hide></hide>
		public virtual float getTextRunAdvances(java.lang.CharSequence text, int start, int
			 end, int contextStart, int contextEnd, int flags, float[] advances, int advancesIndex
			, int reserved)
		{
			if (text == null)
			{
				throw new System.ArgumentException("text cannot be null");
			}
			if ((start | end | contextStart | contextEnd | advancesIndex | (end - start) | (start
				 - contextStart) | (contextEnd - end) | (text.Length - contextEnd) | (advances ==
				 null ? 0 : (advances.Length - advancesIndex - (end - start)))) < 0)
			{
				throw new System.IndexOutOfRangeException();
			}
			if (java.lang.CharSequenceProxy.IsStringProxy(text))
			{
				return getTextRunAdvances(java.lang.CharSequenceProxy.UnWrap(text), start, end, contextStart
					, contextEnd, flags, advances, advancesIndex, reserved);
			}
			if (text is android.text.SpannedString || text is android.text.SpannableString)
			{
				return getTextRunAdvances(text.ToString(), start, end, contextStart, contextEnd, 
					flags, advances, advancesIndex, reserved);
			}
			if (text is android.text.GraphicsOperations)
			{
				return ((android.text.GraphicsOperations)text).getTextRunAdvances(start, end, contextStart
					, contextEnd, flags, advances, advancesIndex, this);
			}
			if (text.Length == 0 || end == start)
			{
				return 0f;
			}
			int contextLen = contextEnd - contextStart;
			int len = end - start;
			char[] buf = android.graphics.TemporaryBuffer.obtain(contextLen);
			android.text.TextUtils.getChars(text, contextStart, contextEnd, buf, 0);
			float result = getTextRunAdvances(buf, start - contextStart, len, 0, contextLen, 
				flags, advances, advancesIndex, reserved);
			android.graphics.TemporaryBuffer.recycle(buf);
			return result;
		}
Exemplo n.º 15
0
		/// <summary>Return the advance widths for the characters in the string.</summary>
		/// <remarks>Return the advance widths for the characters in the string.</remarks>
		/// <param name="text">The text to measure. Cannot be null.</param>
		/// <param name="start">The index of the first char to to measure</param>
		/// <param name="end">The end of the text slice to measure</param>
		/// <param name="widths">
		/// array to receive the advance widths of the characters.
		/// Must be at least a large as (end - start).
		/// </param>
		/// <returns>the actual number of widths returned.</returns>
		public virtual int getTextWidths(java.lang.CharSequence text, int start, int end, 
			float[] widths)
		{
			if (text == null)
			{
				throw new System.ArgumentException("text cannot be null");
			}
			if ((start | end | (end - start) | (text.Length - end)) < 0)
			{
				throw new System.IndexOutOfRangeException();
			}
			if (end - start > widths.Length)
			{
				throw new System.IndexOutOfRangeException();
			}
			if (text.Length == 0 || start == end)
			{
				return 0;
			}
			if (java.lang.CharSequenceProxy.IsStringProxy(text))
			{
				return getTextWidths(java.lang.CharSequenceProxy.UnWrap(text), start, end, widths
					);
			}
			if (text is android.text.SpannedString || text is android.text.SpannableString)
			{
				return getTextWidths(text.ToString(), start, end, widths);
			}
			if (text is android.text.GraphicsOperations)
			{
				return ((android.text.GraphicsOperations)text).getTextWidths(start, end, widths, 
					this);
			}
			char[] buf = android.graphics.TemporaryBuffer.obtain(end - start);
			android.text.TextUtils.getChars(text, start, end, buf, 0);
			int result = getTextWidths(buf, 0, end - start, widths);
			android.graphics.TemporaryBuffer.recycle(buf);
			return result;
		}
Exemplo n.º 16
0
		/// <summary>
		/// Constructs a StringBuffer and initializes it with the content from the
		/// specified
		/// <code>CharSequence</code>
		/// . The capacity of the new buffer will be
		/// the length of the
		/// <code>CharSequence</code>
		/// plus the default capacity.
		/// </summary>
		/// <param name="cs">the content to initialize the instance.</param>
		/// <exception cref="ArgumentNullException">
		/// if
		/// <code>cs</code>
		/// is
		/// <code>null</code>
		/// .
		/// </exception>
		/// <since>1.5</since>
		public StringBuffer(java.lang.CharSequence cs) : base(cs.ToString())
		{
		}
Exemplo n.º 17
0
		/// <summary>
		/// Splits the given
		/// <code>input</code>
		/// at occurrences of this pattern.
		/// <p>If this pattern does not occur in the input, the result is an
		/// array containing the input (converted from a
		/// <code>CharSequence</code>
		/// to
		/// a
		/// <code>String</code>
		/// ).
		/// <p>Otherwise, the
		/// <code>limit</code>
		/// parameter controls the contents of the
		/// returned array as described below.
		/// </summary>
		/// <param name="limit">
		/// Determines the maximum number of entries in the resulting
		/// array, and the treatment of trailing empty strings.
		/// <ul>
		/// <li>For n &gt; 0, the resulting array contains at most n
		/// entries. If this is fewer than the number of matches, the
		/// final entry will contain all remaining input.
		/// <li>For n &lt; 0, the length of the resulting array is
		/// exactly the number of occurrences of the
		/// <code>Pattern</code>
		/// plus one for the text after the final separator.
		/// All entries are included.
		/// <li>For n == 0, the result is as for n &lt; 0, except
		/// trailing empty strings will not be returned. (Note that
		/// the case where the input is itself an empty string is
		/// special, as described above, and the limit parameter does
		/// not apply there.)
		/// </ul>
		/// </param>
		public string[] split(java.lang.CharSequence input, int limit)
		{
			return java.util.regex.Splitter.split(this, _pattern, input.ToString(), limit);
		}
Exemplo n.º 18
0
		/// <summary>Resets the Matcher.</summary>
		/// <remarks>
		/// Resets the Matcher. A new input sequence and a new region can be
		/// specified. Results of a previous find get lost. The next attempt to find
		/// an occurrence of the Pattern in the string will start at the beginning of
		/// the region. This is the internal version of reset() to which the several
		/// public versions delegate.
		/// </remarks>
		/// <param name="input">the input sequence.</param>
		/// <param name="start">the start of the region.</param>
		/// <param name="end">the end of the region.</param>
		/// <returns>the matcher itself.</returns>
		private java.util.regex.Matcher reset(java.lang.CharSequence input, int start_1, 
			int end_1)
		{
			if (input == null)
			{
				throw new System.ArgumentException();
			}
			if (start_1 < 0 || end_1 < 0 || start_1 > input.Length || end_1 > input.Length ||
				 start_1 > end_1)
			{
				throw new System.IndexOutOfRangeException();
			}
			this.input = input.ToString();
			this._regionStart = start_1;
			this._regionEnd = end_1;
			resetForInput();
			matchFound = false;
			findPos = _regionStart;
			appendPos = 0;
			return this;
		}
Exemplo n.º 19
0
		/// <summary>
		/// Inserts the string representation of the specified
		/// <code>CharSequence</code>
		/// at the specified
		/// <code>offset</code>
		/// . The
		/// <code>CharSequence</code>
		/// is converted
		/// to a String as defined by
		/// <see cref="CharSequence.ToString()">CharSequence.ToString()</see>
		/// . If
		/// <code>s</code>
		/// is
		/// <code>null</code>
		/// , then the String
		/// <code>"null"</code>
		/// is inserted.
		/// </summary>
		/// <param name="offset">the index to insert at.</param>
		/// <param name="s">
		/// the
		/// <code>CharSequence</code>
		/// to insert.
		/// </param>
		/// <returns>this builder.</returns>
		/// <exception cref="IndexOutOfRangeException">
		/// if
		/// <code>offset</code>
		/// is negative or greater than the current
		/// <code>length()</code>
		/// .
		/// </exception>
		/// <seealso cref="CharSequence.ToString()">CharSequence.ToString()</seealso>
		public java.lang.StringBuilder insert(int offset, java.lang.CharSequence s)
		{
			insert0(offset, s == null ? "null" : s.ToString());
			return this;
		}
Exemplo n.º 20
0
 public static object reduce(java.math.BigInteger jmbi)
 {
     // TODO: Get rid of this when we replace BigDecimal
     return reduce(BigInteger.Parse(jmbi.ToString()));
 }
Exemplo n.º 21
0
 // TODO: Get rid of this when get the new BigDecimal
 public Ratio(java.math.BigInteger numerator, BigInteger denominator)
 {
     _numerator = BigInteger.Parse(numerator.ToString());
     _denominator = denominator;
 }
		/// <summary>Produce a string from a Number.</summary>
		/// <param name="number">A Number</param>
		/// <returns>A String.</returns>
		/// <exception cref="JSONException">If n is a non-finite number.</exception>
		/// <exception cref="org.json.JSONException"/>
		public static string NumberToString(java.lang.Number number)
		{
			if (number == null)
			{
				throw new org.json.JSONException("Null pointer");
			}
			TestValidity(number);
			// Shave off trailing zeros and decimal point, if possible.
			string @string = number.ToString();
			if (@string.IndexOf('.') > 0 && @string.IndexOf('e') < 0 && @string.IndexOf('E') < 0)
			{
				while (@string.EndsWith("0"))
				{
					@string = Sharpen.Runtime.Substring(@string, 0, @string.Length - 1);
				}
				if (@string.EndsWith("."))
				{
					@string = Sharpen.Runtime.Substring(@string, 0, @string.Length - 1);
				}
			}
			return @string;
		}
Exemplo n.º 23
0
		public override java.io.Writer append(java.lang.CharSequence csq)
		{
			if (csq == null)
			{
				csq = java.lang.CharSequenceProxy.Wrap("null");
			}
			write(csq.ToString());
			return this;
		}
Exemplo n.º 24
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;
		}
Exemplo n.º 25
0
		/// <summary>
		/// Draw the specified range of text, specified by start/end, with its
		/// origin at (x,y), in the specified Paint.
		/// </summary>
		/// <remarks>
		/// Draw the specified range of text, specified by start/end, with its
		/// origin at (x,y), in the specified Paint. The origin is interpreted
		/// based on the Align setting in the Paint.
		/// </remarks>
		/// <param name="text">The text to be drawn</param>
		/// <param name="start">The index of the first character in text to draw</param>
		/// <param name="end">
		/// (end - 1) is the index of the last character in text
		/// to draw
		/// </param>
		/// <param name="x">The x-coordinate of origin for where to draw the text</param>
		/// <param name="y">The y-coordinate of origin for where to draw the text</param>
		/// <param name="paint">The paint used for the text (e.g. color, size, style)</param>
		public virtual void drawText(java.lang.CharSequence text, int start, int end, float
			 x, float y, android.graphics.Paint paint)
		{
			if (java.lang.CharSequenceProxy.IsStringProxy(text) || text is android.text.SpannedString
				 || text is android.text.SpannableString)
			{
				native_drawText(mNativeCanvas, text.ToString(), start, end, x, y, paint.mBidiFlags
					, paint.mNativePaint);
			}
			else
			{
				if (text is android.text.GraphicsOperations)
				{
					((android.text.GraphicsOperations)text).drawText(this, start, end, x, y, paint);
				}
				else
				{
					char[] buf = android.graphics.TemporaryBuffer.obtain(end - start);
					android.text.TextUtils.getChars(text, start, end, buf, 0);
					native_drawText(mNativeCanvas, buf, 0, end - start, x, y, paint.mBidiFlags, paint
						.mNativePaint);
					android.graphics.TemporaryBuffer.recycle(buf);
				}
			}
		}
Exemplo n.º 26
0
		internal virtual void init(java.lang.CharSequence source, android.text.TextPaint 
			paint, int outerwidth, android.text.Layout.Alignment? align, float spacingmult, 
			float spacingadd, android.text.BoringLayout.Metrics metrics, bool includepad, bool
			 trustWidth)
		{
			int spacing;
			if (java.lang.CharSequenceProxy.IsStringProxy(source) && align == android.text.Layout.Alignment
				.ALIGN_NORMAL)
			{
				mDirect = source.ToString();
			}
			else
			{
				mDirect = null;
			}
			mPaint = paint;
			if (includepad)
			{
				spacing = metrics.bottom - metrics.top;
			}
			else
			{
				spacing = metrics.descent - metrics.ascent;
			}
			if (spacingmult != 1 || spacingadd != 0)
			{
				spacing = (int)(spacing * spacingmult + spacingadd + 0.5f);
			}
			mBottom = spacing;
			if (includepad)
			{
				mDesc = spacing + metrics.top;
			}
			else
			{
				mDesc = spacing + metrics.ascent;
			}
			if (trustWidth)
			{
				mMax = metrics.width;
			}
			else
			{
				android.text.TextLine line = android.text.TextLine.obtain();
				line.set(paint, source, 0, source.Length, android.text.Layout.DIR_LEFT_TO_RIGHT, 
					android.text.Layout.DIRS_ALL_LEFT_TO_RIGHT, false, null);
				mMax = (int)android.util.FloatMath.ceil(line.metrics(null));
				android.text.TextLine.recycle(line);
			}
			if (includepad)
			{
				mTopPadding = metrics.top - metrics.ascent;
				mBottomPadding = metrics.bottom - metrics.descent;
			}
		}