Ejemplo n.º 1
0
		private android.graphics.drawable.Drawable getCachedDrawable(android.util.LongSparseArray
			<[email protected]<android.graphics.drawable.Drawable.ConstantState>>
			 drawableCache, long key)
		{
			lock (mTmpValue)
			{
				[email protected]<android.graphics.drawable.Drawable.ConstantState> wr
					 = drawableCache.get(key);
				if (wr != null)
				{
					// we have the key
					android.graphics.drawable.Drawable.ConstantState entry = wr.get();
					if (entry != null)
					{
						//Log.i(TAG, "Returning cached drawable @ #" +
						//        Integer.toHexString(((Integer)key).intValue())
						//        + " in " + this + ": " + entry);
						return entry.newDrawable(this);
					}
					else
					{
						// our entry has been purged
						drawableCache.delete(key);
					}
				}
			}
			return null;
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Check that only values of the following types are in the Bundle:
		/// <ul>
		/// <li>Integer</li>
		/// <li>Long</li>
		/// <li>Boolean</li>
		/// <li>Float</li>
		/// <li>Double</li>
		/// <li>String</li>
		/// <li>Account</li>
		/// <li>null</li>
		/// </ul>
		/// </summary>
		/// <param name="extras">the Bundle to check</param>
		public static void validateSyncExtrasBundle(android.os.Bundle extras)
		{
			try
			{
				foreach (string key in Sharpen.IterableProxy.Create(extras.keySet()))
				{
					object value = extras.get(key);
					if (value == null)
					{
						continue;
					}
					if (value is long)
					{
						continue;
					}
					if (value is int)
					{
						continue;
					}
					if (value is bool)
					{
						continue;
					}
					if (value is float)
					{
						continue;
					}
					if (value is double)
					{
						continue;
					}
					if (value is string)
					{
						continue;
					}
					if (value is android.accounts.Account)
					{
						continue;
					}
					throw new System.ArgumentException("unexpected value type: " + value.GetType().FullName
						);
				}
			}
			catch (System.ArgumentException e)
			{
				throw;
			}
			catch (java.lang.RuntimeException exc)
			{
				throw new System.ArgumentException("error unparceling Bundle", exc);
			}
		}