Java 类android.widget.NumberPicker 实例源码

项目:HighSchoolScienceBowlPractice-Android    文件:StudyModeSettingsPage.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_study_mode_settings_page);

    biologyButton = (ToggleButton) findViewById(R.id.biologyButton);
    chemistryButton = (ToggleButton) findViewById(R.id.chemistryButton);
    earthAndSpaceButton = (ToggleButton) findViewById(R.id.earthAndSpaceButton);
    energyButton = (ToggleButton) findViewById(R.id.energyButton);
    mathButton = (ToggleButton) findViewById(R.id.mathButton);
    physicsButton = (ToggleButton) findViewById(R.id.physicsButton);
    randomButton = (ToggleButton) findViewById(R.id.randomButton);

    roundNumPicker = (NumberPicker) findViewById(R.id.roundNumPicker);
    roundNumPicker.setMinValue(0);
    roundNumPicker.setMaxValue(roundOptions.length-1);
    roundNumPicker.setWrapSelectorWheel(false);
    roundNumPicker.setDisplayedValues(roundOptions);

    menuButton = (Button) findViewById(R.id.menuButton);
}
项目:CatchSpy    文件:GlobalSettingsFragment.java   
@SuppressWarnings("SameParameterValue")
private void playerNumberAlert(String title, final String preferenceName, int min, int max, int default_num) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = LayoutInflater.from(getActivity());
    View mView = inflater.inflate(R.layout.dialog_number_picker, (ViewGroup) getActivity().findViewById(R.id.dialog_layout_number_picker));
    final NumberPicker numberPicker = mView.findViewById(R.id.dialog_number_picker);
    numberPicker.setMinValue(min);
    numberPicker.setMaxValue(max);
    numberPicker.setValue(default_num);
    builder.setTitle(title);
    builder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            sharedPreferences.edit().putInt(preferenceName, numberPicker.getValue()).apply();
        }
    });
    builder.setNegativeButton(android.R.string.no, null);
    builder.setView(mView);
    builder.show();
}
项目:GitHub    文件:CustomTileDimensions.java   
@OnClick(R.id.custom_tile_width_size)
public void onWidthClick() {
  final NumberPicker view = new NumberPicker(this);
  view.setMinValue(24);
  view.setMaxValue(64);
  view.setWrapSelectorWheel(false);
  view.setValue(currentTileWidth);
  new AlertDialog.Builder(this)
          .setView(view)
          .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(@NonNull DialogInterface dialog, int which) {
              currentTileWidth = view.getValue();
              widget.setTileWidthDp(currentTileWidth);
            }
          })
          .show();
}
项目:GitHub    文件:CustomTileDimensions.java   
@OnClick(R.id.custom_tile_height_size)
public void onHeightClick() {
  final NumberPicker view = new NumberPicker(this);
  view.setMinValue(24);
  view.setMaxValue(64);
  view.setWrapSelectorWheel(false);
  view.setValue(currentTileHeight);
  new AlertDialog.Builder(this)
          .setView(view)
          .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(@NonNull DialogInterface dialog, int which) {
              currentTileHeight = view.getValue();
              widget.setTileHeightDp(currentTileHeight);
            }
          })
          .show();
}
项目:GitHub    文件:DynamicSettersActivity.java   
@OnClick(R.id.button_set_tile_size)
void onTileSizeClicked() {
    final NumberPicker view = new NumberPicker(this);
    view.setMinValue(24);
    view.setMaxValue(64);
    view.setWrapSelectorWheel(false);
    view.setValue(currentTileSize);
    new AlertDialog.Builder(this)
            .setView(view)
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(@NonNull DialogInterface dialog, int which) {
                    currentTileSize = view.getValue();
                    widget.setTileSizeDp(currentTileSize);
                }
            })
            .show();
}
项目:HustEating    文件:SettingFragment.java   
/**
 * 初始化传入的moneyPicker
 *
 * @param numberPickerArrayList 需要初始化的NumPicker
 */
private void initNumPicker(ArrayList<NumberPicker> numberPickerArrayList) {
    Iterator iterator = numberPickerArrayList.iterator();
    while (iterator.hasNext()) {
        NumberPicker moneyPicker = (NumberPicker) iterator.next();
        moneyPicker.setFormatter(this);
        moneyPicker.setOnValueChangedListener(this);
        moneyPicker.setOnScrollListener(this);
        moneyPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
    }

    numberPickerArrayList.get(0).setMinValue(3);numberPickerArrayList.get(0).setMaxValue(15);//早餐的价格区间
    numberPickerArrayList.get(1).setMinValue(5);numberPickerArrayList.get(1).setMaxValue(30);//午餐的价格区间
    numberPickerArrayList.get(2).setMinValue(5);numberPickerArrayList.get(2).setMaxValue(30);//晚餐的价格区间


    numberPickerArrayList.get(0).setValue(preferences.getInt("moneyBreakfastChosen", 5));//早餐默认为5
    numberPickerArrayList.get(1).setValue(preferences.getInt("moneyLunchChosen", 10));//午饭默认为10
    numberPickerArrayList.get(2).setValue(preferences.getInt("moneyDinnerChosen", 12));//早餐默认为12

}
项目:LiveNotes    文件:KeySigDialogFragment.java   
private void initializeViews(Dialog dialog) {
    major = (ToggleButton) dialog.findViewById(R.id.major);
    minor = (ToggleButton) dialog.findViewById(R.id.minor);
    dialog.findViewById(R.id.major_parent).setOnClickListener(__ -> onMajorClicked());
    dialog.findViewById(R.id.minor_parent).setOnClickListener(__ -> onMinorClicked());

    keySigImage = (ImageView) dialog.findViewById(R.id.key_sig_image);

    key = (NumberPicker) dialog.findViewById(R.id.key);
    key.setWrapSelectorWheel(false);
    key.setMinValue(0);
    key.setMaxValue(KeySigHandler.FIFTHS.length - 1);

    major.setChecked(false);
    onMajorClicked();
    key.setOnValueChangedListener(this);
    key.setValue(6);
}
项目:orgzly-android    文件:EspressoUtils.java   
/**
 * Set value for {@link NumberPicker}
 */
public static ViewAction setNumber(final int n) {
    return new ViewAction() {
        @Override
        public void perform(UiController uiController, View view) {
            ((NumberPicker) view).setValue(n);
        }

        @Override
        public String getDescription() {
            return "Set NumberPicker value";
        }

        @Override
        public Matcher<View> getConstraints() {
            return ViewMatchers.isAssignableFrom(NumberPicker.class);
        }
    };
}
项目:OneTwo    文件:ListAdapter.java   
public ListAdapterViewHolder(View view) {
    super(view);
    mTextView = (TextView) view.findViewById(R.id.tv_object_data);
    removeButton = (Button) view.findViewById(R.id.remove_button);
    numberPicker = (NumberPicker) view.findViewById(R.id.number_picker);
    numberPicker.setMaxValue(99999);
    numberPicker.setMinValue(0);
    numberPicker.setOnScrollListener(this);
    numberPicker.setOnValueChangedListener(this);
    numberPicker.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            v.performClick();
            return true;
        }
    });
    view.setOnClickListener(this);
}
项目:HighSchoolScienceBowlPractice-Android    文件:ReaderModeSettingsPage.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_reader_mode_settings_page);

    setNumPicker = (NumberPicker) findViewById(R.id.setNumPicker);
    setNumPicker.setMinValue(0);
    setNumPicker.setMaxValue(setOptions.length-1);
    setNumPicker.setWrapSelectorWheel(false);
    setNumPicker.setDisplayedValues(setOptions);

    roundNumPicker = (NumberPicker) findViewById(R.id.roundNumPicker);
    roundNumPicker.setMinValue(0);
    roundNumPicker.setMaxValue(roundOptions.length-1);
    roundNumPicker.setWrapSelectorWheel(false);
    roundNumPicker.setDisplayedValues(roundOptions);

    tossupTimeSpinner = (Spinner) findViewById(R.id.tossupTimeSelector);
    bonusTimeSpinner = (Spinner) findViewById(R.id.bonusTimeSelector);

    menuButton = (Button) findViewById(R.id.menuButton);
}
项目:FitterNumberPicker    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(R.string.app_name);

    NumberPicker stockNumberPicker = (NumberPicker) findViewById(R.id.stock);
    stockNumberPicker.setMinValue(0);
    stockNumberPicker.setMaxValue(10);

    FitterNumberPicker defaultNumberPicker = (FitterNumberPicker) findViewById(R.id.default_number_picker);
    FitterNumberPicker customNumberPicker = (FitterNumberPicker) findViewById(R.id.custom_number_picker);

    ViewConfiguration configuration = ViewConfiguration.get(this);
    //This would be a good value to start with, then / or * to adjust
    //By default, the velocity is divided by 8, so do what you want to adjust
    int maxFlingVelocity = configuration.getScaledMaximumFlingVelocity() / 6;
    customNumberPicker.setMaximumFlingVelocity(maxFlingVelocity);
}
项目:FitterNumberPicker    文件:FitterNumberPicker.java   
/**
 * Uses reflection to access divider private attribute and override its color
 * Use Color.Transparent if you wish to hide them
 *
 * @return true if separator set, false if field was not accessible
 */
public boolean setSeparatorColor(int separatorColor) {
    this.separatorColor = separatorColor;
    if (fieldPickerDivider == null) {
        Field[] pickerFields = NumberPicker.class.getDeclaredFields();
        for (Field pf : pickerFields) {
            if (pf.getName().equals("mSelectionDivider")) {
                pf.setAccessible(true);
                fieldPickerDivider = pf;
                break;
            }
        }
    }
    if (fieldPickerDivider != null) {
        try {
            fieldPickerDivider.set(this, new ColorDrawable(separatorColor));
        } catch (IllegalAccessException | IllegalArgumentException e) {
            return false;
        }
    } else {
        return false;
    }
    return true;
}
项目:FitterNumberPicker    文件:FitterNumberPicker.java   
private boolean updateSelectorWheelPaint() {
    if (selectorWheelPaint == null) {
        try {
            Field selectorWheelPaintField = NumberPicker.class.getDeclaredField("mSelectorWheelPaint");
            selectorWheelPaintField.setAccessible(true);

            selectorWheelPaint = ((Paint) selectorWheelPaintField.get(this));
        } catch (Exception e) {
            return false;
        }
    }
    if (selectorWheelPaint != null) {
        selectorWheelPaint.setColor(textColor);
        selectorWheelPaint.setTextSize(textSize);
        invalidate();
        return true;
    }
    return false;
}
项目:aos-Video    文件:SubtitleDelayTVPicker.java   
public SubtitleDelayTVPicker(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    mContext=context;
    slaveView=null;
    final NumberPicker.Formatter twoDigitFormatter = new NumberPicker.Formatter() {
        final StringBuilder mBuilder = new StringBuilder();
        final java.util.Formatter mFmt = new java.util.Formatter(mBuilder, java.util.Locale.US);
        final Object[] mArgs = new Object[1];
        public String format(int value) {
            mArgs[0] = value;
            mBuilder.delete(0, mBuilder.length());
            mFmt.format("%02d", mArgs);
            return mFmt.toString();
        }
    };


    init();
    if (!isEnabled()) {
        setEnabled(false);
    }
}
项目:Runnest    文件:RequestChallengeDialogFragment.java   
private void setDividerColor(NumberPicker picker, int color) {

        java.lang.reflect.Field[] pickerFields = NumberPicker.class.getDeclaredFields();
        for (java.lang.reflect.Field pf : pickerFields) {
            if (pf.getName().equals("mSelectionDivider")) {
                pf.setAccessible(true);
                try {
                    ColorDrawable colorDrawable = new ColorDrawable(color);
                    pf.set(picker, colorDrawable);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                break;
            }
        }
    }
项目:calendarview2    文件:CustomTileDimensions.java   
@OnClick(R.id.custom_tile_width_size)
public void onWidthClick() {
  final NumberPicker view = new NumberPicker(this);
  view.setMinValue(24);
  view.setMaxValue(64);
  view.setWrapSelectorWheel(false);
  view.setValue(currentTileWidth);
  new AlertDialog.Builder(this)
          .setView(view)
          .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(@NonNull DialogInterface dialog, int which) {
              currentTileWidth = view.getValue();
              widget.setTileWidthDp(currentTileWidth);
            }
          })
          .show();
}
项目:calendarview2    文件:CustomTileDimensions.java   
@OnClick(R.id.custom_tile_height_size)
public void onHeightClick() {
  final NumberPicker view = new NumberPicker(this);
  view.setMinValue(24);
  view.setMaxValue(64);
  view.setWrapSelectorWheel(false);
  view.setValue(currentTileHeight);
  new AlertDialog.Builder(this)
          .setView(view)
          .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(@NonNull DialogInterface dialog, int which) {
              currentTileHeight = view.getValue();
              widget.setTileHeightDp(currentTileHeight);
            }
          })
          .show();
}
项目:calendarview2    文件:DynamicSettersActivity.java   
@OnClick(R.id.button_set_tile_size)
void onTileSizeClicked() {
    final NumberPicker view = new NumberPicker(this);
    view.setMinValue(24);
    view.setMaxValue(64);
    view.setWrapSelectorWheel(false);
    view.setValue(currentTileSize);
    new AlertDialog.Builder(this)
            .setView(view)
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(@NonNull DialogInterface dialog, int which) {
                    currentTileSize = view.getValue();
                    widget.setTileSizeDp(currentTileSize);
                }
            })
            .show();
}
项目:wallpaperboard    文件:RefreshDurationFragment.java   
private void setDividerColor (NumberPicker picker) {
    java.lang.reflect.Field[] pickerFields = NumberPicker.class.getDeclaredFields();
    for (java.lang.reflect.Field pf : pickerFields) {
        if (pf.getName().equals("mSelectionDivider")) {
            pf.setAccessible(true);
            try {
                int color = ColorHelper.getAttributeColor(getActivity(), R.attr.colorAccent);
                pf.set(picker, DrawableHelper.getTintedDrawable(
                        getActivity(), R.drawable.numberpicker_divider, color));
            } catch (Exception e) {
                LogUtil.e(Log.getStackTraceString(e));
            }
            break;
        }
    }
}
项目:iconsole-android    文件:BluetoothChatFragment.java   
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    //mConversationView = (ListView) view.findViewById(R.id.in);
    mStartButton = (Button) view.findViewById(R.id.button_start);
    mStopButton = (Button) view.findViewById(R.id.button_stop);
    mDisconnectButton = (Button) view.findViewById(R.id.button_disconnect);
    mLevel = (NumberPicker) view.findViewById(R.id.Level);
    mLevel.setMaxValue(32);
    mLevel.setMinValue(1);
    mLevel.setValue(1);
    mLevel.setWrapSelectorWheel(false);
    mLevel.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
    mSpeedText = (TextView) view.findViewById(R.id.Speed);
    mPowerText = (TextView) view.findViewById(R.id.Power);
    mRPMText = (TextView) view.findViewById(R.id.RPM);
    mDistanceText = (TextView) view.findViewById(R.id.Distance);
    mCaloriesText = (TextView) view.findViewById(R.id.Calories);
    mHFText = (TextView) view.findViewById(R.id.Heart);
    mTimeText = (TextView) view.findViewById(R.id.Time);
}
项目:MobiRNN-EMDL17    文件:PhoneActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    controlToggle = (ToggleButton) findViewById(R.id.toggle_control);

    mStatusTextView = (TextView) findViewById(R.id.tv_status);
    mStatusTextView.setMovementMethod(new ScrollingMovementMethod());
    mResultProgress = (ProgressBar) findViewById(R.id.progress);
    mResultProgress.setMax(100);

    NumberPicker picker = (NumberPicker) findViewById(R.id.number_picker);
    picker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
    picker.setOnValueChangedListener(this);
    picker.setDisplayedValues(mSampleSizes);
    picker.setMinValue(0);
    picker.setMaxValue(mSampleSizes.length - 1);
    picker.setWrapSelectorWheel(true);
    picker.setValue(0);
    mSampleSize = 1;
    Logger.i("Sample size initial value: %s", mSampleSize);

    checkPermissions();

}
项目:android-chessclock    文件:TimePickerView.java   
/**
 * Set the reference of seconds picker, its digit format and register value change listener.
 *
 * @param pickerVisible if false, removes the spinner widget.
 */
@TargetApi(11)
protected void setupSecondPicker(boolean pickerVisible) {
    mSecondPicker = (NumberPicker) findViewById(R.id.seconds);
    if (pickerVisible) {
        mSecondPicker.setMinValue(0);
        mSecondPicker.setMaxValue(59);
        mSecondPicker.setFormatter(TWO_DIGIT_FORMATTER);
        mSecondPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
            @Override
            public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
                mCurrentSecond = newVal;
            }
        });
    } else {
        mHourPicker.setVisibility(View.GONE);
    }
}
项目:android-chessclock    文件:TimePickerView.java   
/**
 * Set the reference of minute picker, its digit format and register value change listener.
 *
 * @param pickerVisible if false, removes the spinner widget.
 */
@TargetApi(11)
protected void setupMinutePicker(boolean pickerVisible) {
    mMinutePicker = (NumberPicker) findViewById(R.id.minute);
    if (pickerVisible) {
        mMinutePicker.setMinValue(0);
        mMinutePicker.setMaxValue(59);
        mMinutePicker.setFormatter(TWO_DIGIT_FORMATTER);
        mMinutePicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
            @Override
            public void onValueChange(NumberPicker spinner, int oldVal, int newVal) {
                mCurrentMinute = newVal;
            }
        });
    } else {
        mMinutePicker.setVisibility(View.GONE);
        findViewById(R.id.minute_divider).setVisibility(View.GONE);
    }
}
项目:android-chessclock    文件:TimePickerView.java   
/**
 * Set the reference of hour picker, its digit format and register value change listener.
 *
 * @param pickerVisible if false, removes the spinner widget.
 */
@TargetApi(11)
protected void setupHourPicker(boolean pickerVisible) {

    mHourPicker = (NumberPicker) findViewById(R.id.hour);
    if (pickerVisible) {
        mHourPicker.setMinValue(0);
        mHourPicker.setMaxValue(10);
        mHourPicker.setFormatter(TWO_DIGIT_FORMATTER);
        mHourPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
            @Override
            public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
                mCurrentHour = newVal;
            }
        });
    } else {
        mHourPicker.setVisibility(View.GONE);
        findViewById(R.id.hour_divider).setVisibility(View.GONE);
    }
}
项目:candybar-library    文件:CandyBarMuzeiActivity.java   
private void setDividerColor (NumberPicker picker) {
    java.lang.reflect.Field[] pickerFields = NumberPicker.class.getDeclaredFields();
    for (java.lang.reflect.Field pf : pickerFields) {
        if (pf.getName().equals("mSelectionDivider")) {
            pf.setAccessible(true);
            try {
                pf.set(picker, ContextCompat.getDrawable(this,
                        Preferences.get(this).isDarkTheme() ?
                                R.drawable.numberpicker_divider_dark :
                                R.drawable.numberpicker_divider));
            } catch (Exception e) {
                LogUtil.e(Log.getStackTraceString(e));
            }
            break;
        }
    }
}
项目:RPG-Software    文件:DiceActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_dice);
    mTextViewResult = (TextView)findViewById(R.id.textView_Result);
    Button buttonThrow = (Button)findViewById(R.id.button_throw);
    final NumberPicker numberPickerMin = (NumberPicker)findViewById(R.id.numberPickerMin);
    final NumberPicker numberPickerMax = (NumberPicker)findViewById(R.id.numberPickerMax);
    numberPickerMin.setMinValue(1);
    numberPickerMin.setMaxValue(100);
    numberPickerMax.setMinValue(1);
    numberPickerMax.setMaxValue(100);
    numberPickerMax.setValue(6);

    buttonThrow.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Dice d = new Dice(numberPickerMin.getValue(),numberPickerMax.getValue());
            int result = d.diceGenerator();
            mTextViewResult.setText("Result : " + result);
        }
    });
}
项目:MyWorld    文件:NewPeriodicCareFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_new_periodic_care, container, false);
    goalPicker = (NumberPicker) view.findViewById(R.id.goal_picker);
    punishmentPicker = (NumberPicker) view.findViewById(R.id.punishment_picker);
    lengthPicker = (NumberPicker) view.findViewById(R.id.length_picker);
    unitPicker = (NumberPicker) view.findViewById(R.id.unit_picker);
    goalPicker.setMaxValue(Integer.MAX_VALUE);
    goalPicker.setMinValue(1);
    goalPicker.setWrapSelectorWheel(false);
    punishmentPicker.setMaxValue(Integer.MAX_VALUE);
    punishmentPicker.setMinValue(0);
    punishmentPicker.setValue(1);
    punishmentPicker.setWrapSelectorWheel(false);
    lengthPicker.setMaxValue(Integer.MAX_VALUE);
    lengthPicker.setMinValue(1);
    lengthPicker.setWrapSelectorWheel(false);
    unitPicker.setDisplayedValues(getResources().getStringArray(R.array.period_units));
    unitPicker.setMaxValue(3);
    unitPicker.setMinValue(0);
    unitPicker.setValue(3);
    unitPicker.setWrapSelectorWheel(true);
    return view;
}
项目:yun2win-sdk-android    文件:ChooseDateDialog.java   
/**
 * 得到viewGroup里面的numberpicker组件
 * @param viewGroup
 * @return
 */
private List<NumberPicker> findNumberPicker(ViewGroup viewGroup){
    List<NumberPicker> npList = new ArrayList<NumberPicker>();
    View child = null;
    if(null != viewGroup){
        for(int i = 0; i < viewGroup.getChildCount(); i++){
            child = viewGroup.getChildAt(i);
            if(child instanceof NumberPicker){
                npList.add((NumberPicker)child);
            }
            else if(child instanceof LinearLayout){
                List<NumberPicker> result = findNumberPicker((ViewGroup)child);
                if(result.size()>0){
                    return result;
                }
            }
        }
    }
    return npList;
}
项目:xDrip    文件:SnoozeActivity.java   
static void SetSnoozePickerValues(NumberPicker picker, boolean above, int default_snooze) {
    String[] values=new String[snoozeValues.length];
    for(int i=0;i<values.length;i++){
        values[i]=getNameFromTime(snoozeValues[i]);
    }

    picker.setMaxValue(values.length -1);
    picker.setMinValue(0);
    picker.setDisplayedValues(values);
    picker.setWrapSelectorWheel(false);
    if(default_snooze != 0) {
        picker.setValue(getSnoozeLocatoin(default_snooze));
    } else {
        picker.setValue(getSnoozeLocatoin(getDefaultSnooze(above)));
    }
}
项目:xDrip    文件:SnoozeActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //KS if (Home.get_holo()) { setTheme(R.style.OldAppTheme); }
    setContentView(R.layout.activity_snooze);
    alertStatus = (TextView) findViewById(R.id.alert_status);
    snoozeValue = (NumberPicker) findViewById(R.id.snooze);

    prefs =  PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    doMgdl = (prefs.getString("units", "mgdl").compareTo("mgdl") == 0);

    addListenerOnButton();
    if(BgGraphBuilder.isXLargeTablet(getApplicationContext())) {
        alertStatus.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
        buttonSnooze.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
    }
    displayStatus();
}
项目:xDrip    文件:SnoozeActivity.java   
static void SetSnoozePickerValues(NumberPicker picker, boolean above, int default_snooze) {
    String[] values=new String[snoozeValues.length];
    for(int i=0;i<values.length;i++){
        values[i]=getNameFromTime(snoozeValues[i]);
    }

    picker.setMaxValue(values.length -1);
    picker.setMinValue(0);
    picker.setDisplayedValues(values);
    picker.setWrapSelectorWheel(false);
    if(default_snooze != 0) {
        picker.setValue(getSnoozeLocatoin(default_snooze));
    } else {
        picker.setValue(getSnoozeLocatoin(getDefaultSnooze(above)));
    }
}
项目:xDrip    文件:SnoozeActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Home.get_holo()) { setTheme(R.style.OldAppThemeNoTitleBar); }
    JoH.fixActionBar(this);
    setContentView(R.layout.activity_snooze);
    alertStatus = (TextView) findViewById(R.id.alert_status);
    snoozeValue = (NumberPicker) findViewById(R.id.snooze);

    prefs =  PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    doMgdl = (prefs.getString("units", "mgdl").compareTo("mgdl") == 0);

    addListenerOnButton();
    if(BgGraphBuilder.isXLargeTablet(getApplicationContext())) {
        alertStatus.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
        buttonSnooze.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
    }
    displayStatus();
}
项目:xDrip-plus    文件:SnoozeActivity.java   
static void SetSnoozePickerValues(NumberPicker picker, boolean above, int default_snooze) {
    String[] values=new String[snoozeValues.length];
    for(int i=0;i<values.length;i++){
        values[i]=getNameFromTime(snoozeValues[i]);
    }

    picker.setMaxValue(values.length -1);
    picker.setMinValue(0);
    picker.setDisplayedValues(values);
    picker.setWrapSelectorWheel(false);
    if(default_snooze != 0) {
        picker.setValue(getSnoozeLocatoin(default_snooze));
    } else {
        picker.setValue(getSnoozeLocatoin(getDefaultSnooze(above)));
    }
}
项目:xDrip-plus    文件:SnoozeActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //KS if (Home.get_holo()) { setTheme(R.style.OldAppTheme); }
    setContentView(R.layout.activity_snooze);
    alertStatus = (TextView) findViewById(R.id.alert_status);
    snoozeValue = (NumberPicker) findViewById(R.id.snooze);

    prefs =  PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    doMgdl = (prefs.getString("units", "mgdl").compareTo("mgdl") == 0);

    addListenerOnButton();
    if(BgGraphBuilder.isXLargeTablet(getApplicationContext())) {
        alertStatus.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
        buttonSnooze.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
    }
    displayStatus();
}
项目:xDrip-plus    文件:SnoozeActivity.java   
static void SetSnoozePickerValues(NumberPicker picker, boolean above, int default_snooze) {
    String[] values=new String[snoozeValues.length];
    for(int i=0;i<values.length;i++){
        values[i]=getNameFromTime(snoozeValues[i]);
    }

    picker.setMaxValue(values.length -1);
    picker.setMinValue(0);
    picker.setDisplayedValues(values);
    picker.setWrapSelectorWheel(false);
    if(default_snooze != 0) {
        picker.setValue(getSnoozeLocatoin(default_snooze));
    } else {
        picker.setValue(getSnoozeLocatoin(getDefaultSnooze(above)));
    }
}
项目:xDrip-plus    文件:SnoozeActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Home.get_holo()) { setTheme(R.style.OldAppThemeNoTitleBar); }
    JoH.fixActionBar(this);
    setContentView(R.layout.activity_snooze);
    alertStatus = (TextView) findViewById(R.id.alert_status);
    snoozeValue = (NumberPicker) findViewById(R.id.snooze);

    prefs =  PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    doMgdl = (prefs.getString("units", "mgdl").compareTo("mgdl") == 0);

    addListenerOnButton();
    if(BgGraphBuilder.isXLargeTablet(getApplicationContext())) {
        alertStatus.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
        buttonSnooze.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
    }
    displayStatus();
}
项目:DialogAlchemy    文件:NumberPickerStone.java   
@Override
public void bindView(Dialog dialog) {
    textView = (TextView) dialog.findViewById(R.id.description);
    numberPicker = (NumberPicker) dialog.findViewById(R.id.number_picker);

    textView.setText(description);

    numberPicker.setMaxValue(maxValue != null ? maxValue : 24);
    numberPicker.setMinValue(minValue != null ? minValue : 1);
    numberPicker.setOnLongPressUpdateInterval(100);
    numberPicker.setWrapSelectorWheel(false);
    if (currentValue != null) {
        numberPicker.setValue(currentValue);
    }
    if (!canUseKeyBoard) {
        numberPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
    }
}
项目:YingBeautyNote    文件:DateTimePicker.java   
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
    int minValue = mMinuteSpinner.getMinValue();
    int maxValue = mMinuteSpinner.getMaxValue();
    int offset = 0;
    if (oldVal == maxValue && newVal == minValue) {
        offset += 1;
    } else if (oldVal == minValue && newVal == maxValue) {
        offset -= 1;
    }
    if (offset != 0) {
        mDate.add(Calendar.HOUR_OF_DAY, offset);
        mHourSpinner.setValue(getCurrentHour());
        updateDateControl();
        int newHour = getCurrentHourOfDay();
        if (newHour >= HOURS_IN_HALF_DAY) {
            mIsAm = false;
            updateAmPmControl();
        } else {
            mIsAm = true;
            updateAmPmControl();
        }
    }
    mDate.set(Calendar.MINUTE, newVal);
    onDateTimeChanged();
}
项目:medical-data-android    文件:TestActivity.java   
/**
 * Auxiliar function to get questions 8 to 10 value and set an error if they have not been
 * answered.
 *
 * @param i     Number of question
 * @param id    {@link RatingStars} id
 * @param text  {@link TextView} id of the question title
 * @param error {@link TextView} title of the first question title whose question has an error
 * @return <code>true</code> if an error was set; <code>false</code> otherwise.
 */
private TextView NumberPickerAnswered(int i, int id, int text, TextView error) {
    NumberPicker np = (NumberPicker) findViewById(id);
    int value = np.getValue();
    TextView tv = (TextView) findViewById(text);
    if (value == 0) {
        tv.setError("");
        if (error == null) {
            return tv;
        }
    } else {
        questions[i] = ((i == 7) ? (value - 1) * 10 : (value - 1));
        tv.setError(null);
    }
    return error;
}
项目:msb-android    文件:SelectCityDialogV11.java   
@Override
protected void initPicker() {
    mProvincePicker = (NumberPicker) findViewById(R.id.province);
    mCityPicker = (NumberPicker) findViewById(R.id.city);

    mProvincePicker.setDisplayedValues(mProvinceNames);
    mProvincePicker.setMinValue(0);
    mProvincePicker.setMaxValue(mAreas.size() - 1);
    mProvincePicker.setOnValueChangedListener(this);

    int provinceIndex = getDefaultProvinceIndex(mProvince);
    mProvincePicker.setValue(provinceIndex);

    updateCityPicker(provinceIndex);

    int cityIndex = getDefaultCityIndex(provinceIndex, mCity);
    mCityPicker.setValue(cityIndex);
}