Java 类android.widget.CalendarView 实例源码

项目:TrainAppTFG    文件:HistorialFragment.java   
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);
        }
    });
}
项目:FiTAbs    文件:MyCalendarActivity.java   
/**
 * 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());
    }
}
项目:android-samples    文件:InsertFragment.java   
@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();
        }

    });
}
项目:itsnat_droid    文件:ClassDescView_widget_CalendarView.java   
@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;
}
项目:itsnat_droid    文件:TestSetupAssetLayout2.java   
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);
}
项目:tabris-plugin-calendar    文件:CalendarPropertyHandler.java   
@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;
    }
  }
}
项目:ToDoList252    文件:DueDateChooserActivity.java   
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);
}
项目:senior-design-project    文件:AddEvent.java   
@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;

}
项目:Calendar_lunar    文件:EditEventView.java   
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();
}
项目:TrainAppTFG    文件:HistorialFragment.java   
@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;
}
项目:social-journal    文件:JournalCalendar.java   
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);
        }
    });
}
项目:truth-android    文件:CalendarViewSubject.java   
public static SubjectFactory<CalendarViewSubject, CalendarView> type() {
  return new SubjectFactory<CalendarViewSubject, CalendarView>() {
    @Override
    public CalendarViewSubject getSubject(FailureStrategy fs, CalendarView that) {
      return new CalendarViewSubject(fs, that);
    }
  };
}
项目:Zensuren    文件:kursbucheintragen.java   
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);
}
项目:WeMeet    文件:FirstActivity.java   
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();
    }
  });
}
项目:Utopia    文件:CalendarActivity.java   
@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();
            }
        }
    });
}
项目:itsnat_droid    文件:AttrDescView_widget_CalendarView_maxDate_minDate.java   
@Override
public void setAttribute(View view, DOMAttr attr, AttrLayoutContext attrCtx)
{
    String date = getString(attr.getResourceDesc(),attrCtx.getXMLInflaterContext());

    Object calendarObject = getCalendarObject((CalendarView)view);

    Locale currentLocale = fieldCurrentLocale.get(calendarObject);
    Calendar outDate = Calendar.getInstance(currentLocale);
    // No es necesario: outDate.clear();

    if (!TextUtils.isEmpty(date))
    {
        if (!parseDate(calendarObject,date, outDate)) // El código fuente de Android tolera un mal formato, nosotros no pues no hace más que complicarlo to_do
            throw new ItsNatDroidException("Date: " + date + " not in format: " + "MM/dd/yyyy");
    }
    else // Caso de eliminación de atributo, interpretamos el "" como el deseo de poner los valores por defecto (más o menos es así en el código fuente)
    {
        String defaultMaxMin = null;
        if ("maxDate".equals(name))
            defaultMaxMin = DEFAULT_MAX_DATE;
        else if ("minDate".equals(name))
            defaultMaxMin = DEFAULT_MIN_DATE;

        parseDate(calendarObject,defaultMaxMin, outDate);
    }

    fieldMaxMinDate.set(calendarObject,outDate);
}
项目:itsnat_droid    文件:AttrDescView_widget_CalendarView_maxDate_minDate.java   
private Object getCalendarObject(CalendarView view)
{
    if (Build.VERSION.SDK_INT < MiscUtil.LOLLIPOP)
        return view;
    else
        return fieldDelegate.get(view);
}
项目:itsnat_droid    文件:TestAssetLayout2.java   
private static Object getCalendarObject(CalendarView view)
{
    if (Build.VERSION.SDK_INT < TestUtil.LOLLIPOP)
        return view;
    else
        return calendarView_fieldDelegate.get(view);
}
项目:tabris-plugin-calendar    文件:CalendarOperator.java   
@Override
public void onSelectedDayChange(@NonNull CalendarView calendarView, int year, int month, int dayOfMonth) {
  GregorianCalendar gregorianCalendar = new GregorianCalendar(year, month, dayOfMonth);
  gregorianCalendar.setTimeZone(TimeZone.getTimeZone("UTC"));
  String date = String.valueOf(gregorianCalendar.getTimeInMillis());
  RemoteObject remoteObject = tabrisContext.getObjectRegistry().getRemoteObjectForObject(calendarView);
  remoteObject.notify("dateChanged", "date", date);
}
项目:tabris-plugin-calendar    文件:CalendarPropertyHandler.java   
@Override
public Object get(CalendarView calendarView, String property) {
  switch (property) {
    case PROP_DATE:
      return timestampToUtcMidnight(calendarView.getDate());
    case PROP_MIN_DATE:
      return timestampToUtcMidnight(calendarView.getMinDate());
    case PROP_MAX_DATE:
      return timestampToUtcMidnight(calendarView.getMaxDate());
  }
  return super.get(calendarView, property);
}
项目:ToDoList252    文件:DueDateChooserActivity.java   
@Override
public void onSelectedDayChange(CalendarView calendarView, int year, int month, int dayOfMonth) {
    if(calendarView.getDate() != startDate){ //check that a new date was selected
        String date = "";
        month++;//Calendar View starts months at 0, sql uses 1

        //update startDate
        startDate = calendarView.getDate();

        Intent intent = new Intent(getApplicationContext(), CategoryChooserActivity.class);
        intent.putExtra("coursePos", coursePos);
        intent.putExtra("dueDate", ""+year+"-"+month+"-"+dayOfMonth+" 00:00:00");
        startActivity(intent);
    }
}
项目:GitHub    文件:OldCalendarViewActivity.java   
@Override
public void onSelectedDayChange(CalendarView view, int year, int month,
                                int dayOfMonth) {
    textView.setText(FORMATTER.format(view.getDate()));
}
项目:FiTAbs    文件:MyCalendarActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    //Load previous entries
    dbHandler = new DBHandler(this);
    _Schedule = dbHandler.getAllEvents();

    //Setup widgets for easier access
    _Calendar = (CalendarView) this.findViewById(calendarView);
    _ButtonSave = (Button) this.findViewById(R.id.button8);
    _EditText = (EditText) this.findViewById(R.id.editText);
    _SelectedDay = new Day(Calendar.getInstance().get(Calendar.YEAR),
            Calendar.getInstance().get(Calendar.MONTH), Calendar.getInstance().get(Calendar.DAY_OF_MONTH));
    selectedDateChanged(_Calendar, _SelectedDay.getYear(), _SelectedDay.getMonth(), _SelectedDay.getDay());

    //Set up button
    _ButtonSave.setText(R.string.btn_edit);
    updateEditText();

    _ButtonSave.setOnClickListener(this);
    _Calendar.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
        @Override
        public void onSelectedDayChange(@NonNull CalendarView view, int year, int month, int dayOfMonth) {
            selectedDateChanged(view, year, month, dayOfMonth);
        }

    });

    //Define bottom navigation view (thats why design library in gradle was imported)
    BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById (R.id.bottom_navigation);

    //Display right icon
    bottomNavigationView.getMenu().getItem(2).setChecked(true);

    //Define Bottom navigation view listener
    bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {

        //Selected icon(item) - changes to the appropriate view
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            dbHandler.saveAllEvents(_Schedule);
            switch (item.getItemId())
            {
                //Contacts
                case R.id.action_contacts:
                    startActivity(new Intent(MyCalendarActivity.this, ContactsActivity.class));
                    break;

                //Exercise
                case R.id.action_exercise:
                    startActivity(new Intent(MyCalendarActivity.this, GroupsOfExercisesActivity.class));
                    break;

                //Calendar
                case R.id.action_calendar:
                    break;

                //Settings
                case R.id.action_settings:
                    startActivity(new Intent(MyCalendarActivity.this, UserSettingsActivity.class));
                    break;
            }
            return true;
        }
    });


}
项目:calendarview2    文件:OldCalendarViewActivity.java   
@Override
public void onSelectedDayChange(CalendarView view, int year, int month,
                                int dayOfMonth) {
    textView.setText(FORMATTER.format(view.getDate()));
}
项目:AlwaysOnDisplayAmoled    文件:DateView.java   
public CalendarView getCalendarView() {
    return calendarView;
}
项目:truth-android    文件:CalendarViewSubject.java   
protected CalendarViewSubject(FailureStrategy failureStrategy, CalendarView subject) {
  super(failureStrategy, subject);
}
项目:Zensuren    文件:kursbuchbearbeiten.java   
protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.kursbucheintrag);
    eintragnummer = getIntent().getStringExtra("peid");
    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);
    CalendarView calendarView=(CalendarView) findViewById(R.id.calendarView);

    calendarView.setOnDateChangeListener(new CalendarView.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

        }
    });
    dm = new DataManipulator(this);

    String[] datensatz = dm.getkursmappeneintrag(eintragnummer);

    vthema.setText(datensatz[4]);
    vhausaufgabe.setText(datensatz[5]);
    if(datensatz[3].equals("1")){
        vdoppelstunde.setText("Einzelstunde");
    }else{
        vdoppelstunde.setText("Doppelstunde");
    }


    String[]datumzerteilt = new String[4];
    datumzerteilt = datensatz[2].split("\\.");
    Calendar myCal2 = new GregorianCalendar();
    pjahr = Integer.parseInt(datumzerteilt[2]);
    pmonat = Integer.parseInt(datumzerteilt[1])-1;
    ptag = Integer.parseInt(datumzerteilt[0]);
    myCal2.set(pjahr, pmonat, ptag);
    calendarView.setDate(myCal2.getTimeInMillis());
    //vdatum.updateDate(Integer.parseInt(datumzerteilt[2]), Integer.parseInt(datumzerteilt[1])-1, Integer.parseInt(datumzerteilt[0]));


    vkurs.setText("Eintrag ändern / löschen");
    vspeichern.setOnClickListener(this);
    vdoppelstunde.setOnClickListener(this);
    vliste.setText("Eintrag löschen");
    vliste.setOnClickListener(this);

}
项目:ticdesign    文件:DatePicker.java   
@Override
public CalendarView getCalendarView() {
    return mCalendarView;
}
项目:anvil-examples    文件:CalendarLayout.java   
public void onDateChanged(CalendarView v, int y, int m, int d) {
    dateInMillis = new GregorianCalendar(y, m, d).getTimeInMillis();
}
项目:itsnat_droid    文件:AttrDescView_widget_CalendarView_maxDate_minDate.java   
public AttrDescView_widget_CalendarView_maxDate_minDate(ClassDescViewBased parent, String name)
{
    super(parent,name);

    Class calendarClassWithCurrentLocale,calendarClassWithParseDate,calendarClassWithMaxMinDate;
    if (Build.VERSION.SDK_INT < MiscUtil.LOLLIPOP) // < 21
    {
        calendarClassWithCurrentLocale = parent.getDeclaredClass(); // CalendarView
        calendarClassWithParseDate = calendarClassWithCurrentLocale;
        calendarClassWithMaxMinDate = calendarClassWithCurrentLocale;
    }
    else // Lollipop y superiores
    {
        this.fieldDelegate = new FieldContainer<Object>(parent.getDeclaredClass(), "mDelegate");
        calendarClassWithCurrentLocale = MiscUtil.resolveClass(CalendarView.class.getName() + "$AbstractCalendarViewDelegate");
        if (Build.VERSION.SDK_INT == MiscUtil.LOLLIPOP) // 21 (5.0)
        {
            calendarClassWithParseDate = MiscUtil.resolveClass(CalendarView.class.getName() + "$LegacyCalendarViewDelegate");
            calendarClassWithMaxMinDate = calendarClassWithParseDate;
        }
        else if (Build.VERSION.SDK_INT == MiscUtil.LOLLIPOP_MR1) // 22 (5.1)
        {
            // mDelegate puede ser un objeto android.widget.CalendarViewLegacyDelegate o android.widget.CalendarViewMaterialDelegate (ambas clases autónomas) dependiendo
            // de un  MODE_HOLO o MODE_MATERIAL, NO SOPORTAMOS por ahora MODE_MATERIAL por lo que se creará un CalendarViewLegacyDelegate
            calendarClassWithParseDate = calendarClassWithCurrentLocale; // parseDate está ya en $AbstractCalendarViewDelegate
            calendarClassWithMaxMinDate = MiscUtil.resolveClass("android.widget.CalendarViewLegacyDelegate"); // CalendarViewLegacyDelegate no está ya embebida en CalendarView, es autónoma
        }
        else // 23 en adelante
        {
            calendarClassWithParseDate = parent.getDeclaredClass(); // CalendarView
            calendarClassWithMaxMinDate = MiscUtil.resolveClass("android.widget.CalendarViewLegacyDelegate"); // CalendarViewLegacyDelegate no está ya embebida en CalendarView, es autónoma
        }
    }

    this.fieldCurrentLocale = new FieldContainer<Locale>(calendarClassWithCurrentLocale, "mCurrentLocale");
    this.methodParseDate = new MethodContainer<Boolean>(calendarClassWithParseDate,"parseDate",new Class[]{String.class,Calendar.class});

    String fieldName = null;
    if ("maxDate".equals(name))
        fieldName = "mMaxDate";
    else if ("minDate".equals(name))
        fieldName = "mMinDate";
    this.fieldMaxMinDate = new FieldContainer<Calendar>(calendarClassWithMaxMinDate,fieldName);
}
项目:material-hijri-calendarview    文件:OldCalendarViewActivity.java   
@Override
public void onSelectedDayChange(CalendarView view, int year, int month,
                                int dayOfMonth) {
    textView.setText(FORMATTER.format(view.getDate()));
}
项目:material-calendarview    文件:OldCalendarViewActivity.java   
@Override
public void onSelectedDayChange(CalendarView view, int year, int month,
                                int dayOfMonth) {
    textView.setText(FORMATTER.format(view.getDate()));
}
项目:tabris-plugin-calendar    文件:CalendarOperator.java   
@Override
public PropertyHandler<CalendarView> getPropertyHandler(CalendarView object) {
  return propertyHandler;
}
项目:tabris-plugin-calendar    文件:CalendarOperator.java   
@Override
public CalendarView createView(Properties properties) {
  CalendarView calendarView = new CalendarView(activity);
  calendarView.setOnDateChangeListener(new OnDateChangeListener());
  return calendarView;
}
项目:FCM    文件:PaginaCalendario.java   
@SuppressLint({"NewApi","ResourceAsColor"})
private void mostrarEventos(){
    calendario=(CalendarView) findViewById(R.id.calendario_eventos);
    calendario.setFirstDayOfWeek(Calendar.MONDAY); //Hacemos que el primer d�a de la semana sea Lunes
    calendario.setShowWeekNumber(false); //Ocultamos el n�mero de la semana

    //Obtenemos la resoluci�n de pantalla y cambiamos la altura del calendario si fuera necesario
    DisplayMetrics sizeScreen=new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(sizeScreen);
    int altoPantalla=sizeScreen.heightPixels;

    if(altoPantalla<800){ //Comprueba que la pantalla sea menor a 800p de altura
        //800 es el tama�o de la pantalla de desarrollo con margenes
        int altoCalendario=800-altoPantalla; //Obtenemos la diferencia del tama�o de la pantalla actual
        altoCalendario=640-altoCalendario; //Obtenemos la nueva altura del calendario

        //Hacemos que la altura cuadre con la resoluci�n de nuestro dispositivo
        LinearLayout.LayoutParams propiedades=(LinearLayout.LayoutParams) calendario.getLayoutParams();
        propiedades.height=altoCalendario;
        calendario.setLayoutParams(propiedades);
    }

    //Declaramos la variables que har�n de botones
    botonAgregarEntrenamiento=findViewById(R.id.boton_agregar_entrenamiento);
    botonVerEntrenamiento=findViewById(R.id.boton_ver_entrenamiento);
    botonEditarEntrenamiento=findViewById(R.id.boton_editar_entrenamiento);
    botonBorrarEntrenamiento=findViewById(R.id.boton_borrar_entrenamiento);
    botonAgregarPartido=findViewById(R.id.boton_agregar_partido);
    botonVerPartido=findViewById(R.id.boton_ver_partido);
    botonEditarPartido=findViewById(R.id.boton_editar_partido);
    botonBorrarPartido=findViewById(R.id.boton_borrar_partido);

    //Declaramos las imagenes que haran a funci�n de herramientas para los eventos
    agregarEventoEntrenamiento=(ImageView) findViewById(R.id.agregar_evento_entrenamiento);
    verEstadisticasEntrenamiento=(ImageView) findViewById(R.id.ver_estadisticas_entrenamiento);
    editarEventoEntrenamiento=(ImageView) findViewById(R.id.editar_evento_entrenamiento);
    borrarEventoEntrenamiento=(ImageView) findViewById(R.id.borrar_evento_entrenamiento);
    agregarEventoPartido=(ImageView) findViewById(R.id.agregar_evento_partido);
    verEstadisticasPartido=(ImageView) findViewById(R.id.ver_estadisticas_partido);
    editarEventoPartido=(ImageView) findViewById(R.id.editar_evento_partido);
    borrarEventoPartido=(ImageView) findViewById(R.id.borrar_evento_partido);

    //Registramos los controles de borrar como men�s contextuales
    registerForContextMenu(borrarEventoEntrenamiento);
    registerForContextMenu(borrarEventoPartido);

    fechaActual=getFechaActual(); //Fecha actual
    fechaSeleccionada=fechaActual; //Igualamos la fecha actual a la fecha seleccionada

    accionesMostrarEventos(fechaSeleccionada); //Imagenes desactivadas y activadas

    accionesHerramientasEventos(); //Acciones de las imagenes

    calendario.setOnDateChangeListener(new OnDateChangeListener(){
        @Override
        public void onSelectedDayChange(CalendarView arg, int year, int mes, int dia){
            mes=mes+1; //Le debemos sumar 1 al mes porque va solo del 0 al 11
            String month="0";
            if(mes<10){ //Si el mes es fechaInferior a 2 cifras, le agregamos un 0 delante para mantener el formato
                month=month.concat(String.valueOf(mes));
            }else{
                month=String.valueOf(mes);
            }

            String day="0";
            if(dia<10){
                day=day.concat(String.valueOf(dia));
            }else{
                day=String.valueOf(dia);
            }

            fechaSeleccionada=year+"-"+month+"-"+day;
            accionesMostrarEventos(fechaSeleccionada);
        }
    });
}
项目:panther    文件:CalendarActivity.java   
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 Sunday as the first day of the Calendar
    calendar.setFirstDayOfWeek(1);

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

    //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.light_yellow);
    calendar.setClickable(true);
    /*
    calendar.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.d("Info", "CLICKCKCKC");
            Date date = new Date(calendar.getDate());
            java.util.Calendar cal = java.util.Calendar.getInstance();
            cal.setTime(date);
            int day = cal.get(java.util.Calendar.DAY_OF_MONTH);
            int month = cal.get(java.util.Calendar.MONTH);
            int year = cal.get(java.util.Calendar.YEAR);
            Toast.makeText(getApplicationContext(), day + "/" + month + "/" + year, Toast.LENGTH_LONG).show();
            Intent intent = new Intent("com.thunderpanther.panther.DayViewActivity");
            if(taskSelected == true) {
                intent.putExtra("id", selectedTask.id);
                intent.putExtra("name", selectedTask.name);
                intent.putExtra("depth", selectedTask.depth);
                Log.d("cal", "taskSelected: " + selectedTask.name);
                selectedTask = null;
                taskSelected = false;

            } else {
                intent.putExtra("id", -1);
            }
            intent.putExtra("year", year);
            intent.putExtra("month", month);
            intent.putExtra("day", day);

            startActivity(intent);
        }
    });
    */

    //sets the listener to be notified upon selected date change.
    calendar.setOnDateChangeListener(new 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();
            Intent intent = new Intent("com.thunderpanther.panther.DayViewActivity");
            if(taskSelected == true) {
                intent.putExtra("id", selectedTask.id);
                intent.putExtra("name", selectedTask.name);
                intent.putExtra("depth", selectedTask.depth);
                Log.d("cal", "taskSelected: " + selectedTask.name);
                selectedTask = null;
                taskSelected = false;

            } else {
                intent.putExtra("id", -1);
            }
            intent.putExtra("year", year);
            intent.putExtra("month", month);
            intent.putExtra("day", day);

            startActivity(intent);
        }
    });
}
项目:assertj-android    文件:CalendarViewAssert.java   
public CalendarViewAssert(CalendarView actual) {
  super(actual, CalendarViewAssert.class);
}
项目:ticdesign    文件:DatePicker.java   
/**
 * Gets the {@link CalendarView}.
 * <p>
 * This method returns {@code null} when the
 * {@link android.R.attr#datePickerMode} attribute is set
 * to {@code calendar}.
 *
 * @return The calendar view.
 * @see #getCalendarViewShown()
 */
public CalendarView getCalendarView() {
    return mDelegate.getCalendarView();
}
项目:bhammer-android-old    文件:BDatePicker.java   
/**
 * Gets the {@link android.widget.CalendarView}.
 *
 * @return The calendar view.
 * @see #getCalendarViewShown()
 */
public CalendarView getCalendarView () {
    return mCalendarView;
}
项目:ticdesign    文件:DatePicker.java   
CalendarView getCalendarView();