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:com.andryr.musicplayer.fragments.SongListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_song_list, container, false);

    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.list_view);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

    mAdapter = new SongListAdapter(getActivity());
    mAdapter.setOnItemClickListener(mOnItemClickListener);
    View headerView = RecyclerViewUtils.inflateChild(inflater, R.layout.shuffle_list_item, mRecyclerView);
    ThemeHelper.tintCompoundDrawables(getContext(), (TextView) headerView.findViewById(R.id.text_view));

    mAdapter.setHeaderView(headerView);//  w w  w .ja va  2  s  .c  o m
    mAdapter.setOnHeaderClickListener(mOnHeaderClickListener);
    mRecyclerView.setAdapter(mAdapter);

    if (savedInstanceState != null) {
        mShowToolbar = savedInstanceState.getBoolean(STATE_SHOW_TOOLBAR) || mShowToolbar;
        mShowFastScroller = savedInstanceState.getBoolean(STATE_SHOW_FASTSCROLLER) || mShowFastScroller;
    }

    mFastScroller = (FastScroller) rootView.findViewById(R.id.fastscroller);
    mFastScroller.setShowBubble(mShowScrollerBubble);

    if (mShowFastScroller) {
        mFastScroller.setRecyclerView(mRecyclerView);
        mFastScroller.setSectionIndexer(mAdapter);
    } else {
        mFastScroller.setVisibility(View.GONE);
    }

    if (mShowToolbar) {
        Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
        toolbar.setVisibility(View.VISIBLE);
        AppCompatActivity activity = (AppCompatActivity) getActivity();
        activity.setSupportActionBar(toolbar);
        activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
    return rootView;
}

From source file:cl.ipp.katbag.fragment.Player.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.fragment_player, container, false);
    mainActivity = (MainActivity) super.getActivity();

    // rescues parameters
    Bundle bundle = getArguments();
    if (bundle != null) {
        id_app = bundle.getLong("id_app");
        editMode = bundle.getBoolean("editMode");
        name_app_text = bundle.getString("name_app");
    }//w ww .  j  ava  2  s.c  o  m

    scorePanel = (LinearLayout) v.findViewById(R.id.player_score_panel);
    score = (TextView) v.findViewById(R.id.player_score);

    start = (Button) v.findViewById(R.id.player_button_start);
    start.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            scorePanel.setVisibility(View.VISIBLE);
            start.setVisibility(View.GONE);

            drawingUsesAccelerometer.clear();
            drawingUsesBounceThread.clear();

            conditionId.clear();
            conditionState.clear();
            conditionLevel.clear();

            iterationsId.clear();
            iterationsN.clear();
            iterationsBgn.clear();
            iterationsLst.clear();

            touchEventId.clear();
            touchEventDrawing.clear();
            touchEventBgn.clear();
            touchEventLst.clear();

            scoreEqualId.clear();
            scoreEqualToN.clear();
            scoreEqualToBgn.clear();
            scoreEqualToLst.clear();

            shakeId.clear();
            shakeBgn.clear();
            shakeLst.clear();

            develop = mainActivity.katbagHandler.selectDevelopForIdApp(id_app);

            for (int i = 0; i < develop.size(); i++) {
                String[] line = develop.get(i).split("&&");

                if (line[1].contentEquals("sensing")) {
                    switch (Integer.parseInt(line[3])) {
                    case 0:
                        conditionId.add(Integer.valueOf(line[0]));
                        conditionState.add(0);
                        conditionLevel.add(Integer.valueOf(line[8]));
                        break;

                    case 1: // shake
                        conditionId.add(Integer.valueOf(line[0]));
                        conditionState.add(0);
                        conditionLevel.add(Integer.valueOf(line[8]));
                        break;
                    }
                }
            }

            setScore(intScore);
            play(0, develop.size());

        }
    });

    playerView = (RelativeLayout) v.findViewById(R.id.player_view);
    playerView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            if (!mMeasured) {
                loc = new int[2];
                playerView.getLocationInWindow(loc);
                mMeasured = true;
                start.setVisibility(View.VISIBLE);
            }
        }
    });

    return v;
}

From source file:cn.finalteam.galleryfinal.PhotoEditActivity.java

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    mSelectPhotoList = (ArrayList<PhotoInfo>) savedInstanceState.getSerializable("selectPhotoMap");
    mEditPhotoCacheFile = (File) savedInstanceState.getSerializable("editPhotoCacheFile");
    mPhotoTempMap = new LinkedHashMap<>(
            (HashMap<Integer, PhotoTempModel>) savedInstanceState.getSerializable("photoTempMap"));

    mSelectIndex = savedInstanceState.getInt("selectIndex");
    mCropState = savedInstanceState.getBoolean("cropState");
    mRotating = savedInstanceState.getBoolean("rotating");

    mTakePhotoAction = savedInstanceState.getBoolean("takePhotoAction");
    mCropPhotoAction = savedInstanceState.getBoolean("cropPhotoAction");
    mEditPhotoAction = savedInstanceState.getBoolean("editPhotoAction");
}

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

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);

    mIgnoreItemSelection = true;/* w ww.j  a v  a2 s. c  o  m*/
    mLookup.setSelection(savedInstanceState.getInt(PREFS_LOOKUP));
    mURL.setText(savedInstanceState.getString(PREFS_URL));
    mRegExp.setText(savedInstanceState.getString(PREFS_REGEXP));
    mTestInput.setText(savedInstanceState.getString(STATE_TESTINPUT));
    mNotify.setChecked(savedInstanceState.getBoolean(PREFS_NOTIFY));
}

From source file:com.transistorsoft.cordova.bggeo.CDVBackgroundGeolocation.java

private void onChangePace(Bundle event) {
    Boolean success = event.getBoolean("success");
    if (success) {
        int state = event.getBoolean("isMoving") ? 1 : 0;
        paceChangeCallback.success(state);
    } else {//from  w w  w . j  ava2  s .  co m
        paceChangeCallback.error(event.getInt("code"));
    }
}

From source file:com.krayzk9s.imgurholo.ui.SingleImageFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle bundle = getArguments();
    if (bundle.containsKey("gallery"))
        inGallery = bundle.getBoolean("gallery");
    imageData = bundle.getParcelable("imageData");
    setHasOptionsMenu(true);//from w w w .  ja  v a  2 s. c  om
}

From source file:com.transistorsoft.cordova.bggeo.CDVBackgroundGeolocation.java

private void onAddGeofence(Bundle event) {
    boolean success = event.getBoolean("success");
    String identifier = event.getString("identifier");

    if (addGeofenceCallbacks.containsKey(identifier)) {
        CallbackContext callbackContext = addGeofenceCallbacks.get(identifier);
        if (success) {
            callbackContext.success();/*w w  w . j  a  va2 s . c om*/
        } else {
            callbackContext.error(event.getString("error"));
        }
        addGeofenceCallbacks.remove(identifier);
    }
}

From source file:de.elanev.studip.android.app.backend.net.oauth.SignInFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    Log.i(TAG, "onActivityCreated Called!");
    super.onActivityCreated(savedInstanceState);
    ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false);
    ((AppCompatActivity) getActivity()).getSupportActionBar().setHomeButtonEnabled(false);
    getActivity().setTitle(R.string.app_name);
    hideLoginForm();/*from w w  w  .  j a  v  a  2s .co  m*/
    if (savedInstanceState != null) {
        mRequestTokenReceived = savedInstanceState.getBoolean(REQUEST_TOKEN_RECEIVED);
    }

    Prefs prefs = Prefs.getInstance(getActivity());
    // Check if unsecured server credentials exist
    if (prefs.legacyDataExists()) {
        destroyInsecureCredentials();

    } else if (prefs.isAppAuthorized()) {
        Log.i(TAG, "Valid secured credentials found");
        if (prefs.isAppSynced()) {
            Log.i(TAG, "App synced starting..");
            startMainActivity();
            return;
        } else {
            performPrefetchSync();
            return;
        }

    } else if (mRequestTokenReceived) {
        OAuthConnector.with(prefs.getServer()).getAccessToken(this);
        return;
    }

    setListAdapter(mAdapter);
    mAdapter.notifyDataSetChanged();
    mListView.setSelector(R.drawable.list_item_selector);
    mListView.setTextFilterEnabled(true);

    showLoginForm();
}

From source file:com.transistorsoft.cordova.bggeo.CDVBackgroundGeolocation.java

private void onStarted(Bundle event) {
    isStarting = false;//from ww  w . j  ava2s.c o  m
    if (event.getBoolean("response") && !event.getBoolean("success")) {
        Toast.makeText(cordova.getActivity(), event.getString("message"), Toast.LENGTH_LONG).show();
        if (startCallback != null) {
            startCallback.error(event.getString("message"));
        }
    } else if (startCallback != null) {
        startCallback.success();
    }
    startCallback = null;
}

From source file:ca.ualberta.app.activity.CreateAnswerActivity.java

/**
 * This method will be called when the current answer is submitted, then map
 * the thread to the corresponding question and save all details into the
 * question.//from   w  w w . j av a  2 s  . c  o m
 * 
 * @param view
 *            View passed to the activity to check which button was pressed.
 */
public void submit_answer(View view) {
    String content = contentText.getText().toString();
    if (content.trim().length() == 0)
        noContentEntered();
    else {
        if (intent != null) {
            Bundle extras = intent.getExtras();
            if (extras != null) {
                long questionId = extras.getLong(QUESTION_ID);
                String questionTitle = extras.getString(QUESTION_TITLE);
                newAnswer = new Answer(content, User.author.getUserId(), imageString);
                if (addLocation == true) {
                    newAnswer.setLocationName(locationName);
                    newAnswer.setLocationCoordinates(locationCoordinates);
                }
                newAnswer.setQuestionID(questionId);
                newAnswer.setQuestionTitle(questionTitle);

                if (extras.getBoolean(EDIT_MODE)) {
                    long answerID = extras.getLong(ANSWER_ID);
                    newAnswer.setID(answerID);
                }
                if (InternetConnectionChecker.isNetworkAvailable()) {
                    Thread thread = new GetUpdateThread(questionId, newAnswer);
                    thread.start();
                } else {
                    if (extras.getBoolean(EDIT_MODE)) {
                        pushController.updateWaitingListAnswer(getApplicationContext(), newAnswer);
                    } else {
                        Toast.makeText(this,
                                "Answer added to Waiting List, it will be post when Internet is connected.",
                                Toast.LENGTH_LONG).show();
                        pushController.addWaitngListAnswers(getApplicationContext(), newAnswer, questionTitle);
                    }
                    finish();
                }
            }
        }

    }
}