Android Open Source - BikeStation Bikes Adapter






From Project

Back to project page BikeStation.

License

The source code is released under:

GNU General Public License

If you think the Android project BikeStation 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.bikestation.app.adapter;
/*from  www  . j a  va  2 s  . c o  m*/
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.kdravolin.smartlock.app.R;
import com.bikestation.app.User;

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

public class BikesAdapter extends BaseAdapter {

    private List<String> bikes;
    private final Activity context;

    public BikesAdapter(Activity context) {
        this.context = context;
        bikes = new ArrayList<String>();
    }

    @Override
    public int getCount() {
        return bikes.size();
    }

    @Override
    public Object getItem(int i) {
        return bikes.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        View rowView = view;
        if (rowView == null) {
            LayoutInflater inflater = context.getLayoutInflater();
            rowView = inflater.inflate(R.layout.item_bike, null, true);
        }
        TextView tvAccountName = (TextView)rowView.findViewById(R.id.tv_account_name);
        tvAccountName.setText(bikes.get(i));
        return rowView;
    }

    public void addBike(String bike){
        bikes.add(bike);
    }

}




Java Source Code List

com.bikestation.app.BluetoothConnector.java
com.bikestation.app.BluetoothWorker.java
com.bikestation.app.ExtApp.java
com.bikestation.app.History.java
com.bikestation.app.Lock.java
com.bikestation.app.User.java
com.bikestation.app.account.AccountAuthenticator.java
com.bikestation.app.account.AuthenticationService.java
com.bikestation.app.activity.AccountActivity.java
com.bikestation.app.activity.BikesActivity.java
com.bikestation.app.activity.DeviceActivity.java
com.bikestation.app.activity.TimeActivity.java
com.bikestation.app.adapter.BikesAdapter.java
com.bikestation.app.adapter.DeviceAdapter.java