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.nextgis.ngm_clink_monitoring.services.FoclReportService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (!mIsRunning) {
        mIsRunning = true;/*from w  w w .  java 2  s.  c o  m*/

        if (null != intent) {
            mSendReportFromMain = intent.getBooleanExtra(FOCL_SEND_REPORT_FROM_MAIN, false);
            mSendWorkData = intent.getBooleanExtra(FOCL_SEND_WORK_DATA, false);
        }

        Log.d(TAG, "Report service started");
        if (mSendWorkData) {
            startForeground(NOTIFY_ID, getNotification(this, NOTIFICATION_START, null));
        }
        runTask();
    }

    return START_STICKY;
}

From source file:info.guardianproject.otr.app.im.app.WelcomeActivity.java

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

    mApp = (ImApp) getApplication();//from   www  .  j  a v a  2 s .  c  o m
    mHandler = new MyHandler(this);

    mSignInHelper = new SignInHelper(this);

    Intent intent = getIntent();
    mDoSignIn = intent.getBooleanExtra("doSignIn", true);
    mDoLock = intent.getBooleanExtra("doLock", false);

    if (!mDoLock) {
        mApp.maybeInit(this);

    }

    if (ImApp.mUsingCacheword)
        connectToCacheWord();
    else {
        if (openEncryptedStores(null, false)) {
            IocVfs.init(this, "");
        } else {
            connectToCacheWord(); //first time setup
        }
    }

    // if we have an incoming contact, send it to the right place
    String scheme = intent.getScheme();
    if (TextUtils.equals(scheme, "xmpp")) {
        intent.setClass(this, AddContactActivity.class);
        startActivity(intent);
        finish();
        return;
    }
}

From source file:android.support.v17.leanback.app.BrowseSupportFragmentTestActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();

    BrowseTestSupportFragment.NUM_ROWS = intent.getIntExtra(EXTRA_NUM_ROWS,
            BrowseTestSupportFragment.DEFAULT_NUM_ROWS);
    BrowseTestSupportFragment.REPEAT_PER_ROW = intent.getIntExtra(EXTRA_REPEAT_PER_ROW,
            BrowseTestSupportFragment.DEFAULT_REPEAT_PER_ROW);
    BrowseTestSupportFragment.LOAD_DATA_DELAY = intent.getLongExtra(EXTRA_LOAD_DATA_DELAY,
            BrowseTestSupportFragment.DEFAULT_LOAD_DATA_DELAY);
    BrowseTestSupportFragment.TEST_ENTRANCE_TRANSITION = intent.getBooleanExtra(EXTRA_TEST_ENTRANCE_TRANSITION,
            BrowseTestSupportFragment.DEFAULT_TEST_ENTRANCE_TRANSITION);
    setContentView(R.layout.browse);/*w  w  w.  ja v a 2s  . com*/
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    ft.replace(R.id.main_frame, new BrowseTestSupportFragment());
    if (intent.getBooleanExtra(EXTRA_ADD_TO_BACKSTACK, false)) {
        ft.addToBackStack(null);
    }
    ft.commit();
}

From source file:com.mobicage.rogerthat.FriendDetailOrInviteActivity.java

private void initBroadcastReceiver(final IntentFilter filter) {
    T.UI();//from w  w w.j av a 2 s . c om

    mBroadcastReceiver = new SafeBroadcastReceiver() {

        @Override
        public String[] onSafeReceive(final Context context, final Intent intent) {
            T.UI();
            if (FriendsPlugin.FRIEND_INFO_RECEIVED_INTENT.equals(intent.getAction())) {
                final String emailHash = intent.getStringExtra(ProcessScanActivity.EMAILHASH);
                if (emailHash != null && emailHash.equals(mFriendEmail)) {
                    abortProcessing();

                    if (intent.getBooleanExtra(ProcessScanActivity.SUCCESS, true)) {
                        mFriend = mFriendsPlugin.getStore().getFriend(mFriendEmail);
                        updateView();
                    } else {
                        UIUtils.showErrorDialog(FriendDetailOrInviteActivity.this, intent);
                    }

                    return ALL_RECEIVING_INTENTS;
                }
            }
            return null;
        }
    };
    registerReceiver(mBroadcastReceiver, filter);
}

From source file:com.roiland.crm.sm.ui.view.SmOppoInfoFragment.java

/**
 * //w  ww  .  j  a v  a 2s  .  com
 * @param inflater ?
 * @param container 
 * @param savedInstanceState
 * @return ??
 * @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.sm_activity_example, container, false);
    newToggleBtn = (ToggleButton) view.findViewById(R.id.toggleButton_new);
    mNewFollowListView = (ListView) view.findViewById(R.id.oppo_followinfo_list);
    newlayout = (LinearLayout) view.findViewById(R.id.oppo_followinfo_list_layout);
    mCustominfoTitle = (LinearLayout) view.findViewById(R.id.custominfo);
    mCarInfoHide = (ImageButton) view.findViewById(R.id.carinfo_hide_btn);
    mCarInfoMore = (ImageButton) view.findViewById(R.id.carinfo_more_btn);
    newlayout.setVisibility(View.GONE);
    newToggleBtn.setVisibility(View.GONE);
    Intent intent = getActivity().getIntent();
    isFromCustManager = intent.getBooleanExtra("fromCustManager", false);
    setNewListHidden();
    mCustomInfo = (LinearLayout) view.findViewById(R.id.custom_info_list);
    mCarInfo = (LinearLayout) view.findViewById(R.id.car_info_list);
    mCarInfoMore = (ImageButton) view.findViewById(R.id.carinfo_more_btn);
    if (isFromCustManager) {
        comeFromCustMamager();
    } else {
        mCustomInfoMore = (ImageButton) view.findViewById(R.id.custominfo_more_btn);
        mCustomInfoHide = (ImageButton) view.findViewById(R.id.custominfo_hide_btn);
        customInfoAdapter = new SmCustomInfoListAdapter(this.getActivity());

        //???
        mCustomInfoHide.setVisibility(View.GONE);

        //??
        mCustomInfoMore.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                custFlag = !custFlag;
                mCustomInfoHide.setVisibility(View.VISIBLE);
                mCustomInfoMore.setVisibility(View.GONE);
                displayProject(custFlag, carFlag);

            }
        });

        //????
        mCustomInfoHide.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                custFlag = !custFlag;
                mCustomInfoHide.setVisibility(View.GONE);
                mCustomInfoMore.setVisibility(View.VISIBLE);
                displayProject(custFlag, carFlag);

            }
        });
    }
    carInfoAdapter = new SmCarInfoListAdapter(this.getActivity());

    // ???
    mCarInfoHide.setVisibility(View.GONE);

    // ??
    mCarInfoMore.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            carFlag = !carFlag;
            mCarInfoHide.setVisibility(View.VISIBLE);
            mCarInfoMore.setVisibility(View.GONE);
            displayProject(custFlag, carFlag);
        }
    });

    // ????
    mCarInfoHide.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            carFlag = !carFlag;
            mCarInfoHide.setVisibility(View.GONE);
            mCarInfoMore.setVisibility(View.VISIBLE);
            displayProject(custFlag, carFlag);
        }
    });
    displayProject(false, false);
    return view;
}

From source file:net.qvex.dommel.data.DommelDataService.java

/**
 * Does the actual work./*w  w  w.  j  av a2  s. c o m*/
 */

@Override
protected void onHandleIntent(Intent intent) {
    String action = intent.getAction();

    prefs = PreferenceManager.getDefaultSharedPreferences(this);

    final boolean manualUpdate = intent.getBooleanExtra(FIELD_MANUAL, false);

    // send broadcast containing error message
    Intent i = new Intent(MESSAGE_STATUS);
    i.putExtra(FIELD_MANUAL, manualUpdate);

    try {
        i.putExtra(FIELD_STATUS, STATUS_RUNNING);
        sendBroadcast(i);

        update();

        i.putExtra(FIELD_STATUS, STATUS_FINISHED);
        sendBroadcast(i);

    } catch (Exception e) {

    }

}

From source file:com.initiativaromania.hartabanilorpublici.IRUserInterface.activities.MainActivity.java

private void initTransparentView() {

    /* Avoid displaying infographic if the home button has been pushed */
    Intent intent = getIntent();
    displayInfographic = intent.getBooleanExtra(EXTRA_DISPLAY_INFOGRAPHIC, true);
    System.out.println("Display info " + displayInfographic);
    if (!displayInfographic) {
        LinearLayout linear = (LinearLayout) findViewById(R.id.transparentLayer);
        linear.setVisibility(View.INVISIBLE);
        return;//  w  w w.  j a va2  s.c o m
    }

    /* Setup the OK button */
    Button okButton = (Button) findViewById(R.id.okButton);
    if (okButton != null) {
        okButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                System.out.println("OK button pushed");

                Animation animation = AnimationUtils.loadAnimation(context, R.anim.slide_down);
                LinearLayout linear = (LinearLayout) findViewById(R.id.transparentLayer);
                linear.startAnimation(animation);
                linear.setVisibility(View.INVISIBLE);

                Toast toast = Toast.makeText(getBaseContext(), "Apasa pe simbolurile  din jurul tau",
                        Toast.LENGTH_LONG);
                toast.setGravity(Gravity.CENTER | Gravity.CENTER_HORIZONTAL, 0, 0);
                toast.show();

                /* Display initial seek bar value */
                Rect thumbRect = seekBar.getThumb().getBounds();
                seekBarValue.setX(thumbRect.exactCenterX());
                DecimalFormat dm = new DecimalFormat("###,###.###");
                seekBarValue.setText(" " + String.valueOf(dm.format(CommManager.aroundTotalSum)) + " EURO ");
                seekBarValue.setVisibility(View.VISIBLE);
                seekBarValue.startAnimation(animationFadeIn);
            }
        });
    }

    /* Send request to get the init data */
    CommManager.requestInitData(new ICommManagerResponse() {
        @Override
        public void processResponse(JSONObject response) {
            MainActivity.this.receiveInitData(response);
        }

        @Override
        public void onErrorOccurred(String errorMsg) {
            Toast.makeText(MainActivity.this, "Eroare conectare la server", Toast.LENGTH_SHORT).show();
        }
    });
}

From source file:com.jtechme.apphub.FDroid.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    fdroidApp = (FDroidApp) getApplication();
    fdroidApp.applyTheme(this);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.fdroid);/*w  w w.  jav  a  2s  .co  m*/
    createViews();

    getTabManager().createTabs();

    // Start a search by just typing
    setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);

    Intent intent = getIntent();
    handleSearchOrAppViewIntent(intent);

    if (intent.hasExtra(EXTRA_TAB_UPDATE)) {
        boolean showUpdateTab = intent.getBooleanExtra(EXTRA_TAB_UPDATE, false);
        if (showUpdateTab) {
            getTabManager().selectTab(2);
        }
    }

    Uri uri = AppProvider.getContentUri();
    getContentResolver().registerContentObserver(uri, true, new AppObserver());

    InstallExtensionDialogActivity.firstTime(this);

    // Re-enable once it can be disabled via a setting
    // See https://gitlab.com/fdroid/fdroidclient/issues/435
    //
    // if (UpdateService.isNetworkAvailableForUpdate(this)) {
    //     UpdateService.updateNow(this);
    // }
}

From source file:my.home.lehome.service.SendMsgIntentService.java

private void preparePengindCommand(Intent intent) {
    Messenger messenger;/*from  w ww .j  a  v a2s .c  o  m*/
    if (intent.hasExtra("messenger"))
        messenger = (Messenger) intent.getExtras().get("messenger");
    else
        messenger = null;
    Message repMsg = Message.obtain();
    repMsg.what = MSG_BEGIN_SENDING;

    boolean isSysCmd = intent.getBooleanExtra("isSysCmd", false);
    if (isSysCmd) {
        Log.d(TAG, "sys cmd item");
        return;
    }

    ChatItem item = intent.getParcelableExtra("update");
    if (item == null) {
        item = new ChatItem();
        item.setContent(intent.getStringExtra("cmd"));
        item.setType(ChatItemConstants.TYPE_CLIENT);
        item.setState(Constants.CHATITEM_STATE_ERROR); // set ERROR
        item.setDate(new Date());
        DBStaticManager.addChatItem(getApplicationContext(), item);
    }
    item.setState(Constants.CHATITEM_STATE_PENDING);

    Log.d(TAG, "enqueue item: \n" + item);
    Bundle bundle = new Bundle();
    bundle.putBoolean("update", intent.hasExtra("update"));
    bundle.putParcelable("item", item);
    if (messenger != null) {
        repMsg.setData(bundle);
        try {
            messenger.send(repMsg);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    } else {
        Log.d(TAG, "messager is null, send broadcast instead:" + ACTION_SEND_MSG_BEGIN);
        Intent newIntent = new Intent(ACTION_SEND_MSG_BEGIN);
        newIntent.putExtras(bundle);
        sendBroadcast(newIntent);
    }

    intent.putExtra("pass_item", item);
}

From source file:com.easemob.chatuidemo.ui.MainActivity.java

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    if (intent.getBooleanExtra(Constant.ACCOUNT_CONFLICT, false) && !isConflictDialogShow) {
        showConflictDialog();/*from  w  w w .  ja  va2 s.  c o  m*/
    } else if (intent.getBooleanExtra(Constant.ACCOUNT_REMOVED, false) && !isAccountRemovedDialogShow) {
        showAccountRemovedDialog();
    }
}