Android Open Source - AerisAndroidLibrary Weekend Fragment

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.fragment;
// w ww .  j a va 2  s  .c  o m
import java.util.ArrayList;
import java.util.List;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.example.demoaerisproject.R;
import com.example.listview.DayNightPeriod;
import com.example.listview.WeekendAdapter;
import com.hamweather.aeris.communication.AerisCallback;
import com.hamweather.aeris.communication.EndpointType;
import com.hamweather.aeris.model.AerisResponse;
import com.hamweather.aeris.response.ForecastsResponse;

public class WeekendFragment extends AerisFragment implements AerisCallback {
  ListView listView;
  WeekendAdapter adapter;
  private List<DayNightPeriod> periods;

  public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_extforecast,
        container, false);
    listView = (ListView) rootView;
    return rootView;

  public void onResult(EndpointType endpoint, AerisResponse response) {
    if (listView == null) {
    if (endpoint == EndpointType.FORECASTS) {
      if (response.isSuccessfulWithResponses()) {
        ForecastsResponse fResponse = new ForecastsResponse(
        periods = new ArrayList<DayNightPeriod>();

        for (int i = 0; i < fResponse.getPeriodsSize(); i = i + 2) {
          periods.add(new DayNightPeriod(fResponse.getPeriod(i),
              fResponse.getPeriod(i + 1)));
        if (adapter == null) {
          adapter = new WeekendAdapter(periods, getActivity());
        } else {
      } else {

  void performRequest() {

  EndpointType getEndpointType() {
    return EndpointType.FORECASTS;

  String getKey() {
    return HeadlessFragment.WEEKEND;


Java Source Code List