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


Java CalendarView类代码示例

本文整理汇总了Java中android.widget.CalendarView的典型用法代码示例。如果您正苦于以下问题:Java CalendarView类的具体用法?Java CalendarView怎么用?Java CalendarView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: configuracionCalendario

import android.widget.CalendarView; //导入依赖的package包/类
private void configuracionCalendario(){
    this.calendario.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
        @Override
        public void onSelectedDayChange(@NonNull CalendarView view, int year, int month, int dayOfMonth) {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            SimpleDateFormat dateFormat2 = new SimpleDateFormat("dd/MM/yyyy");

            Calendar cal = Calendar.getInstance();
            cal.set(Calendar.YEAR, year);
            cal.set(Calendar.MONTH, month);
            cal.set(Calendar.DAY_OF_MONTH, dayOfMonth);
            Date dateRepresentation = cal.getTime();

            String dateString = dateFormat.format(dateRepresentation);
            Intent intent = new Intent(getContext(), HistorialDiaConcreto.class);
            intent.putExtra("dayToShow", dateString);
            intent.putExtra("dayToShow2", dateFormat2.format(dateRepresentation));

            startActivity(intent);
        }
    });
}
 
开发者ID:TfgReconocimientoPulseras,项目名称:TrainAppTFG,代码行数:23,代码来源:HistorialFragment.java

示例2: selectedDateChanged

import android.widget.CalendarView; //导入依赖的package包/类
/**
 * Method called when CalendarView selected date changes
 * @param view - current view
 * @param year - year selected
 * @param month - month selected
 * @param dayOfMonth - day selected
 */
private void selectedDateChanged(CalendarView view, int year, int month, int dayOfMonth){
    //Switch back to view mode
    _ButtonSave.setText(R.string.btn_edit);
    _EditText.setText("");
    updateEditText();

    closeOnScreenKeyboard(view);

    Day selectedDay = new Day(year, month, dayOfMonth);
    _SelectedDay = selectedDay;
    if(dayIsAlreadyInList(selectedDay)){
        int indexOfFoundDay = getIndexOfSpecificDay(selectedDay);
        Day day = _Schedule.get(indexOfFoundDay);
        _EditText.setText(day.getMessage());
    }
}
 
开发者ID:clicket7,项目名称:FiTAbs,代码行数:24,代码来源:MyCalendarActivity.java

示例3: onViewCreated

import android.widget.CalendarView; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    database=new DataBase(this.getContext());
    cal_doj=getActivity().findViewById(R.id.calview_doj);
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    data_date = sdf.format(new Date(cal_doj.getDate()));
    cal_doj.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
        @Override
        public void onSelectedDayChange(@NonNull CalendarView calendarView, int year, int month, int date) {
            if(month==12)
                month=1;
            else
                month=month+1;
            data_date=date + "/" + month + "/" + year;
            Toast.makeText(getContext(), date + "/" + month + "/" + year , Toast.LENGTH_SHORT).show();
        }

    });
}
 
开发者ID:kevalpatel2106,项目名称:android-samples,代码行数:21,代码来源:InsertFragment.java

示例4: createPendingViewPostCreateProcess

import android.widget.CalendarView; //导入依赖的package包/类
@Override
public PendingViewPostCreateProcess createPendingViewPostCreateProcess(final View view, ViewGroup viewParent)
{
    PendingViewPostCreateProcess pendingViewPostCreateProcess = super.createPendingViewPostCreateProcess(view, viewParent);

    pendingViewPostCreateProcess.addPendingSetAttribsTask(new Runnable()
    {
        @Override
        public void run()
        {
            // Esto es raro de narices pero es un workaround de un buggy de CalendarView al crearse programáticamente
            // o bien es por nuestra "culpa" al aplicar los atributos en un orden incorrecto, el caso es que la semana
            // actual no se selecciona, llamando a calendarView.setDate(System.currentTimeMillis()) no reacciona
            // pero sí lo hace si cambiamos mucho la fecha
            CalendarView calView = (CalendarView) view;
            long current = System.currentTimeMillis();
            calView.setDate(current - 7 * 24 * 60 * 60 * 1000);
            calView.setDate(current);
            //calView.setDate(current,true,true);
        }
    });

    return pendingViewPostCreateProcess;
}
 
开发者ID:jmarranz,项目名称:itsnat_droid,代码行数:25,代码来源:ClassDescView_widget_CalendarView.java

示例5: initialConfiguration

import android.widget.CalendarView; //导入依赖的package包/类
private static void initialConfiguration(TestActivity act, View rootView)
{
    CalendarView calendarView = (CalendarView)rootView.findViewById(R.id.calendarViewTestId);
    DatePicker datePicker = (DatePicker)rootView.findViewById(R.id.datePickerTestId);
    if ("sdk".equals( Build.PRODUCT ) || "sdk_x86".equals( Build.PRODUCT ))
    {
        // La aceleración hardware hace caer el emulador 4.0.3 en estos componentes
        // http://kevsaidwhat.blogspot.com.es/2012/09/intel-atom-emulator-crashes-with.html
        calendarView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        datePicker.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    else
    {
        // Esto es sólo por jugar para asegurar que hay un calendarView y un datePicker en estos tests
        calendarView.getLayerType();
        datePicker.getLayerType();
    }

    defineTabHost(act,rootView);
    inflateViewStub(act,rootView);
}
 
开发者ID:jmarranz,项目名称:itsnat_droid,代码行数:22,代码来源:TestSetupAssetLayout2.java

示例6: set

import android.widget.CalendarView; //导入依赖的package包/类
@Override
public void set(CalendarView calendarView, Properties properties) {
  super.set(calendarView, properties);
  for (String property : properties.getAll().keySet()) {
    switch (property) {
      case PROP_DATE:
        calendarView.setDate(Long.parseLong(properties.getString(PROP_DATE)), true, false);
        break;
      case PROP_MIN_DATE:
        calendarView.setMinDate(Long.parseLong(properties.getString(PROP_MIN_DATE)));
        break;
      case PROP_MAX_DATE:
        calendarView.setMaxDate(Long.parseLong(properties.getString(PROP_MAX_DATE)));
        break;
    }
  }
}
 
开发者ID:eclipsesource,项目名称:tabris-plugin-calendar,代码行数:18,代码来源:CalendarPropertyHandler.java

示例7: onCreate

import android.widget.CalendarView; //导入依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.duedate_chooser);

    TextView courseSelected = (TextView) findViewById(R.id.selectedCourse);

    if(getIntent().hasExtra("coursePos")){
        coursePos = getIntent().getIntExtra("coursePos", -1);
        if(coursePos < 0){ Log.d("Sean", "Invalid Course Pos"); }
    }
    else{
        coursePos = -1;
    }
    if(coursePos >= 0){
        courseSelected.setText("Course: " + User.currentUser.getCourses()[coursePos]);
    }
    else{
        courseSelected.setText("Course: ");
    }

    CalendarView calendarView = (CalendarView) findViewById(R.id.calendarview);
    startDate = calendarView.getDate();
    calendarView.setOnDateChangeListener(dateChangeListener);
}
 
开发者ID:aarya123,项目名称:ToDoList252,代码行数:25,代码来源:DueDateChooserActivity.java

示例8: onCreateDialog

import android.widget.CalendarView; //导入依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
	// Use the current date as the default date in the picker
	
	int year = currentDateTime.getYear();
	int month = currentDateTime.getMonthOfYear();
	int day = currentDateTime.getDayOfMonth();

	//Joda's month indexing is +1 compared to android.
	month--;
	// Create a new instance of DatePickerDialog
	DatePickerDialog dpdialog = 
			new DatePickerDialog(getActivity(), this, year, month, day);
	//Get the CalendarView for the DatePicker, Hide the week numbers
	CalendarView cv = dpdialog.getDatePicker().getCalendarView();
	cv.setShowWeekNumber(false);
	return dpdialog;
			
}
 
开发者ID:nalabelle,项目名称:senior-design-project,代码行数:20,代码来源:AddEvent.java

示例9: onClick

import android.widget.CalendarView; //导入依赖的package包/类
public void onClick(View v) {
    DatePickerDialog dpd = new DatePickerDialog(
            mActivity, new DateListener(v), mTime.year, mTime.month, mTime.monthDay);
    CalendarView cv = dpd.getDatePicker().getCalendarView();
    cv.setShowWeekNumber(Utils.getShowWeekNumber(mActivity));
    int startOfWeek = Utils.getFirstDayOfWeek(mActivity);
    // Utils returns Time days while CalendarView wants Calendar days
    if (startOfWeek == Time.SATURDAY) {
        startOfWeek = Calendar.SATURDAY;
    } else if (startOfWeek == Time.SUNDAY) {
        startOfWeek = Calendar.SUNDAY;
    } else {
        startOfWeek = Calendar.MONDAY;
    }
    cv.setFirstDayOfWeek(startOfWeek);
    dpd.setCanceledOnTouchOutside(true);
    dpd.show();
}
 
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:19,代码来源:EditEventView.java

示例10: onCreateView

import android.widget.CalendarView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_historial, container, false);

    this.calendario = (CalendarView) view.findViewById(R.id.calendario_historial);
    configuracionCalendario();

    return view;
}
 
开发者ID:TfgReconocimientoPulseras,项目名称:TrainAppTFG,代码行数:13,代码来源:HistorialFragment.java

示例11: initializeCalendar

import android.widget.CalendarView; //导入依赖的package包/类
private void initializeCalendar() {
    calendar = (CalendarView) findViewById(R.id.calendar);
    calendar.setFirstDayOfWeek(1); //SUNDAY
    calendar.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
        @Override
        public void onSelectedDayChange(@NonNull CalendarView view, int year, int month, int day) {
            navigateToDate(year, month, day);
        }
    });
}
 
开发者ID:cache117,项目名称:social-journal,代码行数:11,代码来源:JournalCalendar.java

示例12: type

import android.widget.CalendarView; //导入依赖的package包/类
public static SubjectFactory<CalendarViewSubject, CalendarView> type() {
  return new SubjectFactory<CalendarViewSubject, CalendarView>() {
    @Override
    public CalendarViewSubject getSubject(FailureStrategy fs, CalendarView that) {
      return new CalendarViewSubject(fs, that);
    }
  };
}
 
开发者ID:pkware,项目名称:truth-android,代码行数:9,代码来源:CalendarViewSubject.java

示例13: onCreate

import android.widget.CalendarView; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.kursbucheintrag);
    vkurs = (TextView) findViewById(R.id.textViewkurs);
    vthema = (EditText) findViewById(R.id.editTextthema);
    vhausaufgabe = (EditText) findViewById(R.id.editTextha);
    vdoppelstunde = (Button) findViewById(R.id.buttonds);
    vspeichern = (Button) findViewById(R.id.buttonspeichern);
    vliste = (Button) findViewById(R.id.buttonliste);
    // vdatum = (DatePicker) findViewById(R.id.datePicker);
    Calendar myCal2 = new GregorianCalendar();
    pjahr = myCal2.get( Calendar.YEAR  );
    pmonat = myCal2.get( Calendar.MONTH );
    ptag = myCal2.get( Calendar.DATE  );
    CalendarView calendarView=(CalendarView) findViewById(R.id.calendarView);

    calendarView.setOnDateChangeListener(new OnDateChangeListener() {
                                             @Override
                                             public void onSelectedDayChange(CalendarView view, int year, int month,
                                                                             int dayOfMonth) {
                                                 pjahr = year;
                                                 pmonat = month;
                                                 ptag = dayOfMonth;
                                                 // Toast.makeText(getApplicationContext(), ""+dayOfMonth, 0).show();// TODO Auto-generated method stub

                                             }
                                         });
    kursnummer = getIntent().getStringExtra("pkurs");
    kursname = getIntent().getStringExtra("pkursname");
    pdatum = getIntent().getStringExtra("pdatum");
    dm = new DataManipulator(this);

    if(!pdatum.equals("")){
        calendarView.setVisibility(View.INVISIBLE);
    }

    vkurs.setText("Kurs: " + kursname);
    vspeichern.setOnClickListener(this);
    vdoppelstunde.setOnClickListener(this);
}
 
开发者ID:ngbvol,项目名称:Zensuren,代码行数:41,代码来源:kursbucheintragen.java

示例14: initializeCalendar

import android.widget.CalendarView; //导入依赖的package包/类
public void initializeCalendar() {
  calendar = (CalendarView) findViewById(R.id.calendar);

  // sets whether to show the week number.
  calendar.setShowWeekNumber(false);

  // sets the first day of week according to Calendar.
  // here we set Monday as the first day of the Calendar
  calendar.setFirstDayOfWeek(2);


  //The background color for the selected week.
  calendar.setSelectedWeekBackgroundColor(getResources().getColor(R.color.green));

  //sets the color for the dates of an unfocused month.
  calendar.setUnfocusedMonthDateColor(getResources().getColor(R.color.transparent));

  //sets the color for the separator line between weeks.
  calendar.setWeekSeparatorLineColor(getResources().getColor(R.color.transparent));

  //sets the color for the vertical bar shown at the beginning and at the end of the selected date.
  calendar.setSelectedDateVerticalBar(R.color.darkgreen);

  //sets the listener to be notified upon selected date change.
  calendar.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {

    //show the selected date as a toast
    @Override
    public void onSelectedDayChange(CalendarView view, int year, int month, int day) {
      Toast.makeText(getApplicationContext(), day + "/" + month + "/" + year, Toast.LENGTH_LONG).show();
    }
  });
}
 
开发者ID:spicecoder,项目名称:WeMeet,代码行数:34,代码来源:FirstActivity.java

示例15: onCreate

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

    final CalendarView calendarView = (CalendarView)findViewById(R.id.calendar_view);
    Intent callerIntent = getIntent();
    long currentTime = callerIntent.getLongExtra("currentTime",0);
    final long millis = TimeUtil.getMillisFromTime(currentTime);
    calendarView.setDate(millis);

    Calendar cal = Calendar.getInstance();
    cal.setTime(new Date(millis));
    final int currentYear = cal.get(Calendar.YEAR);
    final int currentMonth = cal.get(Calendar.MONTH);
    final int currentDayOfMonth = cal.get(Calendar.DAY_OF_MONTH);

    calendarView.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
        @Override
        public void onSelectedDayChange(CalendarView view, int year, int month, int dayOfMonth) {
            long changedMillis = view.getDate();
            if(currentYear != year || currentMonth != month || currentDayOfMonth != dayOfMonth) {
                Intent intent = new Intent(CalendarActivity.this,MainActivity.class);
                intent.putExtra("millis", changedMillis);
                setResult(RESULT_OK, intent);
                finish();
            }
        }
    });
}
 
开发者ID:UtopiaGroup,项目名称:Utopia,代码行数:31,代码来源:CalendarActivity.java


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