当前位置: 首页>>代码示例>>Java>>正文


Java TimePicker.setCurrentMinute方法代码示例

本文整理汇总了Java中android.widget.TimePicker.setCurrentMinute方法的典型用法代码示例。如果您正苦于以下问题:Java TimePicker.setCurrentMinute方法的具体用法?Java TimePicker.setCurrentMinute怎么用?Java TimePicker.setCurrentMinute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.TimePicker的用法示例。


在下文中一共展示了TimePicker.setCurrentMinute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.widget.TimePicker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_time_selection);

    Bundle extras = getIntent().getExtras();
    setTitle(extras.getInt("title"));
    //noinspection ConstantConditions
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(this, extras.getInt("color"))));

    dtpTime = (TimePicker) findViewById(R.id.timePicker);
    dtpTime.setIs24HourView(true);
    timeSelection = GregorianCalendar.getInstance();
    timeSelection.setTimeInMillis(extras.getLong("date"));
    //noinspection deprecation
    dtpTime.setCurrentHour(timeSelection.get(Calendar.HOUR_OF_DAY));
    //noinspection deprecation
    dtpTime.setCurrentMinute(timeSelection.get(Calendar.MINUTE));
}
 
开发者ID:Baleine82,项目名称:TrainPonctuality,代码行数:20,代码来源:TimeSelectionActivity.java

示例2: onCreateDialogView

import android.widget.TimePicker; //导入方法依赖的package包/类
@Override
protected View onCreateDialogView() {

    TimePicker tp = new TimePicker(getContext());
    tp.setIs24HourView(DateFormat.is24HourFormat(getContext()));
    tp.setOnTimeChangedListener(this);
    originalHour = getHour();
    originalMinute = getMinute();
    if (originalHour >= 0 && originalMinute >= 0) {
        tp.setCurrentHour(originalHour);
        tp.setCurrentMinute(originalMinute);
    }

    return tp;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:16,代码来源:TimePickerPreference.java

示例3: pickTime

import android.widget.TimePicker; //导入方法依赖的package包/类
/**
 * 时间选择对话框
 *
 * @param con      上下文
 * @param title    标题
 * @param listener 选择事件
 * @param cal      默认时间
 */
public static void pickTime(Context con, String title, Calendar cal, final OnTimeSetListener listener) {
    LinearLayout ll = new LinearLayout(con);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    ll.setLayoutParams(layoutParams);
    ll.setOrientation(LinearLayout.VERTICAL);
    //添加一条线
    LinearLayout line = new LinearLayout(con);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 1);
    line.setBackgroundColor(con.getResources().getColor(R.color.line));
    line.setLayoutParams(lp);
    ll.addView(line);
    //添加选择器控件
    final TimePicker timePicker = new TimePicker(con, null, themeId);
    timePicker.setLayoutParams(layoutParams);
    timePicker.setCurrentHour(cal.get(Calendar.HOUR_OF_DAY));
    timePicker.setCurrentMinute(cal.get(Calendar.MINUTE));
    timePicker.setIs24HourView(true);
    ll.addView(timePicker);
    QuickDialog.Builder builder = new QuickDialog.Builder(con);
    builder.setContentView(ll);
    builder.setTitle(title);
    builder.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            listener.onTimeSet(timePicker, timePicker.getCurrentHour(), timePicker.getCurrentMinute());
        }
    });
    builder.create().show();
}
 
开发者ID:quickhybrid,项目名称:quickhybrid-android,代码行数:39,代码来源:DialogUtil.java

示例4: onCreateContentView

import android.widget.TimePicker; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected View onCreateContentView(Bundle savedInstanceState) {

    picker = new TimePicker(getContext());

    if (savedInstanceState != null){
        picker.setCurrentHour(savedInstanceState.getInt(HOUR));
        picker.setCurrentMinute(savedInstanceState.getInt(MINUTE));

    } else {
        if (getArguments().containsKey(HOUR)) {
            picker.setCurrentHour(getArguments().getInt(HOUR));
        }
        if (getArguments().containsKey(MINUTE)) {
            picker.setCurrentMinute(getArguments().getInt(MINUTE));
        }
    }

    if (getArguments().containsKey(VIEW_24_HOUR)) {
        picker.setIs24HourView(getArguments().getBoolean(VIEW_24_HOUR));
    } else {
        picker.setIs24HourView(DateFormat.is24HourFormat(getContext())); // system default
    }
    picker.setOnTimeChangedListener(this);

    return picker;
}
 
开发者ID:eltos,项目名称:SimpleDialogFragments,代码行数:29,代码来源:SimpleTimeDialog.java

示例5: setTime

import android.widget.TimePicker; //导入方法依赖的package包/类
@SuppressWarnings("SameParameterValue")
public static ViewAction setTime(final int hour, final int minute) {
    return new ViewAction() {
        @Override
        public void perform(UiController uiController, View view) {
            TimePicker tp = (TimePicker) view;
            if(android.os.Build.VERSION.SDK_INT < 23) {
                //noinspection deprecation
                tp.setCurrentHour(hour);
                //noinspection deprecation
                tp.setCurrentMinute(minute);
            }
            else {
                tp.setHour(hour);
                tp.setMinute(minute);
            }
        }
        @Override
        public String getDescription() {
            return "Set the passed time into the TimePicker";
        }
        @Override
        public Matcher<View> getConstraints() {
            return ViewMatchers.isAssignableFrom(TimePicker.class);
        }
    };
}
 
开发者ID:jgevans,项目名称:TherapyGuide,代码行数:28,代码来源:SettingsActions.java

示例6: onCreateDialogView

import android.widget.TimePicker; //导入方法依赖的package包/类
@Override
protected View onCreateDialogView() {
    Context context = getContext();
    TimePicker timePicker = new TimePicker(context);
    timePicker.setIs24HourView(is24HourFormat(context));
    timePicker.setOnTimeChangedListener(this);
    timePicker.setCurrentHour(getHour());
    timePicker.setCurrentMinute(getMinute());
    return timePicker;
}
 
开发者ID:tiberiusteng,项目名称:financisto1-holo,代码行数:11,代码来源:TimePreference.java


注:本文中的android.widget.TimePicker.setCurrentMinute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。