Java Code Examples for android.os.Bundle#getInt()

The following examples show how to use android.os.Bundle#getInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlayerActivity.java    From AndroidDemoProjects with Apache License 2.0 6 votes vote down vote up
private void startVideoPlayer() {
    Bundle bundle = getIntent().getExtras();
    mSelectedMovie = (Movie) getIntent().getSerializableExtra( VideoDetailsFragment.EXTRA_MOVIE );

    if( mSelectedMovie == null || TextUtils.isEmpty( mSelectedMovie.getVideoUrl() ) || bundle == null )
        return;
    
    mShouldStartPlayback = bundle.getBoolean( VideoDetailsFragment.EXTRA_SHOULD_AUTO_START, true );
    int startPosition = bundle.getInt( EXTRA_START_POSITION, 0 );
    mVideoView.setVideoPath( mSelectedMovie.getVideoUrl() );
    if ( mShouldStartPlayback ) {
        mPlaybackState = PlaybackState.PLAYING;
        updatePlayButton( mPlaybackState );
        if ( startPosition > 0 ) {
            mVideoView.seekTo( startPosition );
        }
        mVideoView.start();
        mPlayPause.requestFocus();
        startControllersTimer();
    } else {
        updatePlaybackLocation();
        mPlaybackState = PlaybackState.PAUSED;
        updatePlayButton( mPlaybackState );
    }
}
 
Example 2
Source File: MainPage.java    From Paginize with MIT License 6 votes vote down vote up
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
  super.onRestoreInstanceState(savedInstanceState);
  int index = savedInstanceState.getInt(SAVE_INDEX);
  if (index != mSelectIndex) {
    switch (index) {
      case 0:
        mRbNavBtn1.setChecked(true);
        mTabPage1.onRestoreInstanceState(savedInstanceState);
        setInnerPage(mTabPage1, null);
        break;
      case 1:
        mRbNavBtn2.setChecked(true);
        mTabPage2.onRestoreInstanceState(savedInstanceState);
        setInnerPage(mTabPage2, null);
        break;
      case 2:
        mRbNavBtn3.setChecked(true);
        mTabPage3.onRestoreInstanceState(savedInstanceState);
        setInnerPage(mTabPage3, null);
        break;
    }

    mSelectIndex = index;
  }
}
 
Example 3
Source File: ControllerCover.java    From PlayerBase with Apache License 2.0 6 votes vote down vote up
@Override
public void onPlayerEvent(int eventCode, Bundle bundle) {
    switch (eventCode){
        case OnPlayerEventListener.PLAYER_EVENT_ON_DATA_SOURCE_SET:
            mBufferPercentage = 0;
            mTimeFormat = null;
            updateUI(0, 0);
            setBottomSeekBarState(true);
            DataSource data = (DataSource) bundle.getSerializable(EventKey.SERIALIZABLE_DATA);
            getGroupValue().putObject(DataInter.Key.KEY_DATA_SOURCE, data);
            setTitle(data);
            break;
        case OnPlayerEventListener.PLAYER_EVENT_ON_STATUS_CHANGE:
            int status = bundle.getInt(EventKey.INT_DATA);
            if(status== IPlayer.STATE_PAUSED){
                mStateIcon.setSelected(true);
            }else if(status==IPlayer.STATE_STARTED){
                mStateIcon.setSelected(false);
            }
            break;
        case OnPlayerEventListener.PLAYER_EVENT_ON_VIDEO_RENDER_START:
        case OnPlayerEventListener.PLAYER_EVENT_ON_SEEK_COMPLETE:
            mTimerUpdateProgressEnable = true;
            break;
    }
}
 
Example 4
Source File: DashboardActivity.java    From Taskbar with Apache License 2.0 6 votes vote down vote up
private void configureWidget(Intent data) {
    Bundle extras = data.getExtras();
    int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
    AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
    if(appWidgetInfo.configure != null) {
        Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
        intent.setComponent(appWidgetInfo.configure);
        intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
        startActivityForResult(intent, REQUEST_CREATE_APPWIDGET);

        SharedPreferences pref = U.getSharedPreferences(this);
        if(LauncherHelper.getInstance().isOnHomeScreen(this)
                && (!pref.getBoolean(PREF_TASKBAR_ACTIVE, false)
                || pref.getBoolean(PREF_IS_HIDDEN, false)))
            pref.edit().putBoolean(PREF_DONT_STOP_DASHBOARD, true).apply();

        shouldFinish = false;
    } else {
        createWidget(data);
    }
}
 
Example 5
Source File: WalletTransfersItemDialog.java    From android-wallet-app with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Bundle bundle = getArguments();
    address = bundle.getString("address");
    isConfirmed = bundle.getInt("isConfirmed") != 0;
    hash = bundle.getString("hash");

    return new AlertDialog.Builder(getActivity())
            .setTitle(getString(R.string.transfer))
            .setItems(R.array.listOnWalletTransfersRecyclerViewClickDialog, this)
            .create();
}
 
Example 6
Source File: PermissionsActivity.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();
    // Only do request when there is no pending request to avoid duplicated requests.
    if (mPendingRequestCode == INVALID_REQUEST_CODE) {
        final Bundle extras = getIntent().getExtras();
        final String[] permissionsToRequest =
                extras.getStringArray(EXTRA_PERMISSION_REQUESTED_PERMISSIONS);
        mPendingRequestCode = extras.getInt(EXTRA_PERMISSION_REQUEST_CODE);
        // Assuming that all supplied permissions are not granted yet, so that we don't need to
        // check them again.
        PermissionsUtil.requestPermissions(this, mPendingRequestCode, permissionsToRequest);
    }
}
 
Example 7
Source File: DialogFragment.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mShowsDialog = mContainerId == 0;

    if (savedInstanceState != null) {
        mStyle = savedInstanceState.getInt(SAVED_STYLE, STYLE_NORMAL);
        mTheme = savedInstanceState.getInt(SAVED_THEME, 0);
        mCancelable = savedInstanceState.getBoolean(SAVED_CANCELABLE, true);
        mShowsDialog = savedInstanceState.getBoolean(SAVED_SHOWS_DIALOG, mShowsDialog);
        mBackStackId = savedInstanceState.getInt(SAVED_BACK_STACK_ID, -1);
    }
    
}
 
Example 8
Source File: OdooActivity.java    From framework with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    mSavedInstanceState = savedInstanceState;
    if (savedInstanceState == null) {
        // Loading Default Fragment (if any)
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                IBaseFragment fragment = DrawerUtils.getDefaultDrawerFragment();
                if (fragment != null) {
                    ODrawerItem item = DrawerUtils.getStartableObject(OdooActivity.this, fragment);
                    setTitle(item.getTitle());
                    loadDrawerItemInstance(item.getInstance(), item.getExtra());
                    int selected_item = DrawerUtils.findItemIndex(item, mDrawerItemContainer);
                    if (selected_item > -1) {
                        focusOnDrawerItem(selected_item);
                    }
                }
            }
        }, DRAWER_ITEM_LAUNCH_DELAY);
    } else {
        mHasActionBarSpinner = savedInstanceState.getBoolean(KEY_HAS_ACTIONBAR_SPINNER);
        mDrawerSelectedIndex = savedInstanceState.getInt(KEY_CURRENT_DRAWER_ITEM);
        setTitle(savedInstanceState.getString(KEY_APP_TITLE));
        focusOnDrawerItem(mDrawerSelectedIndex);
    }
}
 
Example 9
Source File: HierarchySecondFragment.java    From WanAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    Bundle bundle = getArguments();
    if(bundle != null){
        mId = bundle.getInt(Constant.KEY_HIERARCHY_PAGENUM, -1);
    }
    super.onCreate(savedInstanceState);
}
 
Example 10
Source File: CircularSeekBar.java    From CircularSeekBar with Apache License 2.0 5 votes vote down vote up
@Override
protected void onRestoreInstanceState(Parcelable state) {
    Bundle savedState = (Bundle) state;

    Parcelable superState = savedState.getParcelable("PARENT");
    super.onRestoreInstanceState(superState);

    mMax = savedState.getFloat("MAX");
    mProgress = savedState.getFloat("PROGRESS");
    mCircleColor = savedState.getInt("mCircleColor");
    mCircleProgressColor = savedState.getInt("mCircleProgressColor");
    mPointerColor = savedState.getInt("mPointerColor");
    mPointerHaloColor = savedState.getInt("mPointerHaloColor");
    mPointerHaloColorOnTouch = savedState.getInt("mPointerHaloColorOnTouch");
    mPointerAlpha = savedState.getInt("mPointerAlpha");
    mPointerAlphaOnTouch = savedState.getInt("mPointerAlphaOnTouch");
    mPointerAngle = savedState.getFloat("mPointerAngle");
    mDisablePointer = savedState.getBoolean("mDisablePointer");
    mLockEnabled = savedState.getBoolean("mLockEnabled");
    mNegativeEnabled = savedState.getBoolean("mNegativeEnabled");
    mDisableProgressGlow = savedState.getBoolean("mDisableProgressGlow");
    mIsInNegativeHalf = savedState.getBoolean("mIsInNegativeHalf");
    mCircleStyle = Paint.Cap.values()[savedState.getInt("mCircleStyle")];
    mHideProgressWhenEmpty = savedState.getBoolean("mHideProgressWhenEmpty");

    initPaints();

    recalculateAll();
}
 
Example 11
Source File: ReminderUtils.java    From hr with GNU Affero General Public License v3.0 5 votes vote down vote up
public boolean cancelReminder(Date date, Bundle extra) {
    Intent myIntent = new Intent(mContext, ReminderReceiver.class);
    myIntent.putExtras(extra);
    int row_id = extra.getInt(OColumn.ROW_ID);
    AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, row_id, myIntent,
            PendingIntent.FLAG_CANCEL_CURRENT);
    alarmManager.cancel(pendingIntent);
    return true;
}
 
Example 12
Source File: BaiduNaviSuperManager.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
public void zoomToRouteBound(BNRoutePlanNode start, BNRoutePlanNode end) {
    LatLng ws = new LatLng(start.getLatitude(), start.getLongitude());
    LatLng we = new LatLng(start.getLatitude(), end.getLongitude());
    int hd = (int) DistanceUtil.getDistance(ws, we);

    LatLng hs = new LatLng(start.getLatitude(), start.getLongitude());
    LatLng he = new LatLng(end.getLatitude(), start.getLongitude());
    int vd = (int) DistanceUtil.getDistance(hs, he);
    //Log.e(TAG,"hd="+hd+",vd="+vd);
    int level = getScales(hd, vd, Math.min(start.getLatitude(), end.getLatitude()));
    MapStatusProxy ms = BNMapControllerProxy.getInstance().getMapStatus();
    //Log.e(TAG,"level="+level);
    ms._Level = level;
    double cLatitude = Math.min(start.getLatitude(), end.getLatitude()) + Math.abs((start.getLatitude() - end.getLatitude()) / 2);
    double cLogitude = Math.min(start.getLongitude(), end.getLongitude()) + Math.abs((start.getLongitude() - end.getLongitude()) / 2);
    //Log.e(TAG,"lat="+cLatitude+",lng="+cLogitude);
    Bundle b1 = ZeroZeroProxy.bala2((int) (cLogitude * 1e5), (int) (cLatitude * 1e5));
    if (b1 != null) {
        ms._CenterPtX = b1.getInt("MCx");
        ms._CenterPtY = b1.getInt("MCy");
    }
    /*if (!BNavigatorProxy.getInstance().isNaviBegin()) {
        _Yoffest = 205;
        _Xoffest = 45;
    } else {
        _Yoffest = 60;
        _Xoffest = 30;
    }
    ms._Yoffset = ScreenUtil.getInstance().dip2px(_Yoffest);
    ms._Xoffset = 0 - ScreenUtil.getInstance().dip2px(_Xoffest);*/
    if (!BNavigatorProxy.getInstance().isNaviBegin())
        ms._Yoffset = ScreenUtil.getInstance().dip2px(100);

    BNMapControllerProxy.getInstance().setMapStatus(ms, BNMapControllerProxy.AnimationType.eAnimationLevel);
}
 
Example 13
Source File: TimePickerDialog.java    From date_picker_converter with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.containsKey(KEY_INITIAL_TIME)
                && savedInstanceState.containsKey(KEY_IS_24_HOUR_VIEW)) {
        mInitialTime = savedInstanceState.getParcelable(KEY_INITIAL_TIME);
        mIs24HourMode = savedInstanceState.getBoolean(KEY_IS_24_HOUR_VIEW);
        mInKbMode = savedInstanceState.getBoolean(KEY_IN_KB_MODE);
        mTitle = savedInstanceState.getString(KEY_TITLE);
        mThemeDark = savedInstanceState.getBoolean(KEY_THEME_DARK);
        mThemeDarkChanged = savedInstanceState.getBoolean(KEY_THEME_DARK_CHANGED);
        mAccentColor = savedInstanceState.getInt(KEY_ACCENT);
        mVibrate = savedInstanceState.getBoolean(KEY_VIBRATE);
        mDismissOnPause = savedInstanceState.getBoolean(KEY_DISMISS);
        mEnableSeconds = savedInstanceState.getBoolean(KEY_ENABLE_SECONDS);
        mEnableMinutes = savedInstanceState.getBoolean(KEY_ENABLE_MINUTES);
        mOkResid = savedInstanceState.getInt(KEY_OK_RESID);
        mOkString = savedInstanceState.getString(KEY_OK_STRING);
        mOkColor = savedInstanceState.getInt(KEY_OK_COLOR);
        mCancelResid = savedInstanceState.getInt(KEY_CANCEL_RESID);
        mCancelString = savedInstanceState.getString(KEY_CANCEL_STRING);
        mCancelColor = savedInstanceState.getInt(KEY_CANCEL_COLOR);
        mVersion = (Version) savedInstanceState.getSerializable(KEY_VERSION);
        mLimiter = savedInstanceState.getParcelable(KEY_TIMEPOINTLIMITER);
        mLocale = (Locale) savedInstanceState.getSerializable(KEY_LOCALE);

        /*
        If the user supplied a custom limiter, we need to create a new default one to prevent
        null pointer exceptions on the configuration methods
        If the user did not supply a custom limiter we need to ensure both mDefaultLimiter
        and mLimiter are the same reference, so that the config methods actually
        affect the behaviour of the picker (in the unlikely event the user reconfigures
        the picker when it is shown)
         */
        mDefaultLimiter = mLimiter instanceof DefaultTimepointLimiter
                ? (DefaultTimepointLimiter) mLimiter
                : new DefaultTimepointLimiter();
    }
}
 
Example 14
Source File: ProjectListFragment.java    From Awesome-WanAndroid with Apache License 2.0 5 votes vote down vote up
@Override
protected void initEventAndData() {
    super.initEventAndData();
    setRefresh();
    Bundle bundle = getArguments();
    cid = bundle.getInt(Constants.ARG_PARAM1);
    mPresenter.getProjectListData(mCurrentPage, cid, true);
    if (CommonUtils.isNetworkConnected()) {
        showLoading();
    }
}
 
Example 15
Source File: OnAssistPlayEventHandler.java    From PlayerBase with Apache License 2.0 5 votes vote down vote up
@Override
public void requestRetry(AssistPlay assistPlay, Bundle bundle) {
    int pos = 0;
    if(bundle!=null){
        pos = bundle.getInt(EventKey.INT_DATA);
    }
    assistPlay.rePlay(pos);
}
 
Example 16
Source File: RecreationRecordingActivity.java    From android-test with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  requestWindowFeature(Window.FEATURE_NO_TITLE);

  if (savedInstanceState != null) {
    numOfCreation = savedInstanceState.getInt(KEY_NUM_OF_CREATION, 0);
  } else {
    numOfCreation = 0;
  }
}
 
Example 17
Source File: SubsonicActivity.java    From Audinaut with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    int size = savedInstanceState.getInt(Constants.MAIN_BACK_STACK_SIZE);
    String[] ids = savedInstanceState.getStringArray(Constants.MAIN_BACK_STACK);
    FragmentManager fm = getSupportFragmentManager();
    currentFragment = (SubsonicFragment) fm.findFragmentByTag(ids[0]);
    currentFragment.setPrimaryFragment(true);
    currentFragment.setSupportTag(ids[0]);
    supportInvalidateOptionsMenu();
    FragmentTransaction trans = getSupportFragmentManager().beginTransaction();
    for (int i = 1; i < size; i++) {
        SubsonicFragment frag = (SubsonicFragment) fm.findFragmentByTag(ids[i]);
        frag.setSupportTag(ids[i]);
        if (secondaryContainer != null) {
            frag.setPrimaryFragment(false, true);
        }
        trans.hide(frag);
        backStack.add(frag);
    }
    trans.commit();

    // Current fragment is hidden in secondaryContainer
    if (secondaryContainer == null && !currentFragment.isVisible()) {
        trans = getSupportFragmentManager().beginTransaction();
        trans.remove(currentFragment);
        trans.commit();
        getSupportFragmentManager().executePendingTransactions();

        trans = getSupportFragmentManager().beginTransaction();
        trans.add(R.id.fragment_container, currentFragment, ids[0]);
        trans.commit();
    }
    // Current fragment needs to be moved over to secondaryContainer
    else if (secondaryContainer != null && secondaryContainer.findViewById(currentFragment.getRootId()) == null && backStack.size() > 0) {
        trans = getSupportFragmentManager().beginTransaction();
        trans.remove(currentFragment);
        trans.show(backStack.get(backStack.size() - 1));
        trans.commit();
        getSupportFragmentManager().executePendingTransactions();

        trans = getSupportFragmentManager().beginTransaction();
        trans.add(R.id.fragment_second_container, currentFragment, ids[0]);
        trans.commit();

        secondaryContainer.setVisibility(View.VISIBLE);
    }

    lastSelectedPosition = savedInstanceState.getInt(Constants.FRAGMENT_POSITION);
    if (lastSelectedPosition != 0) {
        MenuItem item = drawerList.getMenu().findItem(lastSelectedPosition);
        if (item != null) {
            item.setChecked(true);
        }
    }
    recreateSpinner();
}
 
Example 18
Source File: CropImageActivity.java    From memoir with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.rte_crop_image);
    mImageView = (CropImageView) findViewById(R.id.image);

    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    if (extras != null) {

        if (extras.getString(CIRCLE_CROP) != null) {
            mImageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            mCircleCrop = true;
            mAspectX = 1;
            mAspectY = 1;
        }

        mImageSource = extras.getString(IMAGE_SOURCE_FILE);
        mBitmap = getBitmap(mImageSource);

        mImageDest = extras.getString(IMAGE_DESTINATION_FILE);
        if (mImageDest == null) {
            mImageDest = mImageSource;
        }
        mSaveUri = Uri.fromFile(new File(mImageDest));

        if (extras.containsKey(ASPECT_X)
                && extras.get(ASPECT_X) instanceof Integer) {
            mAspectX = extras.getInt(ASPECT_X);
        } else {
            throw new IllegalArgumentException("aspect_x must be integer");
        }
        if (extras.containsKey(ASPECT_Y)
                && extras.get(ASPECT_Y) instanceof Integer) {
            mAspectY = extras.getInt(ASPECT_Y);
        } else {
            throw new IllegalArgumentException("aspect_y must be integer");
        }
        mOutputX = extras.getInt(OUTPUT_X);
        mOutputY = extras.getInt(OUTPUT_Y);
        mScale = extras.getBoolean(SCALE, true);
        mScaleUp = extras.getBoolean(SCALE_UP_IF_NEEDED, true);
    }

    if (mBitmap == null) {
        finish();
        return;
    }

    startFaceDetection();
}
 
Example 19
Source File: DetailActivity.java    From atlas with Apache License 2.0 4 votes vote down vote up
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    initialItem = savedInstanceState.getInt(STATE_INITIAL_ITEM, 0);
    super.onRestoreInstanceState(savedInstanceState);
}
 
Example 20
Source File: RNPushNotificationAttributes.java    From react-native-push-notification-CE with MIT License 4 votes vote down vote up
/**
 * User to find notifications:
 * <p>
 * https://github.com/facebook/react-native/blob/master/Libraries/PushNotificationIOS/RCTPushNotificationManager.m#L294
 *
 * @param userInfo map of fields to match
 * @return true all fields in userInfo object match, false otherwise
 */
public boolean matches(ReadableMap userInfo) {
    Bundle bundle = toBundle();

    ReadableMapKeySetIterator iterator = userInfo.keySetIterator();
    while (iterator.hasNextKey()) {
        String key = iterator.nextKey();

        if (!bundle.containsKey(key))
            return false;

        switch (userInfo.getType(key)) {
            case Null: {
                if (bundle.get(key) != null)
                    return false;
                break;
            }
            case Boolean: {
                if (userInfo.getBoolean(key) != bundle.getBoolean(key))
                    return false;
                break;
            }
            case Number: {
                if ((userInfo.getDouble(key) != bundle.getDouble(key)) && (userInfo.getInt(key) != bundle.getInt(key)))
                    return false;
                break;
            }
            case String: {
                if (!userInfo.getString(key).equals(bundle.getString(key)))
                    return false;
                break;
            }
            case Map:
                return false;//there are no maps in the bundle
            case Array:
                return false;//there are no arrays in the bundle
        }
    }

    return true;
}