Java Code Examples for android.content.Intent.getBooleanExtra()

The following are Jave code examples for showing how to use getBooleanExtra() of the android.content.Intent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Habitizer   File: FeedTabActivity.java   View Source Code Vote up 8 votes
@Override
protected void onStart() {
    super.onStart();
    myHabitEventsListView = (ListView) findViewById(R.id.feed_list);

    DummyMainActivity.myHabitEventsAdapter = new MyFeedAdapter(this, DummyMainActivity
            .myHabitEvents);
    myHabitEventsListView.setAdapter(DummyMainActivity.myHabitEventsAdapter);
    //TODO change here
    DummyMainActivity.myHabitEventsAdapter.notifyDataSetChanged();
    Intent intent = getIntent();
    if (intent.getBooleanExtra("fromHabit", false)){
        refreshFeed2();
    } else{
        refreshFeed(null);
    }


}
 
Example 2
Project: puremadrid   File: MainActivity.java   View Source Code Vote up 7 votes
@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    if (intent.getBooleanExtra(KEY_OPENED_FROM_NOTIFICATION,false)){
        intent.putExtra(KEY_OPENED_FROM_NOTIFICATION,false);
        clearBackStack(getFragmentManager());
        replaceFragment(POSITION_MAIN);

    } else if (intent.getBooleanExtra(KEY_OPENED_FROM_WIDGET,false)){
        intent.putExtra(KEY_OPENED_FROM_WIDGET,false);
        clearBackStack(getFragmentManager());
        replaceFragment(POSITION_MAIN);
    }

}
 
Example 3
Project: privacyidea-authenticator   File: MainActivity.java   View Source Code Vote up 7 votes
private Token makeTokenFromIntent(Intent data) {
    String type = data.getStringExtra(TYPE);
    byte[] secret = data.getByteArrayExtra(SECRET);
    String label = data.getStringExtra(LABEL);
    int digits = data.getIntExtra(DIGITS, 6);
    String algorithm = data.getStringExtra(ALGORITHM);
    Token tmp = new Token(secret, label, type, digits);

    if (type.equals(TOTP)) {
        int period = data.getIntExtra(PERIOD, 30);
        tmp.setPeriod(period);
    }

    if (algorithm != null) {
        tmp.setAlgorithm(algorithm);
    }
    if (data.getBooleanExtra(WITHPIN, false)) {
        tmp.setWithPIN(true);
    }

    return tmp;
}
 
Example 4
Project: ImitateZHRB   File: MainActivity.java   View Source Code Vote up 6 votes
@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    if (intent != null) {
        boolean isExit = intent.getBooleanExtra(TAG_EXIT, false);
        if (isExit) {
            this.finish();
        }
    }
}
 
Example 5
Project: Cable-Android   File: WebRtcCallService.java   View Source Code Vote up 6 votes
private void handleBluetoothChange(Intent intent) {
  this.bluetoothAvailable = intent.getBooleanExtra(EXTRA_AVAILABLE, false);

  if (recipient != null) {
    sendMessage(viewModelStateFor(callState), recipient, localVideoEnabled, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled);
  }
}
 
Example 6
Project: Habitizer   File: HabitTabActivity.java   View Source Code Vote up 6 votes
/**
 * For sending user to different activities
 * @param requestCode
 * @param resultCode
 * @param data
 */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if(data != null && data.getBooleanExtra("fromHabit", false)){
        setResult(DummyMainActivity.VIEW_FEED, data);
        finish();
    }
    if(requestCode == ADDING_EVENT){
    }
    DummyMainActivity.myHabitsAdapter.notifyDataSetChanged();
}
 
Example 7
Project: FireFiles   File: StandaloneActivity.java   View Source Code Vote up 6 votes
private void buildDefaultState() {
    mState = new State();
    final Intent intent = getIntent();
    mState.action = State.ACTION_MANAGE_ALL;
    mState.acceptMimes = new String[] { "*/*" };
    mState.allowMultiple = true;
    mState.acceptMimes = new String[] { intent.getType() };
    mState.localOnly = intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false);
    mState.forceAdvanced = intent.getBooleanExtra(DocumentsContract.EXTRA_SHOW_ADVANCED, false);
    mState.showAdvanced = mState.forceAdvanced
            | SettingsActivity.getDisplayAdvancedDevices(this);
    mState.showSize = true;
}
 
Example 8
Project: Renrentou   File: JpushReceiver.java   View Source Code Vote up 6 votes
@Override
public void onReceive(Context context, Intent intent) {
    try {
        Bundle bundle = intent.getExtras();
        Log.d(TAG, "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));

        if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
            String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
            Log.d(TAG, "[MyReceiver] 接收Registration Id : " + regId);
            //send the Registration Id to your server...

        } else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
            Log.d(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE));

        } else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
            Log.d(TAG, "[MyReceiver] 接收到推送下来的通知");
            int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
            Log.d(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);
            processCustomMessage(context,bundle);

        } else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
            Log.d(TAG, "[MyReceiver] 用户点击打开了通知");
            openNotification(context);

        } else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
            Log.d(TAG, "[MyReceiver] 用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA));
            //在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码,比如打开新的Activity, 打开一个网页等..

        } else if(JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
            boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
            Log.d(TAG, "[MyReceiver]" + intent.getAction() +" connected state change to "+connected);
        } else {
            Log.d(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
        }
    } catch (Exception e){

    }

}
 
Example 9
Project: android-project-gallery   File: CropperActivity.java   View Source Code Vote up 6 votes
public void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.wrapper_cn_image_cropper);
	cropImageView = (CropImageView) findViewById(R.id.crop_imageview);
	// Sets initial aspect ratio to 10/10, for demonstration purposes
	//cropImageView.setAspectRatio(DEFAULT_ASPECT_RATIO_VALUES, DEFAULT_ASPECT_RATIO_VALUES);

	Intent intent = getIntent();
	isCrop = intent.getBooleanExtra(EXTRA_CROP, true);
	aspectX = intent.getIntExtra(EXTRA_ASPECTX, 0);
	aspectY = intent.getIntExtra(EXTRA_ASPECTY, 0);
	outputX = intent.getIntExtra(EXTRA_OUTPUTX, 0);
	outputY = intent.getIntExtra(EXTRA_OUTPUTY, 0);
	isScale = intent.getBooleanExtra(EXTRA_SCALE, true);
	output = intent.getParcelableExtra(EXTRA_OUTPUT);
	isReturnData = intent.getBooleanExtra(EXTRA_RETURN_DATA, false);
	noFaceDetection = intent.getBooleanExtra(EXTRA_NOFACEDETECTION, true);
	outputFormat = intent.getStringExtra(EXTRA_OUTPUTFORMAT);
	if (TextUtils.isEmpty(outputFormat))
	{
		outputFormat = Bitmap.CompressFormat.PNG.toString();
	}
	title = intent.getStringExtra(EXTRA_TITLE);

	String path = output.getPath();
	mSourceBitmap = BitmapFactory.decodeFile(path);
	cropImageView.setImageBitmap(mSourceBitmap);
}
 
Example 10
Project: easyfilemanager   File: StandaloneActivity.java   View Source Code Vote up 6 votes
private void buildDefaultState() {
    mState = new State();
    final Intent intent = getIntent();
    mState.action = State.ACTION_MANAGE_ALL;
    mState.acceptMimes = new String[] { "*/*" };
    mState.allowMultiple = true;
    mState.acceptMimes = new String[] { intent.getType() };
    mState.localOnly = intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false);
    mState.forceAdvanced = intent.getBooleanExtra(DocumentsContract.EXTRA_SHOW_ADVANCED, false);
    mState.showAdvanced = mState.forceAdvanced
            | SettingsActivity.getDisplayAdvancedDevices(this);
    mState.showSize = true;
}
 
Example 11
Project: Habitizer   File: HabitTabActivity.java   View Source Code Vote up 6 votes
/**
 * Called when activity starts, retrieves habits from server or offline list
 */
@Override
protected void onStart() {
    super.onStart();
    //TODO 2 searching another user habits for viewing
    Intent intent = getIntent();
    ArrayList<Habit> habitList;
    if(intent != null && intent.getBooleanExtra("fromProfile", false)){
        isFromProfile = true;
        if(Utilities.isNetworkAvailable(HabitTabActivity.this)){
            ElasticsearchController.GetItemsTask getHabitsArrayGetTask = new ElasticsearchController.GetItemsTask();
            getHabitsArrayGetTask.execute(DummyMainActivity.Habit_Index, "username", intent.getStringExtra("targetUsername"));
            try{
                JsonArray jsonHabits =  getHabitsArrayGetTask.get();
                habitList = new ArrayList<>();
                for (int i = 0; i < jsonHabits.size(); i++){
                    Habit h = new Habit();
                    JsonObject job  = jsonHabits.get(i).getAsJsonObject();
                    h.fromJsonObject(job);
                    habitList.add(h);
                }
            }catch (Exception e){
                habitList = null;
                Log.d("ESC", "Adding habits in login.");
            }
        }else{
            habitList = null;
            DummyMainActivity.toastMe("No internet", HabitTabActivity.this);
        }
    }else {
        isFromProfile = false;
        habitList = DummyMainActivity.myHabits;
    }
    myHabitsListView = (ListView) findViewById(R.id.habits_listview);
    DummyMainActivity.myHabitsAdapter = new MyHabitsAdapter(HabitTabActivity.this, habitList);
    myHabitsListView.setAdapter(DummyMainActivity.myHabitsAdapter);
    DummyMainActivity.myHabitsAdapter.notifyDataSetChanged();
}
 
Example 12
Project: sealtalk-android-master   File: MultiVideoCallActivity.java   View Source Code Vote up 6 votes
@Override
protected void onNewIntent(Intent intent) {
    startForCheckPermissions = intent.getBooleanExtra("checkPermissions", false);
    if (!requestCallPermissions(RongCallCommon.CallMediaType.VIDEO, REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS)) {
        return;
    }
    initViews();
    setupIntent();
    super.onNewIntent(intent);
}
 
Example 13
Project: letv   File: MainActivity.java   View Source Code Vote up 6 votes
private boolean isFromPush(Intent intent) {
    boolean z = false;
    this.mLaunchByPush = intent.getBooleanExtra(MyDownloadActivityConfig.FROM_PUSH, false);
    if (intent.getBooleanExtra("isLivePush", false) || intent.getIntExtra("LaunchMode", 0) == 19 || intent.getIntExtra("LaunchMode", 0) == 20) {
        z = true;
    }
    this.mIsLivePush = z;
    if (this.mIsLivePush) {
        BaseApplication.getInstance().setPush(true);
    }
    return this.mLaunchByPush;
}
 
Example 14
Project: PermissionsWrapper   File: PermissionWrapper.java   View Source Code Vote up 6 votes
@Override
public void onReceive(Context context, Intent intent) {
    if (onRequestPermissionsCallBack == null) {
        return;
    }
    boolean result = intent.getBooleanExtra(Constants.GRANT, false);
    if (result) {
        onRequestPermissionsCallBack.onGrant();
    } else {
        String permission = intent.getStringExtra(Constants.DENIED);
        onRequestPermissionsCallBack.onDenied(permission);
    }
    LocalBroadcastManager.getInstance(PermissionWrapper.this.context).unregisterReceiver(callBackBroadcastReceiver);
}
 
Example 15
Project: Linphone4Android   File: NetworkManager.java   View Source Code Vote up 6 votes
@Override
public void onReceive(Context context, Intent intent) {
	ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
	Boolean lNoConnectivity = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY,false);
	if (LinphoneManager.isInstanciated()) {
		LinphoneManager.getInstance().connectivityChanged(cm, lNoConnectivity);
	}
}
 
Example 16
Project: Pocket-Plays-for-Twitch   File: VideoCastNotificationService.java   View Source Code Vote up 6 votes
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    LOGD(TAG, "onStartCommand");
    if (intent != null) {

        String action = intent.getAction();
        if (ACTION_VISIBILITY.equals(action)) {
            mVisible = intent.getBooleanExtra(NOTIFICATION_VISIBILITY, false);
            LOGD(TAG, "onStartCommand(): Action: ACTION_VISIBILITY " + mVisible);
            onRemoteMediaPlayerStatusUpdated(mCastManager.getPlaybackStatus());
            if (mNotification == null) {
                try {
                    setUpNotification(mCastManager.getRemoteMediaInformation());
                } catch (TransientNetworkDisconnectionException | NoConnectionException e) {
                    LOGE(TAG, "onStartCommand() failed to get media", e);
                }
            }
            if (mVisible && mNotification != null) {
                startForeground(NOTIFICATION_ID, mNotification);
            } else {
                stopForeground(true);
            }
        }
    }

    return Service.START_STICKY;
}
 
Example 17
Project: PeSanKita-android   File: WebRtcCallService.java   View Source Code Vote up 6 votes
private void handleBluetoothChange(Intent intent) {
  this.bluetoothAvailable = intent.getBooleanExtra(EXTRA_AVAILABLE, false);

  if (recipient != null) {
    sendMessage(viewModelStateFor(callState), recipient, localVideoEnabled, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled);
  }
}
 
Example 18
Project: letv   File: BasePlayActivity.java   View Source Code Vote up 6 votes
private void initDataFromIntent() {
    Intent intent = getIntent();
    this.mPlayType = intent.getIntExtra(PlayConstant.PLAY_TYPE, 0);
    this.mLaunchMode = intent.getIntExtra("launchMode", 0);
    this.mFromLaunch = intent.getIntExtra("from", 0);
    this.mFull = intent.getBooleanExtra(PlayConstant.LIVE_FULL_ONLY, false);
    this.mIsPanoramaVideo = intent.getSerializableExtra(PlayConstant.VIDEO_TYPE) == VideoType.Panorama;
    if (this.mLaunchMode == 0) {
        String path = null;
        if (!(getIntent() == null || getIntent().getData() == null)) {
            Uri uriPath = getIntent().getData();
            String scheme = uriPath.getScheme();
            path = (scheme == null || scheme.equals(IDataSource.SCHEME_FILE_TAG)) ? uriPath.getPath() : uriPath.toString();
        }
        this.mLaunchMode = 1;
        intent.putExtra("launchMode", 1);
        intent.putExtra(PlayConstant.URI, path);
        intent.putExtra("seek", 0);
        intent.putExtra(PlayConstant.PLAY_MODE, 1);
    }
    if (this.mFromLaunch == 13) {
        LetvApplication.getInstance().setPush(true);
    } else if (intent.getBooleanExtra("isFromPush", false)) {
        LetvApplication.getInstance().setPush(true);
    } else if (intent.getBooleanExtra("isLiveFromPush", false)) {
        LetvApplication.getInstance().setPush(true);
    }
}
 
Example 19
Project: letv   File: KVUtils.java   View Source Code Vote up 5 votes
public static boolean getBoolean(Intent i, String key, boolean defaultValue) {
    if (i == null || TextUtils.empty(key)) {
        return defaultValue;
    }
    return i.getBooleanExtra(key, defaultValue);
}
 
Example 20
Project: SetupWizardLibCompat   File: WizardManagerHelper.java   View Source Code Vote up 3 votes
/**
 * Check whether an intent is intended to be used within the setup wizard flow.
 *
 * @param intent The intent to be checked, usually from
 *               {@link android.app.Activity#getIntent()}.
 * @return true if the intent passed in was intended to be used with setup wizard.
 */
public static boolean isSetupWizardIntent(Intent intent) {
    return intent.getBooleanExtra(EXTRA_IS_FIRST_RUN, false);
}