Android Open Source - android-whereami Fragment Saved Locations






From Project

Back to project page android-whereami.

License

The source code is released under:

GNU General Public License

If you think the Android project android-whereami 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.uvwxy.whereami.fragments;
//w  w  w .j a  va  2  s  .co  m
import java.util.ArrayList;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.TextView;

import de.uvwxy.whereami.ActivityMain;
import de.uvwxy.whereami.ListItemLocationAdapter;
import de.uvwxy.whereami.R;
import de.uvwxy.whereami.db_location.Location;

public class FragmentSavedLocations extends Fragment {
  private TextView tvSavedLocationCount = null;
  private ListView lvSavedLocations = null;
  private ArrayList<Location> list = new ArrayList<Location>();
  private ListItemLocationAdapter listAdapter = null;
  public boolean isFav = false;

  private ActivityMain dhis;
  
  public void setFav(boolean isFav) {
    this.isFav = isFav;
  }

  private void initGUI(View rootView) {
    tvSavedLocationCount = (TextView) rootView.findViewById(R.id.tvSavedLocationCount);
    lvSavedLocations = (ListView) rootView.findViewById(R.id.lvSavedLocations);
  }

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_saved_locations, container, false);
    initGUI(rootView);
    dhis = ActivityMain.dhis;
    
    dhis.mData.getAllEntries(list, !isFav, isFav);
    listAdapter = new ListItemLocationAdapter(getActivity(), list);

    tvSavedLocationCount.setText("" + list.size());
    lvSavedLocations.setAdapter(listAdapter);
    return rootView;
  }

  public void updateList() {
    dhis.mData.getAllEntries(list, !isFav, isFav);
    tvSavedLocationCount.setText("" + list.size());
    listAdapter.notifyDataSetChanged();
  }
  
  public void refreshList() {
    listAdapter.notifyDataSetChanged();
  }

  @Override
  public void onDestroy() {
    super.onDestroy();
  }
}




Java Source Code List

de.uvwxy.whereami.ActionShare.java
de.uvwxy.whereami.ActivityMain.java
de.uvwxy.whereami.Converter.java
de.uvwxy.whereami.ListItemLocationAdapter.java
de.uvwxy.whereami.LocationManager.java
de.uvwxy.whereami.db_location.DBLocationConnection.java
de.uvwxy.whereami.db_location.DBLocationExporter.java
de.uvwxy.whereami.db_location.DBLocation.java
de.uvwxy.whereami.db_location.Location.java
de.uvwxy.whereami.fragments.FragmentCurrentLocation.java
de.uvwxy.whereami.fragments.FragmentSavedLocations.java
de.uvwxy.whereami.fragments.FragmentSettings.java