List of usage examples for android.support.v4.util SimpleArrayMap clear
public void clear()
From source file:com.appsimobile.appsii.module.appsiagenda.MonthAdapter2.java
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { MonthView v = (MonthView) holder.itemView; SimpleArrayMap<String, Integer> drawingParams; // We store the drawing parameters in the view so it can be recycled drawingParams = (SimpleArrayMap<String, Integer>) v.getTag(); if (drawingParams == null) { drawingParams = new SimpleArrayMap<>(); }/*from ww w .j a v a 2 s .co m*/ drawingParams.clear(); final int month = position % MONTHS_IN_YEAR; final int year = position / MONTHS_IN_YEAR + mController.getMinYear(); int selectedDay = -1; if (isSelectedDayInMonth(year, month)) { selectedDay = mSelectedDay.day; } // Invokes requestLayout() to ensure that the recycled view is set with the appropriate // height/number of weeks before being displayed. v.reuse(); mTime.set(1, month, year); long millis = mTime.normalize(true); int startJulianDay = Time.getJulianDay(millis, 0); drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay); drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year); drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month); drawingParams.put(MonthView.VIEW_PARAMS_START_JULIAN_DAY, startJulianDay); drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek()); v.setMonthParams(drawingParams); v.invalidate(); }
From source file:com.appsimobile.appsii.module.appsiagenda.MonthAdapter.java
@SuppressWarnings("unchecked") @Override//from ww w. j ava2s .c o m public View getView(int position, View convertView, ViewGroup parent) { MonthView v; SimpleArrayMap<String, Integer> drawingParams = null; if (convertView != null) { v = (MonthView) convertView; // We store the drawing parameters in the view so it can be recycled drawingParams = (SimpleArrayMap<String, Integer>) v.getTag(); } else { v = createMonthView(mContext); // Set up the new view LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); v.setLayoutParams(params); v.setClickable(true); v.setOnDayClickListener(this); } if (drawingParams == null) { drawingParams = new SimpleArrayMap<String, Integer>(); } drawingParams.clear(); final int month = position % MONTHS_IN_YEAR; final int year = position / MONTHS_IN_YEAR + mController.getMinYear(); int selectedDay = -1; if (isSelectedDayInMonth(year, month)) { selectedDay = mSelectedDay.day; } // Invokes requestLayout() to ensure that the recycled view is set with the appropriate // height/number of weeks before being displayed. v.reuse(); drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay); drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year); drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month); drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek()); v.setMonthParams(drawingParams); v.invalidate(); return v; }