Search in sources :

Example 1 with ContributionCalendarView

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);
}
Also used : ContributionCalendarView(com.suraj.waext.views.ContributionCalendarView) RelativeLayout(android.widget.RelativeLayout) TextView(android.widget.TextView) TargetApi(android.annotation.TargetApi)

Aggregations

TargetApi (android.annotation.TargetApi)1 RelativeLayout (android.widget.RelativeLayout)1 TextView (android.widget.TextView)1 ContributionCalendarView (com.suraj.waext.views.ContributionCalendarView)1