Esempio n. 1
0
		public override void selectTab(android.app.ActionBar.Tab tab)
		{
			if (getNavigationMode() != NAVIGATION_MODE_TABS)
			{
				mSavedTabPosition = tab != null ? tab.getPosition() : INVALID_POSITION;
				return;
			}
			android.app.FragmentTransaction trans = mActivity.getFragmentManager().beginTransaction
				().disallowAddToBackStack();
			if (mSelectedTab == tab)
			{
				if (mSelectedTab != null)
				{
					mSelectedTab.getCallback().onTabReselected(mSelectedTab, trans);
					mTabScrollView.animateToTab(tab.getPosition());
				}
			}
			else
			{
				mTabScrollView.setTabSelected(tab != null ? tab.getPosition() : android.app.ActionBar
					.Tab.INVALID_POSITION);
				if (mSelectedTab != null)
				{
					mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans);
				}
				mSelectedTab = ([email protected])tab;
				if (mSelectedTab != null)
				{
					mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans);
				}
			}
			if (!trans.isEmpty())
			{
				trans.commit();
			}
		}
Esempio n. 2
0
		/// <summary>
		/// When a particular suggestion has been selected, perform the various lookups required
		/// to use the suggestion.
		/// </summary>
		/// <remarks>
		/// When a particular suggestion has been selected, perform the various lookups required
		/// to use the suggestion.  This includes checking the cursor for suggestion-specific data,
		/// and/or falling back to the XML for defaults;  It also creates REST style Uri data when
		/// the suggestion includes a data id.
		/// </remarks>
		/// <param name="c">The suggestions cursor, moved to the row of the user's selection</param>
		/// <param name="actionKey">
		/// The key code of the action key that was pressed,
		/// or
		/// <see cref="android.view.KeyEvent.KEYCODE_UNKNOWN">android.view.KeyEvent.KEYCODE_UNKNOWN
		/// 	</see>
		/// if none.
		/// </param>
		/// <param name="actionMsg">
		/// The message for the action key that was pressed,
		/// or <code>null</code> if none.
		/// </param>
		/// <returns>An intent for the suggestion at the cursor's position.</returns>
		private android.content.Intent createIntentFromSuggestion(android.database.Cursor
			 c, int actionKey, string actionMsg)
		{
			try
			{
				// use specific action if supplied, or default action if supplied, or fixed default
				string action = android.widget.SuggestionsAdapter.getColumnString(c, android.app.SearchManager
					.SUGGEST_COLUMN_INTENT_ACTION);
				if (action == null)
				{
					action = mSearchable.getSuggestIntentAction();
				}
				if (action == null)
				{
					action = android.content.Intent.ACTION_SEARCH;
				}
				// use specific data if supplied, or default data if supplied
				string data = android.widget.SuggestionsAdapter.getColumnString(c, android.app.SearchManager
					.SUGGEST_COLUMN_INTENT_DATA);
				if (data == null)
				{
					data = mSearchable.getSuggestIntentData();
				}
				// then, if an ID was provided, append it.
				if (data != null)
				{
					string id = android.widget.SuggestionsAdapter.getColumnString(c, android.app.SearchManager
						.SUGGEST_COLUMN_INTENT_DATA_ID);
					if (id != null)
					{
						data = data + "/" + Sharpen.Util.EncodeUri(id);
					}
				}
				System.Uri dataUri = (data == null) ? null : Sharpen.Util.ParseUri(data);
				string query = android.widget.SuggestionsAdapter.getColumnString(c, android.app.SearchManager
					.SUGGEST_COLUMN_QUERY);
				string extraData = android.widget.SuggestionsAdapter.getColumnString(c, android.app.SearchManager
					.SUGGEST_COLUMN_INTENT_EXTRA_DATA);
				return createIntent(action, dataUri, extraData, query, actionKey, actionMsg);
			}
			catch (java.lang.RuntimeException e)
			{
				int rowNum;
				try
				{
					// be really paranoid now
					rowNum = c.getPosition();
				}
				catch (java.lang.RuntimeException)
				{
					rowNum = -1;
				}
				android.util.Log.w(LOG_TAG, "Search Suggestions cursor at row " + rowNum + " returned exception"
					 + e.ToString());
				return null;
			}
		}
Esempio n. 3
0
		public override void removeTab(android.app.ActionBar.Tab tab)
		{
			removeTabAt(tab.getPosition());
		}