protected override void OnSaveInstanceState (Bundle outState) 
		{
			base.OnSaveInstanceState (outState);
        
			if (mGesture != null)
				outState.PutParcelable ("gesture", mGesture);
		}
Пример #2
0
 // Getting an authentication token is not supported //throws NetworkErrorException
 public override Bundle GetAuthToken(AccountAuthenticatorResponse response, Account account, string authTokenType, Bundle options)
 {
     var result = new Bundle();
     var am = AccountManager.Get(mContext.ApplicationContext);
     var authToken = am.PeekAuthToken(account, authTokenType);
     if (string.IsNullOrEmpty(authToken))
     {
         var password = am.GetPassword(account);
         if (!string.IsNullOrEmpty(password))
         {
             authToken = AuthTokenLoader.SignIn(mContext, account.Name, password);
         }
     }
     if (!string.IsNullOrEmpty(authToken))
     {
         result.PutString(AccountManager.KeyAccountName, account.Name);
         result.PutString(AccountManager.KeyAccountType, account.Type);
         result.PutString(AccountManager.KeyAuthtoken, authToken);
     }
     else
     {
         var intent = new Intent(mContext, typeof(LoginActivity));
         intent.PutExtra(AccountManager.KeyAccountAuthenticatorResponse, response);
         intent.PutExtra(LoginActivity.EXTRA_TOKEN_TYPE, authTokenType);
         var bundle = new Bundle();
         bundle.PutParcelable(AccountManager.KeyIntent, intent);
     }
     return result;
 }
		public override void OnSaveInstanceState (Bundle outState)
		{
			base.OnSaveInstanceState (outState);
			if (resultData != null) {
				outState.PutInt (STATE_RESULT_CODE, resultCode);
				outState.PutParcelable (STATE_RESULT_DATA, resultData);
			}
		}
 public static SearchedSessionsFragment NewInstance(ISearchGroup searchGroup)
 {
     var fragment = new SearchedSessionsFragment();
     var bundle = new Bundle();
     bundle.PutParcelable(typeof(ISearchGroup).Name, Parcels.Wrap(searchGroup));
     fragment.Arguments = bundle;
     return fragment;
 }
 public static SessionDetailFragment Create(Session session)
 {
     var fragment = new SessionDetailFragment();
     var args = new Bundle();
     args.PutParcelable(typeof(Session).Name, Parcels.Wrap(session));
     fragment.Arguments = args;
     return fragment;
 }
Пример #6
0
        protected override IParcelable OnSaveInstanceState()
        {
            Bundle bundle = new Bundle();

            bundle.PutParcelable("superState", base.OnSaveInstanceState());
            bundle.PutFloat("value", value);
            bundle.PutFloat("needleValue", needleValue);
            return(bundle);
        }
        public static SessionDetailFragment Create(Session session)
        {
            var fragment = new SessionDetailFragment();
            var args     = new Bundle();

            args.PutParcelable(typeof(Session).Name, Parcels.Wrap(session));
            fragment.Arguments = args;
            return(fragment);
        }
Пример #8
0
        protected override IParcelable OnSaveInstanceState()
        {
            var bundle = new Bundle();

            bundle.PutParcelable("superState", base.OnSaveInstanceState());
            bundle.PutFloat("previousWidth", _screenWidth);
            bundle.PutString("vectorStringData", _vectorStringData);
            return(bundle);
        }
Пример #9
0
 protected override void OnSaveInstanceState(Bundle outState)
 {
     UpdateTrackSelectorParameters();
     UpdateStartPosition();
     outState.PutParcelable(KEY_TRACK_SELECTOR_PARAMETERS, trackSelectorParameters);
     outState.PutBoolean(KEY_AUTO_PLAY, startAutoPlay);
     outState.PutInt(KEY_WINDOW, startWindow);
     outState.PutLong(KEY_POSITION, startPosition);
 }
Пример #10
0
        /**
         * Overridden to save instance state when device orientation changes. This method is called automatically if you assign an id to the RangeSeekBar widget using the {@link #setId(int)} method. Other members of this class than the normalized min and max values don't need to be saved.
         */
        protected override IParcelable OnSaveInstanceState()
        {
            Bundle bundle = new Bundle();

            bundle.PutParcelable("SUPER", base.OnSaveInstanceState());
            bundle.PutDouble("MIN", this.normalizedMinValue);
            bundle.PutDouble("MAX", this.normalizedMaxValue);
            return(bundle);
        }
Пример #11
0
        protected override IParcelable OnSaveInstanceState()
        {
            var superState = base.OnSaveInstanceState();
            var state      = new Bundle();

            state.PutParcelable("base", superState);
            state.PutInt("currentPosition", currentPosition);
            return(state);
        }
        /// <summary>
        ///     Overridden to save instance state when device orientation changes. This method is called automatically if you
        ///     assign an id to the RangeSliderControl widget using the Id. Other members of this class than the normalized min and
        ///     max values don't need to be saved.
        /// </summary>
        protected override IParcelable OnSaveInstanceState()
        {
            var bundle = new Bundle();

            bundle.PutParcelable("SUPER", base.OnSaveInstanceState());
            bundle.PutFloat("MIN", NormalizedMinValue);
            bundle.PutFloat("MAX", NormalizedMaxValue);
            return(bundle);
        }
Пример #13
0
        protected override IParcelable OnSaveInstanceState()
        {
            var bundle = new Bundle();

            bundle.PutParcelable(INSTANCE_STATE_SAVEDSTATE, base.OnSaveInstanceState());
            bundle.PutFloat(INSTANCE_STATE_PROGRESS, Progress);
            bundle.PutFloat(INSTANCE_STATE_MARKER_PROGRESS, MarkerProgress);
            return(bundle);
        }
Пример #14
0
        public static SearchedSessionsFragment NewInstance(ISearchGroup searchGroup)
        {
            var fragment = new SearchedSessionsFragment();
            var bundle   = new Bundle();

            bundle.PutParcelable(typeof(ISearchGroup).Name, Parcels.Wrap(searchGroup));
            fragment.Arguments = bundle;
            return(fragment);
        }
Пример #15
0
        protected override IParcelable OnSaveInstanceState()
        {
            var bundle = new Bundle();

            bundle.PutParcelable(KEY_SUPER_STATE, base.OnSaveInstanceState());
            bundle.PutInt(KEY_NUMBER_OF_INCHES, NumberInInches);

            return(bundle);
        }
        public static ItemDetailFragment NewInstance(Item item)
        {
            var    fragment = new ItemDetailFragment();
            Bundle args     = new Bundle();

            args.PutParcelable(Item.KEY, item);
            fragment.Arguments = args;
            return(fragment);
        }
        public static BarcodeDialogFragment CreateInstance(BarcodeScanningResult data)
        {
            var fragment = new BarcodeDialogFragment();
            var args     = new Bundle();

            args.PutParcelable(NAME, data);
            fragment.Arguments = args;
            return(fragment);
        }
        protected override void OnSaveInstanceState(Bundle outState)
        {
            base.OnSaveInstanceState(outState);

            if (mGesture != null)
            {
                outState.PutParcelable("gesture", mGesture);
            }
        }
Пример #19
0
 public override void OnSaveInstanceState(Bundle outState)
 {
     base.OnSaveInstanceState(outState);
     if (resultData != null)
     {
         outState.PutInt(STATE_RESULT_CODE, resultCode);
         outState.PutParcelable(STATE_RESULT_DATA, resultData);
     }
 }
Пример #20
0
        /// <summary>
        /// Put all the data in the intent.
        /// </summary>
        private void PutAll()
        {
            this.PutExtra(ExtraProgress, Progress);
            this.PutExtra(ExtraIsOperationCompleted, IsCompleted);

            Bundle bundle = new Bundle();

            bundle.PutParcelable(ExtraMessageObject, Message);
            this.PutExtra(ExtraMessage, bundle);
        }
Пример #21
0
        protected override IParcelable OnSaveInstanceState()
        {
            var bundle = new Bundle();

            bundle.PutParcelable(KEY_PARENT_STATE, base.OnSaveInstanceState());
            bundle.PutString(KEY_CURRENTDIR, _currentDir);
            bundle.PutBoolean(KEY_SHOWCURRENTDIR, _showCurrentDir);
            bundle.PutBoolean(KEY_SHOWHIDDENFILES, _showHiddenFiles);
            return(bundle);
        }
Пример #22
0
        public static MovieDetailsFragment NewInstance(Bitmap poster, string imdbID)
        {
            var bundle = new Bundle();

            bundle.PutParcelable("poster", poster);
            bundle.PutString("imdbID", imdbID);
            return(new MovieDetailsFragment {
                Arguments = bundle
            });
        }
Пример #23
0
        public static NfcDialogFragment CreateInstance(NfcPassportScanningResult data)
        {
            var fragment = new NfcDialogFragment();
            var args     = new Bundle();

            args.PutParcelable(NFC_DATA, data);
            fragment.Arguments = args;

            return(fragment);
        }
        /// <summary>
        /// Override of <see cref="Android.Views.View.OnSaveInstanceState"/>.  Creates a <see cref="PagerSlidingTabStripState"/> instance with
        /// the current position, encompassing any base saved state, and returns it.
        /// </summary>
        protected override IParcelable OnSaveInstanceState()
        {
            //see notes in OnRestoreInstanceState about using Bundle.
            var    superState = base.OnSaveInstanceState();
            Bundle state      = new Bundle();

            state.PutParcelable("base", superState);
            state.PutInt("currentPosition", _currentPosition);
            return(state);
        }
Пример #25
0
        protected override IParcelable OnSaveInstanceState()
        {
            var    superState = base.OnSaveInstanceState();
            Bundle state      = new Bundle();

            state.PutParcelable("base", superState);
            state.PutInt("currentPosition", _viewAbove.GetCurrentItem());

            return(state);
        }
Пример #26
0
        public static MRZDialogFragment CreateInstance(MRZRecognitionResult data)
        {
            var fragment = new MRZDialogFragment();
            var args     = new Bundle();

            args.PutParcelable(MRZ_DATA, data);
            fragment.Arguments = args;

            return(fragment);
        }
Пример #27
0
        protected override void OnSaveInstanceState(Bundle outState)
        {
            if (currentLocation != null)
            {
                outState.PutBoolean(KeyRequesting, requestingUpdates);
                outState.PutParcelable(KeyLocation, currentLocation);
                outState.PutString(KeyLastUpdated, lastUpdateTime);
            }

            base.OnSaveInstanceState(outState);
        }
Пример #28
0
        public static MapFragmentExtended NewInstance(GoogleMapOptions options)
        {
            Bundle arguments = new Bundle();

            arguments.PutParcelable("MapOptions", options);

            MapFragmentExtended fragment = new MapFragmentExtended();

            fragment.Arguments = arguments;
            return(fragment);
        }
Пример #29
0
 protected override void OnSaveInstanceState(Bundle outState)
 {
     if (mCurrentInputContentInfo != null)
     {
         outState.PutParcelable(InputContentInfoKey, (IParcelable)mCurrentInputContentInfo.Unwrap());
         outState.PutInt(CommitContentFlagsKey, mCurrentFlags);
     }
     mCurrentInputContentInfo = null;
     mCurrentFlags            = 0;
     base.OnSaveInstanceState(outState);
 }
Пример #30
0
        /**
         * Returns a Parcelable object containing the AnimationAdapter's current dynamic state.
         */

        public IParcelable onSaveInstanceState()
        {
            Bundle bundle = new Bundle();

            if (mViewAnimator != null)
            {
                bundle.PutParcelable(SAVEDINSTANCESTATE_VIEWANIMATOR, mViewAnimator.onSaveInstanceState());
            }

            return(bundle);
        }
        public static AspectRatioFragment NewInstance(IList <AspectRatio> ratios, AspectRatio currentRatio)
        {
            AspectRatioFragment fragment = new AspectRatioFragment();
            Bundle args = new Bundle();

            args.PutParcelableArray(ARG_ASPECT_RATIOS, ratios.ToArray());
            args.PutParcelable(ARG_CURRENT_ASPECT_RATIO, currentRatio);
            fragment.Arguments = args;

            return(fragment);
        }
        public override void SaveToBundle(Bundle bundle)
        {
            base.SaveToBundle(bundle);

            if (expandableItemManager != null)
            {
                bundle.PutParcelable(
                    ExpandManagerParcelableKey,
                    expandableItemManager.GetSavedState());
            }
        }
Пример #33
0
        public static MainFragment newInstance(Config config)
        {
            Bundle args = new Bundle();

            args.PutParcelable(EXTRA_CONFIG, config);

            MainFragment fragment = new MainFragment();

            fragment.Arguments = args;
            return(fragment);
        }
Пример #34
0
 public override Bundle AddAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options)
 {
     System.Console.WriteLine ("KiwiAuthenticator-AddAccount");
     Intent intent = new Intent(mContext, typeof(LoginActivity));
     intent.PutExtra("accountType", accountType);
     intent.PutExtra("authTokenType", authTokenType);
     intent.PutExtra("isAddingNewAccount", true);
     intent.PutExtra(AccountManager.KeyAccountAuthenticatorResponse, response);
     Bundle bundle = new Bundle();
     bundle.PutParcelable(AccountManager.KeyIntent, intent);
     return bundle;
 }
        public static DCResultDialogFragment CreateInstance(Workflow flow, List <WorkflowStepResult> results)
        {
            var fragment = new DCResultDialogFragment();

            var args = new Bundle();

            args.PutParcelable(WORKFLOW_EXTRA, flow);
            args.PutParcelableArray(WORKFLOW_RESULT_EXTRA, results.ToArray());
            fragment.Arguments = args;

            return(fragment);
        }
Пример #36
0
 protected override void OnSaveInstanceState(Bundle bundle)
 {
     //scaleButton.Enabled = false;
     //computeButton.Enabled = false;
     string[][] tdA = CreateStrArrsFromData();
     bundle.PutStringArray("TAGS_ARR", tdA[0]);
     bundle.PutStringArray("DATA_ARR", tdA[1]);
     bundle.PutParcelable("MEDIA_URI", mediaUri);
     bundle.PutString("V_VIEW_HEIGHT", vView.Height.ToString());
     bundle.PutString("RESULT_TEXT", resultTextView.Text);
     base.OnSaveInstanceState(bundle);
 }
Пример #37
0
 // Don't add additional accounts //throws NetworkErrorException
 public override Bundle AddAccount(AccountAuthenticatorResponse response, string accountType, string authTokenType, string[] requiredFeatures, Bundle options)
 {
     var intent = new Intent(mContext, typeof(LoginActivity));
     intent.PutExtra(LoginActivity.EXTRA_TOKEN_TYPE, accountType);
     intent.PutExtra(AccountManager.KeyAccountAuthenticatorResponse, response);
     var bundle = new Bundle();
     if (options != null)
     {
         bundle.PutAll(options);
     }
     bundle.PutParcelable(AccountManager.KeyIntent, intent);
     return bundle;
 }
Пример #38
0
        public void MyButton_OnClick(View view)
        {
            ((Button)view).Text = "clicked!";

            Bundle b = new Bundle ();
            var p = Parcel.Obtain ();
            b.PutSerializable ("dummy", new MySerializable ());
            b.PutParcelable ("dummy2", new MyParcelable ());
            p.WriteBundle (b);
            p.SetDataPosition (0);
            var b2 = p.ReadBundle ();
            Console.WriteLine (b2);
            var p2 = b.GetParcelable ("dummy2");
            Console.WriteLine (p2);
        }
Пример #39
0
        public void OnItemSelected(Android.Net.Uri dateUri)
        {
            if (twoPane) {
                Bundle args = new Bundle ();
                args.PutParcelable (DetailFragment.DETAIL_URI, dateUri);

                DetailFragment fragment = new DetailFragment ();
                fragment.Arguments = args;

                FragmentManager.BeginTransaction ()
                         .Replace (Resource.Id.weather_detail_container, fragment, DETAILFRAGMENT_TAG)
                         .Commit ();
            } else {
                Intent intent = new Intent (this, typeof(DetailActivity))
                             .SetData (dateUri);
                StartActivity (intent);
            }
        }
		public override IParcelable SaveState()
		{
			IParcelable p = base.SaveState();
			Bundle bundle = new Bundle();
			bundle.PutParcelable(_stateSuperState, p);

			bundle.PutInt(_statePages, _pages.Size());
			if (0 < _pages.Size())
			{
				for (int i = 0; i < _pages.Size(); i++)
				{
					int position = _pages.KeyAt(i);
					bundle.PutInt(CreateCacheIndex(i), position);
					Fragment f = _pages.Get(position);
					_fm.PutFragment(bundle, CreateCacheKey(position), f);
				}
			}
			return bundle;
		}
        public void MyButton_OnClick(View view)
        {
            ((Button)view).Text = "clicked!";

            Console.WriteLine ("Activity1.MyButton_OnClick: Writing into Bundle...");

            Bundle b = new Bundle ();
            var p = Parcel.Obtain ();
            b.PutSerializable ("dummy", new MySerializable ("foo"));
            b.PutParcelable ("dummy2", new MyParcelable ("bar"));
            p.WriteBundle (b);
            p.SetDataPosition (0);

            Console.WriteLine ("Activity1.MyButton_OnClick: Reading from Parcel...");
            var b2 = p.ReadBundle ();
            Console.WriteLine ("Read Bundle: {0}", b2);
            var s  = b.GetSerializable ("dummy");
            Console.WriteLine ("Read Serializable: {0}", s);
            var p2 = b.GetParcelable ("dummy2");
            Console.WriteLine ("Read Parcelable: {0}", p2);
        }
Пример #42
0
        /// <summary>
        /// Intents to fragment argument.
        /// </summary>
        /// <returns>The to fragment argument.</returns>
        /// <param name="intent">Intent.</param>
        public static Bundle IntentToFragmentArgument(Intent intent)
        {
            Bundle arguments = new Bundle();
            if (intent == null)
            {
                return arguments;
            }

            var data = intent.Data;
            if (data != null)
            {
                arguments.PutParcelable("_uri", data);
            }

            var extras = intent.Extras;
            if (extras != null)
            {
                arguments.PutAll(intent.Extras);
            }

            return arguments;
        }
Пример #43
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);
            RequestWindowFeature (WindowFeatures.ActionBar);
            SetContentView (Resource.Layout.activity_detail);
            ActionBar.SetDisplayHomeAsUpEnabled (true);
            ActionBar.SetDisplayShowHomeEnabled (true);
            ActionBar.SetIcon (Resource.Mipmap.ic_launcher);
            ActionBar.Title = "Details";
            if (savedInstanceState == null) {
                Bundle arguments = new Bundle ();
                arguments.PutParcelable (DetailFragment.DETAIL_URI, Intent.Data);

                DetailFragment fragment = new DetailFragment ();
                fragment.Arguments = arguments;

                FragmentTransaction fragTx = this.FragmentManager.BeginTransaction ();

                fragTx.Add (Resource.Id.weather_detail_container, fragment)
                    .Commit ();

            }
        }
		/// <summary>
		/// Override of <see cref="Android.Views.View.OnSaveInstanceState"/>.  Creates a <see cref="PagerSlidingTabStripState"/> instance with
		/// the current position, encompassing any base saved state, and returns it.
		/// </summary>
		protected override IParcelable OnSaveInstanceState()
		{
			//see notes in OnRestoreInstanceState about using Bundle.
			var superState = base.OnSaveInstanceState();
			Bundle state = new Bundle();
			state.PutParcelable("base", superState);
			state.PutInt("currentPosition", _currentPosition);
			return state;
		}
Пример #45
0
		protected override void OnSaveInstanceState (Bundle outState)
		{
			outState.PutBoolean (KEY_REQUESTING_LOCATION_UPDATES, mRequestingLocationUpdates);
			outState.PutParcelable (KEY_LOCATION, mCurrentLocation);
			outState.PutString (KEY_LAST_UPDATED_TIME_STRING, mLastUpdateTime);
			base.OnSaveInstanceState (outState);
		}
Пример #46
0
 protected override Android.OS.IParcelable OnSaveInstanceState()
 {
     // Get the state of the view
     IParcelable superState = base.OnSaveInstanceState();
     Bundle bundle = new Bundle();
     // put the state in the bundle
     bundle.PutParcelable("parcelable", superState);
     // serialize mBoxes to JSON and put that in the bundle
     bundle.PutString("json", JsonConvert.SerializeObject(mBoxes));
     return bundle;
 }
Пример #47
0
        public override Bundle GetAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options)
        {
            // Extract the username and password from the Account Manager, and ask
            // the server for an appropriate AuthToken.
            AccountManager am = AccountManager.Get(mContext);

            String authToken = am.PeekAuthToken(account, authTokenType);

            // Lets give another try to authenticate the user
            if (TextUtils.IsEmpty(authToken)) {
                String password = am.GetPassword(account);
                if (password != null) {
                    //var auth = new KiwiServerAuthenticate ();
                    var auth = new KiwiLoginService ();
                    var authTokenResult = auth.Login(account.Name, password);
                    Task.WaitAll(authTokenResult);
                    authToken = authTokenResult.Result.AuthToken;
                }
            }

            // If we get an authToken - we return it
            if (!TextUtils.IsEmpty(authToken)) {
                Bundle result = new Bundle();
                result.PutString(AccountManager.KeyAccountName, account.Name);
                result.PutString(AccountManager.KeyAccountType, account.Type);
                result.PutString(AccountManager.KeyAuthtoken, authToken);
                return result;
            }

            // If we get here, then we couldn't access the user's password - so we
            // need to re-prompt them for their credentials. We do that by creating
            // an intent to display our AuthenticatorActivity.
            Intent intent = new Intent(mContext, typeof(LoginActivity));
            intent.PutExtra(AccountManager.KeyAccountAuthenticatorResponse, response);
            intent.PutExtra("accountType", account.Type);
            intent.PutExtra("authTokenType", authTokenType);
            intent.PutExtra ("accountName", account.Name);
            Bundle bundle = new Bundle();
            bundle.PutParcelable(AccountManager.KeyIntent, intent);
            return bundle;
        }
 protected override void OnSaveInstanceState (Bundle outState) 
 {
     base.OnSaveInstanceState(outState);
     outState.PutParcelable (MARKER_POSITION_KEY, mMarker.Position);
 }
 /// <summary>
 /// The on client updated.
 /// </summary>
 /// <param name="clientMessenger">
 /// The client messenger.
 /// </param>
 public void OnClientUpdated(Messenger clientMessenger)
 {
     using (var bundle = new Bundle(1))
     {
         bundle.PutParcelable(ServiceParameters.Messenger, clientMessenger);
         this.Send(ServiceMessages.RequestClientUpdate, bundle);
     }
 }
		protected override IParcelable OnSaveInstanceState()
		{
			var superState = base.OnSaveInstanceState();
			var state = new Bundle();
			state.PutParcelable("base", superState);
			state.PutInt("mCurrentPage", mCurrentPage);

			return state;
		}
Пример #51
0
        private void onSaveClicked()
        {
            // TODO this code needs to change to use the decode/crop/encode single
            // step api so that we don't require that the whole (possibly large)
            // bitmap doesn't have to be read into memory
            if (Saving)
            {
                return;
            }

            Saving = true;

            var r = Crop.CropRect;

            int width = r.Width();
            int height = r.Height();

            Bitmap croppedImage = Bitmap.CreateBitmap(width, height, Bitmap.Config.Rgb565);
            {
                Canvas canvas = new Canvas(croppedImage);
                Rect dstRect = new Rect(0, 0, width, height);
                canvas.DrawBitmap(bitmap, r, dstRect, null);
            }

            // If the output is required to a specific size then scale or fill
            if (outputX != 0 && outputY != 0)
            {
                if (scale)
                {
                    // Scale the image to the required dimensions
                    Bitmap old = croppedImage;
                    croppedImage = Util.transform(new Matrix(),
                                                  croppedImage, outputX, outputY, scaleUp);
                    if (old != croppedImage)
                    {
                        old.Recycle();
                    }
                }
                else
                {
                    // Don't scale the image crop it to the size requested.
                    // Create an new image with the cropped image in the center and
                    // the extra space filled.
                    Bitmap b = Bitmap.CreateBitmap(outputX, outputY,
                                                   Bitmap.Config.Rgb565);
                    Canvas canvas = new Canvas(b);

                    Rect srcRect = Crop.CropRect;
                    Rect dstRect = new Rect(0, 0, outputX, outputY);

                    int dx = (srcRect.Width() - dstRect.Width()) / 2;
                    int dy = (srcRect.Height() - dstRect.Height()) / 2;

                    // If the srcRect is too big, use the center part of it.
                    srcRect.Inset(Math.Max(0, dx), Math.Max(0, dy));

                    // If the dstRect is too big, use the center part of it.
                    dstRect.Inset(Math.Max(0, -dx), Math.Max(0, -dy));

                    // Draw the cropped bitmap in the center
                    canvas.DrawBitmap(bitmap, srcRect, dstRect, null);

                    // Set the cropped bitmap as the new bitmap
                    croppedImage.Recycle();
                    croppedImage = b;
                }
            }

            // Return the cropped image directly or save it to the specified URI.
            Bundle myExtras = Intent.Extras;

            if (myExtras != null &&
                (myExtras.GetParcelable("data") != null || myExtras.GetBoolean("return-data")))
            {
                Bundle extras = new Bundle();
                extras.PutParcelable("data", croppedImage);
                SetResult(Result.Ok,
                          (new Intent()).SetAction("inline-data").PutExtras(extras));
                Finish();
            }
            else
            {
                Bitmap b = croppedImage;
                BackgroundJob.StartBackgroundJob(this, null, "Saving image", () => saveOutput(b), mHandler);
            }
        }
        public override IParcelable OnSaveInstanceState()
        {
            if (SaveEnabled)
            {
                var bundle = new Bundle();
                bundle.PutParcelable("instanceState", base.OnSaveInstanceState());
                bundle.PutInt("max", m_Max);
                bundle.PutInt("progress", m_Progress);

                return bundle;
            }

            return base.OnSaveInstanceState();
        }
Пример #53
0
 public override void OnSaveInstanceState(Bundle outState)
 {
     base.OnSaveInstanceState(outState);
     outState.PutParcelable("recycler_layout", listViewNews.GetLayoutManager().OnSaveInstanceState());
 }
 protected override IParcelable OnSaveInstanceState()
 {
     var bundle = new Bundle();
       bundle.PutParcelable(INSTANCE_STATE_SAVEDSTATE, base.OnSaveInstanceState());
       bundle.PutFloat(INSTANCE_STATE_PROGRESS, Progress);
       bundle.PutFloat(INSTANCE_STATE_MARKER_PROGRESS, MarkerProgress);
       return bundle;
 }
		protected override IParcelable OnSaveInstanceState ()
		{
			Bundle bundle = new Bundle();
			bundle.PutParcelable("saved_state", base.OnSaveInstanceState());
			bundle.PutFloat("progress", _progress);
			bundle.PutFloat("marker_progress", _markerProgress);
			bundle.PutInt("progress_color", _progressColor);
			bundle.PutInt("progress_background_color", _progressBackgroundColor);
			bundle.PutBoolean("thumb_visible", _isThumbEnabled);
			bundle.PutBoolean("marker_visible", _isMarkerEnabled);
			return bundle;
		}
Пример #56
0
 //@Override
 protected override IParcelable OnSaveInstanceState()
 {
     Bundle state = new Bundle();
     state.PutFloatArray("color", colorHSV);
     state.PutParcelable("super", base.OnSaveInstanceState());
     return state;
 }
Пример #57
0
		protected override void OnSaveInstanceState (Bundle outState)
		{
			base.OnSaveInstanceState (outState);
			//save the file path
			outState.PutString (FileNameKey, fileName); 
			outState.PutParcelable ("image", bitmap);
		}
		private void CreateRestrictions (Context context, PendingResult result, Bundle existingRestrictions) 
		{
			// The incoming restrictions bundle contains key/value pairs representing existing app
			// restrictions for this package. In order to retain existing app restrictions, you need to
			// construct new restriction entries and then copy in any existing values for the new keys.
			List <IParcelable> newEntries = InitRestrictions (context);

			// If app restrictions were not previously configured for the package, create the default
			// restrictions entries and return them.
			if (existingRestrictions == null) {
				var extras = new Bundle ();
				extras.PutParcelableArrayList (Intent.ExtraRestrictionsList, newEntries);
				result.SetResult (Result.Ok, null, extras);
				result.Finish ();
				return;
			}

			// Retains current restriction settings by transferring existing restriction entries to
			// new ones.
			foreach (RestrictionEntry entry in newEntries) {
				String key = entry.Key;

				if (KEY_BOOLEAN.Equals (key)) {
					entry.SelectedState = existingRestrictions.GetBoolean (KEY_BOOLEAN);

				} else if (KEY_CHOICE.Equals (key)) {
					if (existingRestrictions.ContainsKey (KEY_CHOICE)) {
						entry.SelectedString = existingRestrictions.GetString (KEY_CHOICE);
					}
			
				} else if (KEY_MULTI_SELECT.Equals (key)) {
					if (existingRestrictions.ContainsKey (KEY_MULTI_SELECT)) {
						entry.SetAllSelectedStrings(existingRestrictions.GetStringArray (key));
					}
				}
			}

			var extra = new Bundle();

			// This path demonstrates the use of a custom app restriction activity instead of standard
			// types.  When a custom activity is set, the standard types will not be available under
			// app restriction settings.
			//
			// If your app has an existing activity for app restriction configuration, you can set it
			// up with the intent here.
			if (PreferenceManager.GetDefaultSharedPreferences (context)
			    .GetBoolean (MainActivity.CUSTOM_CONFIG_KEY, false)) {
				var customIntent = new Intent();
				customIntent.SetClass (context, typeof (CustomRestrictionsActivity));
				extra.PutParcelable (Intent.ExtraRestrictionsIntent, customIntent);
			}

			extra.PutParcelableArrayList (Intent.ExtraRestrictionsList, newEntries);
			result.SetResult (Result.Ok, null, extra);
			result.Finish ();
		}
        /**
         * Returns a Parcelable object containing the AnimationAdapter's current dynamic state.
         */

        public IParcelable onSaveInstanceState()
        {
            Bundle bundle = new Bundle();

            if (mViewAnimator != null)
            {
                bundle.PutParcelable(SAVEDINSTANCESTATE_VIEWANIMATOR, mViewAnimator.onSaveInstanceState());
            }

            return bundle;
        }
Пример #60
0
        protected override IParcelable OnSaveInstanceState()
        {
            var superState = base.OnSaveInstanceState();
            Bundle state = new Bundle();
            state.PutParcelable("base", superState);
            state.PutInt("currentPosition", _viewAbove.GetCurrentItem());

            return state;
        }