Android Open Source - UTMShuttleAndroid Times List Adapter






From Project

Back to project page UTMShuttleAndroid.

License

The source code is released under:

GNU General Public License

If you think the Android project UTMShuttleAndroid 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 adapters;
//w  ww.j  a v a  2 s. c o  m
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import me.echeung.utmshuttleandroid.R;


public class TimesListAdapter {

    private List<String> times;
    private LinearLayout mList;
    private LayoutInflater inflater;

    public TimesListAdapter(Context context, LinearLayout view) {
        this.times = new ArrayList<>();
        this.mList = view;
        this.inflater = LayoutInflater.from(context);
    }

    private void updateList() {
        if (mList.getChildCount() > 0)
            mList.removeAllViews();

        for (int i = 0; i < times.size(); i++) {
            View vi = inflater.inflate(R.layout.time_list_item, null);
            TextView mTime = (TextView) vi.findViewById(R.id.time);
            mTime.setText(times.get(i));

            mList.addView(vi);
        }
    }

    public void notifyDataSetChanged() {
        this.updateList();
    }

    public void setTimes(List<String> times) {
        this.times = times;
    }
}




Java Source Code List

activities.MainActivity.java
adapters.TimesListAdapter.java
async.NoticesTask.java
async.RoutesTask.java
classes.Route.java
classes.Routes.java
global.App.java
util.NetworkHelper.java
util.Scraper.java