Example usage for android.os Bundle putBoolean

List of usage examples for android.os Bundle putBoolean

Introduction

In this page you can find the example usage for android.os Bundle putBoolean.

Prototype

public void putBoolean(@Nullable String key, boolean value) 

Source Link

Document

Inserts a Boolean value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.seafile.seadroid2.provider.SeafileProvider.java

/**
 * Create a MatrixCursor with the option to enable the extraLoading flag.
 *
 * @param netProjection column list/*from  w ww .ja v  a  2s.  c om*/
 * @param extraLoading if true, the client will expect that more entries will arrive shortly.
 * @return the Cursor object
 */
private static MatrixCursor createCursor(String[] netProjection, final boolean extraLoading,
        final boolean isReachable) {
    return new MatrixCursor(netProjection) {
        @Override
        public Bundle getExtras() {
            Bundle b = new Bundle();
            b.putBoolean(DocumentsContract.EXTRA_LOADING, extraLoading);
            if (!extraLoading && !isReachable) {
                b.putString(DocumentsContract.EXTRA_ERROR, "Could not connect with server");
            }
            return b;
        }
    };
}

From source file:com.skywomantechnology.app.guildviewer.sync.GuildViewerSyncAdapter.java

/**
 *  Sync the remote data immediately passing along sync data to
 *  the routines to determine how much data to sync
 *
 * @param context Activity context/*  w  w  w . j  a v  a2  s  .c  o  m*/
 * @param syncAll if true process all news items within the date range,
 *                if false process normally by checking the timestamps
 * @param syncMax Max number of news items to process
 */
public static void syncImmediately(Context context, boolean syncAll, int syncMax) {
    Bundle bundle = new Bundle();
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    bundle.putBoolean(SYNC_EXTRAS_SYNC_ALL, syncAll);
    bundle.putInt(SYNC_EXTRAS_SYNC_MAX, syncMax);
    ContentResolver.requestSync(getSyncAccount(context), context.getString(R.string.content_authority), bundle);
}

From source file:it.evilsocket.dsploit.core.System.java

public static boolean checkNetworking(final Activity current) {
    if (Network.isWifiConnected(mContext) == false) {
        AlertDialog.Builder builder = new AlertDialog.Builder(current);

        builder.setCancelable(false);/*from   w  ww  . j  a  v a 2 s .c  o  m*/
        builder.setTitle("Error");
        builder.setMessage("WiFi connectivity went down.");
        builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();

                Bundle bundle = new Bundle();
                bundle.putBoolean(WifiScannerActivity.CONNECTED, false);

                Intent intent = new Intent();
                intent.putExtras(bundle);

                current.setResult(Activity.RESULT_OK, intent);

                current.finish();
            }
        });

        AlertDialog alert = builder.create();
        alert.show();

        return false;
    }

    return true;
}

From source file:com.manning.androidhacks.hack023.MainActivity.java

public void refresh(View v) {
    Bundle extras = new Bundle();
    extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);

    Account account = ((HackApplication) getApplication()).getCurrentAccount();

    if (ContentResolver.isSyncPending(account, TodoContentProvider.AUTHORITY)) {
        ContentResolver.cancelSync(account, TodoContentProvider.AUTHORITY);
    }/* ww w  . jav  a  2s.  c o  m*/

    ContentResolver.requestSync(account, TodoContentProvider.AUTHORITY, extras);
}

From source file:com.krayzk9s.imgurholo.tools.CommentsAsync.java

@Override
protected void onPostExecute(Void aVoid) {
    if (galleryAlbumData != null) {
        SingleImageFragment fragment = new SingleImageFragment();
        Bundle bundle = new Bundle();
        bundle.putBoolean("gallery", true);
        JSONParcelable data = new JSONParcelable();
        data.setJSONObject(galleryAlbumData);
        bundle.putParcelable("imageData", data);
        fragment.setArguments(bundle);/*from  w  w  w .  ja va2s.c  om*/
        if (activity != null) {
            FragmentManager fragmentManager = activity.getSupportFragmentManager();
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
            FrameLayout displayFrag = (FrameLayout) activity.findViewById(R.id.frame_layout_child);
            if (displayFrag != null)
                fragmentTransaction.replace(R.id.frame_layout_child, fragment).commitAllowingStateLoss();
            else
                fragmentTransaction.replace(R.id.frame_layout, fragment).commitAllowingStateLoss();
        }
    }
}

From source file:com.nextgis.maplibui.formcontrol.Checkbox.java

@Override
public void saveState(Bundle outState) {
    outState.putBoolean(ControlHelper.getSavedStateKey(mFieldName), isChecked());
}

From source file:com.activiti.android.app.fragments.labs.LabsMenuFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    Button sync = (Button) viewById(R.id.app_sync);
    sync.setOnClickListener(new View.OnClickListener() {
        @Override/*  w w w .  ja  v  a 2  s. c om*/
        public void onClick(View v) {
            List<Account> accounts = ActivitiAccountManager.getInstance(getActivity()).getAndroidAccounts();
            Bundle settingsBundle = new Bundle();
            settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
            settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
            ContentResolver.requestSync(accounts.get(0), ProcessDefinitionModelProvider.AUTHORITY,
                    settingsBundle);
        }
    });
}

From source file:org.klnusbaum.udj.auth.Authenticator.java

@Override
public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] freaturs) {
    final Bundle result = new Bundle();
    result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false);
    return result;
}

From source file:com.android.deskclock.actionbarmenu.SearchMenuItemController.java

public void saveInstance(Bundle outState) {
    outState.putString(KEY_SEARCH_QUERY, mQuery);
    outState.putBoolean(KEY_SEARCH_MODE, mSearchMode);
}

From source file:com.allandroidprojects.ecomsample.fragments.ViewPagerActivity.java

@Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
    if (isViewPagerActive()) {
        outState.putBoolean(ISLOCKED_ARG, ((HackyViewPager) mViewPager).isLocked());
    }/*from   w w w . ja  v  a 2s  . co m*/
    super.onSaveInstanceState(outState);
}