Example usage for android.os Bundle getBooleanArray

List of usage examples for android.os Bundle getBooleanArray

Introduction

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

Prototype

@Nullable
public boolean[] getBooleanArray(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:paulscode.android.mupen64plusae.jni.CoreService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (intent != null) {
        Bundle extras = intent.getExtras();

        mRomGoodName = extras.getString(ActivityHelper.Keys.ROM_GOOD_NAME);
        mRomPath = extras.getString(ActivityHelper.Keys.ROM_PATH);
        mCheatOptions = extras.getString(ActivityHelper.Keys.CHEAT_ARGS);
        mIsRestarting = extras.getBoolean(ActivityHelper.Keys.DO_RESTART, false);
        mSaveToLoad = extras.getString(ActivityHelper.Keys.SAVE_TO_LOAD);
        mCoreLib = extras.getString(ActivityHelper.Keys.CORE_LIB);
        mUseHighPriorityThread = extras.getBoolean(ActivityHelper.Keys.HIGH_PRIORITY_THREAD, false);

        mPakType = extras.getIntegerArrayList(ActivityHelper.Keys.PAK_TYPE_ARRAY);

        boolean[] isPluggedArray = extras.getBooleanArray(ActivityHelper.Keys.IS_PLUGGED_ARRAY);
        mIsPlugged = new ArrayList<>();

        for (Boolean isPlugged : isPluggedArray) {
            mIsPlugged.add(isPlugged);/*from ww  w. ja  v  a 2  s. c  o m*/
        }

        mIsFrameLimiterEnabled = extras.getBoolean(ActivityHelper.Keys.IS_FPS_LIMIT_ENABLED, true);
        mCoreUserDataDir = extras.getString(ActivityHelper.Keys.CORE_USER_DATA_DIR);
        mCoreUserCacheDir = extras.getString(ActivityHelper.Keys.CORE_USER_CACHE_DIR);
        mCoreUserConfigDir = extras.getString(ActivityHelper.Keys.CORE_USER_CONFIG_DIR);
        mUserSaveDir = extras.getString(ActivityHelper.Keys.USER_SAVE_DIR);

        mArtPath = extras.getString(ActivityHelper.Keys.ROM_ART_PATH);

        String libsDir = extras.getString(ActivityHelper.Keys.LIBS_DIR);
        // Load the native libraries, this must be done outside the thread to prevent race conditions
        // that depend on the libraries being loaded after this call is made
        NativeExports.loadLibraries(libsDir, Build.VERSION.SDK_INT);

        mIsServiceRunning = true;

        updateNotification();
    }

    mStartId = startId;

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

From source file:jp.co.noxi.app.NXAlertDialog.java

private void setMultiChoiceItems(AlertDialog.Builder builder) {
    final Bundle args = getArguments();
    final CharSequence[] items = args.getCharSequenceArray(ARG_MULTI_CHOICE_ITEMS);
    final boolean[] checked = args.getBooleanArray(ARG_CHECKED_ITEMS);
    if ((items == null) || (checked == null) || (items.length != checked.length)) {
        return;/*from  w w  w  . j  av a 2  s.c  om*/
    }
    builder.setMultiChoiceItems(items, checked, new DialogInterface.OnMultiChoiceClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which, boolean isChecked) {
            final OnMultiChoiceClickListener listener = findListenerByTag(OnMultiChoiceClickListener.class,
                    ARG_MULTI_CHOICE_LISTENER);
            if (listener != null) {
                listener.onClick(NXAlertDialog.this, which, isChecked);
            }
        }
    });
}

From source file:com.facebook.LegacyTokenCacheTest.java

@Test
public void testAllTypes() {
    Bundle originalBundle = new Bundle();

    putBoolean(BOOLEAN_KEY, originalBundle);
    putBooleanArray(BOOLEAN_ARRAY_KEY, originalBundle);
    putByte(BYTE_KEY, originalBundle);/* ww w. ja  v  a2s  .c om*/
    putByteArray(BYTE_ARRAY_KEY, originalBundle);
    putShort(SHORT_KEY, originalBundle);
    putShortArray(SHORT_ARRAY_KEY, originalBundle);
    putInt(INT_KEY, originalBundle);
    putIntArray(INT_ARRAY_KEY, originalBundle);
    putLong(LONG_KEY, originalBundle);
    putLongArray(LONG_ARRAY_KEY, originalBundle);
    putFloat(FLOAT_KEY, originalBundle);
    putFloatArray(FLOAT_ARRAY_KEY, originalBundle);
    putDouble(DOUBLE_KEY, originalBundle);
    putDoubleArray(DOUBLE_ARRAY_KEY, originalBundle);
    putChar(CHAR_KEY, originalBundle);
    putCharArray(CHAR_ARRAY_KEY, originalBundle);
    putString(STRING_KEY, originalBundle);
    putStringList(STRING_LIST_KEY, originalBundle);
    originalBundle.putSerializable(SERIALIZABLE_KEY, AccessTokenSource.FACEBOOK_APPLICATION_WEB);

    ensureApplicationContext();

    LegacyTokenHelper cache = new LegacyTokenHelper(RuntimeEnvironment.application);
    cache.save(originalBundle);

    LegacyTokenHelper cache2 = new LegacyTokenHelper(RuntimeEnvironment.application);
    Bundle cachedBundle = cache2.load();

    assertEquals(originalBundle.getBoolean(BOOLEAN_KEY), cachedBundle.getBoolean(BOOLEAN_KEY));
    assertArrayEquals(originalBundle.getBooleanArray(BOOLEAN_ARRAY_KEY),
            cachedBundle.getBooleanArray(BOOLEAN_ARRAY_KEY));
    assertEquals(originalBundle.getByte(BYTE_KEY), cachedBundle.getByte(BYTE_KEY));
    assertArrayEquals(originalBundle.getByteArray(BYTE_ARRAY_KEY), cachedBundle.getByteArray(BYTE_ARRAY_KEY));
    assertEquals(originalBundle.getShort(SHORT_KEY), cachedBundle.getShort(SHORT_KEY));
    assertArrayEquals(originalBundle.getShortArray(SHORT_ARRAY_KEY),
            cachedBundle.getShortArray(SHORT_ARRAY_KEY));
    assertEquals(originalBundle.getInt(INT_KEY), cachedBundle.getInt(INT_KEY));
    assertArrayEquals(originalBundle.getIntArray(INT_ARRAY_KEY), cachedBundle.getIntArray(INT_ARRAY_KEY));
    assertEquals(originalBundle.getLong(LONG_KEY), cachedBundle.getLong(LONG_KEY));
    assertArrayEquals(originalBundle.getLongArray(LONG_ARRAY_KEY), cachedBundle.getLongArray(LONG_ARRAY_KEY));
    assertEquals(originalBundle.getFloat(FLOAT_KEY), cachedBundle.getFloat(FLOAT_KEY),
            TestUtils.DOUBLE_EQUALS_DELTA);
    assertArrayEquals(originalBundle.getFloatArray(FLOAT_ARRAY_KEY),
            cachedBundle.getFloatArray(FLOAT_ARRAY_KEY));
    assertEquals(originalBundle.getDouble(DOUBLE_KEY), cachedBundle.getDouble(DOUBLE_KEY),
            TestUtils.DOUBLE_EQUALS_DELTA);
    assertArrayEquals(originalBundle.getDoubleArray(DOUBLE_ARRAY_KEY),
            cachedBundle.getDoubleArray(DOUBLE_ARRAY_KEY));
    assertEquals(originalBundle.getChar(CHAR_KEY), cachedBundle.getChar(CHAR_KEY));
    assertArrayEquals(originalBundle.getCharArray(CHAR_ARRAY_KEY), cachedBundle.getCharArray(CHAR_ARRAY_KEY));
    assertEquals(originalBundle.getString(STRING_KEY), cachedBundle.getString(STRING_KEY));
    assertListEquals(originalBundle.getStringArrayList(STRING_LIST_KEY),
            cachedBundle.getStringArrayList(STRING_LIST_KEY));
    assertEquals(originalBundle.getSerializable(SERIALIZABLE_KEY),
            cachedBundle.getSerializable(SERIALIZABLE_KEY));
}

From source file:com.iClone.AlarmChallenge.ActivityAlarmSettings.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    AppSettings.setTheme(getBaseContext(), ActivityAlarmSettings.this);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.settings);/*from  ww  w.  j  ava  2  s  . c  o  m*/

    setTitle(getString(R.string.settings));

    ActionBar actionBar = getSupportActionBar();

    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    alarmId = getIntent().getExtras().getLong(EXTRAS_ALARM_ID, MISSING_EXTRAS);
    if (alarmId == MISSING_EXTRAS) {
        throw new IllegalStateException("EXTRAS_ALARM_ID not supplied in intent.");
    }

    // Access to in-memory and persistent data structures.
    service = new AlarmClockServiceBinder(getApplicationContext());
    db = new DbAccessor(getApplicationContext());

    // Read the current settings from the database.  Keep a copy of the
    // original values so that we can write new values only if they differ
    // from the originals.
    originalInfo = db.readAlarmInfo(alarmId);
    // Info will not be available for the default settings.
    if (originalInfo != null) {
        info = new AlarmInfo(originalInfo);

        if (savedInstanceState != null) {
            if (savedInstanceState.containsKey(SETTINGS_TIME_HOUR_OF_DAY_KEY)
                    && savedInstanceState.containsKey(SETTINGS_TIME_MINUTE_KEY)
                    && savedInstanceState.containsKey(SETTINGS_TIME_SECOND_KEY)) {
                final AlarmTime time = info.getTime();

                info.setTime(new AlarmTime(savedInstanceState.getInt(SETTINGS_TIME_HOUR_OF_DAY_KEY),
                        savedInstanceState.getInt(SETTINGS_TIME_MINUTE_KEY),
                        savedInstanceState.getInt(SETTINGS_TIME_SECOND_KEY), time.getDaysOfWeek()));
            }

            if (savedInstanceState.containsKey(SETTINGS_NAME_KEY)) {
                info.setName(savedInstanceState.getString(SETTINGS_NAME_KEY));
            }

            if (savedInstanceState.containsKey(SETTINGS_DAYS_OF_WEEK_KEY)) {
                info.setDaysOfWeek(new Week(savedInstanceState.getBooleanArray(SETTINGS_DAYS_OF_WEEK_KEY)));
            }
        }
    }
    originalSettings = db.readAlarmSettings(alarmId);
    settings = new AlarmSettings(originalSettings);

    if (savedInstanceState != null) {
        if (savedInstanceState.containsKey(SETTINGS_SNOOZE_KEY)) {
            settings.setSnoozeMinutes(savedInstanceState.getInt(SETTINGS_SNOOZE_KEY));
        }

        if (savedInstanceState.containsKey(SETTINGS_VIBRATE_KEY)) {
            settings.setVibrate(savedInstanceState.getBoolean(SETTINGS_VIBRATE_KEY));
        }

        if (savedInstanceState.containsKey(SETTINGS_VOLUME_START_PERCENT_KEY)
                && savedInstanceState.containsKey(SETTINGS_VOLUME_END_PERCENT_KEY)
                && savedInstanceState.containsKey(SETTINGS_VOLUME_CHANGE_TIME_SEC_KEY)) {
            settings.setVolumeStartPercent(savedInstanceState.getInt(SETTINGS_VOLUME_START_PERCENT_KEY));

            settings.setVolumeEndPercent(savedInstanceState.getInt(SETTINGS_VOLUME_END_PERCENT_KEY));

            settings.setVolumeChangeTimeSec(savedInstanceState.getInt(SETTINGS_VOLUME_CHANGE_TIME_SEC_KEY));
        }

        if (savedInstanceState.containsKey(SETTINGS_TONE_URI_KEY)
                && savedInstanceState.containsKey(SETTINGS_TONE_NAME_KEY)) {
            settings.setTone((Uri) savedInstanceState.getParcelable(SETTINGS_TONE_URI_KEY),
                    savedInstanceState.getString(SETTINGS_TONE_NAME_KEY));
        }
    }

    // Setup the list of settings.  Each setting is represented by a Setting
    // object.  Create one here for each setting type.
    final ArrayList<Setting> settingsObjects = new ArrayList<>(SettingType.values().length);
    // Only display AlarmInfo if the user is editing an actual alarm (as
    // opposed to the default application settings).
    if (alarmId != AlarmSettings.DEFAULT_SETTINGS_ID) {
        // The alarm time.
        settingsObjects.add(new Setting() {
            @Override
            public String name() {
                return getString(R.string.time);
            }

            @Override
            public String value() {
                return info.getTime().localizedString(getApplicationContext());
            }

            @Override
            public SettingType type() {
                return SettingType.TIME;
            }
        });
        // A human-readable label for the alarm.
        settingsObjects.add(new Setting() {
            @Override
            public String name() {
                return getString(R.string.label);
            }

            @Override
            public String value() {
                return info.getName().equals("") ? getString(R.string.none) : info.getName();
            }

            @Override
            public SettingType type() {
                return SettingType.NAME;
            }
        });
        // Days of the week this alarm should repeat.
        settingsObjects.add(new Setting() {
            @Override
            public String name() {
                return getString(R.string.repeat);
            }

            @Override
            public String value() {
                return info.getTime().getDaysOfWeek().toString(getApplicationContext());
            }

            @Override
            public SettingType type() {
                return SettingType.DAYS_OF_WEEK;
            }
        });
    }
    // The notification tone used for this alarm.
    settingsObjects.add(new Setting() {
        @Override
        public String name() {
            return getString(R.string.tone);
        }

        @Override
        public String value() {
            String value = settings.getToneName();
            //        if (AppSettings.isDebugMode(getApplicationContext())) {
            //          value += " " + settings.getTone().toString();
            //        }
            return value;
        }

        @Override
        public SettingType type() {
            return SettingType.TONE;
        }
    });
    // The snooze duration for this alarm.
    settingsObjects.add(new Setting() {
        @Override
        public String name() {
            return getString(R.string.snooze_minutes);
        }

        @Override
        public String value() {
            return "" + settings.getSnoozeMinutes();
        }

        @Override
        public SettingType type() {
            return SettingType.SNOOZE;
        }
    });
    // The vibrator setting for this alarm.
    settingsObjects.add(new Setting() {
        @Override
        public String name() {
            return getString(R.string.vibrate);
        }

        @Override
        public String value() {
            return settings.getVibrate() ? getString(R.string.enabled) : getString(R.string.disabled);
        }

        @Override
        public SettingType type() {
            return SettingType.VIBRATE;
        }
    });
    // How the volume should be controlled while this alarm is triggering.
    settingsObjects.add(new Setting() {
        @Override
        public String name() {
            return getString(R.string.alarm_fade);
        }

        @Override
        public String value() {
            return getString(R.string.fade_description, settings.getVolumeStartPercent(),
                    settings.getVolumeEndPercent(), settings.getVolumeChangeTimeSec());
        }

        @Override
        public SettingType type() {
            return SettingType.VOLUME_FADE;
        }
    });

    final ListView settingsList = (ListView) findViewById(R.id.settings_list);
    settingsAdapter = new SettingsAdapter(getApplicationContext(), settingsObjects);
    settingsList.setAdapter(settingsAdapter);
    settingsList.setOnItemClickListener(new SettingsListClickListener());
}

From source file:io.github.carlorodriguez.alarmon.ActivityAlarmSettings.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    AppSettings.setTheme(getBaseContext(), ActivityAlarmSettings.this);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.settings);//from   w w w . j a v  a 2 s .  c  o m

    setTitle(getString(R.string.settings));

    ActionBar actionBar = getSupportActionBar();

    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    // An alarm id is required in the extras bundle.
    alarmId = getIntent().getExtras().getLong(EXTRAS_ALARM_ID, MISSING_EXTRAS);
    if (alarmId == MISSING_EXTRAS) {
        throw new IllegalStateException("EXTRAS_ALARM_ID not supplied in intent.");
    }

    // Access to in-memory and persistent data structures.
    service = new AlarmClockServiceBinder(getApplicationContext());
    db = new DbAccessor(getApplicationContext());

    // Read the current settings from the database.  Keep a copy of the
    // original values so that we can write new values only if they differ
    // from the originals.
    originalInfo = db.readAlarmInfo(alarmId);
    // Info will not be available for the default settings.
    if (originalInfo != null) {
        info = new AlarmInfo(originalInfo);

        if (savedInstanceState != null) {
            if (savedInstanceState.containsKey(SETTINGS_TIME_HOUR_OF_DAY_KEY)
                    && savedInstanceState.containsKey(SETTINGS_TIME_MINUTE_KEY)
                    && savedInstanceState.containsKey(SETTINGS_TIME_SECOND_KEY)) {
                final AlarmTime time = info.getTime();

                info.setTime(new AlarmTime(savedInstanceState.getInt(SETTINGS_TIME_HOUR_OF_DAY_KEY),
                        savedInstanceState.getInt(SETTINGS_TIME_MINUTE_KEY),
                        savedInstanceState.getInt(SETTINGS_TIME_SECOND_KEY), time.getDaysOfWeek()));
            }

            if (savedInstanceState.containsKey(SETTINGS_NAME_KEY)) {
                info.setName(savedInstanceState.getString(SETTINGS_NAME_KEY));
            }

            if (savedInstanceState.containsKey(SETTINGS_DAYS_OF_WEEK_KEY)) {
                info.setDaysOfWeek(new Week(savedInstanceState.getBooleanArray(SETTINGS_DAYS_OF_WEEK_KEY)));
            }
        }
    }
    originalSettings = db.readAlarmSettings(alarmId);
    settings = new AlarmSettings(originalSettings);

    if (savedInstanceState != null) {
        if (savedInstanceState.containsKey(SETTINGS_SNOOZE_KEY)) {
            settings.setSnoozeMinutes(savedInstanceState.getInt(SETTINGS_SNOOZE_KEY));
        }

        if (savedInstanceState.containsKey(SETTINGS_VIBRATE_KEY)) {
            settings.setVibrate(savedInstanceState.getBoolean(SETTINGS_VIBRATE_KEY));
        }

        if (savedInstanceState.containsKey(SETTINGS_VOLUME_START_PERCENT_KEY)
                && savedInstanceState.containsKey(SETTINGS_VOLUME_END_PERCENT_KEY)
                && savedInstanceState.containsKey(SETTINGS_VOLUME_CHANGE_TIME_SEC_KEY)) {
            settings.setVolumeStartPercent(savedInstanceState.getInt(SETTINGS_VOLUME_START_PERCENT_KEY));

            settings.setVolumeEndPercent(savedInstanceState.getInt(SETTINGS_VOLUME_END_PERCENT_KEY));

            settings.setVolumeChangeTimeSec(savedInstanceState.getInt(SETTINGS_VOLUME_CHANGE_TIME_SEC_KEY));
        }

        if (savedInstanceState.containsKey(SETTINGS_TONE_URI_KEY)
                && savedInstanceState.containsKey(SETTINGS_TONE_NAME_KEY)) {
            settings.setTone((Uri) savedInstanceState.getParcelable(SETTINGS_TONE_URI_KEY),
                    savedInstanceState.getString(SETTINGS_TONE_NAME_KEY));
        }
    }

    // Setup the list of settings.  Each setting is represented by a Setting
    // object.  Create one here for each setting type.
    final ArrayList<Setting> settingsObjects = new ArrayList<>(SettingType.values().length);
    // Only display AlarmInfo if the user is editing an actual alarm (as
    // opposed to the default application settings).
    if (alarmId != AlarmSettings.DEFAULT_SETTINGS_ID) {
        // The alarm time.
        settingsObjects.add(new Setting() {
            @Override
            public String name() {
                return getString(R.string.time);
            }

            @Override
            public String value() {
                return info.getTime().localizedString(getApplicationContext());
            }

            @Override
            public SettingType type() {
                return SettingType.TIME;
            }
        });
        // A human-readable label for the alarm.
        settingsObjects.add(new Setting() {
            @Override
            public String name() {
                return getString(R.string.label);
            }

            @Override
            public String value() {
                return info.getName().equals("") ? getString(R.string.none) : info.getName();
            }

            @Override
            public SettingType type() {
                return SettingType.NAME;
            }
        });
        // Days of the week this alarm should repeat.
        settingsObjects.add(new Setting() {
            @Override
            public String name() {
                return getString(R.string.repeat);
            }

            @Override
            public String value() {
                return info.getTime().getDaysOfWeek().toString(getApplicationContext());
            }

            @Override
            public SettingType type() {
                return SettingType.DAYS_OF_WEEK;
            }
        });
    }
    // The notification tone used for this alarm.
    settingsObjects.add(new Setting() {
        @Override
        public String name() {
            return getString(R.string.tone);
        }

        @Override
        public String value() {
            String value = settings.getToneName();
            if (AppSettings.isDebugMode(getApplicationContext())) {
                value += " " + settings.getTone().toString();
            }
            return value;
        }

        @Override
        public SettingType type() {
            return SettingType.TONE;
        }
    });
    // The snooze duration for this alarm.
    settingsObjects.add(new Setting() {
        @Override
        public String name() {
            return getString(R.string.snooze_minutes);
        }

        @Override
        public String value() {
            return "" + settings.getSnoozeMinutes();
        }

        @Override
        public SettingType type() {
            return SettingType.SNOOZE;
        }
    });
    // The vibrator setting for this alarm.
    settingsObjects.add(new Setting() {
        @Override
        public String name() {
            return getString(R.string.vibrate);
        }

        @Override
        public String value() {
            return settings.getVibrate() ? getString(R.string.enabled) : getString(R.string.disabled);
        }

        @Override
        public SettingType type() {
            return SettingType.VIBRATE;
        }
    });
    // How the volume should be controlled while this alarm is triggering.
    settingsObjects.add(new Setting() {
        @Override
        public String name() {
            return getString(R.string.alarm_fade);
        }

        @Override
        public String value() {
            return getString(R.string.fade_description, settings.getVolumeStartPercent(),
                    settings.getVolumeEndPercent(), settings.getVolumeChangeTimeSec());
        }

        @Override
        public SettingType type() {
            return SettingType.VOLUME_FADE;
        }
    });

    final ListView settingsList = (ListView) findViewById(R.id.settings_list);
    settingsAdapter = new SettingsAdapter(getApplicationContext(), settingsObjects);
    settingsList.setAdapter(settingsAdapter);
    settingsList.setOnItemClickListener(new SettingsListClickListener());
}

From source file:org.epstudios.epcoding.ProcedureDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.procedure_codes, container, false);
    context = getActivity();/*from  ww  w .jav  a 2s.com*/

    LinearLayout primaryCheckBoxLayout = (LinearLayout) rootView.findViewById(R.id.primary_checkbox_layout);
    LinearLayout secondaryCheckBoxLayout = (LinearLayout) rootView.findViewById(R.id.secondary_checkbox_layout);
    TextView primaryCodeTextView = (TextView) rootView.findViewById(R.id.primary_code_textView);
    TextView secondaryCodeTextView = (TextView) rootView.findViewById(R.id.secondary_code_textView);

    loadSettings();

    switch (mItem) {
    case allProcedures:
        procedure = new AllCodes();
        break;
    case afbAblation:
        procedure = new AfbAblation();
        break;
    case svtAblation:
        procedure = new SvtAblation();
        break;
    case vtAblation:
        procedure = new VtAblation();
        break;
    case avnAblation:
        procedure = new AvnAblation();
        break;
    case epTesting:
        procedure = new EpTesting();
        break;
    case newPpm:
        procedure = new NewPpm();
        break;
    case newIcd:
        procedure = new NewIcd();
        break;
    case ppmReplacement:
        procedure = new PpmReplacement();
        break;
    case icdReplacement:
        procedure = new IcdReplacement();
        break;
    case deviceUpgrade:
        procedure = new DeviceUpgrade();
        break;
    case subQIcd:
        procedure = new SubQIcd();
        break;
    case otherProcedure:
        procedure = new OtherProcedure();
        break;
    default:
        procedure = new AllCodes();
        break;
    }

    getActivity().setTitle(procedure.title(context));

    Code[] secondaryCodes = procedure.secondaryCodes();

    if (secondaryCodes.length > 0) {
        createCheckBoxLayoutAndCodeMap(secondaryCodes, secondaryCheckBoxMap, secondaryCheckBoxLayout);
    } else {
        secondaryCheckBoxLayout.setVisibility(View.GONE);
        secondaryCodeTextView.setVisibility(View.GONE);
    }

    if (mItem == allProcedures) {
        primaryCodeTextView.setText(getString(R.string.all_codes_primary_title));
    }

    Code[] primaryCodes = procedure.primaryCodes();
    String[] disabledCodeNumbers = procedure.disabledCodeNumbers();

    for (int i = 0; i < disabledCodeNumbers.length; ++i)
        secondaryCheckBoxMap.get(disabledCodeNumbers[i]).disable();

    createCheckBoxLayoutAndCodeMap(primaryCodes, primaryCheckBoxMap, primaryCheckBoxLayout);

    if (procedure.disablePrimaryCodes()) {
        // check and disable primary checkboxes for ablation type items
        for (Map.Entry<String, CodeCheckBox> entry : primaryCheckBoxMap.entrySet()) {
            entry.getValue().setEnabled(false);
            entry.getValue().setChecked(true);
        }
    }

    // apply saved configurations here
    if (null != savedInstanceState) {
        // restore state
        boolean[] primaryCodesState = savedInstanceState.getBooleanArray("primary_codes");
        boolean[] secondaryCodesState = savedInstanceState.getBooleanArray("secondary_codes");
        int i = 0;
        for (Map.Entry<String, CodeCheckBox> entry : primaryCheckBoxMap.entrySet())
            entry.getValue().setChecked(primaryCodesState[i++]);
        i = 0;
        for (Map.Entry<String, CodeCheckBox> entry : secondaryCheckBoxMap.entrySet())
            entry.getValue().setChecked(secondaryCodesState[i++]);
    } else
        loadCoding();
    // set up buttons
    Button summarizeButton = (Button) rootView.findViewById(R.id.summary_button);
    summarizeButton.setOnClickListener(this);
    Button clearButton = (Button) rootView.findViewById(R.id.clear_button);
    clearButton.setOnClickListener(this);
    return rootView;
}

From source file:com.androidaq.AndroiDAQAdapter.java

public void setUIStates(Bundle bundle) {

    isOutputCh = bundle.getBooleanArray("isInput");
    isDigCh = bundle.getBooleanArray("isDig");
    outputState = bundle.getBooleanArray("outputState");
    desiredFreq = bundle.getStringArray("desiredFreqs");
    desiredDuty = bundle.getStringArray("desiredDutys");
}

From source file:com.cognizant.trumobi.PersonaLauncher.java

/**
 * Restores the previous state, if it exists.
 * //from  w w w  . ja v  a2 s.c  o  m
 * @param savedState
 *            The previous state.
 */
private void restoreState(Bundle savedState) {
    if (savedState == null) {
        return;
    }

    final int currentScreen = savedState.getInt(RUNTIME_STATE_CURRENT_SCREEN, -1);
    if (currentScreen > -1) {
        mWorkspace.setCurrentScreen(currentScreen);
    }

    final int addScreen = savedState.getInt(RUNTIME_STATE_PENDING_ADD_SCREEN, -1);
    if (addScreen > -1) {
        mAddItemCellInfo = new PersonaCellLayout.CellInfo();
        final PersonaCellLayout.CellInfo addItemCellInfo = mAddItemCellInfo;
        addItemCellInfo.valid = true;
        addItemCellInfo.screen = addScreen;
        addItemCellInfo.cellX = savedState.getInt(RUNTIME_STATE_PENDING_ADD_CELL_X);
        addItemCellInfo.cellY = savedState.getInt(RUNTIME_STATE_PENDING_ADD_CELL_Y);
        addItemCellInfo.spanX = savedState.getInt(RUNTIME_STATE_PENDING_ADD_SPAN_X);
        addItemCellInfo.spanY = savedState.getInt(RUNTIME_STATE_PENDING_ADD_SPAN_Y);
        addItemCellInfo.findVacantCellsFromOccupied(
                savedState.getBooleanArray(RUNTIME_STATE_PENDING_ADD_OCCUPIED_CELLS),
                savedState.getInt(RUNTIME_STATE_PENDING_ADD_COUNT_X),
                savedState.getInt(RUNTIME_STATE_PENDING_ADD_COUNT_Y));
        mRestoring = true;
    }

    boolean renameFolder = savedState.getBoolean(RUNTIME_STATE_PENDING_FOLDER_RENAME, false);
    if (renameFolder) {
        long id = savedState.getLong(RUNTIME_STATE_PENDING_FOLDER_RENAME_ID);
        mFolderInfo = sModel.getFolderById(this, id);
        mRestoring = true;
    }
}