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.amaze.carbonfilemanager.services.CopyService.java

@Override
public int onStartCommand(Intent intent, int flags, final int startId) {
    Bundle b = new Bundle();
    ArrayList<BaseFile> files = intent.getParcelableArrayListExtra(TAG_COPY_SOURCES);
    String targetPath = intent.getStringExtra(TAG_COPY_TARGET);
    int mode = intent.getIntExtra(TAG_COPY_OPEN_MODE, OpenMode.UNKNOWN.ordinal());
    final boolean move = intent.getBooleanExtra(TAG_COPY_MOVE, false);

    mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    b.putInt(TAG_COPY_START_ID, startId);
    Intent notificationIntent = new Intent(this, MainActivity.class);
    notificationIntent.setAction(Intent.ACTION_MAIN);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    notificationIntent.putExtra(MainActivity.KEY_INTENT_PROCESS_VIEWER, true);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
    mBuilder = new NotificationCompat.Builder(c);
    mBuilder.setContentIntent(pendingIntent);
    mBuilder.setContentTitle(getResources().getString(R.string.copying))
            .setSmallIcon(R.drawable.ic_content_copy_white_36dp);

    startForeground(Integer.parseInt("456" + startId), mBuilder.build());

    b.putBoolean(TAG_COPY_MOVE, move);
    b.putString(TAG_COPY_TARGET, targetPath);
    b.putInt(TAG_COPY_OPEN_MODE, mode);//  ww w .  j  a  va2s.  c om
    b.putParcelableArrayList(TAG_COPY_SOURCES, files);

    //going async
    new DoInBackground().execute(b);

    // If we get killed, after returning from here, restart
    return START_STICKY;
}

From source file:se.leap.bitmaskclient.ProviderAPI.java

private Bundle authenticate(String username, String password) {
    Bundle result = new Bundle();

    LeapSRPSession client = new LeapSRPSession(username, password);
    byte[] A = client.exponential();

    JSONObject step_result = sendAToSRPServer(provider_api_url, username, new BigInteger(1, A).toString(16));
    try {/*from   w ww . j av  a  2  s  . c om*/
        String salt = step_result.getString(LeapSRPSession.SALT);
        byte[] Bbytes = new BigInteger(step_result.getString("B"), 16).toByteArray();
        byte[] M1 = client.response(new BigInteger(salt, 16).toByteArray(), Bbytes);
        if (M1 != null) {
            step_result = sendM1ToSRPServer(provider_api_url, username, M1);
            setTokenIfAvailable(step_result);
            byte[] M2 = new BigInteger(step_result.getString(LeapSRPSession.M2), 16).toByteArray();
            if (client.verify(M2)) {
                result.putBoolean(RESULT_KEY, true);
            } else {
                authFailedNotification(step_result, username);
            }
        } else {
            result.putBoolean(RESULT_KEY, false);
            result.putString(SessionDialog.USERNAME, username);
            result.putString(getResources().getString(R.string.user_message),
                    getResources().getString(R.string.error_srp_math_error_user_message));
        }
    } catch (JSONException e) {
        result = authFailedNotification(step_result, username);
        e.printStackTrace();
    }

    return result;
}

From source file:github.popeen.dsub.fragments.SelectDirectoryFragment.java

@Override
public void onItemClicked(UpdateView<Entry> updateView, Entry entry) {
    if (entry.isDirectory()) {
        SubsonicFragment fragment = new SelectDirectoryFragment();
        Bundle args = new Bundle();
        args.putString(Constants.INTENT_EXTRA_NAME_ID, entry.getId());
        args.putString(Constants.INTENT_EXTRA_NAME_NAME, entry.getTitle());
        args.putSerializable(Constants.INTENT_EXTRA_NAME_DIRECTORY, entry);
        if ("newest".equals(albumListType)) {
            args.putBoolean(Constants.INTENT_EXTRA_REFRESH_LISTINGS, true);
        }/*from   w  ww . ja  v  a2 s  . com*/
        if (!entry.isAlbum()) {
            args.putBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, true);
        }
        fragment.setArguments(args);

        replaceFragment(fragment, true);
    } else if (entry.isVideo()) {
        playVideo(entry);
    } else if (entry instanceof PodcastEpisode) {
        String status = ((PodcastEpisode) entry).getStatus();
        if ("error".equals(status)) {
            Util.toast(context, R.string.select_podcasts_error);
            return;
        } else if (!"completed".equals(status)) {
            Util.toast(context, R.string.select_podcasts_skipped);
            return;
        }

        onSongPress(Arrays.asList(entry), entry, false);
    } else {
        onSongPress(entries, entry, albumListType == null || "starred".equals(albumListType));
    }
}

From source file:com.ichi2.anki.CardEditor.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    // TODO//www  .  j  av  a  2  s. c om
    // Log.i(AnkiDroidApp.TAG, "onSaveInstanceState: " + path);
    // outState.putString("deckFilename", path);
    outState.putBoolean("addFact", mAddNote);
    outState.putInt("caller", mCaller);
    Log.i(AnkiDroidApp.TAG, "onSaveInstanceState - Ending");
}

From source file:co.taqat.call.LinphoneActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putSerializable("currentFragment", currentFragment);
    outState.putBoolean("fetchedContactsOnce", fetchedContactsOnce);
    super.onSaveInstanceState(outState);
}

From source file:co.taqat.call.LinphoneActivity.java

public void displayContact(LinphoneContact contact, boolean chatOnly) {
    Fragment fragment2 = getFragmentManager().findFragmentById(R.id.fragmentContainer2);
    if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.CONTACT_DETAIL) {
        ContactDetailsFragment contactFragment = (ContactDetailsFragment) fragment2;
        contactFragment.changeDisplayedContact(contact);
    } else {//from   w ww  .j av  a 2 s  .c o  m
        Bundle extras = new Bundle();
        extras.putSerializable("Contact", contact);
        extras.putBoolean("ChatAddressOnly", chatOnly);
        changeCurrentFragment(FragmentsAvailable.CONTACT_DETAIL, extras);
    }
}

From source file:com.aslanoba.hwc.SettingsActivity.java

/**
 * Save the current value in ui control for restoring later. In most cases, the saved state is
 * not used. However, if the activity is collected by OS due to low memory, then the saved
 * state will be used in onCreate method with the Bundle parameter, so that any pending change
 * in UI will be kept and restored.//from  ww w  .ja  v  a  2  s. co  m
 */
@Override
protected void onSaveInstanceState(Bundle outState) {

    outState.clear();
    //save pending settings in UI
    for (int i = 0; i < m_lstSettings.size(); i++) {
        SettingsListItem oItem = m_lstSettings.get(i);
        if (!oItem.m_oOrigValue.equals(oItem.m_oValue)) {
            if (oItem.m_oValue instanceof Integer)
                outState.putInt(String.valueOf(oItem.m_iPropId), (Integer) oItem.m_oValue);
            else if (oItem.m_oValue instanceof Boolean)
                outState.putBoolean(String.valueOf(oItem.m_iPropId), (Boolean) oItem.m_oValue);
            else
                outState.putString(String.valueOf(oItem.m_iPropId), oItem.m_oValue.toString());
        }
    }
}

From source file:com.owncloud.android.authentication.AuthenticatorActivity.java

private void syncAccount() {
    // / immediately request for the synchronization of the new account
    Bundle bundle = new Bundle();
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    ContentResolver.requestSync(mAccount, AccountAuthenticator.AUTHORITY, bundle);
}

From source file:com.grass.caishi.cc.activity.main.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putBoolean("isConflict", isConflict);
    outState.putBoolean(Constant.ACCOUNT_REMOVED, isCurrentAccountRemoved);
    super.onSaveInstanceState(outState);
}

From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java

public void showMap(boolean popBackStack) {
    if (popBackStack) {
        popBackStackFull();//from www.  j  a va  2s .com
    }

    FragmentTransaction ft;
    ft = fm.beginTransaction();
    Fragment f = new RMBTMapFragment();
    Bundle bundle = new Bundle();
    bundle.putBoolean(RMBTMapFragment.OPTION_ENABLE_ALL_GESTURES, true);
    bundle.putBoolean(RMBTMapFragment.OPTION_SHOW_INFO_TOAST, true);
    bundle.putBoolean(RMBTMapFragment.OPTION_ENABLE_CONTROL_BUTTONS, true);
    f.setArguments(bundle);
    ft.replace(R.id.fragment_content, f, AppConstants.PAGE_TITLE_MAP);
    ft.addToBackStack(AppConstants.PAGE_TITLE_MAP);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    ft.commit();

    refreshActionBar(AppConstants.PAGE_TITLE_MAP);
}