Beispiel #1
0
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   outState.putParcelableArray(
       INSTANCE_STATE_BACK_STACK_FILES,
       mBackSelectFileFragments.toArray(new JsonDirectory.JsonFileDir[0]));
   outState.putParcelableArray(
       INSTANCE_STATE_BACK_STACK_TORRENTS,
       mBackTorrentFragments.toArray(new JsonTorrent.JsonTorrentResult[0]));
   super.onSaveInstanceState(outState);
 }
 public Parcelable saveState() {
   Object localObject1 = null;
   Object localObject2;
   if (mSavedState.size() > 0) {
     localObject1 = new Bundle();
     localObject2 = new Fragment.SavedState[mSavedState.size()];
     mSavedState.toArray((Object[]) localObject2);
     ((Bundle) localObject1).putParcelableArray("states", (Parcelable[]) localObject2);
   }
   int i = 0;
   while (i < mFragments.size()) {
     Fragment localFragment = (Fragment) mFragments.get(i);
     localObject2 = localObject1;
     if (localFragment != null) {
       localObject2 = localObject1;
       if (localObject1 == null) {
         localObject2 = new Bundle();
       }
       localObject1 = "f" + i;
       mFragmentManager.putFragment((Bundle) localObject2, (String) localObject1, localFragment);
     }
     i += 1;
     localObject1 = localObject2;
   }
   return (Parcelable) localObject1;
 }
  @Override
  public Parcelable saveState() {
    Bundle state = null;

    mItemIds = new long[getCount()];
    for (int i = 0; i < mItemIds.length; i++) {
      mItemIds[i] = getItemId(i);
    }
    if (mSavedState.size() > 0) {
      state = new Bundle();

      Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()];
      mSavedState.toArray(fss);
      state.putParcelableArray("states", fss);
    }
    for (int i = 0; i < mFragments.size(); i++) {
      Fragment f = mFragments.get(i);
      if (f != null) {
        if (state == null) {
          state = new Bundle();
        }
        String key = "f" + i;
        mFragmentManager.putFragment(state, key, f);
      }
    }

    if (mItemIds.length > 0) {
      if (state == null) {
        state = new Bundle();
      }
      state.putLongArray("itemids", mItemIds);
    }
    return state;
  }
 public void handleExtraButtonClick(View v) {
   if (focusedPlace == null) {
     return;
   }
   Intent intent;
   if (focusedBookmarkIds.isEmpty()) {
     intent = new Intent(this, AddBookmarkActivity.class);
     intent.putExtra(BookmarksActivity.PLACE_ID, focusedPlace.getId());
   } else {
     if (focusedBookmarkIds.size() == 1) {
       intent = new Intent(this, EditBookmarkActivity.class);
       intent.putExtra(BookmarksActivity.BOOKMARK_ID, focusedBookmarkIds.get(0));
     } else {
       Bookmark[] bookmarks = new Bookmark[focusedBookmarkIds.size()];
       for (int i = 0; i < focusedBookmarkIds.size(); i++) {
         bookmarks[i] = Bookmark.getBookmark(this, focusedBookmarkIds.get(i));
       }
       Bundle data = new Bundle();
       data.putParcelableArray(BOOKMARKS, bookmarks);
       removeDialog(DIALOG_MULTIPLE_BOOKMARKS);
       showDialog(DIALOG_MULTIPLE_BOOKMARKS, data);
       return;
     }
   }
   startActivityForResult(intent, ADD_EDIT_BOOKMARK_RESULT);
 }
Beispiel #5
0
 /* Constructor to allow us to receive devices array from calling activity */
 public static DashboardFragment newInstance(Device[] devices) {
   DashboardFragment f = new DashboardFragment();
   Bundle args = new Bundle();
   args.putParcelableArray("devices", devices);
   f.setArguments(args);
   return f;
 }
Beispiel #6
0
 static Bundle a(bs bsVar) {
   String str = null;
   int i = 0;
   if (bsVar == null) {
     return null;
   }
   Bundle bundle = new Bundle();
   if (bsVar.e() != null && bsVar.e().length > 1) {
     str = bsVar.e()[0];
   }
   Parcelable[] parcelableArr = new Parcelable[bsVar.a().length];
   while (i < parcelableArr.length) {
     Bundle bundle2 = new Bundle();
     bundle2.putString(p, bsVar.a()[i]);
     bundle2.putString(o, str);
     parcelableArr[i] = bundle2;
     i++;
   }
   bundle.putParcelableArray(q, parcelableArr);
   ca h = bsVar.h();
   if (h != null) {
     bundle.putParcelable(r, C0056bn.a(h));
   }
   bundle.putParcelable(s, bsVar.c());
   bundle.putParcelable(t, bsVar.d());
   bundle.putStringArray(u, bsVar.e());
   bundle.putLong(v, bsVar.g());
   return bundle;
 }
 /**
  * Add extended data to the extra.
  *
  * @param name The name of the extra data, with package prefix.
  * @param value The Parcelable[] data value.
  * @return Returns the same extra object, for chaining multiple calls into a single statement.
  * @see #putExtras
  * @see #removeExtra
  * @see #getParcelableArrayExtra(String)
  */
 public Request putExtra(String name, Parcelable[] value) {
   if (mExtras == null) {
     mExtras = new Bundle();
   }
   mExtras.putParcelableArray(name, value);
   return this;
 }
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   if (networksFound != null) outState.putParcelableArray(NETWORKS_FOUND, networksFound);
   if (mActivatedPosition != ListView.INVALID_POSITION) {
     outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
   }
 }
 @Override
 public void onSaveInstanceState(Bundle outState) {
   if (colaboradorList != null) {
     outState.putParcelableArray(
         COLABORADORLIST_KEY, colaboradorList.toArray(new Colaborador[colaboradorList.size()]));
   }
   super.onSaveInstanceState(outState);
 }
  @Override
  protected void onSaveInstanceState(Bundle outState) {

    userArray = convertUserListToArray(userLiset);
    outState.putParcelableArray(USER_LIST, userArray);
    outState.putInt("userEditedIndex", editedUserIndex);
    super.onSaveInstanceState(outState);
  }
  @Override
  public void onSaveInstanceState(Bundle outState) {
    // TODO Auto-generated method stub

    Uri[] mThumbUris = imgAdpt.getUris();
    Toast.makeText(getActivity(), " images in onsaveinsta" + imgAdpt.getCount(), Toast.LENGTH_SHORT)
        .show();
    Log.e(TAG, "images in onsaveinsta " + imgAdpt.getCount());
    outState.putParcelableArray("img", mThumbUris);
    super.onSaveInstanceState(outState);
  }
  /**
   * Saves pending/shown SuperCardToasts to a bundle. <br>
   *
   * @param bundle Use onSaveInstanceState() bundle
   */
  public static void onSaveState(Bundle bundle) {

    Style[] list = new Style[ManagerSuperCardToast.getInstance().getList().size()];

    LinkedList<SuperCardToast> lister = ManagerSuperCardToast.getInstance().getList();

    for (int i = 0; i < list.length; i++) {

      list[i] = new Style(lister.get(i));
    }

    bundle.putParcelableArray(BUNDLE_TAG, list);

    SuperCardToast.cancelAllSuperCardToasts();
  }
Beispiel #13
0
  public Bundle onSaveInstanceState() {
    Bundle b = new Bundle();

    b.putParcelable(STATE_CURRENT_MESSAGE, mCurrentMessage);

    final int count = mMessages.size();
    final Message[] messages = new Message[count];
    int i = 0;
    for (Message message : mMessages) {
      messages[i++] = message;
    }

    b.putParcelableArray(STATE_MESSAGES, messages);

    return b;
  }
  @Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    WPImageSpan[] spans =
        mContentEditText
            .getText()
            .getSpans(0, mContentEditText.getText().length(), WPEditImageSpan.class);

    if (spans != null && spans.length > 0) {
      outState.putParcelableArray(KEY_IMAGE_SPANS, spans);
    }

    outState.putInt(KEY_START, mContentEditText.getSelectionStart());
    outState.putInt(KEY_END, mContentEditText.getSelectionEnd());
    outState.putString(KEY_CONTENT, mContentEditText.getText().toString());
  }
  /* May be called at any time before onDestroy() */
  @Override
  public void onSaveInstanceState(Bundle outState) {

    Bundle[] dialogOptions = new Bundle[mManagedDialogs.size()];
    int x = 0;
    for (ManagedDialog d : mManagedDialogs.values()) {
      d.mShowing = d.mDialog.isShowing();
      dialogOptions[x++] = d.mOptions;
      d.mOptions.putInt(KEY_DIALOG_ID, d.mId);
    }
    outState.putSerializable(KEY_MANAGED_DIALOGS, mManagedDialogs);
    outState.putParcelableArray(KEY_MANAGED_DIALOG_OPTIONS, dialogOptions);

    if (mCustomInterfaceConfiguration != null) {
      mCustomInterfaceConfiguration.onSaveInstanceState(outState);
    }

    super.onSaveInstanceState(outState);
  }
  /**
   * Called after the connection parameters have been set (in setupConnection()) *and* a connection
   * has been established (as signaled by onServiceConnected()). These two events can happen in any
   * order. Has to be called with mLock.
   */
  private void doConnectionSetupLocked() {
    try {
      TraceEvent.begin("ChildProcessConnectionImpl.doConnectionSetupLocked");
      assert mServiceConnectComplete && mService != null;
      assert mConnectionParams != null;

      Bundle bundle = new Bundle();
      bundle.putStringArray(EXTRA_COMMAND_LINE, mConnectionParams.mCommandLine);
      bundle.putParcelableArray(EXTRA_FILES, mConnectionParams.mFilesToBeMapped);
      // Add the CPU properties now.
      bundle.putInt(EXTRA_CPU_COUNT, CpuFeatures.getCount());
      bundle.putLong(EXTRA_CPU_FEATURES, CpuFeatures.getMask());
      bundle.putBundle(Linker.EXTRA_LINKER_SHARED_RELROS, mConnectionParams.mSharedRelros);
      try {
        mPid = mService.setupConnection(bundle, mConnectionParams.mCallback);
        assert mPid != 0 : "Child service claims to be run by a process of pid=0.";
      } catch (android.os.RemoteException re) {
        Log.e(TAG, "Failed to setup connection.", re);
      }
      // We proactively close the FDs rather than wait for GC & finalizer.
      try {
        for (FileDescriptorInfo fileInfo : mConnectionParams.mFilesToBeMapped) {
          fileInfo.mFd.close();
        }
      } catch (IOException ioe) {
        Log.w(TAG, "Failed to close FD.", ioe);
      }
      mConnectionParams = null;

      if (mConnectionCallback != null) {
        mConnectionCallback.onConnected(mPid);
      }
      mConnectionCallback = null;
    } finally {
      TraceEvent.end("ChildProcessConnectionImpl.doConnectionSetupLocked");
    }
  }
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putParcelableArray("data", data);
   outState.putBoolean("isLoading", isLoading);
 }
 @Override
 public void onSaveInstanceState(Bundle outState) {
   if (occurrences != null) outState.putParcelableArray(OCCURRENCES_KEY, occurrences);
 }
 @Override
 public void onSaveInstanceState(Bundle outState) {
   if (files != null) outState.putParcelableArray(FILES_KEY, files);
 }