Android Open Source - SurgeTracker Aggregate List Fragment






From Project

Back to project page SurgeTracker.

License

The source code is released under:

MIT License

If you think the Android project SurgeTracker 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.bklimt.surgetracker.view;
/* ww w  .  java 2  s  .co m*/
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.bklimt.surgetracker.R;
import com.bklimt.surgetracker.model.RootViewModel;

/**
 * A placeholder fragment containing a simple view.
 */
public class AggregateListFragment extends Fragment {
    /**
     * Returns a new instance of this fragment for the given section
     * number.
     */
    public static AggregateListFragment newInstance() {
        AggregateListFragment fragment = new AggregateListFragment();
        Bundle args = new Bundle();
        fragment.setArguments(args);
        return fragment;
    }

    public AggregateListFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        final View rootView = inflater.inflate(R.layout.fragment_aggregates, container, false);

        final RootViewModel root = RootViewModel.get();

        final AggregateListAdapter aggregateListAdapter = new AggregateListAdapter(getActivity());
        final ListView aggregateListView = (ListView) rootView.findViewById(R.id.aggregate_list);
        aggregateListView.setAdapter(aggregateListAdapter);
        root.getAggregates().bindToArrayAdapter(aggregateListAdapter);

        /*Button startButton = (Button) rootView.findViewById(R.id.start_button);
        final WeakReference<Button> weakStartButton = new WeakReference<Button>(startButton);
        final Capture<ModelListener<RootViewModel>> weakListener = new Capture<ModelListener<RootViewModel>>();
        weakListener.set(new ModelListener<RootViewModel>() {
            @Override
            public void onChanged(RootViewModel model, String key, Object oldValue, Object newValue) {
                Button startButton = weakStartButton.get();
                if (startButton == null) {
                    root.removeListener(weakListener.get());
                    return;
                }

                if (key.equals("currentSurge")) {
                    if (newValue == null) {
                        startButton.setText(R.string.start);
                    } else {
                        startButton.setText(R.string.stop);
                    }
                }
            }
        });
        root.addListener(weakListener.get());

        startButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (root.getCurrentSurge() == null) {
                    root.startSurge();
                } else {
                    root.stopSurge();
                }
            }
        });*/

        return rootView;
    }
}




Java Source Code List

com.bklimt.surgetracker.ApplicationTest.java
com.bklimt.surgetracker.SurgeTrackerApplication.java
com.bklimt.surgetracker.TimerThread.java
com.bklimt.surgetracker.backbone.CollectionListener.java
com.bklimt.surgetracker.backbone.Collection.java
com.bklimt.surgetracker.backbone.ModelListener.java
com.bklimt.surgetracker.backbone.Model.java
com.bklimt.surgetracker.backbone.Visitor.java
com.bklimt.surgetracker.model.AggregateCollection.java
com.bklimt.surgetracker.model.Aggregate.java
com.bklimt.surgetracker.model.RootViewModel.java
com.bklimt.surgetracker.model.SurgeCollection.java
com.bklimt.surgetracker.model.SurgeParseObject.java
com.bklimt.surgetracker.model.Surge.java
com.bklimt.surgetracker.view.AggregateListAdapter.java
com.bklimt.surgetracker.view.AggregateListFragment.java
com.bklimt.surgetracker.view.MainActivity.java
com.bklimt.surgetracker.view.SurgeDeletionDialogFragment.java
com.bklimt.surgetracker.view.SurgeDurationDialogFragment.java
com.bklimt.surgetracker.view.SurgeGraphFragment.java
com.bklimt.surgetracker.view.SurgeListAdapter.java
com.bklimt.surgetracker.view.SurgeListFragment.java
com.bklimt.surgetracker.view.SurgeStartDialogFragment.java