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

The following examples show how to use android.os.Bundle#putSerializable() . 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 check out the related API usage on the sidebar.
Example 1
Source File: ImagePicker.java    From imsdk-android with 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
Source File: PermissionRationaleDialogFragment.java    From Permissify with MIT License 6 votes vote down vote up
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
Source File: SearchFragment.java    From deltachat-android with GNU General Public License v3.0 5 votes vote down vote up
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 4
Source File: RMBTTermsCheckFragment.java    From open-rmbt with Apache License 2.0 5 votes vote down vote up
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 5
Source File: RemoveFromHistoryDialog.java    From cathode with 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 6
Source File: FriendTab.java    From kute with 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 7
Source File: ImageZoomFragment.java    From Expert-Android-Programming with MIT License 5 votes vote down vote up
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 8
Source File: CheckoutHandler.java    From mobikul-standalone-pos with 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 9
Source File: NewsActivity.java    From Pioneer with 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 10
Source File: FoldersFragment.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
public static FoldersFragment newInstance(File directory) {
    FoldersFragment frag = new FoldersFragment();
    Bundle b = new Bundle();
    b.putSerializable(PATH, directory);
    frag.setArguments(b);
    return frag;
}
 
Example 11
Source File: LoginActivity.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 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 12
Source File: AlbumListFragment.java    From NewFastFrame with 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 13
Source File: CropPickerBuilder.java    From YImagePicker with 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 14
Source File: DialogLayoutPreview.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
public static DialogLayoutPreview newInstance(File content) {

        Bundle args = new Bundle();
        args.putSerializable("file", content);
        DialogLayoutPreview fragment = new DialogLayoutPreview();
        fragment.setArguments(args);
        return fragment;
    }
 
Example 15
Source File: LoginActivity.java    From android-skeleton-project with 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 16
Source File: CopyDbIntentService.java    From android_dbinspector with Apache License 2.0 5 votes vote down vote up
/**
 * 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 17
Source File: DialogNewAndroidResource.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
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 18
Source File: FetchChannelService.java    From alltv with 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 19
Source File: SetupWizardConfigureSwitchFragment.java    From talkback with Apache License 2.0 4 votes vote down vote up
public void setActionToBeAssigned(Action actionToBeAssigned) {
  this.actionToBeAssigned = actionToBeAssigned;
  Bundle args = new Bundle();
  args.putSerializable(ACTION_KEY, actionToBeAssigned);
  setArguments(args);
}
 
Example 20
Source File: VideoPlusAdapter.java    From VideoOS-Android-SDK with GNU General Public License v3.0 4 votes vote down vote up
public void notifyMediaStatusChanged(MediaStatus status) {
    Bundle bundle = new Bundle();
    bundle.putSerializable("media_changed", status);
    ObservableManager.getDefaultObserable().sendToTarget(VenvyObservableTarget.TAG_MEDIA_CHANGED, bundle);
}