Example #1
0
		public override void onReceive(android.content.Context context, android.content.Intent
			 intent)
		{
			// BEGIN_INCLUDE(onReceive)
			// Protect against rogue update broadcasts (not really a security issue,
			// just filter bad broacasts out so subclasses are less likely to crash).
			string action = intent.getAction();
			if (android.appwidget.AppWidgetManager.ACTION_APPWIDGET_UPDATE.Equals(action))
			{
				android.os.Bundle extras = intent.getExtras();
				if (extras != null)
				{
					int[] appWidgetIds = extras.getIntArray(android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_IDS
						);
					if (appWidgetIds != null && appWidgetIds.Length > 0)
					{
						this.onUpdate(context, android.appwidget.AppWidgetManager.getInstance(context), appWidgetIds
							);
					}
				}
			}
			else
			{
				if (android.appwidget.AppWidgetManager.ACTION_APPWIDGET_DELETED.Equals(action))
				{
					android.os.Bundle extras = intent.getExtras();
					if (extras != null && extras.containsKey(android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID
						))
					{
						int appWidgetId = extras.getInt(android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID
							);
						this.onDeleted(context, new int[] { appWidgetId });
					}
				}
				else
				{
					if (android.appwidget.AppWidgetManager.ACTION_APPWIDGET_ENABLED.Equals(action))
					{
						this.onEnabled(context);
					}
					else
					{
						if (android.appwidget.AppWidgetManager.ACTION_APPWIDGET_DISABLED.Equals(action))
						{
							this.onDisabled(context);
						}
					}
				}
			}
		}
Example #2
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;
			}
		}