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:cn.fulldroid.lib.datetimepicker.time.TimePickerDialog.java

@Override
public void onSaveInstanceState(Bundle outState) {
    if (mTimePicker != null) {
        outState.putInt(KEY_HOUR_OF_DAY, mTimePicker.getHours());
        outState.putInt(KEY_MINUTE, mTimePicker.getMinutes());
        outState.putBoolean(KEY_IS_24_HOUR_VIEW, mIs24HourMode);
        outState.putInt(KEY_CURRENT_ITEM_SHOWING, mTimePicker.getCurrentItemShowing());
        outState.putBoolean(KEY_IN_KB_MODE, mInKbMode);
        if (mInKbMode) {
            outState.putIntegerArrayList(KEY_TYPED_TIMES, mTypedTimes);
        }/* www. jav  a 2s .  c o m*/
        outState.putBoolean(KEY_VIBRATE, mVibrate);
    }
}

From source file:com.googlecode.CallerLookup.Main.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putInt(PREFS_LOOKUP, mLookup.getSelectedItemPosition());
    outState.putString(PREFS_URL, mURL.getText().toString());
    outState.putString(PREFS_REGEXP, mRegExp.getText().toString());
    outState.putString(STATE_TESTINPUT, mTestInput.getText().toString());
    outState.putBoolean(PREFS_NOTIFY, mNotify.isChecked());
}

From source file:com.android.datetimepicker.time.TimePickerDialog.java

@Override
public void onSaveInstanceState(Bundle outState) {
    if (mTimePicker != null) {
        outState.putInt(KEY_HOUR_OF_DAY, mTimePicker.getHours());
        outState.putInt(KEY_MINUTE, mTimePicker.getMinutes());
        outState.putBoolean(KEY_IS_24_HOUR_VIEW, mIs24HourMode);
        outState.putInt(KEY_CURRENT_ITEM_SHOWING, mTimePicker.getCurrentItemShowing());
        outState.putBoolean(KEY_IN_KB_MODE, mInKbMode);
        if (mInKbMode) {
            outState.putIntegerArrayList(KEY_TYPED_TIMES, mTypedTimes);
        }/*w  ww  .  ja  v  a2  s.c  om*/
        outState.putBoolean(KEY_DARK_THEME, mThemeDark);
    }
}

From source file:com.gelakinetic.mtgfam.activities.MainActivity.java

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

    /* http://stackoverflow.com/questions/13179620/force-overflow-menu-in-actionbarsherlock/13180285
     * /*  www  .  j  a  v  a2  s .  c om*/
     * Open ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/ActionMenuPresenter.java, go to method reserveOverflow
     * Replace the original with:
     * public static boolean reserveOverflow(Context context) { return true; }
     */
    if (DEVICE_VERSION >= DEVICE_HONEYCOMB) {
        try {
            ViewConfiguration config = ViewConfiguration.get(this);
            Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
            if (menuKeyField != null) {
                menuKeyField.setAccessible(true);
                menuKeyField.setBoolean(config, false);
            }
        } catch (Exception ex) {
            // Ignore
        }
    }

    mFragmentManager = getSupportFragmentManager();

    try {
        pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
    } catch (NameNotFoundException e) {
        pInfo = null;
    }

    if (prefAdapter == null) {
        prefAdapter = new PreferencesAdapter(this);
    }

    int lastVersion = prefAdapter.getLastVersion();
    if (pInfo.versionCode != lastVersion) {
        // Clear the robospice cache on upgrade. This way, no cached values w/o foil prices will exist
        try {
            spiceManager.removeAllDataFromCache();
        } catch (NullPointerException e) {
            // eat it. tasty
        }
        showDialogFragment(CHANGELOGDIALOG);
        prefAdapter.setLastVersion(pInfo.versionCode);
        bounceMenu = lastVersion <= 15; //Only bounce if the last version is 1.8.1 or lower (or a fresh install) 
    }

    File mtr = new File(getFilesDir(), JudgesCornerFragment.MTR_LOCAL_FILE);
    File ipg = new File(getFilesDir(), JudgesCornerFragment.IPG_LOCAL_FILE);
    if (!mtr.exists()) {
        try {
            InputStream in = getResources().openRawResource(R.raw.mtr);
            FileOutputStream fos = new FileOutputStream(mtr);
            IOUtils.copy(in, fos);
        } catch (FileNotFoundException e) {
            Log.w("MainActivity", "MTR file could not be copied: " + e.getMessage());
        } catch (IOException e) {
            Log.w("MainActivity", "MTR file could not be copied: " + e.getMessage());
        }
    }
    if (!ipg.exists()) {
        try {
            InputStream in = getResources().openRawResource(R.raw.ipg);
            FileOutputStream fos = new FileOutputStream(ipg);
            IOUtils.copy(in, fos);
        } catch (FileNotFoundException e) {
            Log.w("MainActivity", "IPG file could not be copied: " + e.getMessage());
        } catch (IOException e) {
            Log.w("MainActivity", "IPG file could not be copied: " + e.getMessage());
        }
    }

    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setIcon(R.drawable.sliding_menu_icon);

    SlidingMenu slidingMenu = getSlidingMenu();
    slidingMenu.setBehindWidthRes(R.dimen.sliding_menu_width);
    slidingMenu.setBehindScrollScale(0.0f);
    slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    slidingMenu.setShadowWidthRes(R.dimen.shadow_width);
    slidingMenu.setShadowDrawable(R.drawable.sliding_menu_shadow);
    setSlidingActionBarEnabled(false);
    setBehindContentView(R.layout.fragment_menu);

    me = this;

    boolean autoupdate = prefAdapter.getAutoUpdate();
    if (autoupdate) {
        // Only update the banning list if it hasn't been updated recently
        long curTime = new Date().getTime();
        int updatefrequency = Integer.valueOf(prefAdapter.getUpdateFrequency());
        int lastLegalityUpdate = prefAdapter.getLastLegalityUpdate();
        // days to ms
        if (((curTime / 1000) - lastLegalityUpdate) > (updatefrequency * 24 * 60 * 60)) {
            startService(new Intent(this, DbUpdaterService.class));
        }
    }

    timerHandler = new Handler();
    registerReceiver(endTimeReceiver, new IntentFilter(RoundTimerFragment.RESULT_FILTER));
    registerReceiver(startTimeReceiver, new IntentFilter(RoundTimerService.START_FILTER));
    registerReceiver(cancelTimeReceiver, new IntentFilter(RoundTimerService.CANCEL_FILTER));

    updatingDisplay = false;
    timeShowing = false;

    getSlidingMenu().setOnOpenedListener(new OnOpenedListener() {

        @Override
        public void onOpened() {
            // Close the keyboard if the slidingMenu is opened
            hideKeyboard();
        }
    });

    setContentView(R.layout.fragment_activity);
    getSupportFragmentManager().beginTransaction().replace(R.id.frag_menu, new MenuFragment()).commit();

    showOnePane();
    if (findViewById(R.id.middle_container) != null) {
        // The detail container view will be present only in the
        // large-screen layouts (res/values-large and
        // res/values-sw600dp). If this view is present, then the
        // activity should be in two-pane mode.
        mIsATablet = true;
        if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
            mThreePane = true;
        } else {
            mThreePane = false;
        }
    } else {
        mThreePane = false;
        mIsATablet = false;
        if (findViewById(R.id.middle_container) != null) {
            findViewById(R.id.middle_container).setVisibility(View.GONE);
            findViewById(R.id.right_container).setVisibility(View.GONE);
        }
    }

    Intent intent = getIntent();

    if (savedInstanceState == null) {
        try {
            if (intent.getAction().equals(Intent.ACTION_VIEW)) { //apparently this can NPE on 4.3. because why not. if we catch it, launch the default frag
                // handles a click on a search suggestion; launches activity to show word
                Uri u = intent.getData();
                long id = Long.parseLong(u.getLastPathSegment());

                // add a fragment
                Bundle args = new Bundle();
                args.putBoolean("isSingle", true);
                args.putLong("id", id);
                CardViewFragment rlFrag = new CardViewFragment();
                rlFrag.setArguments(args);

                attachSingleFragment(rlFrag, "left_frag", false, false);
                showOnePane();
                hideKeyboard();
            } else if (intent.getAction().equals(Intent.ACTION_SEARCH)) {
                boolean consolidate = prefAdapter.getConsolidateSearch();
                String query = intent.getStringExtra(SearchManager.QUERY);
                SearchCriteria sc = new SearchCriteria();
                sc.Name = query;
                sc.Set_Logic = (consolidate ? CardDbAdapter.FIRSTPRINTING : CardDbAdapter.ALLPRINTINGS);

                // add a fragment
                Bundle args = new Bundle();
                args.putBoolean(SearchViewFragment.RANDOM, false);
                args.putSerializable(SearchViewFragment.CRITERIA, sc);
                if (mIsATablet) {
                    SearchViewFragment svFrag = new SearchViewFragment();
                    svFrag.setArguments(args);
                    attachSingleFragment(svFrag, "left_frag", false, false);
                } else {
                    ResultListFragment rlFrag = new ResultListFragment();
                    rlFrag.setArguments(args);
                    attachSingleFragment(rlFrag, "left_frag", false, false);
                }
                hideKeyboard();
            } else if (intent.getAction().equals(ACTION_FULL_SEARCH)) {
                attachSingleFragment(new SearchViewFragment(), "left_frag", false, false);
                showOnePane();
            } else if (intent.getAction().equals(ACTION_WIDGET_SEARCH)) {
                attachSingleFragment(new SearchWidgetFragment(), "left_frag", false, false);
                showOnePane();
            } else if (intent.getAction().equals(ACTION_ROUND_TIMER)) {
                attachSingleFragment(new RoundTimerFragment(), "left_frag", false, false);
                showOnePane();
            } else {
                launchDefaultFragment();
            }
        } catch (NullPointerException e) {
            launchDefaultFragment();
        }
    }
}

From source file:at.alladin.rmbt.android.test.RMBTTestFragment.java

/**
 * //from   ww  w.  j a va 2 s .  com
 * @param inflater
 * @param view
 */
private void populateViewForOrientation(final LayoutInflater inflater, final ViewGroup view) {

    System.out.println("RECREATING INSTANCE FOR ORIENTATION CHANGE");

    GroupCountView groupCountView = null;
    if (groupCountContainerView != null && groupCountContainerView.getChildAt(0) != null) {
        groupCountView = (GroupCountView) groupCountContainerView.getChildAt(0);
        groupCountContainerView.removeAllViews();
    }

    final String infoText = String.valueOf(textView.getText());
    final String header = testView.getHeaderString();

    final String subHeader = testView.getSubHeaderString();
    final String resultPing = testView.getResultPingString();
    final String resultDown = testView.getResultDownString();
    final String resultUp = testView.getResultUpString();

    final GraphData signalGraphData;
    final GraphData speedGraphData;

    final MinMax<Integer> currentSignalBounds;
    final List<GraphView.GraphLabel> graphLabelList;

    if (graphView != null) {
        graphLabelList = graphView.getLabelInfoVerticalList();
        currentSignalBounds = graphView.getSignalRange();
    } else {
        graphLabelList = null;
        currentSignalBounds = null;
    }

    if (signalGraph != null) {
        signalGraphData = signalGraph.getGraphData();
    } else {
        signalGraphData = null;
    }

    if (speedGraph != null) {
        speedGraphData = speedGraph.getGraphData();
    } else {
        speedGraphData = null;
    }

    view.removeAllViewsInLayout();
    final View v = inflater.inflate(R.layout.test, view);

    final Bundle options = new Bundle();
    options.putBoolean(OPTION_ON_CREATE_VIEW_CREATE_SIGNAL_GRAPH, false);
    options.putBoolean(OPTION_ON_CREATE_VIEW_CREATE_SPEED_GRAPH, false);

    createView(v, inflater, options);

    if (groupCountContainerView != null && groupCountView != null && qosProgressView != null) {
        groupCountContainerView.addView(groupCountView);
        qosProgressView.setVisibility(View.VISIBLE);
        //groupCountContainerView.setVisibility(View.VISIBLE);

        if (graphView != null) {
            graphView.setVisibility(View.GONE);
        }
        if (infoView != null) {
            infoView.setVisibility(View.GONE);
        }
    }

    if (testView != null) {
        testView.setHeaderString(header);
        testView.setSubHeaderString(subHeader);
        testView.setResultPingString(resultPing);
        testView.setResultDownString(resultDown);
        testView.setResultUpString(resultUp);
    }

    if (textView != null) {
        textView.setText(infoText);
    }

    if (graphView != null) {
        graphView.setRowLinesLabelList(ResultGraphView.SPEED_LABELS);

        if (signalGraphData != null) {
            signalGraph = SimpleGraph.addGraph(graphView, GRAPH_MAX_NSECS, signalGraphData);

            if (currentSignalBounds != null) {
                graphView.setLabelInfoVerticalList(graphLabelList);
                graphView.setSignalRange(currentSignalBounds.min, currentSignalBounds.max);
            }
        }
        if (speedGraphData != null) {
            speedGraph = SmoothGraph.addGraph(graphView, SMOOTHING_DATA_AMOUNT, SMOOTHING_FUNCTION, false,
                    speedGraphData);
            speedGraph.setMaxTime(GRAPH_MAX_NSECS);
        }
    }

}

From source file:com.synox.android.ui.activity.FileActivity.java

protected void startSynchronization() {
    Log_OC.d(TAG, "Got to start sync");
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.KITKAT) {
        Log_OC.d(TAG, "Canceling all syncs for " + MainApp.getAuthority());
        ContentResolver.cancelSync(null, MainApp.getAuthority());
        // cancel the current synchronizations of any ownCloud account
        Bundle bundle = new Bundle();
        bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
        bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
        Log_OC.d(TAG, "Requesting sync for " + getAccount().name + " at " + MainApp.getAuthority());
        ContentResolver.requestSync(getAccount(), MainApp.getAuthority(), bundle);
    } else {//from   w w  w. ja  va 2  s  . c o m
        Log_OC.d(TAG,
                "Requesting sync for " + getAccount().name + " at " + MainApp.getAuthority() + " with new API");
        SyncRequest.Builder builder = new SyncRequest.Builder();
        builder.setSyncAdapter(getAccount(), MainApp.getAuthority());
        builder.setExpedited(true);
        builder.setManual(true);
        builder.syncOnce();

        // Fix bug in Android Lollipop when you click on refresh the whole account
        Bundle extras = new Bundle();
        builder.setExtras(extras);

        SyncRequest request = builder.build();
        ContentResolver.requestSync(request);
    }
}

From source file:com.example.scrumptious.SelectionFragment.java

@Override
public void onSaveInstanceState(Bundle bundle) {
    super.onSaveInstanceState(bundle);
    for (BaseListElement listElement : listElements) {
        listElement.onSaveInstanceState(bundle);
    }/*from  w w  w. ja  va  2s . c  o m*/
    bundle.putBoolean(PENDING_ANNOUNCE_KEY, pendingAnnounce);
}

From source file:com.buddi.client.dfu.DfuActivity.java

@Override
protected void onSaveInstanceState(final Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt(DATA_FILE_TYPE, mFileType);
    outState.putInt(DATA_FILE_TYPE_TMP, mFileTypeTmp);
    outState.putString(DATA_FILE_PATH, mFilePath);
    outState.putParcelable(DATA_FILE_STREAM, mFileStreamUri);
    outState.putParcelable(DATA_DEVICE, mSelectedDevice);
    outState.putBoolean(DATA_STATUS, mStatusOk);
}

From source file:at.jclehner.rxdroid.DrugListActivity.java

@SuppressWarnings("deprecation")
private void showDoseDialog(Drug drug, Date date, int doseTime, boolean forceShow) {
    if (toastIfPastMaxHistoryAge(date))
        return;/*from  w  w w .  ja v a 2s .  c om*/
    else if (!date.equals(mCurrentDate)) {
        Log.i(TAG, "DoseView date " + DateTime.toDateString(date) + " differs from Activity date "
                + DateTime.toDateString(mCurrentDate) + " ");

        invalidateViewPager();
        date = mCurrentDate;

        if (BuildConfig.DEBUG)
            Toast.makeText(this, "Invoked workaround!", Toast.LENGTH_SHORT).show();
    }

    final Bundle args = new Bundle();
    args.putInt(DoseDialog.ARG_DRUG_ID, drug.getId());
    args.putInt(DoseDialog.ARG_DOSE_TIME, doseTime);
    args.putSerializable(DoseDialog.ARG_DATE, date);
    args.putBoolean(DoseDialog.ARG_FORCE_SHOW, forceShow);

    showDialog(R.id.dose_dialog, args);
}

From source file:com.adityarathi.muo.ui.activities.NowPlayingActivity.java

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    super.onSaveInstanceState(savedInstanceState);
    savedInstanceState.putBoolean("CALLED_FROM_FOOTER", true);
    savedInstanceState.putBoolean("CALLED_FROM_NOTIF", true);
}