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

The following are Jave code examples for showing how to use getInt() of the android.os.Bundle 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: SciChart.Android.Examples   File: AddRemoveSeriesFragment.java   View Source Code Vote up 6 votes
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null) {
        final int seriesCount = savedInstanceState.getInt("seriesCount");
        for (int i = 0; i < seriesCount; i++) {
            final int seriesColor = savedInstanceState.getInt("seriesColor" + i);
            final int areaColor = savedInstanceState.getInt("areaColor" + i);
            final ISciList<Double> xValues = savedInstanceState.getParcelable("xValues" + i);
            final ISciList<Double> yValues = savedInstanceState.getParcelable("yValues" + i);

            final IXyDataSeries<Double, Double> series = new XyDataSeries<>(Double.class, Double.class);
            series.append(xValues, yValues);

            final FastMountainRenderableSeries renderableSeries = sciChartBuilder.newMountainSeries()
                    .withDataSeries(series)
                    .withAreaFillColor(areaColor)
                    .withStrokeStyle(seriesColor)
                    .build();

            surface.getRenderableSeries().add(renderableSeries);
        }
    }
}
 
Example 2
Project: aliyun-cloudphotos-android-demo   File: PhotosFragment.java   View Source Code Vote up 6 votes
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle bundle = getArguments();
    if (bundle != null) {
        what = bundle.getInt("what", ContentType.PHOTO.ordinal());
        id = bundle.getLong("id", 0);
        cols = bundle.getInt("cols", 0);
    }

    setHasOptionsMenu(true);

    DisplayMetrics metrics = getResources().getDisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
    Log.d(TAG, String.valueOf(metrics.density));
    Log.d(TAG, String.valueOf(metrics.widthPixels));
    if (cols == 0) {
        cols = 4;
    }
}
 
Example 3
Project: GitHub   File: NumberProgressBar.java   View Source Code Vote up 6 votes
@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        final Bundle bundle = (Bundle) state;
        mTextColor = bundle.getInt(INSTANCE_TEXT_COLOR);
        mTextSize = bundle.getFloat(INSTANCE_TEXT_SIZE);
        mReachedBarHeight = bundle.getFloat(INSTANCE_REACHED_BAR_HEIGHT);
        mUnreachedBarHeight = bundle.getFloat(INSTANCE_UNREACHED_BAR_HEIGHT);
        mReachedBarColor = bundle.getInt(INSTANCE_REACHED_BAR_COLOR);
        mUnreachedBarColor = bundle.getInt(INSTANCE_UNREACHED_BAR_COLOR);
        initializePainters();
        setMax(bundle.getInt(INSTANCE_MAX));
        setProgress(bundle.getInt(INSTANCE_PROGRESS));
        setPrefix(bundle.getString(INSTANCE_PREFIX));
        setSuffix(bundle.getString(INSTANCE_SUFFIX));
        setProgressTextVisibility(bundle.getBoolean(INSTANCE_TEXT_VISIBILITY) ? ProgressTextVisibility.Visible : ProgressTextVisibility.Invisible);
        super.onRestoreInstanceState(bundle.getParcelable(INSTANCE_STATE));
        return;
    }
    super.onRestoreInstanceState(state);
}
 
Example 4
Project: cordova-huawei-push   File: HuaweiPushReceiver.java   View Source Code Vote up 6 votes
public void onEvent(Context context, Event event, Bundle extras) {
    if (Event.NOTIFICATION_OPENED.equals(event) || Event.NOTIFICATION_CLICK_BTN.equals(event)) {
        int notifyId = extras.getInt(BOUND_KEY.pushNotifyId, 0);
        if (0 != notifyId) {
            NotificationManager manager = (NotificationManager) context
                    .getSystemService(Context.NOTIFICATION_SERVICE);
            manager.cancel(notifyId);
        }
        String content = "receive extented notification message: " + extras.getString(BOUND_KEY.pushMsgKey);
        CordovaHuaweiPush.openNotificationId = notifyId;
        CordovaHuaweiPush.openNotificationExtras = extras.getString(BOUND_KEY.pushMsgKey);
        Log.w(CordovaHuaweiPush.TAG, content);
        CordovaHuaweiPush.notificationOpened(CordovaHuaweiPush.openNotificationId,CordovaHuaweiPush.openNotificationExtras);
        Intent launch = context.getPackageManager().getLaunchIntentForPackage(
            context.getPackageName());
        launch.addCategory(Intent.CATEGORY_LAUNCHER);
        launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        context.startActivity(launch);
    }
    super.onEvent(context, event, extras);
}
 
Example 5
Project: chat-sdk-android-push-firebase   File: ProfilePictureView.java   View Source Code Vote up 6 votes
/**
 * If the passed in state is a Bundle, an attempt is made to restore from it.
 * @param state a Parcelable containing the current state
 */
@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (state.getClass() != Bundle.class) {
        super.onRestoreInstanceState(state);
    } else {
        Bundle instanceState = (Bundle)state;
        super.onRestoreInstanceState(instanceState.getParcelable(SUPER_STATE_KEY));

        profileId = instanceState.getString(PROFILE_ID_KEY);
        presetSizeType = instanceState.getInt(PRESET_SIZE_KEY);
        isCropped = instanceState.getBoolean(IS_CROPPED_KEY);
        queryWidth = instanceState.getInt(BITMAP_WIDTH_KEY);
        queryHeight = instanceState.getInt(BITMAP_HEIGHT_KEY);

        setImageBitmap((Bitmap)instanceState.getParcelable(BITMAP_KEY));

        if (instanceState.getBoolean(PENDING_REFRESH_KEY)) {
            refreshImage(true);
        }
    }
}
 
Example 6
Project: OSchina_resources_android   File: NoteEditFragment.java   View Source Code Vote up 5 votes
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);
    Bundle bundle = getActivity().getIntent().getBundleExtra(
            SimpleBackActivity.BUNDLE_KEY_ARGS);
    if (bundle != null) {
        editData = (NotebookData) bundle.getSerializable(NOTE_KEY);
        whereFrom = bundle.getInt(NOTE_FROMWHERE_KEY, QUICK_DIALOG);
    }
}
 
Example 7
Project: Farmacias   File: MapTabFragment.java   View Source Code Vote up 5 votes
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    Utils.logD(LOG_TAG, "onCreateView:" + this);
    View view = inflater.inflate(R.layout.fragment_tab_map, container, false);
    unbinder = ButterKnife.bind(this, view);
    setUpBotomSheet();
    setUpTvPhone();
    setUpIvCall();
    setUpIvGo();
    setUpIvShare();
    setUpIvFavorite();
    setUpIvOpeningHours();
    setUpZoomControls();


    mapFragment = Utils.handleMapFragmentRecreation(getChildFragmentManager(),
            R.id.mapFragmentContainer, "mapFragment");
    mapFragment.getMapAsync(this);

    mMapFragment = mapFragment;
    if (savedInstanceState != null) {
        mRotation = true;
        mLastMarkerClicked = savedInstanceState.getParcelable(LAST_MARKER_KEY);
        mPresenter.onSetLastMarkerClick(mLastMarkerClicked);
        mBottomSheetState = savedInstanceState.getInt(BOTTOM_SHEET_STATE);
    }


    markerBitmap = Utils.getBitmapFromVectorDrawable(getActivity().getApplicationContext(), R.drawable.hospital_pin_stroke);
    mPresenter.onSetMarkerBitMap(markerBitmap);


    return view;
}
 
Example 8
Project: anitrend-app   File: ComposerActivity.java   View Source Code Vote up 5 votes
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    if(savedInstanceState != null) {
        mActionType = (KeyUtils.ActionType) savedInstanceState.getSerializable(ARG_ACTION_TYPE);
        id = savedInstanceState.getInt(ARG_ACTION_ID, 0);
        isPreviewMode = savedInstanceState.getBoolean(arg_key_is_preview);
        original = savedInstanceState.getString(arg_key_editor);
    }
}
 
Example 9
Project: springreplugin   File: PluginInfo.java   View Source Code Vote up 5 votes
/**
 * 根据MetaData来设置框架版本号 <p>
 * 注意:若为“纯APK”方案所用,则修改后需调用PluginInfoList.save来保存,否则会无效
 *
 * @param meta MetaData数据
 */
public void setFrameworkVersionByMeta(Bundle meta) {
    int dfv = RePlugin.getConfig().getDefaultFrameworkVersion();
    int frameVer = 0;
    if (meta != null) {
        frameVer = meta.getInt("com.qihoo360.framework.ver", dfv);
    }
    if (frameVer < 1) {
        frameVer = dfv;
    }
    setFrameworkVersion(frameVer);
}
 
Example 10
Project: SimpleDialogFragments   File: FlatFragmentActivity.java   View Source Code Vote up 5 votes
/**
 * Let the hosting fragment or activity implement this interface
 * to receive results from the dialog
 *
 * @param dialogTag the tag passed to {@link SimpleDialog#show}
 * @param which result type, one of {@link #BUTTON_POSITIVE}, {@link #BUTTON_NEGATIVE},
 *              {@link #BUTTON_NEUTRAL} or {@link #CANCELED}
 * @param extras the extras passed to {@link SimpleDialog#extra(Bundle)}
 * @return true if the result was handled, false otherwise
 */
@Override
public boolean onResult(@NonNull String dialogTag, int which, @NonNull Bundle extras) {

    // handle results as usual
    if (COLOR_FRAGMENT.equals(dialogTag) && which == BUTTON_POSITIVE) {
        @ColorInt int color = extras.getInt(SimpleColorDialog.COLOR);

        // Sets action bar colors
        if (getSupportActionBar() != null) {
            getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0xFF000000 | color));

            boolean dark = Color.red(color) * 0.299 + Color.green(color) * 0.587 + Color.blue(color) * 0.114 < 180;
            SpannableString s = new SpannableString(getSupportActionBar().getTitle());
            s.setSpan(new ForegroundColorSpan(dark ? Color.WHITE : Color.BLACK), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            getSupportActionBar().setTitle(s);
        }

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            float[] hsv = new float[3];
            Color.colorToHSV(color, hsv);
            hsv[2] *= 0.75;
            getWindow().setStatusBarColor(Color.HSVToColor(hsv));
        }

        return true;
    }
    return false;
}
 
Example 11
Project: GitJourney   File: GitHubJourneyWidgetConfigureActivity.java   View Source Code Vote up 5 votes
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    // Set the result to CANCELED.  This will cause the widget host to cancel
    // out of the widget placement if the user presses the back button.
    setResult(RESULT_CANCELED);

    setContentView(R.layout.git_hub_journey_widget_configure);
    mAppWidgetText = (EditText) findViewById(R.id.appwidget_text);
    findViewById(R.id.add_button).setOnClickListener(mOnClickListener);

    // Find the widget id from the intent.
    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    if (extras != null) {
        mAppWidgetId = extras.getInt(
                AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
    }

    // If this activity was started with an intent without an app widget ID, finish with an error.
    if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
        finish();
        return;
    }
    mAppWidgetText.setText(loadTitlePref(GitHubJourneyWidgetConfigureActivity.this, mAppWidgetId));
}
 
Example 12
Project: AliZhiBoHao   File: LiveCameraActivity.java   View Source Code Vote up 5 votes
private void getExtraData() {
    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        pushUrl = bundle.getString(URL);
        resolution = bundle.getInt(VIDEO_RESOLUTION);
        screenOrientation = bundle.getBoolean(SCREENORIENTATION);
        cameraFrontFacing = bundle.getInt(FRONT_CAMERA_FACING);
        mWatermark = new AlivcWatermark.Builder()
                .watermarkUrl(bundle.getString(WATERMARK_PATH))
                .paddingX(bundle.getInt(WATERMARK_DX))
                .paddingY(bundle.getInt(WATERMARK_DY))
                .site(bundle.getInt(WATERMARK_SITE))
                .build();
        minBitrate = bundle.getInt(MIN_BITRATE);
        maxBitrate = bundle.getInt(MAX_BITRATE);
        bestBitrate = bundle.getInt(BEST_BITRATE);
        initBitrate = bundle.getInt(INIT_BITRATE);
        frameRate = bundle.getInt(FRAME_RATE);
        pList = bundle.getParcelableArrayList(PRODUCT_LIST);
        eventUrl = bundle.getString(EVENT_URL);
        memberLevelId = bundle.getInt(MEMBERLEVEL_ID);
        mShareInfo = bundle.getParcelable(SHARE_INFO);
        openID = bundle.getString(OPEN_ID);
        //获取分享缩略图
        new Thread(new Runnable() {
            @Override
            public void run() {
                mBitmap = HttpUtils.getBitmapByUrl(mShareInfo.getImgUrl());
            }
        }).start();
    }
}
 
Example 13
Project: Flashcard-Maker-Android   File: MostUsedFragment.java   View Source Code Vote up 5 votes
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    if (savedInstanceState != null) {
        mHeaderDisplay = savedInstanceState
                .getInt(KEY_HEADER_POSITIONING,
                        getResources().getInteger(R.integer.default_header_display));
        mAreMarginsFixed = savedInstanceState
                .getBoolean(KEY_MARGINS_FIXED,
                        getResources().getBoolean(R.bool.default_margins_fixed));
    } else {
        mHeaderDisplay = getResources().getInteger(R.integer.default_header_display);
        mAreMarginsFixed = getResources().getBoolean(R.bool.default_margins_fixed);
    }

    db = FlashcardDb.getInstance(getActivity().getApplicationContext());
    flashcards = db.getAllFlashcards();
    Log.d(TAG, "onViewCreated: flashcards.size() = " + flashcards.size());
    rv.setLayoutManager(new LayoutManager(getActivity()));
    //OverScrollDecoratorHelper.setUpOverScroll(rv, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);
    adapter = new RVMainAdapter(getActivity(), mHeaderDisplay,
            Utils.getMostUsedFlashcards(flashcards)
    );
    adapter.setMarginsFixed(mAreMarginsFixed);
    adapter.setHeaderDisplay(mHeaderDisplay);
    rv.setAdapter(new ScaleInAnimationAdapter(new AlphaInAnimationAdapter(adapter)));

    LinearLayout noSets = (LinearLayout)view.findViewById(R.id.no_sets);
    if (Utils.getMostUsedFlashcards(flashcards).isEmpty())
        noSets.setVisibility(View.VISIBLE);
    else
        noSets.setVisibility(View.GONE);
}
 
Example 14
Project: GitHub   File: SegmentTabLayout.java   View Source Code Vote up 5 votes
@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        mCurrentTab = bundle.getInt("mCurrentTab");
        state = bundle.getParcelable("instanceState");
        if (mCurrentTab != 0 && mTabsContainer.getChildCount() > 0) {
            updateTabSelection(mCurrentTab);
        }
    }
    super.onRestoreInstanceState(state);
}
 
Example 15
Project: okwallet   File: WalletBalanceWidgetProvider.java   View Source Code Vote up 4 votes
private static void updateWidget(final Context context, final AppWidgetManager appWidgetManager,
        final int appWidgetId, final Bundle appWidgetOptions, final Coin balance) {
    final Configuration config = new Configuration(PreferenceManager.getDefaultSharedPreferences(context),
            context.getResources());
    final MonetaryFormat btcFormat = config.getFormat();

    final Spannable balanceStr = new MonetarySpannable(btcFormat.noCode(), balance).applyMarkup(null,
            MonetarySpannable.STANDARD_INSIGNIFICANT_SPANS);

    final Cursor data = context.getContentResolver().query(
            ExchangeRatesProvider.contentUri(context.getPackageName(), true), null,
            ExchangeRatesProvider.KEY_CURRENCY_CODE, new String[] { config.getExchangeCurrencyCode() }, null);
    final Spannable localBalanceStr;
    if (data != null) {
        if (data.moveToFirst()) {
            final ExchangeRate exchangeRate = ExchangeRatesProvider.getExchangeRate(data);
            final Fiat localBalance = exchangeRate.rate.coinToFiat(balance);
            final MonetaryFormat localFormat = Constants.LOCAL_FORMAT.code(0,
                    Constants.PREFIX_ALMOST_EQUAL_TO + GenericUtils.currencySymbol(exchangeRate.getCurrencyCode()));
            final Object[] prefixSpans = new Object[] { MonetarySpannable.SMALLER_SPAN,
                    new ForegroundColorSpan(context.getResources().getColor(R.color.fg_less_significant)) };
            localBalanceStr = new MonetarySpannable(localFormat, localBalance).applyMarkup(prefixSpans,
                    MonetarySpannable.STANDARD_INSIGNIFICANT_SPANS);
        } else {
            localBalanceStr = null;
        }

        data.close();
    } else {
        localBalanceStr = null;
    }

    final RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.wallet_balance_widget_content);

    final String currencyCode = btcFormat.code();
    if (MonetaryFormat.CODE_BTC.equals(currencyCode))
        views.setImageViewResource(R.id.widget_wallet_prefix, R.drawable.currency_symbol_btc);
    else if (MonetaryFormat.CODE_MBTC.equals(currencyCode))
        views.setImageViewResource(R.id.widget_wallet_prefix, R.drawable.currency_symbol_mbtc);
    else if (MonetaryFormat.CODE_UBTC.equals(currencyCode))
        views.setImageViewResource(R.id.widget_wallet_prefix, R.drawable.currency_symbol_ubtc);

    views.setTextViewText(R.id.widget_wallet_balance_btc, balanceStr);
    views.setViewVisibility(R.id.widget_wallet_balance_local, localBalanceStr != null ? View.VISIBLE : View.GONE);
    views.setTextViewText(R.id.widget_wallet_balance_local, localBalanceStr);

    if (appWidgetOptions != null) {
        final int minWidth = appWidgetOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH);
        views.setViewVisibility(R.id.widget_app_icon, minWidth > 400 ? View.VISIBLE : View.GONE);
        views.setViewVisibility(R.id.widget_button_request, minWidth > 300 ? View.VISIBLE : View.GONE);
        views.setViewVisibility(R.id.widget_button_send, minWidth > 300 ? View.VISIBLE : View.GONE);
        views.setViewVisibility(R.id.widget_button_send_qr, minWidth > 200 ? View.VISIBLE : View.GONE);
    }

    views.setOnClickPendingIntent(R.id.widget_button_balance,
            PendingIntent.getActivity(context, 0, new Intent(context, WalletActivity.class), 0));
    views.setOnClickPendingIntent(R.id.widget_button_request,
            PendingIntent.getActivity(context, 0, new Intent(context, RequestCoinsActivity.class), 0));
    views.setOnClickPendingIntent(R.id.widget_button_send,
            PendingIntent.getActivity(context, 0, new Intent(context, SendCoinsActivity.class), 0));
    views.setOnClickPendingIntent(R.id.widget_button_send_qr,
            PendingIntent.getActivity(context, 0, new Intent(context, SendCoinsQrActivity.class), 0));

    appWidgetManager.updateAppWidget(appWidgetId, views);
}
 
Example 16
Project: encdroidMC   File: EDFileChooserActivity.java   View Source Code Vote up 4 votes
protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this));
		threadErrorHandler = new ThreadErrorHandler(this.getApplicationContext()) ;
		
		setContentView(R.layout.file_chooser);

		//we come back from another activity (not from an android app restoration)
		if (savedInstanceState == null) {
			// New activity creation
			Bundle params = getIntent().getExtras();
			mMode = params.getInt(PARAM_KEY_MODE);
			mFileProvider = (EncdroidFileProvider)params.getSerializable(PARAM_KEY_PROVIDER);
			mExportFileName = params.getString(EXPORT_FILE_KEY);
			mCurrentDir = "/";
		} else {
			// Restoring previously killed activity
			mMode = savedInstanceState.getInt(PARAM_KEY_MODE);
			mFileProvider = (EncdroidFileProvider)savedInstanceState.getSerializable(PARAM_KEY_PROVIDER);
			mExportFileName = savedInstanceState.getString(EXPORT_FILE_KEY);
			mCurrentDir = savedInstanceState.getString(CUR_DIR_KEY);
		}

		mCurFileList = new ArrayList<EDFileChooserItem>();

		mPrefs = PreferenceManager.getDefaultSharedPreferences(this);


//		//we are be here:
//		//- when creating a new volume (we have to select the parent folder of the container on the distant filesystem)
//		//- when importing a new volume (we have to select the encrypted container on the distant filesystem)
//		//- when choosing a file from the local fs to upload it (with mFsType==0)
//		//starn test mFileProvider = EncdroidFileProvider.getNewProvider(mFsType, this);
//		if (mFsType==0){
//			mFileProvider=EncdroidFileProvider.getProvider(0, "", "/");
//			launchFillTask();
//		} else {
//			Intent i = new Intent(this, EDPreferenceActivity.class);
//			i.putExtra("idProvider", mFsType);
//			this.startActivityForResult(i,999);
//			//launchFillTask() is called by the intent
//		}

		launchFillTask();
		registerForContextMenu(this.getListView());

		mApp = (EDApplication) getApplication();

		if (mApp.isActionBarAvailable()) {
			mActionBar = new EDActionBar(this);
			mActionBar.setDisplayHomeAsUpEnabled(true);
		}

		mListHeader = new TextView(this);
		mListHeader.setTypeface(null, Typeface.BOLD);
		mListHeader.setTextSize(16);
		this.getListView().addHeaderView(mListHeader);
	}
 
Example 17
Project: Phoenix-for-VK   File: AbsStepsHost.java   View Source Code Vote up 4 votes
public void restoreState(Bundle saveInstanceState){
    currentStep = saveInstanceState.getInt("host_current");
    state = saveInstanceState.getParcelable("host_state");
}
 
Example 18
Project: PangciACG   File: UserActonFragment.java   View Source Code Vote up 4 votes
@Override
public void setArguments(Bundle args) {
    super.setArguments(args);
    uid = args.getString("uid");
    actions = args.getInt("actions");
}
 
Example 19
Project: Android-PickerDialog   File: BaseOptionsPickerDialog.java   View Source Code Vote up 4 votes
private void init(View v, Bundle savedInstanceState) {

        Bundle bundle = getArguments();

        int selectFirst;
        int selectSecond;
        int selectThird;

        String firstLabel = bundle.getString(LABEL_FIRST);
        String secondLabel = bundle.getString(LABEL_SECOND);
        String thirdLabel = bundle.getString(LABEL_THIRD);

        boolean firstCyclic = bundle.getBoolean(CYCLIC_FIRST, false);
        boolean secondCyclic = bundle.getBoolean(CYCLIC_SECOND, false);
        boolean thirdCyclic = bundle.getBoolean(CYCLIC_THIRD, false);

        boolean linkage = bundle.getBoolean(LINKAGE, true);

        int textSize = bundle.getInt(TEXT_SIZE, 25);

        //恢复数据
        if (savedInstanceState != null) {
            selectFirst = savedInstanceState.getInt(SELECT_FIRST, 0);
            selectSecond = savedInstanceState.getInt(SELECT_SECOND, 0);
            selectThird = savedInstanceState.getInt(SELECT_THIRD, 0);
        } else {
            selectFirst = bundle.getInt(SELECT_FIRST, 0);
            selectSecond = bundle.getInt(SELECT_SECOND, 0);
            selectThird = bundle.getInt(SELECT_THIRD, 0);
        }

        initView(v);

        // ----转轮
        final View optionspicker = v.findViewById(getPickerViewId());
        mWheelOptions = new WheelOptions<A, B, C>(optionspicker, textSize);

        mWheelOptions.setPicker(mOptions1Items, mOptions2Items, mOptions3Items, linkage);

        //获取焦点
        requestFocus();

        mWheelOptions.setLabels(firstLabel, secondLabel, thirdLabel);

        mWheelOptions.setCyclic(firstCyclic, secondCyclic, thirdCyclic);

        if (selectFirst != 0 || selectSecond != 0 || selectThird != 0) {
            mWheelOptions.setCurrentItems(selectFirst, selectSecond, selectThird);
        }

    }
 
Example 20
Project: ommvplib   File: MainPresenter.java   View Source Code Vote up 4 votes
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) bindCounter = savedInstanceState.getInt("counter");
}