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.lepin.activity.CarpoolWithCalendarActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ViewInjectUtil.inject(CarpoolWithCalendarActivity.this);
    Bundle bundle = getIntent().getExtras();
    carpoolProgramPassengerId = bundle.getString(Constant.CARPOOLPROGRAMPASSENGERID);
    isDriver = bundle.getBoolean(Constant.IS_DRIVER);
    setTitleText();//from w ww.  j  a  v  a2  s  . c  o m
    initView();

}

From source file:android.support.car.app.menu.CarDrawerActivity.java

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    mDrawerShowing = savedInstanceState.getBoolean(KEY_DRAWERSHOWING);
    mUiController.onRestoreInstanceState(savedInstanceState);
}

From source file:fi.mikuz.boarder.gui.internet.DownloadBoardComments.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.internet_download_comments_list);
    this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
    registerForContextMenu(getListView());

    Bundle extras = getIntent().getExtras();
    XStream xstream = new XStream();
    mBoard = (InternetFullBoard) xstream.fromXML(extras.getString(DownloadBoard.BOARD_KEY));
    mLoggedIn = extras.getBoolean(DownloadBoardList.LOGGED_IN_KEY);

    if (mLoggedIn) {
        mUserId = extras.getString(InternetMenu.USER_ID_KEY);
        mSessionToken = extras.getString(InternetMenu.SESSION_TOKEN_KEY);
    }//from www .java2 s.c  om

    this.setTitle(mBoard.getUploaderUsername() + " - " + mBoard.getBoardName());

    mListView = (ListView) findViewById(android.R.id.list);
    mList = new ArrayList<Comment>();
    mMaxResults = 40;
    refreshList();

    Button sendComment = (Button) findViewById(R.id.sendComment);
    final EditText commentInput = (EditText) findViewById(R.id.commentInput);

    if (mLoggedIn) {
        sendComment.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                if (commentInput.getText().toString().length() > 0) {
                    mWaitDialog = new TimeoutProgressDialog(DownloadBoardComments.this, "Waiting for response",
                            TAG, false);
                    HashMap<String, String> sendList = new HashMap<String, String>();
                    sendList.put(InternetMenu.BOARD_ID_KEY, Integer.toString(mBoard.getBoardId()));
                    sendList.put(InternetMenu.SESSION_TOKEN_KEY, mSessionToken);
                    sendList.put(InternetMenu.USER_ID_KEY, mUserId);
                    sendList.put(InternetMenu.COMMENT_KEY, commentInput.getText().toString());
                    commentInput.setText("");
                    new ConnectionManager(DownloadBoardComments.this, InternetMenu.mCommentURL, sendList);
                } else {
                    Toast.makeText(DownloadBoardComments.this, "Type your comment...", Toast.LENGTH_LONG)
                            .show();
                }
            }
        });
    } else {
        commentInput.setHint("Login to comment");
        commentInput.setFocusable(false);
    }

    getListView().setOnScrollListener(this);
}

From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_trainer.SignTrainerActiveFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    Log.d(TAG, "onActivityCreated " + hashCode());
    super.onActivityCreated(savedInstanceState);
    if (null != savedInstanceState) {
        final Sign parcelledSign = savedInstanceState.getParcelable(KEY_CURRENT_SIGN);
        if (null != parcelledSign)
            this.currentSign = parcelledSign;
        final Boolean answerVisible = savedInstanceState.getBoolean(KEY_ANSWER_VISIBLE);
        Validate.notNull(answerVisible, "AnswerVisible should always be non-null in savedInstance bundle.");
        if (answerVisible && (null != this.currentSign)) {
            setVisibility(this.questionViews, View.GONE);
            setVisibility(this.answerViews, View.VISIBLE);
            try {
                setupVideoView(this.currentSign, SOUND.ON, CONTROLS.SHOW);
            } catch (VideoSetupException ex) {
                handleVideoCouldNotBeLoaded(ex);
            }/*from w  w  w  . j av a2s  . co m*/
            setAnswerTextViews();
        } else {
            setVisibility(this.questionViews, View.VISIBLE);
            if (null != this.currentSign)
                this.signQuestionTextDetail.setText(this.currentSign.getNameLocaleDe());
            setVisibility(this.answerViews, View.GONE);
        }
    } else {
        this.loadRandomSignTask = new LoadRandomSignTask(getActivity());
        this.loadRandomSignTask.execute(this.currentSign);
    }
}

From source file:ca.ualberta.cmput301w14t08.geochan.fragments.PostFragment.java

/**
 * Initializes several of the member variables used
 * by PostFragment./*from   ww w. ja v a  2s.  com*/
 * @param savedInstanceState The previously saved state of the fragment.
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    locationListenerService = new LocationListenerService(getActivity());
    locationListenerService.startListening();
    Bundle args = getArguments();
    if (args.getLong("id") != -1) {
        commentToReplyTo = (Comment) args.getParcelable("cmt");
        boolean fromFavs = args.getBoolean("fromFavs");
        if (fromFavs) {
            FavouritesLog log = FavouritesLog.getInstance(getActivity());
            thread = log.getThreads().get((int) args.getLong("id"));
        } else {
            thread = ThreadList.getThreads().get((int) args.getLong("id"));
        }
    }
}

From source file:cn.reflect.dialogs.core.BaseDialogFragment.java

@NonNull
@Override// w w  w . j  av a 2s . c  o m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    int theme = R.style.SDL_Dialog;
    Dialog dialog = new Dialog(getActivity(), theme);

    Bundle args = getArguments();
    if (args != null) {
        dialog.setCanceledOnTouchOutside(args.getBoolean(BaseDialogBuilder.ARG_CANCELABLE_ON_TOUCH_OUTSIDE));
    }
    dialog.setOnShowListener(this);
    return dialog;
}

From source file:com.nextgis.maplibui.formcontrol.Checkbox.java

@Override
public void init(JSONObject element, List<Field> fields, Bundle savedState, Cursor featureCursor,
        SharedPreferences preferences) throws JSONException {

    JSONObject attributes = element.getJSONObject(JSON_ATTRIBUTES_KEY);
    mFieldName = attributes.getString(JSON_FIELD_NAME_KEY);
    mIsShowLast = ControlHelper.isSaveLastValue(attributes);

    Boolean value = null;//  w ww.j a v  a 2 s  .  c o  m
    if (ControlHelper.hasKey(savedState, mFieldName))
        value = savedState.getBoolean(ControlHelper.getSavedStateKey(mFieldName));
    else if (null != featureCursor) {
        int column = featureCursor.getColumnIndex(mFieldName);

        if (column >= 0)
            value = featureCursor.getInt(column) != 0;
    } else {
        value = attributes.getBoolean(JSON_INIT_VALUE_KEY);

        if (mIsShowLast)
            value = preferences.getBoolean(mFieldName, value);
    }

    if (value == null)
        value = false;

    setChecked(value);
    setText(attributes.getString(JSON_TEXT_KEY));
    setEnabled(ControlHelper.isEnabled(fields, mFieldName));
}

From source file:ca.ualberta.cmput301w14t08.geochan.fragments.EditFragment.java

/**
 * Overriden method from Fragment. Determines the Comment being edited based on the id
 * contained in fragment arguments as well as the ThreadComment containing said Comment.
 * After the Comment is found the appropriate UI elements and state variables are set.
 *///from w  w w  .  j  a v  a  2  s .  c om
@Override
public void onStart() {
    super.onStart();
    Bundle bundle = getArguments();
    String commentId = bundle.getString("commentId");
    int threadIndex = bundle.getInt("threadIndex");
    boolean fromFavs = bundle.getBoolean("fromFavs");
    if (fromFavs == true) {
        FavouritesLog log = FavouritesLog.getInstance(getActivity());
        thread = log.getThreads().get(threadIndex);
    } else {
        thread = ThreadList.getThreads().get(threadIndex);
    }
    if (thread.getBodyComment().getId().equals(commentId)) {
        editComment = thread.getBodyComment();
        isThread = true;
    } else {
        getCommentFromId(commentId, thread.getBodyComment().getChildren());
        isThread = false;
    }
    if (EditFragment.oldText == null) {
        EditFragment.oldText = editComment.getTextPost();
        TextView oldTextView = (TextView) getActivity().findViewById(R.id.old_comment_text);
        oldTextView.setText(EditFragment.oldText);
    }
    if (EditFragment.oldThumbnail == null && editComment.getImageThumb() != null) {
        EditFragment.oldThumbnail = editComment.getImageThumb();
    }
    newTextPost = (EditText) getActivity().findViewById(R.id.editBody);
    newTextPost.setText(editComment.getTextPost());
    newTextPost.setMovementMethod(new ScrollingMovementMethod());
}

From source file:com.photon.phresco.nativeapp.eshop.activity.PhrescoActivity.java

/**
 * Process the error message dialog as per the data recevied
 *
 * @param msg/*from   www  .j a  v a2  s  . c  om*/
 */
private void processError(Message msg) {
    try {
        Bundle data = msg.getData();
        if (data != null) {
            if (data.getBoolean(cancelFlag)) {
                showErrorDialog(data.getString(errMessage), data.getBoolean(cancelFlag));
            } else {
                showErrorDialog(data.getString(errMessage));
            }
        }

    } catch (Exception ex) {
        PhrescoLogger.info(TAG + " - splashHandler  - Exception : " + ex.toString());
        PhrescoLogger.warning(ex);
    }
}

From source file:ca.farrelltonsolar.classic.ChargeControllers.java

public void update(Bundle info, String deviceIpAddress, int port, boolean useUnitIdAsKey) {
    int unitId = info.getInt("UnitID");
    String unitName = info.getString("UnitName");
    DeviceType deviceType = (DeviceType) info.getSerializable("DeviceType");
    boolean hasWhizbang = info.getBoolean("FoundWhizbang");
    boolean updated = false;
    synchronized (devices) {
        for (ChargeController cc : devices) {
            if (useUnitIdAsKey ? cc.unitID() == unitId
                    : (deviceIpAddress.compareTo(cc.deviceIpAddress()) == 0 && port == cc.port())) {
                if (cc.setUnitID(unitId)) {
                    updated = true;/*w  w w  .j  a v  a  2  s  .  com*/
                }
                if (cc.setDeviceName(unitName)) {
                    updated = true;
                }
                if (cc.setDeviceIP(deviceIpAddress)) {
                    updated = true;
                }
                if (cc.setPort(port)) {
                    updated = true;
                }
                if (cc.setDeviceType(deviceType)) {
                    updated = true;
                }
                if (cc.setHasWhizbang(hasWhizbang)) {
                    updated = true;
                }
                if (cc.setIsReachable(true)) {
                    updated = true;
                }
                break;
            }
        }
    }
    if (updated) {
        BroadcastUpdateNotification();
    } else if (useUnitIdAsKey) { // retry matching on IP address if no cc matched UnitID
        update(info, deviceIpAddress, port, false);
    }
}