Android Open Source - AerisAndroidLibrary Custom Sunmoon Holder






From Project

Back to project page AerisAndroidLibrary.

License

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;

  @Override
  public View inflateview(LayoutInflater mInflater) {
    View v = mInflater.inflate(R.layout.view_sunmoon, null, false);
    sunriseTextView = (TextView) v.findViewById(R.id.tvSunmoonDayTime);
    sunsetTextView = (TextView) v.findViewById(R.id.tvSunmoonNightTime);
    totalDaylightTextView = (TextView) v
        .findViewById(R.id.tvSunmoonTotalDaylightVal);
    moonphaseTextView = (TextView) v.findViewById(R.id.tvSunmoonMoonphase);
    totalDaylightPBar = (ProgressBar) v
        .findViewById(R.id.pbSunmoonTotalDaylight);
    totalDaylightPBar.setMax(60 * 60 * 24);
    titleView = (TextView) v.findViewById(R.id.tvSunmoonTitle);
    return v;
  }

  @Override
  public void populateView(CustomSunmoonModel model, int position) {
    sunriseTextView.setText(WeatherUtil.getFormatFromISO(model.sun.riseISO,
        "h:mm a"));
    sunsetTextView.setText(WeatherUtil.getFormatFromISO(model.sun.setISO,
        "h:mm a"));
    if (position == 0) {
      titleView.setText("Today");
    } else if (position == 1) {
      titleView.setText("Tomorrow");
    } else {
      titleView.setText(WeatherUtil.getFormatFromISO(model.dateTimeISO,
          "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);
    moonphaseTextView
        .setText(WeatherUtil.capitalize(model.moon.phase.name));
  }

}




Java Source Code List

aeris.AerisUnusedStub.java
com.example.customendpoint.CustomEndpointAdapter.java
com.example.customendpoint.CustomMoonModel.java
com.example.customendpoint.CustomSunModel.java
com.example.customendpoint.CustomSunmoonFragment.java
com.example.customendpoint.CustomSunmoonHolder.java
com.example.customendpoint.CustomSunmoonModel.java
com.example.customendpoint.CustomSunmoonResponse.java
com.example.db.MyLocLoader.java
com.example.db.MyPlace.java
com.example.db.MyPlacesDb.java
com.example.db.MyPlacesSubject.java
com.example.db.SimpleCursorLoader.java
com.example.demoaerisproject.AerisDialog.java
com.example.demoaerisproject.AerisNotification.java
com.example.demoaerisproject.BaseApplication.java
com.example.demoaerisproject.DrawerActivity.java
com.example.demoaerisproject.LocationSearchActivity.java
com.example.demoaerisproject.MyLocsActivity.java
com.example.demoaerisproject.SettingsActivity.java
com.example.edithelp.EditTextEnterListener.java
com.example.edithelp.EnterPressedDelegate.java
com.example.fragment.AerisFragment.java
com.example.fragment.AerisPrefFragment.java
com.example.fragment.ExtForecastFragment.java
com.example.fragment.HeadlessFragment.java
com.example.fragment.MapFragment.java
com.example.fragment.NearbyObsFragment.java
com.example.fragment.ObservationFragment.java
com.example.fragment.OverviewFragment.java
com.example.fragment.RecentObsFragment.java
com.example.fragment.RefreshInterface.java
com.example.fragment.SplashFragment.java
com.example.fragment.WeekendFragment.java
com.example.listview.AdapterHolder.java
com.example.listview.DayNightPeriod.java
com.example.listview.ForecastAdapter.java
com.example.listview.ForecastItemHolder.java
com.example.listview.IndexMonitorAdapter.java
com.example.listview.ListAdapter.java
com.example.listview.ObservationAdapter.java
com.example.listview.ObservationItemHolder.java
com.example.listview.ObservationPeriodAdapter.java
com.example.listview.PlacesAdapter.java
com.example.listview.PlacesItemHolder.java
com.example.listview.RecentObsHolder.java
com.example.listview.WeekendAdapter.java
com.example.listview.WeekendItemHolder.java
com.example.menudrawer.HomeFragment.java
com.example.menudrawer.NavDrawerItem.java
com.example.menudrawer.NavDrawerListAdapter.java
com.example.preference.PrefManager.java
com.example.service.NotificationService.java
com.example.service.ScreenOnReceiver.java
com.example.service.ScreenOnService.java
com.example.util.FormatUtil.java
com.example.view.DayNightView.java
com.example.view.SmallForecastView.java
com.example.view.TemperatureInfoData.java
com.example.view.TemperatureWindowAdapter.java
com.example.view.TwoPartView.java