Android Open Source - AerisAndroidLibrary Custom Sunmoon Holder

From Project

Back to project page AerisAndroidLibrary.


The source code is released under:

Apache License

If you think the Android project AerisAndroidLibrary listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.customendpoint;
//w  ww  . ja  v a 2s  .  c o  m
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.example.demoaerisproject.R;
import com.example.listview.AdapterHolder;
import com.hamweather.aeris.util.WeatherUtil;

public class CustomSunmoonHolder implements AdapterHolder<CustomSunmoonModel> {
  private TextView titleView;
  private TextView sunriseTextView;
  private TextView sunsetTextView;
  private TextView totalDaylightTextView;
  private TextView moonphaseTextView;
  private ProgressBar totalDaylightPBar;

  public View inflateview(LayoutInflater mInflater) {
    View v = mInflater.inflate(R.layout.view_sunmoon, null, false);
    sunriseTextView = (TextView) v.findViewById(;
    sunsetTextView = (TextView) v.findViewById(;
    totalDaylightTextView = (TextView) v
    moonphaseTextView = (TextView) v.findViewById(;
    totalDaylightPBar = (ProgressBar) v
    totalDaylightPBar.setMax(60 * 60 * 24);
    titleView = (TextView) v.findViewById(;
    return v;

  public void populateView(CustomSunmoonModel model, int position) {
        "h:mm a"));
        "h:mm a"));
    if (position == 0) {
    } else if (position == 1) {
    } else {
          "EEE dd"));

    long seconds = model.sun.set - model.sun.rise;
    long minutes = seconds % 60;
    long hours = seconds / 60 / 60;

    totalDaylightTextView.setText(String.format("%d hours,%d minutes",
        hours, minutes));
    totalDaylightPBar.setProgress((int) seconds);


Java Source Code List