Example usage for android.os Bundle getBoolean

List of usage examples for android.os Bundle getBoolean

Introduction

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

Prototype

public boolean getBoolean(String key) 

Source Link

Document

Returns the value associated with the given key, or false if no mapping of the desired type exists for the given key.

Usage

From source file:de.geeksfactory.opacclient.frontend.OpacActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    supportRequestWindowFeature(android.view.Window.FEATURE_INDETERMINATE_PROGRESS);

    super.onCreate(savedInstanceState);

    setContentView(getContentView());/* ww  w.  ja  va2 s .  c o m*/
    app = (OpacClient) getApplication();

    aData = new AccountDataSource(this);
    setupDrawer();

    if (savedInstanceState != null) {
        setTwoPane(savedInstanceState.getBoolean("twoPane"));
        if (savedInstanceState.containsKey("title")) {
            setTitle(savedInstanceState.getCharSequence("title"));
        }
        if (savedInstanceState.containsKey("fragment")) {
            fragment = (Fragment) getSupportFragmentManager().getFragment(savedInstanceState, "fragment");
            getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, fragment).commit();
        }
    }
}

From source file:ca.mudar.mtlaucasou.BaseMapActivity.java

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

    ((AppHelper) getApplicationContext()).updateUiLanguage();

    /**//w  w w.  j a v a2  s  .c  o m
     * By default, show map and hide list.
     */
    isHiddenList = true;
    if ((savedInstanceState != null) && savedInstanceState.containsKey(Const.KEY_INSTANCE_LIST_IS_HIDDEN)) {
        /**
         * For visible/hidden fragments and actionbar icon
         */
        isHiddenList = savedInstanceState.getBoolean(Const.KEY_INSTANCE_LIST_IS_HIDDEN);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        getActionBar().setHomeButtonEnabled(true);
    }
}

From source file:com.android.contacts.activities.ContactSelectionActivity.java

@Override
protected void onCreate(Bundle savedState) {
    super.onCreate(savedState);

    RequestPermissionsActivity.startPermissionActivityIfNeeded(this);

    if (savedState != null) {
        mActionCode = savedState.getInt(KEY_ACTION_CODE);
        mIsSearchMode = savedState.getBoolean(KEY_SEARCH_MODE);
    }// ww w. j  a  v a2 s  .  c o  m

    // Extract relevant information from the intent
    mRequest = mIntentResolver.resolveIntent(getIntent());
    if (!mRequest.isValid()) {
        setResult(RESULT_CANCELED);
        finish();
        return;
    }

    setContentView(R.layout.contact_picker);

    if (mActionCode != mRequest.getActionCode()) {
        mActionCode = mRequest.getActionCode();
        configureListFragment();
    }

    prepareSearchViewAndActionBar(savedState);
    configureActivityTitle();
}

From source file:com.hybris.mobile.app.commerce.fragment.CatalogMenuFragment.java

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

    // Restore the current category
    if (savedInstanceState != null) {
        if (savedInstanceState.containsKey(SAVED_INSTANCE_CATEGORY)) {
            mCurrentCategoryId = savedInstanceState.getString(SAVED_INSTANCE_CATEGORY);
        }/*from ww  w  .  j  a  va  2  s  .c  o  m*/

        if (savedInstanceState.containsKey(SAVED_INSTANCE_OPEN_BY_DEFAULT)) {
            mOpenByDefault = savedInstanceState.getBoolean(SAVED_INSTANCE_OPEN_BY_DEFAULT);
        }
    }

    mCatalogMenuViewFlipper = (ViewFlipper) getActivity().findViewById(R.id.catalog_menu_fragment);

    // The catalog menu does not add any overlay on the screen
    mCatalogMenuDrawerLayout = ((DrawerLayout) getActivity().findViewById(R.id.catalog_menu_drawer));
    mCatalogMenuDrawerLayout.setScrimColor(Color.TRANSPARENT);

    // Call the API to get the catalog list
    QueryCatalog queryCatalog = new QueryCatalog();
    queryCatalog.setCatalogId(CommerceApplication.getContentServiceHelper().getConfiguration().getCatalogId());
    queryCatalog.setCatalogVersionId(
            CommerceApplication.getContentServiceHelper().getConfiguration().getCatalogVersionId());
    queryCatalog.setCatalogCategoryId(
            CommerceApplication.getContentServiceHelper().getConfiguration().getCatalogIdMainCategory());

    CommerceApplication.getContentServiceHelper().getCatalogCategory(this, mCatalogRequestId, queryCatalog,
            true, null, new OnRequestListener() {

                @Override
                public void beforeRequest() {
                    UIUtils.showLoadingActionBar(getActivity(), true);
                }

                @Override
                public void afterRequestBeforeResponse() {

                }

                @Override
                public void afterRequest(boolean isDataSynced) {
                    UIUtils.showLoadingActionBar(getActivity(), false);
                }
            });

}

From source file:at.wada811.android.dialogfragments.AlertDialogFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState == null) {
        return;//  w  w  w  .j  a va2  s. co  m
    }
    isFromBuilder = savedInstanceState.getBoolean(IS_FROM_BUILDER);
}

From source file:com.firefly.sample.castcompanionlibrary.cast.player.VideoCastControllerFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mCastConsumer = new MyCastConsumer();
    Bundle bundle = getArguments();/*  ww w.  j  a  v a 2 s .  c o  m*/
    if (null == bundle) {
        return;
    }
    Bundle extras = bundle.getBundle(EXTRAS);
    Bundle mediaWrapper = extras.getBundle(VideoCastManager.EXTRA_MEDIA);

    // Retain this fragment across configuration changes.
    setRetainInstance(true);

    if (extras.getBoolean(VideoCastManager.EXTRA_HAS_AUTH)) {
        mOverallState = OverallState.AUTHORIZING;
        mMediaAuthService = mCastManager.getMediaAuthService();
        handleMediaAuthTask(mMediaAuthService);
        showImage(Utils.getImageUrl(mMediaAuthService.getMediaInfo(), 1));
    } else if (null != mediaWrapper) {
        mOverallState = OverallState.PLAYBACK;
        boolean shouldStartPlayback = extras.getBoolean(VideoCastManager.EXTRA_SHOULD_START);
        String customDataStr = extras.getString(VideoCastManager.EXTRA_CUSTOM_DATA);
        JSONObject customData = null;
        if (!TextUtils.isEmpty(customDataStr)) {
            try {
                customData = new JSONObject(customDataStr);
            } catch (JSONException e) {
                LOGE(TAG, "Failed to unmarshalize custom data string: customData=" + customDataStr, e);
            }
        }
        MediaInfo info = Utils.toMediaInfo(mediaWrapper);
        int startPoint = extras.getInt(VideoCastManager.EXTRA_START_POINT, 0);
        onReady(info, shouldStartPlayback, startPoint, customData);
    }
}

From source file:mp.paschalis.EditBookActivity.java

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

    app = (App) getApplication();//from ww w  . j  ava  2  s .  c  o  m

    setContentView(R.layout.activity_edit_book);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    // Get arguments, to determine who opened this activity
    final Bundle extras = getIntent().getExtras();

    try {
        fromBookSearch = extras.getBoolean(App.ExtrasForEditBookActivityFromBookSearch);
    } catch (Exception e) {
        fromBookSearch = false;
    }

    // Set the layout's data
    // Get layout's Data
    bookISBN = (TextView) findViewById(R.id.textViewBookISBN);

    bookTitle = (TextView) findViewById(R.id.textViewBookTitle);
    bookAuthors = (TextView) findViewById(R.id.textViewBookAuthors);
    bookPublishedYear = (TextView) findViewById(R.id.textViewBookPublishedYear);
    bookPageCount = (TextView) findViewById(R.id.textViewBookPageCount);
    bookDateOfInsert = (TextView) findViewById(R.id.textViewBookDateOfInsert);

    bookCoverImage = (ImageView) findViewById(R.id.imageViewBookCover);

    bookLanguage = (TextView) findViewById(R.id.textViewBookLanguage);

    textViewCheckYourBooks = (TextView) findViewById(R.id.textViewCheckYourBooks);

    TextView tvnocover = (TextView) findViewById(R.id.textViewNoCover);
    ProgressBar pb = (ProgressBar) findViewById(R.id.progressBarLoadCover);

    // show The Image and save it to Library
    ImageLoader.DataClassDisplayBookCover bk = new ImageLoader.DataClassDisplayBookCover();

    bk.iv = bookCoverImage;
    bk.isCover = true;
    bk.pb = pb;
    bk.tv = tvnocover;
    bk.book = app.selectedBook;

    App.imageLoader.DisplayCover(bk);

    // Assign the appropriate data from our alert object above
    bookISBN.setText(app.selectedBook.isbn);
    bookTitle.setText(app.selectedBook.title);
    bookAuthors.setText(app.selectedBook.authors);
    bookPublishedYear.setText(Integer.valueOf(app.selectedBook.publishedYear).toString());
    bookPageCount.setText(Integer.valueOf(app.selectedBook.pageCount).toString());
    bookDateOfInsert
            .setText(App.makeTimeStampHumanReadble(getApplicationContext(), app.selectedBook.dateOfInsert));
    bookLanguage.setText(app.selectedBook.lang);

    progressBarChangeStatusOfBook = (ProgressBar) findViewById(R.id.progressBarChangeBookStatus);
    progressBarLentReturnButton = (ProgressBar) findViewById(R.id.progressBarReturnLentBook);
    progressBarLentDeleteButton = (ProgressBar) findViewById(R.id.progressBarBookDeleteButton);

    buttonDeleteBook = (Button) findViewById(R.id.buttonBookDelete);
    buttonLentReturnBook = (Button) findViewById(R.id.buttonLentReturnBook);

    spinnerEditBookStatus = (Spinner) findViewById(R.id.spinnerBookStatus);

    // Create adapter for the Spinner
    adapter = ArrayAdapter.createFromResource(this, R.array.ArrayBookSetStatus,
            android.R.layout.simple_spinner_item);
    // Specify the layout to use when the list of choices appears
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner

    spinnerEditBookStatus.setAdapter(adapter);

    getStatusDefaultValue();

    spinnerEditBookStatus.setOnItemSelectedListener(new OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {

            if (booleanFirstInit) {
                booleanFirstInit = false;
                return;
            }

            // your code here
            new AsyncTaskChangeStatusOfBook().execute(
                    App.getBookStatusCode((String) (adapter.getItem(position)), EditBookActivity.this));
        }

        @Override
        public void onNothingSelected(AdapterView<?> parentView) {
        }

    });

    // Hybrid button: Lent/Return a book
    buttonLentReturnBook.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            {
                // Lent the book
                if (buttonLentReturnBook.getText().toString().equals(getString(R.string.lent))) {
                    // Send ISBN As Argument
                    Intent i = new Intent(getApplicationContext(), LentBookActivity.class);
                    i.putExtra(App.ExtrasForLentBookActivityISBN, bookISBN.getText().toString());
                    EditBookActivity.this.startActivity(i);
                }
                // Return the book
                else {

                    {
                        AlertDialog.Builder alert = new AlertDialog.Builder(EditBookActivity.this);
                        alert.setTitle(R.string.msgIsItReturnedToYou_);

                        alert.setIcon(R.drawable.ic_menu_forward);

                        alert.setNegativeButton(R.string.no,
                                new android.content.DialogInterface.OnClickListener() {

                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                    }
                                });

                        alert.setPositiveButton(R.string.yes,
                                new android.content.DialogInterface.OnClickListener() {

                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        // Return the book
                                        new AsyncTaskReturnABook().execute(app.selectedBook.isbn);
                                    }
                                });

                        alert.show();

                    }

                }
            }

        }
    });// End of Lent/Return Button!

    // Delete Button
    buttonDeleteBook.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(EditBookActivity.this);
                alert.setTitle(R.string.msgAreYouSureDelBOok_);

                alert.setIcon(R.drawable.ic_dialog_alert_holo_light);

                alert.setNegativeButton(R.string.no, new android.content.DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                    }
                });

                alert.setPositiveButton(R.string.yes, new android.content.DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // Return the book

                        new AsyncTaskDeleteABook().execute(app.selectedBook.isbn);
                    }
                });

                alert.show();

            }

        }
    });

}

From source file:li.barter.fragments.AddOrEditBookFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    init(container, savedInstanceState);
    setHasOptionsMenu(true);/*from www. ja v a 2s  .co  m*/
    setActionBarTitle(R.string.editbook_title);
    final View view = inflater.inflate(R.layout.fragment_add_or_edit_book, container, false);
    initViews(view);
    mGoogleBooksApiKey = getString(R.string.google_maps_v2_api_key);
    getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
            | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
    final Bundle extras = getArguments();

    // If extras are null, it means that user has to decided to add the
    // book completely manually
    if (extras != null) {

        mEditMode = extras.getBoolean(Keys.EDIT_MODE);

        if (mEditMode) {
            mId = extras.getString(Keys.ID);
            setActionBarTitle(R.string.editbook_title2);

            //Reached here by editing current user's book
            loadBookDetails(QueryTokens.LOAD_BOOK_DETAIL_FOR_EDIT, mId);

        } else {
            mIsbnNumber = extras.getString(Keys.ISBN);
            Logger.d(TAG, "Book Isbn:" + mIsbnNumber);

            if (savedInstanceState != null) {
                mHasFetchedDetails = savedInstanceState.getBoolean(Keys.HAS_FETCHED_INFO);
            } else {
                loadDetailsForIntent(extras);
            }
            if (!mHasFetchedDetails && !TextUtils.isEmpty(mIsbnNumber)) {
                getBookInfoFromServer(mIsbnNumber);
            }
        }

    }

    return view;
}

From source file:com.mirasense.scanditsdk.plugin.ScanditSDKActivity.java

@SuppressWarnings("deprecation")
public void initializeAndStartBarcodeRecognition(Bundle extras) {
    // Switch to full screen.
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    ScanSettings settings = ScanditSDKParameterParser.settingsForBundle(extras);

    mBarcodePicker = new SearchBarBarcodePicker(this, settings);

    this.setContentView(mBarcodePicker);

    Display display = getWindowManager().getDefaultDisplay();
    ScanditSDKParameterParser.updatePickerUIFromBundle(mBarcodePicker, extras, display.getWidth(),
            display.getHeight());/*from   w ww .j ava2 s.  c om*/

    if (extras.containsKey(ScanditSDKParameterParser.paramContinuousMode)) {
        mContinuousMode = extras.getBoolean(ScanditSDKParameterParser.paramContinuousMode);
    }

    // Register listener, in order to be notified about relevant events
    // (e.g. a successfully scanned bar code).
    mBarcodePicker.setOnScanListener(this);
    mBarcodePicker.setOnSearchBarListener(this);

    if (extras.containsKey(ScanditSDKParameterParser.paramPaused)
            && extras.getBoolean(ScanditSDKParameterParser.paramPaused)) {
        mStartPaused = true;
    } else {
        mStartPaused = false;
    }
}

From source file:io.teak.sdk.Teak.java

@Override
public void onReceive(Context inContext, Intent intent) {
    final Context context = inContext.getApplicationContext();

    if (!Teak.isEnabled()) {
        Log.e(LOG_TAG, "Teak is disabled, ignoring onReceive().");
        return;//from w  w  w.j ava  2 s .  c o m
    }

    String action = intent.getAction();

    if (GCM_RECEIVE_INTENT_ACTION.equals(action)) {
        final TeakNotification notif = TeakNotification.remoteNotificationFromIntent(context, intent);
        if (notif == null) {
            return;
        }

        // Send Notification Received Metric
        Session.whenUserIdIsReadyRun(new Session.SessionRunnable() {
            @Override
            public void run(Session session) {
                HashMap<String, Object> payload = new HashMap<>();
                payload.put("app_id", session.appConfiguration.appId);
                payload.put("user_id", session.userId());
                payload.put("platform_id", notif.teakNotifId);

                new Request("/notification_received", payload, session).run();
            }
        });
    } else if (action.endsWith(TeakNotification.TEAK_NOTIFICATION_OPENED_INTENT_ACTION_SUFFIX)) {
        Bundle bundle = intent.getExtras();

        // Cancel any updates pending
        TeakNotification.cancel(context, bundle.getInt("platformId"));

        // Launch the app
        if (!bundle.getBoolean("noAutolaunch")) {
            if (Teak.isDebug) {
                Log.d(LOG_TAG,
                        "Notification (" + bundle.getString("teakNotifId") + ") opened, auto-launching app.");
            }
            Intent launchIntent = context.getPackageManager()
                    .getLaunchIntentForPackage(context.getPackageName());
            launchIntent.addCategory("android.intent.category.LAUNCHER");
            launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            launchIntent.putExtras(bundle);
            if (bundle.getString("deepLink") != null) {
                launchIntent.setData(Uri.parse(bundle.getString("deepLink")));
            }
            context.startActivity(launchIntent);
        } else {
            if (Teak.isDebug) {
                Log.d(LOG_TAG, "Notification (" + bundle.getString("teakNotifId")
                        + ") opened, NOT auto-launching app (noAutoLaunch flag present, and set to true).");
            }
        }

        // Send broadcast
        if (Teak.localBroadcastManager != null) {
            Intent broadcastEvent = new Intent(TeakNotification.LAUNCHED_FROM_NOTIFICATION_INTENT);
            broadcastEvent.putExtras(bundle);
            Teak.localBroadcastManager.sendBroadcast(broadcastEvent);
        }
    } else if (action.endsWith(TeakNotification.TEAK_NOTIFICATION_CLEARED_INTENT_ACTION_SUFFIX)) {
        Bundle bundle = intent.getExtras();
        TeakNotification.cancel(context, bundle.getInt("platformId"));
    }

}