Android Open Source - EdmontonWifi Wifi Array Adapter






From Project

Back to project page EdmontonWifi.

License

The source code is released under:

MIT License

If you think the Android project EdmontonWifi 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 hey.rich.edmontonwifi.adapters;
//from  www  .  jav a  2s. co m
import java.util.List;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import hey.rich.edmontonwifi.Objects.Wifi;
import hey.rich.edmontonwifi.R;

public class WifiArrayAdapter extends ArrayAdapter<Wifi> {
  private final Activity context;
  private final List<Wifi> values;

  public WifiArrayAdapter(Activity context, List<Wifi> values) {
    super(context, R.layout.wifi_list_view, values);
    this.context = context;
    this.values = values;
  }

  static class ViewHolder {
    public TextView name, distance;
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View rowView = convertView;

    if (rowView == null) {
      LayoutInflater inflater = context.getLayoutInflater();
      rowView = inflater.inflate(R.layout.wifi_list_view, null);

      ViewHolder v = new ViewHolder();
      v.name = (TextView) rowView.findViewById(R.id.wifi_list_name);
      v.distance = (TextView) rowView.findViewById(R.id.wifi_list_distance);
      rowView.setTag(v);
    }

    ViewHolder holder = (ViewHolder) rowView.getTag();
    Wifi wifi = values.get(position);
    holder.name.setText(wifi.getName().split("\\(")[0]);
    holder.distance.setText(Wifi.getDistanceString(wifi));

    return rowView;
  }
}




Java Source Code List

hey.rich.edmontonwifi.EdmontonWifi.java
hey.rich.edmontonwifi.Objects.ConstructionList.java
hey.rich.edmontonwifi.Objects.Construction.java
hey.rich.edmontonwifi.Objects.Data.java
hey.rich.edmontonwifi.Objects.WifiList.java
hey.rich.edmontonwifi.Objects.Wifi.java
hey.rich.edmontonwifi.activities.ConstructionViewActivity.java
hey.rich.edmontonwifi.activities.MainActivity.java
hey.rich.edmontonwifi.activities.SearchActivity.java
hey.rich.edmontonwifi.activities.WifiViewActivity.java
hey.rich.edmontonwifi.adapters.ConstructionArrayAdapter.java
hey.rich.edmontonwifi.adapters.WifiArrayAdapter.java
hey.rich.edmontonwifi.fragments.ClearSearchHistoryDialogFragment.java
hey.rich.edmontonwifi.fragments.ConstructionFragment.java
hey.rich.edmontonwifi.fragments.NavigationDrawerFragment.java
hey.rich.edmontonwifi.fragments.SettingsFragment.java
hey.rich.edmontonwifi.fragments.WifiFragment.java
hey.rich.edmontonwifi.utils.JsonReader.java
hey.rich.edmontonwifi.utils.Sorters.java
hey.rich.edmontonwifi.utils.WifiSearchRecentSuggestionsProvider.java