use of com.suraj.waext.views.ContributionCalendarView in project WhatsappExtensions by suraj0208.
the class StatsActivity method displayContributionCalendar.
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void displayContributionCalendar(String dateString) {
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(contributionCalendarViewWidth, contributionCalendarViewHeight);
layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
layoutParams.addRule(RelativeLayout.BELOW, R.id.spinMonths);
relativeLayoutMain.removeView(contributionCalendarView);
DistributionPair distributionPair = dateStringMedianPairHashMap.get(dateString);
contributionCalendarView = new ContributionCalendarView(StatsActivity.this, contributionCalendarViewSquareSize, contributionCalendarViewSpacing, distributionPair.middleStart, distributionPair.middleEnd, dateStringTreeMapHashMap.get(dateString));
contributionCalendarView.setId(View.generateViewId());
relativeLayoutMain.addView(contributionCalendarView, layoutParams);
RelativeLayout.LayoutParams layoutParamsDay = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParamsDay.addRule(RelativeLayout.ALIGN_TOP, contributionCalendarView.getId());
layoutParamsDay.addRule(RelativeLayout.LEFT_OF, contributionCalendarView.getId());
layoutParamsDay.setMargins(0, 0, 5, 0);
relativeLayoutMain.removeView(tvDay);
tvDay = new TextView(StatsActivity.this);
tvDay.setText("Sun");
tvDay.setTextSize(10);
tvDay.setLayoutParams(layoutParamsDay);
relativeLayoutMain.addView(tvDay);
RelativeLayout.LayoutParams layoutParamsLegend = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParamsLegend.addRule(RelativeLayout.BELOW, contributionCalendarView.getId());
layoutParamsLegend.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
layoutParamsLegend.setMargins(0, 20, 0, 0);
setLegend(dateString);
linearLayoutLegend.setVisibility(View.VISIBLE);
linearLayoutLegend.setLayoutParams(layoutParamsLegend);
}
Aggregations