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.flowzr.activity.BlotterFragment.java

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

    if (savedInstanceState != null) {
        blotterFilter = WhereFilter.fromBundle(savedInstanceState);
    }//w w w.  j a v a  2  s. c o  m
    if (saveFilter && blotterFilter.isEmpty()) {
        blotterFilter = WhereFilter.fromSharedPreferences(getActivity().getPreferences(0));
    }

    Bundle args = this.getArguments();
    if (args != null) {
        blotterFilter = WhereFilter.fromBundle(args);
        saveFilter = args.getBoolean(SAVE_FILTER, false);
        isAccountBlotter = args.getBoolean(BlotterFilterActivity.IS_ACCOUNT_FILTER, false);
    } else {
        Intent intent = getActivity().getIntent();
        if (intent != null) {
            blotterFilter = WhereFilter.fromIntent(intent);
            saveFilter = intent.getBooleanExtra(SAVE_FILTER, false);
            isAccountBlotter = intent.getBooleanExtra(BlotterFilterActivity.IS_ACCOUNT_FILTER, false);
        }
        if (saveFilter) {
            saveFilter();
        }
    }

    totalText = (TextView) getView().findViewById(R.id.total); // set for calculation task
    if (totalText != null) { //ex: ScheduledListFragment
        totalText.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View arg0, MotionEvent arg1) {
                showTotals();
                return false;
            }
        });
    }
    calculateTotals();
    getActivity().setTitle(blotterFilter.getTitle());
    prepareAddButtonActionGrid();
    if (args != null && args.containsKey(BlotterFragment.EXTRA_REQUEST_TYPE)) {
        if (args.getInt(
                BlotterFragment.EXTRA_REQUEST_TYPE) == BlotterFragment.NEW_TRANSACTION_FROM_TEMPLATE_REQUEST) {
            createFromTemplate();
        }
    }
}

From source file:alaindc.memenguage.View.MainActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    checkLoggedIn();// ww  w . j a va  2s. co  m
    setContentView(R.layout.activity_main);

    dbmanager = new DBManager(getApplicationContext());
    crs = dbmanager.getAllWords();

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    if (fab != null)
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent createWordIntentActivity = new Intent(MainActivity.this, CreateEditActivity.class);
                createWordIntentActivity.setAction(Constants.ACTION_ADD_WORD);
                MainActivity.this.startActivity(createWordIntentActivity);
            }
        });

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar,
            R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    if (drawer != null)
        drawer.setDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    if (navigationView != null)
        navigationView.setNavigationItemSelectedListener(this);

    ImageView navlogo = (ImageView) navigationView.getHeaderView(0).findViewById(R.id.navLogoImageView);
    TextView navtitle = (TextView) navigationView.getHeaderView(0).findViewById(R.id.navTitle);
    TextView navsubtitle = (TextView) navigationView.getHeaderView(0).findViewById(R.id.navSubTitle);
    progressDialog = new ProgressDialog(this);

    BroadcastReceiver receiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equals(Constants.INTENT_VIEW_UPDATE)) {
                adapter.getFilter().filter("");
                adapter.notifyDataSetChanged();
            } else if (intent.getAction().equals(Constants.INTENT_COMMSERV_UPDATE)) {
                boolean success = intent.getBooleanExtra(Constants.EXTRA_COMMSERV_SUCCESS, false);
                String message = (intent.getIntExtra(Constants.EXTRA_COMMSERV_TYPE, 0) == Constants.UPLOAD)
                        ? "Databased uploaded "
                        : "Databased downloaded ";
                message = (success) ? message + "successfully!" : "An error occurred, try again.";
                progressDialog.setMessage(message);
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        progressDialog.dismiss();
                    }
                }, 1500);

            } else {
                Log.d("", "");
            }
        }
    };

    IntentFilter updateviewIntFilt = new IntentFilter(Constants.INTENT_VIEW_UPDATE);
    IntentFilter serverCommIntFilt = new IntentFilter(Constants.INTENT_COMMSERV_UPDATE);
    LocalBroadcastManager.getInstance(this).registerReceiver(receiver, updateviewIntFilt);
    LocalBroadcastManager.getInstance(this).registerReceiver(receiver, serverCommIntFilt);

    SharedPreferences sharedPref = getApplicationContext().getSharedPreferences(Constants.PREF_FILE,
            Context.MODE_PRIVATE);
    personName = sharedPref.getString(Constants.PREF_GOOGLEACCOUNT_NAME, "");
    personEmail = sharedPref.getString(Constants.PREF_GOOGLEACCOUNT_EMAIL, "");
    personId = sharedPref.getString(Constants.PREF_GOOGLEACCOUNT_ID, "");
    personPhoto = sharedPref.getString(Constants.PREF_GOOGLEACCOUNT_PHOTOURI, "");

    //        if (!personPhoto.equals(""))
    //            new AsyncImageTask(navlogo).execute(personPhoto);
    navtitle.setText(personName);
    navsubtitle.setText(personEmail);

    // TODO Just one time and in bcast receiver start phone
    Intent randomStart = new Intent(MainActivity.this, RandomIntentService.class);
    randomStart.setAction(Constants.ACTION_RANDOM_START);
    getApplicationContext().startService(randomStart);

    updateWordsList();
}

From source file:cn.moon.superwechat.ui.MainActivity.java

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    showExceptionDialogFromIntent(intent);
    boolean isChat = intent.getBooleanExtra(I.IS_FROM_CHAT, false);
    if (isChat) {
        mLayoutTabhost.setChecked(0);//from  w w  w.  j  av a  2 s .c  om
        mLayoutViewpage.setCurrentItem(0);
    }
    //??IntentonResume(),?
    //setIntent(intent);
}

From source file:com.sft.blackcatapp.SearchCoachActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (data != null) {
        if (resultCode == R.id.base_left_btn) {
            return;
        }/*from  w  ww  .  j  a  v a 2 s.c  om*/
        boolean isFromEnroll = data.getBooleanExtra(from_searchCoach_enroll, false);
        if (isFromEnroll) {
            data.setClass(this, ApplyActivity.class);
            data.putExtra(from_searchCoach_enroll, isFromEnroll);
            startActivity(data);
            finish();
        }
    }
}

From source file:arun.com.chromer.webheads.WebHeadService.java

private void processIntent(@Nullable Intent intent) {
    if (intent == null || intent.getDataString() == null)
        return; // don't do anything

    final boolean isForMinimized = intent.getBooleanExtra(EXTRA_KEY_MINIMIZE, false);
    final boolean isFromAmp = intent.getBooleanExtra(EXTRA_KEY_FROM_AMP, false);
    final boolean isIncognito = intent.getBooleanExtra(EXTRA_KEY_INCOGNITO, false);

    final String urlToLoad = intent.getDataString();
    if (TextUtils.isEmpty(urlToLoad)) {
        Toast.makeText(this, R.string.invalid_link, LENGTH_SHORT).show();
        return;//  w w w  .ja v a 2 s  . c  o m
    }

    if (!isLinkAlreadyLoaded(urlToLoad)) {
        addWebHead(urlToLoad, isFromAmp, isIncognito);
    } else if (!isForMinimized) {
        Toast.makeText(this, R.string.already_loaded, LENGTH_SHORT).show();
    }
}

From source file:com.laevatein.internal.ui.PhotoSelectionActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == REQUEST_CODE_CAPTURE && resultCode == Activity.RESULT_OK) {
        Uri captured = mMediaStoreCompat.getCapturedPhotoUri(data, mCapturePhotoUriHolder);
        if (captured != null) {
            mCollection.add(captured);/*from  ww  w  .  ja v a  2s.  c  o m*/
            mMediaStoreCompat.cleanUp(mCapturePhotoUriHolder);
        }
        supportInvalidateOptionsMenu();
    } else if (requestCode == REQUEST_CODE_PREVIEW && resultCode == Activity.RESULT_OK) {
        boolean checked = data.getBooleanExtra(ImagePreviewActivity.EXTRA_RESULT_CHECKED, false);
        Item item = data.getParcelableExtra(ImagePreviewActivity.EXTRA_RESULT_ITEM);
        if (checked) {
            mCollection.add(item.buildContentUri());
        } else {
            mCollection.remove(item.buildContentUri());
        }
        PhotoSelectionViewHelper.refreshGridView(this);
        supportInvalidateOptionsMenu();
    }
}

From source file:com.github.play.app.StatusService.java

@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
    if (intent != null) {
        String intentKey = intent.getStringExtra(EXTRA_KEY);
        if (!TextUtils.isEmpty(intentKey) && !intentKey.equals(applicationKey)) {
            destroyPusher(pusher);//from   w w w . j a  va 2s.  c o m
            createPusher(intentKey);
        }

        boolean updateNotification = intent.hasExtra(EXTRA_NOTIFY);
        if (updateNotification)
            sendNotification = intent.getBooleanExtra(EXTRA_NOTIFY, false);
        Song song = (Song) intent.getSerializableExtra(EXTRA_SONG);
        if (updateNotification && !sendNotification) {
            clearNotification();
        } else if (song != null)
            updateNotification(song);
    }

    return super.onStartCommand(intent, flags, startId);
}

From source file:com.mobicage.rogerthat.plugins.scan.ProcessScanActivity.java

@Override
protected void onServiceBound() {
    T.UI();/*from   www .  jav a 2 s  .  co m*/

    mFriendsPlugin = mService.getPlugin(FriendsPlugin.class);
    mBroadcastReceiver = getBroadcastReceiver();

    final IntentFilter filter = new IntentFilter(FriendsPlugin.FRIEND_INFO_RECEIVED_INTENT);
    filter.addAction(FriendsPlugin.SERVICE_ACTION_INFO_RECEIVED_INTENT);
    filter.addAction(URL_REDIRECTION_DONE);
    registerReceiver(mBroadcastReceiver, filter);

    Intent intent = getIntent();
    final String url = intent.getStringExtra(URL);
    final String emailHash = intent.getStringExtra(EMAILHASH);

    if (url == null && emailHash == null) {
        L.bug("url == null && emailHash == null");
        finish();
    } else {
        startSpinner(intent.getBooleanExtra(SCAN_RESULT, false));
        if (url != null)
            processUrl(url);
        else
            processEmailHash(emailHash);
    }
}

From source file:com.paranoid.gerrit.GerritControllerActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    mTheme = Prefs.getCurrentThemeID(this);
    setTheme(mTheme);//ww  w.  j ava  2 s.  com

    super.onCreate(savedInstanceState);

    // check if caller has a gerrit instance start screen preference
    String suppliedGerritInstance = getIntent().getStringExtra(GERRIT_INSTANCE);
    if (suppliedGerritInstance != null && !suppliedGerritInstance.isEmpty()
            && suppliedGerritInstance.contains("http")) {
        // just set the prefs and allow normal loading
        Prefs.setCurrentGerrit(this, suppliedGerritInstance);
    }

    GoogleAnalytics googleAnalytics = GoogleAnalytics.getInstance(this);

    String trackingId = getString(R.string.ga_trackingId);
    Tracker tracker = googleAnalytics.getTracker(trackingId);
    googleAnalytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
    tracker.send(MapBuilder.createAppView().build());

    // keep a log of what ROM our users run
    EasyTracker easyTracker = EasyTracker.getInstance(this);
    easyTracker.send(MapBuilder.createEvent(AnalyticsConstants.GA_APP_OPEN, // Event category (required)
            AnalyticsConstants.GA_ROM_VERSION, // Event action (required)
            ROMHelper.determineRom(this), // Event label
            null) // Event value (long)
            .build());
    // note this screen as viewed
    easyTracker.send(MapBuilder.createAppView().build());

    // Keep track of what theme is being used
    easyTracker.send(MapBuilder.createEvent(AnalyticsConstants.GA_APP_OPEN,
            AnalyticsConstants.GA_THEME_SET_ON_OPEN, Prefs.getCurrentTheme(this), null).build());
    // note this screen as viewed
    easyTracker.send(MapBuilder.createAppView().build());

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.main);

    FragmentManager fm = getSupportFragmentManager();
    if (findViewById(R.id.change_detail_fragment) != null) {
        // The detail container view will be present only in the
        // large-screen layouts (res/values-large and
        // res/values-sw600dp). If this view is present, then the
        // activity should be in two-pane mode.
        mTwoPane = true;
        mChangeDetail = (PatchSetViewerFragment) fm.findFragmentById(R.id.change_detail_fragment);
    }
    Prefs.setTabletMode(this, mTwoPane);

    mChangeList = (ChangeListFragment) fm.findFragmentById(R.id.change_list_fragment);

    mGerritWebsite = Prefs.getCurrentGerrit(this);

    /* Initially set the current Gerrit globally here.
     *  We can rely on callbacks to know when they change */
    GerritURL.setGerrit(Prefs.getCurrentGerrit(this));
    GerritURL.setProject(Prefs.getCurrentProject(this));

    // Don't register listeners here. It is registered in onResume instead.
    mChangeListener = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String changeid = intent.getStringExtra(PatchSetViewerFragment.CHANGE_ID);
            String status = intent.getStringExtra(PatchSetViewerFragment.STATUS);
            boolean expand = intent.getBooleanExtra(PatchSetViewerFragment.EXPAND_TAG, false);
            onChangeSelected(changeid, status, expand);
        }
    };

    handleIntent(this.getIntent());
}

From source file:com.bilibili.boxing_impl.ui.BoxingViewFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (data == null) {
        return;/*from w ww.  j a va 2 s . co m*/
    }
    if (resultCode == Activity.RESULT_OK && requestCode == IMAGE_PREVIEW_REQUEST_CODE) {
        mIsPreview = false;
        boolean isBackClick = data.getBooleanExtra(BoxingViewActivity.EXTRA_TYPE_BACK, false);
        List<BaseMedia> selectedMedias = data.getParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA);
        onViewActivityRequest(selectedMedias, mMediaAdapter.getAllMedias(), isBackClick);
        if (isBackClick) {
            mMediaAdapter.setSelectedMedias(selectedMedias);
            mMediaAdapter.notifyDataSetChanged();
        }
        updateMultiPickerLayoutState(selectedMedias);
    }

}