Example usage for android.content Intent getBooleanExtra

List of usage examples for android.content Intent getBooleanExtra

Introduction

In this page you can find the example usage for android.content Intent getBooleanExtra.

Prototype

public boolean getBooleanExtra(String name, boolean defaultValue) 

Source Link

Document

Retrieve extended data from the intent.

Usage

From source file:com.itime.team.itime.fragments.CalendarTypeFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_EDIT_CALENDAR_TYPE) {
        if (resultCode == CalendarTypeSubFragment.RESULT_ADD_CALENDAR_TYPE) {
            if (data != null && data.getBooleanExtra(CalendarTypeSubFragment.RETURN_IF_UPDATED, false)) {
                // reload data from server
                loadCalendarType();/*  w  w  w.  ja  va  2  s  . c om*/
            }
        }
    }
}

From source file:ch.carteggio.provider.sync.NotificationService.java

protected void onHandleIntent(Intent intent) {

    if (intent != null) {

        if (UPDATE_RECEIVING_STATE_ACTION.equals(intent.getAction())) {

            mReceiveFailure = intent.getBooleanExtra(FAILURE_EXTRA, true);

            mReceiveMessage = intent.getStringExtra(FAILURE_MESSAGE_EXTRA);

            if (!mReceiveFailure) {
                mLastReceiveSuccessTime = SystemClock.elapsedRealtime();
            }/*from  www.  ja  v a 2s  .c o m*/

        } else if (UPDATE_SENDING_STATE_ACTION.equals(intent.getAction())) {

            mSendFailure = intent.getBooleanExtra(FAILURE_EXTRA, true);

            mSendMessage = intent.getStringExtra(FAILURE_MESSAGE_EXTRA);

            if (!mSendFailure) {
                mLastSendSuccessTime = SystemClock.elapsedRealtime();
            }

        } else if (UPDATE_UNREAD_STATE_ACTION.equals(intent.getAction())) {

            boolean newMessage = intent.getBooleanExtra(NEW_MESSAGE_EXTRA, false);

            updateUnreadNotification(newMessage);

        }

    }

    // update the notifications
    if ((mSendFailure && SystemClock.elapsedRealtime() - mLastSendSuccessTime > DISCONNECTION_TIME_THRESHOLD)
            || (mReceiveFailure && SystemClock.elapsedRealtime()
                    - mLastReceiveSuccessTime > DISCONNECTION_TIME_THRESHOLD)) {
        showFailureNotification();
    } else {
        hideFailureNotification();
    }

    // inform UI of the changes
    broadcastNetworkStateChange();

}

From source file:com.keithcassidy.finishline.FinishLineService.java

private void handleStartCommand(Intent intent, int startId) {

    // Check if the service is called to resume track (from phone reboot)
    if (intent == null || intent.getBooleanExtra(Constants.RESUME_RACE_EXTRA_NAME, false)) {
        if (!shouldResumeRace()) {
            Log.v(TAG, "Stop resume track.");
            updateRacingState(false);/*from  w  ww  . j a v  a 2 s  .  c  o m*/
            stopSelfResult(startId);
            return;
        } else {
            restartRace();
        }
    } else if (intent.getBooleanExtra(Constants.START_RACE_EXTRA_NAME, false)) {
        startNewRace();
    } else if (intent.getBooleanExtra(Constants.STOP_RACE_EXTRA_NAME, false)) {
        stopRace();
    }
}

From source file:com.arantius.tivocommander.ShowList.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != Activity.RESULT_OK) {
        return;/*w  ww  .java 2 s.c  o m*/
    }

    if (EXPECT_REFRESH_INTENT_ID == requestCode) {
        if (data.getBooleanExtra("refresh", false)) {
            setRefreshResult();
            if (mShowData.size() == 1) {
                // We deleted the last show! Go up a level.
                finishWithRefresh();
            } else {
                // Load the list of remaining shows.
                startRequest();
                setRefreshResult();
            }
        }
    }
}

From source file:com.cellbots.local.EyesView.java

public EyesView(CellDroidActivity ct, String url, boolean torch) {
    Log.e("remote eyes", "started " + url);
    mParent = ct;//from  ww w . ja va2s.  co  m
    putUrl = url;

    PowerManager pm = (PowerManager) ct.getSystemService(Context.POWER_SERVICE);
    mWakeLock = pm.newWakeLock(
            PowerManager.FULL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE | PowerManager.ACQUIRE_CAUSES_WAKEUP,
            "Cellbot Eyes");
    mWakeLock.acquire();

    out = new ByteArrayOutputStream();

    if (putUrl != null) {
        isLocalUrl = putUrl.contains("127.0.0.1") || putUrl.contains("localhost");
        server = putUrl.replace("http://", "");
        server = server.substring(0, server.indexOf("/"));
        mTorchMode = torch;
        resetConnection();
        mHttpState = new HttpState();
    }

    ct.setContentView(R.layout.eyes_main);
    mPreview = (SurfaceView) ct.findViewById(R.id.eyes_preview);
    mHolder = mPreview.getHolder();
    mHolder.addCallback(this);
    mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

    mPreview.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            setTorchMode(!mTorchMode);
        }
    });

    mReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            boolean useTorch = intent.getBooleanExtra("TORCH", false);
            boolean shouldTakePicture = intent.getBooleanExtra("PICTURE", false);
            setTorchMode(useTorch);
            setTakePicture(shouldTakePicture);
        }
    };

    ct.registerReceiver(mReceiver, new IntentFilter(EyesView.EYES_COMMAND));

    mFrame = (FrameLayout) ct.findViewById(R.id.eyes_frame);
    mImageView = new ImageView(ct);
    mImageView.setScaleType(ScaleType.FIT_CENTER);
    mImageView.setBackgroundColor(Color.BLACK);

    setPersona(PERSONA_READY);

    mFrame.addView(mImageView);
}

From source file:org.klnusbaum.udj.auth.AuthActivity.java

/**
 * {@inheritDoc}/*from w ww  . j av  a  2s . com*/
 */
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mAccountManager = AccountManager.get(this);
    final Intent intent = getIntent();
    mUsername = intent.getStringExtra(PARAM_USERNAME);
    mRequestNewAccount = mUsername == null;
    mConfirmCredentials = intent.getBooleanExtra(PARAM_CONFIRM_CREDENTIALS, false);
    Log.i(TAG, "    request new: " + mRequestNewAccount);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.login_activity);
    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_alert);
    mMessage = (TextView) findViewById(R.id.message);
    mUsernameEdit = (EditText) findViewById(R.id.username_edit);
    mPasswordEdit = (EditText) findViewById(R.id.password_edit);
    if (!TextUtils.isEmpty(mUsername))
        mUsernameEdit.setText(mUsername);
    mMessage.setText(getMessage());

    TextView signUp = (TextView) findViewById(R.id.signup_text);
    signUp.setText(Html.fromHtml(getString(R.string.dont_have_account)));
    signUp.setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:com.conferenceengineer.android.iosched.ui.SessionFeedbackFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Intent intent = BaseActivity.fragmentArgumentsToIntent(getArguments());
    mSessionUri = intent.getData();//w  ww  .  j  a  va  2 s .com

    if (mSessionUri == null) {
        return;
    }

    mSessionId = ScheduleContract.Sessions.getSessionId(mSessionUri);

    mVariableHeightHeader = intent.getBooleanExtra(EXTRA_VARIABLE_HEIGHT_HEADER, false);

    LoaderManager manager = getLoaderManager();
    manager.restartLoader(0, null, this);

    setHasOptionsMenu(true);
}

From source file:com.nononsenseapps.filepicker.ui.core.AbstractFilePickerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_ACTION_BAR);
    setupFauxDialog();/*from ww w.ja  v  a2 s  . co  m*/
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_filepicker);

    Intent intent = getIntent();
    if (intent != null) {
        startPath = intent.getStringExtra(Extras.EXTRA_START_PATH);
        mode = AbstractFilePickerFragment.SelectionMode.values()[intent.getIntExtra(Extras.EXTRA_MODE,
                AbstractFilePickerFragment.SelectionMode.MODE_FILE.ordinal())];
        allowCreateDir = intent.getBooleanExtra(Extras.EXTRA_ALLOW_CREATE_DIR, allowCreateDir);
        allowMultiple = intent.getBooleanExtra(Extras.EXTRA_ALLOW_MULTIPLE, allowMultiple);
    }

    setupActionBar();

    FragmentManager fm = getSupportFragmentManager();
    AbstractFilePickerFragment fragment = (AbstractFilePickerFragment) fm.findFragmentByTag(TAG);

    if (fragment == null) {
        fragment = getFragment(startPath, mode, allowMultiple, allowCreateDir);
    }

    if (fragment != null) {
        fm.beginTransaction().replace(R.id.fragment, fragment, TAG).commit();
    }

    // Default to cancelled
    setResult(Activity.RESULT_CANCELED);
}

From source file:com.pindroid.authenticator.AuthenticatorActivity.java

/**
 * {@inheritDoc}//from   ww  w . j  av a  2s. co  m
 */
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    mAccountAuthenticatorResponse = getIntent()
            .getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE);

    if (mAccountAuthenticatorResponse != null) {
        mAccountAuthenticatorResponse.onRequestContinued();
    }

    mAccountManager = AccountManager.get(this);
    final Intent intent = getIntent();
    mUsername = intent.getStringExtra(PARAM_USERNAME);
    mRequestNewAccount = mUsername == null;
    mConfirmCredentials = intent.getBooleanExtra(PARAM_CONFIRMCREDENTIALS, false);

    setContentView(R.layout.login_activity);

    mMessage = (TextView) findViewById(R.id.message);
    mUsernameEdit = (EditText) findViewById(R.id.username_edit);
    mPasswordEdit = (EditText) findViewById(R.id.password_edit);

    mPasswordEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                startLogin();
                return true;
            } else {
                return false;
            }
        }
    });

    if (!TextUtils.isEmpty(mUsername)) {
        mUsernameEdit.setText(mUsername);
        mPasswordEdit.requestFocus();
    }
}

From source file:name.gumartinm.weather.information.widget.WidgetIntentService.java

@Override
protected void onHandleIntent(final Intent intent) {
    final int appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
            AppWidgetManager.INVALID_APPWIDGET_ID);
    final boolean isRefreshAppWidget = intent.getBooleanExtra("refreshAppWidget", false);

    if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
        // Nothing to do. Something went wrong.
        return;/* w w w . j a v  a  2  s.  c  o  m*/
    }

    final DatabaseQueries query = new DatabaseQueries(this.getApplicationContext());
    final WeatherLocation weatherLocation = query.queryDataBase();

    if (weatherLocation == null) {
        // Nothing to do. Show error.
        final RemoteViews view = this.makeViewOnError(appWidgetId);
        this.updateWidget(view, appWidgetId);
        return;
    }

    if (!isRefreshAppWidget) {
        final RemoteViews view = this.makeViewOnNotRefresh(weatherLocation, appWidgetId);
        this.updateWidget(view, appWidgetId);
    } else {
        final RemoteViews view = this.makeViewOnRefresh(weatherLocation, appWidgetId);
        this.updateWidget(view, appWidgetId);
    }
}