Android Open Source - hackspacewidget Hackspace List Fragment






From Project

Back to project page hackspacewidget.

License

The source code is released under:

Apache License

If you think the Android project hackspacewidget 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 de.ring0.hackspace;
//from  w  w  w  . j av a 2 s. com
import java.util.ArrayList;
import java.util.List;

import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class HackspaceListFragment extends ListFragment implements OnItemClickListener {

  List<String> spaceList = new ArrayList<String>();
  private SpaceSelectedListener listener = null;
  private ArrayAdapter<String> spaceAdapter;
  
  public HackspaceListFragment() {
    super();
  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        spaceAdapter = new ArrayAdapter<String>(getActivity(), R.layout.hackspace_list, spaceList);
  }
  
  @Override
  public void onStart() {
    super.onStart();
        setListAdapter(spaceAdapter);
        getListView().setOnItemClickListener(this);
        
        //END
        spaceAdapter.notifyDataSetChanged();
  }
  
  public void setOnSpaceSelectedListener(SpaceSelectedListener listener) {
    this.listener = listener;
  }
  
  public interface SpaceSelectedListener {
    public void onSpaceSelected(int position);
  }

  @Override
  public void onItemClick(AdapterView<?> parent, View vuew, int position, long id) {
    if (null != listener) {
      listener.onSpaceSelected(position);
        }    
  }
  
  public void setSelectable(boolean selectable) {
        if (selectable) {
            getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        }
        else {
            getListView().setChoiceMode(ListView.CHOICE_MODE_NONE);
        }
    }
}




Java Source Code List

de.ring0.hackspace.HackspaceInfoFragment.java
de.ring0.hackspace.HackspaceListFragment.java
de.ring0.hackspace.HackspaceStatusAPI.java
de.ring0.hackspace.HackspaceStatusProvider.java
de.ring0.hackspace.HackspaceViewActivity.java
de.ring0.hackspace.HackspaceWidgetConfig.java
de.ring0.hackspace.UpdateWidgetTask.java
de.ring0.hackspace.database.InternalHelper.java
de.ring0.hackspace.database.SpaceDataSource.java
de.ring0.hackspace.database.StatusDataSource.java
de.ring0.hackspace.datatypes.Space.java
de.ring0.hackspace.datatypes.field.SpaceCache.java
de.ring0.hackspace.datatypes.field.SpaceContact.java
de.ring0.hackspace.datatypes.field.SpaceEvent.java
de.ring0.hackspace.datatypes.field.SpaceFED.java
de.ring0.hackspace.datatypes.field.SpaceFeeds.java
de.ring0.hackspace.datatypes.field.SpaceIcon.java
de.ring0.hackspace.datatypes.field.SpaceKeymaster.java
de.ring0.hackspace.datatypes.field.SpaceLocation.java
de.ring0.hackspace.datatypes.field.SpaceRadioShow.java
de.ring0.hackspace.datatypes.field.SpaceSensors.java
de.ring0.hackspace.datatypes.field.SpaceState.java
de.ring0.hackspace.datatypes.sensors.AccountBalance.java
de.ring0.hackspace.datatypes.sensors.Barometer.java
de.ring0.hackspace.datatypes.sensors.BeverageSupply.java
de.ring0.hackspace.datatypes.sensors.DoorLocked.java
de.ring0.hackspace.datatypes.sensors.Humidity.java
de.ring0.hackspace.datatypes.sensors.NetworkConnections.java
de.ring0.hackspace.datatypes.sensors.PeopleNowPresent.java
de.ring0.hackspace.datatypes.sensors.PowerConsumption.java
de.ring0.hackspace.datatypes.sensors.Radiation.java
de.ring0.hackspace.datatypes.sensors.Sensor.java
de.ring0.hackspace.datatypes.sensors.Temperature.java
de.ring0.hackspace.datatypes.sensors.TotalMemberCount.java
de.ring0.hackspace.datatypes.sensors.Wind.java