Java Code Examples for android.os.Bundle#putSerializable()

The following examples show how to use android.os.Bundle#putSerializable() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: imsdk-android   File: ImagePicker.java    License: MIT License 6 votes vote down vote up
/**
 * 用于手机内存不足,进程被系统回收时的状态保存
 */
public void saveInstanceState(Bundle outState) {
    outState.putSerializable("cropCacheFolder", cropCacheFolder);
    outState.putSerializable("takeImageFile", takeImageFile);
    outState.putSerializable("imageLoader", imageLoader);
    outState.putSerializable("style", style);
    outState.putBoolean("multiMode", multiMode);
    outState.putBoolean("crop", crop);
    outState.putBoolean("showCamera", showCamera);
    outState.putBoolean("isSaveRectangle", isSaveRectangle);
    outState.putInt("selectLimit", selectLimit);
    outState.putInt("outPutX", outPutX);
    outState.putInt("outPutY", outPutY);
    outState.putInt("focusWidth", focusWidth);
    outState.putInt("focusHeight", focusHeight);
}
 
Example 2
public static void showDialog(FragmentManager fragmentManager, PermissifyManager.PendingPermissionCall pendingPermissionCall) {
    if (fragmentManager.findFragmentByTag(TAG) != null) {
        Log.w(TAG, "Dialog is already on screen - rejecting show command");
        return;
    }

    Bundle args = new Bundle();
    args.putSerializable(ARG_PENDING_CALL, pendingPermissionCall);

    PermissionRationaleDialogFragment dialog = new PermissionRationaleDialogFragment();
    dialog.setArguments(args);
    dialog.setCancelable(false);

    fragmentManager
        .beginTransaction()
        .add(dialog, TAG)
        .commitAllowingStateLoss();
}
 
Example 3
public static RMBTTermsCheckFragment newInstance(final CheckType followedBy) {
	final RMBTTermsCheckFragment f = new RMBTTermsCheckFragment();
	final Bundle bdl = new Bundle(1);
	bdl.putSerializable("followedByType", followedBy);
    f.setArguments(bdl);
    return f;
}
 
Example 4
public static DialogNewAndroidResource newInstance(@NonNull JavaProjectFolder p, @Nullable File currentFolder) {
    Bundle args = new Bundle();
    args.putSerializable(KEY_PROJECT_FILE, p);
    args.putSerializable(KEY_PARENT_FILE, currentFolder);
    DialogNewAndroidResource fragment = new DialogNewAndroidResource();
    fragment.setArguments(args);
    return fragment;
}
 
Example 5
/**
 * Start service to copy the database. It will be copied to the app's directory
 *
 * @param context  : Context to start service
 * @param database : File with the database that we want to copy
 */
public static void startService(Context context, File database) {
    Bundle bundle = new Bundle();
    bundle.putSerializable(EXTRA_FILE, database);
    Intent intent = new Intent(context, CopyDbIntentService.class);
    intent.putExtras(bundle);
    context.startService(intent);
}
 
Example 6
Source Project: android-skeleton-project   File: LoginActivity.java    License: MIT License 5 votes vote down vote up
private void onAuthClientCompleted(AuthorizationClient.Result outcome) {
    request = null;

    int resultCode = (outcome.code == AuthorizationClient.Result.Code.CANCEL) ?
            RESULT_CANCELED : RESULT_OK;

    Bundle bundle = new Bundle();
    bundle.putSerializable(RESULT_KEY, outcome);

    Intent resultIntent = new Intent();
    resultIntent.putExtras(bundle);
    setResult(resultCode, resultIntent);

    finish();
}
 
Example 7
public static DialogLayoutPreview newInstance(File content) {

        Bundle args = new Bundle();
        args.putSerializable("file", content);
        DialogLayoutPreview fragment = new DialogLayoutPreview();
        fragment.setArguments(args);
        return fragment;
    }
 
Example 8
Source Project: YImagePicker   File: CropPickerBuilder.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * fragment构建
 *
 * @param imageListener 图片视频选择回调
 */
public MultiImageCropFragment pickWithFragment(OnImagePickCompleteListener imageListener) {
    checkVideoAndImage();
    MultiImageCropFragment mFragment = new MultiImageCropFragment();
    Bundle bundle = new Bundle();
    bundle.putSerializable(MultiImageCropActivity.INTENT_KEY_DATA_PRESENTER, presenter);
    bundle.putSerializable(MultiImageCropActivity.INTENT_KEY_SELECT_CONFIG, selectConfig);
    mFragment.setArguments(bundle);
    mFragment.setOnImagePickCompleteListener(imageListener);
    return mFragment;
}
 
Example 9
Source Project: NewFastFrame   File: AlbumListFragment.java    License: Apache License 2.0 5 votes vote down vote up
public static AlbumListFragment newInstance(ArrayList<AlbumWrappedBean> albumBeans) {
    Bundle bundle = new Bundle();
    bundle.putSerializable(Constant.DATA, albumBeans);
    AlbumListFragment albumListFragment = new AlbumListFragment();
    albumListFragment.setArguments(bundle);
    return albumListFragment;
}
 
Example 10
private void onAuthClientCompleted(AuthorizationClient.Result outcome) {
    request = null;

    int resultCode = (outcome.code == AuthorizationClient.Result.Code.CANCEL) ?
            RESULT_CANCELED : RESULT_OK;

    Bundle bundle = new Bundle();
    bundle.putSerializable(RESULT_KEY, outcome);

    Intent resultIntent = new Intent();
    resultIntent.putExtras(bundle);
    setResult(resultCode, resultIntent);

    finish();
}
 
Example 11
public static FoldersFragment newInstance(File directory) {
    FoldersFragment frag = new FoldersFragment();
    Bundle b = new Bundle();
    b.putSerializable(PATH, directory);
    frag.setArguments(b);
    return frag;
}
 
Example 12
Source Project: Pioneer   File: NewsActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void navigateToDetail(News item) {
    Bundle args = new Bundle(2);
    args.putSerializable(EXTRA_NEWS, item);
    if (getIntent().hasExtra(EXTRA_EDITABLE)) {
        args.putBoolean(EXTRA_EDITABLE, getIntent().getBooleanExtra(EXTRA_EDITABLE, false));
    }
    NewsDetailFragment fragment = NewsDetailFragment.newInstance(args);
    getSupportFragmentManager().beginTransaction()
            .replace(getSearchFragmentContainerId(), fragment, TAG_FRAG_DETAIL)
            .addToBackStack(null)
            .commit();
}
 
Example 13
Source Project: mobikul-standalone-pos   File: CheckoutHandler.java    License: MIT License 5 votes vote down vote up
public void cashPayment(TotalModel totalModel) {
    FragmentManager fragmentManager = ((AppCompatActivity) context).getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left);
    Fragment fragment;
    fragment = fragmentManager.findFragmentByTag(CashFragment.class.getSimpleName());
    if (fragment == null)
        fragment = new CashFragment();
    Bundle bundle = new Bundle();
    bundle.putSerializable("total", totalModel);
    fragment.setArguments(bundle);
    fragmentTransaction.add(((Checkout) context).checkoutBinding.frameLayout.getId(), fragment, fragment.getClass().getSimpleName());
    fragmentTransaction.addToBackStack(fragment.getClass().getSimpleName()).commit();
}
 
Example 14
public static ImageZoomFragment newInstance(RestaurantImage contentItem, int pos) {
    ImageZoomFragment f = new ImageZoomFragment();
    Bundle args = new Bundle();
    args.putSerializable("content", contentItem);
    args.putInt("pos", pos);
    f.setArguments(args);
    return f;
}
 
Example 15
Source Project: kute   File: FriendTab.java    License: Apache License 2.0 5 votes vote down vote up
public void setupCurrentFriends()
{
    Log.d(TAG,"Setting Up Current Friend");
    FriendFrame f=new FriendFrame();
    Bundle args=new Bundle();
    args.putSerializable("Friend_1",friend_detail_list.get(0));
    f.setArguments(args);
    viewall_currentfriends.setEnabled(true);
    getChildFragmentManager().beginTransaction().replace(R.id.currentFriendsFrame,f).commit();
}
 
Example 16
Source Project: cathode   File: RemoveFromHistoryDialog.java    License: Apache License 2.0 5 votes vote down vote up
public static Bundle getArgs(Type type, long id, String title, String showTitle) {
  Bundle args = new Bundle();
  args.putSerializable(ARG_TYPE, type);
  args.putLong(ARG_ID, id);
  args.putString(ARG_TITLE, title);
  args.putString(ARG_SHOW_TITLE, showTitle);
  return args;
}
 
Example 17
public static SearchFragment newInstance(@NonNull Locale locale) {
  Bundle args = new Bundle();
  args.putSerializable(EXTRA_LOCALE, locale);

  SearchFragment fragment = new SearchFragment();
  fragment.setArguments(args);

  return fragment;
}
 
Example 18
public void notifyMediaStatusChanged(MediaStatus status) {
    Bundle bundle = new Bundle();
    bundle.putSerializable("media_changed", status);
    ObservableManager.getDefaultObserable().sendToTarget(VenvyObservableTarget.TAG_MEDIA_CHANGED, bundle);
}
 
Example 19
Source Project: alltv   File: FetchChannelService.java    License: MIT License 4 votes vote down vote up
@Override
protected void onHandleIntent(Intent intent) {

    if (intent != null) {
        ResultReceiver channelResultReceiver = intent
                .getParcelableExtra(getStringById(R.string.FETCHCHANNELRESULTRECEIVER_STR));

        Gson gson = new Gson();
        SettingsData settingsData = gson.fromJson(intent
                .getStringExtra(getStringById(R.string.SETTINGSDATA_STR)), SettingsData.class);

        Utils.SiteType siteType = (Utils.SiteType) intent.getSerializableExtra(getStringById(R.string.SITETYPE_STR));

        if (siteType == Utils.SiteType.Pooq) {
            mSiteProcessor = new PooqSiteProcessor(getApplicationContext());
        } else if (siteType == Utils.SiteType.Tving) {
            mSiteProcessor = new TvingSiteProcessor(getApplicationContext());
        } else if (siteType == Utils.SiteType.Oksusu) {
            mSiteProcessor = new OksusuSiteProcessor(getApplicationContext());
        }

        String authkey = (String) intent.getSerializableExtra(getStringById(R.string.AUTHKEY_STR));

        if (authkey == null || authkey.length() == 0) {
            mSiteProcessor.setAuthKey("");
        } else {
            mSiteProcessor.setAuthKey(authkey);
        }

        String mode = (String) intent.getSerializableExtra(getStringById(R.string.FETCHMODE_STR));

        ArrayList<ChannelData> channels = new ArrayList<>();
        ArrayList<CategoryData> category = new ArrayList<>();
        boolean error = false;

        if(mode.equals("create")) {
            if (mSiteProcessor.doProcess(settingsData)) {
                channels = mSiteProcessor.getChannelList();
                category = mSiteProcessor.getCategorylList();
            } else {
                error = true;
            }
        } else if(mode.equals("refresh")) {
            channels = intent.getParcelableArrayListExtra(getStringById(R.string.CHANNELS_STR));
            category = intent.getParcelableArrayListExtra(getStringById(R.string.CATEGORY_STR));

            mSiteProcessor.setChannelList(channels);
            mSiteProcessor.setCategorylList(category);

            if(!mSiteProcessor.updateProcess()) {
                error = true;
            }
        }

        Bundle retBundle = new Bundle();
        retBundle.putParcelableArrayList(getStringById(R.string.CHANNELS_STR), channels);
        retBundle.putParcelableArrayList(getStringById(R.string.CATEGORY_STR), category);
        retBundle.putString(getStringById(R.string.AUTHKEY_STR), mSiteProcessor.getAuthKey());
        retBundle.putSerializable(getStringById(R.string.SITETYPE_STR), siteType);
        retBundle.putString(getStringById(R.string.FETCHMODE_STR), mode);

        int retCode;

        if(error) retCode = Utils.Code.ServiceIntent_Fail.ordinal();
        else      retCode = Utils.Code.ServiceIntent_OK.ordinal();

        channelResultReceiver.send(retCode, retBundle);
    }
}
 
Example 20
public void setActionToBeAssigned(Action actionToBeAssigned) {
  this.actionToBeAssigned = actionToBeAssigned;
  Bundle args = new Bundle();
  args.putSerializable(ACTION_KEY, actionToBeAssigned);
  setArguments(args);
}