Android Open Source - GeoTasker Main Activity






From Project

Back to project page GeoTasker.

License

The source code is released under:

GNU General Public License

If you think the Android project GeoTasker 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.fjaviermo.geotasker;
/*from   w  w w  . j a v a  2 s  . co m*/
import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;

import com.fjaviermo.geotasker.ProfileListFragment.OnSelectedProfileChangeListener;

public class MainActivity extends Activity 
implements OnSelectedProfileChangeListener {

  public static final String PROFILE_LIST = "profileList";
  public static final String PROFILE_DESC = "profileDescription";
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Get the profile description fragment
    FragmentManager fm = getFragmentManager();

    // Begin transaction
    FragmentTransaction ft = fm.beginTransaction();

    // Create the Fragment and add
    ProfileListFragment listFragment = new ProfileListFragment();
    ft.add(R.id.layoutRoot, listFragment, PROFILE_LIST);

    // Commit the changes
    ft.commit();
  }

  @Override
  public void onSelectedProfileChanged(long profileIndex) {
    ProfileFragment profileDescFragment;
    FragmentManager fm = getFragmentManager();

    // Handle dynamic switch to description fragment
    FragmentTransaction ft = fm.beginTransaction();

    // Create the fragment and attach profile id
    profileDescFragment = new ProfileFragment();
    Bundle args = new Bundle();
    args.putLong(ProfileFragment.PROFILE_INDEX, profileIndex);
    profileDescFragment.setArguments(args);

    // Replace the profile list with the description
    ft.replace(R.id.layoutRoot, profileDescFragment, PROFILE_DESC);
    ft.addToBackStack(null);
    ft.setCustomAnimations(
        android.R.animator.fade_in, android.R.animator.fade_out);
    ft.commit();
  }
}




Java Source Code List

com.fjaviermo.adapter.ProfileAdapter.java
com.fjaviermo.dao.LocationDataSource.java
com.fjaviermo.dao.ProfilesDataSource.java
com.fjaviermo.database.DatabaseHelper.java
com.fjaviermo.database.LocationSQLiteHelper.java
com.fjaviermo.database.ProfilesSQLiteHelper.java
com.fjaviermo.geotasker.AddProfileDialogFragment.java
com.fjaviermo.geotasker.MainActivity.java
com.fjaviermo.geotasker.ProfileFragment.java
com.fjaviermo.geotasker.ProfileListFragment.java
com.fjaviermo.model.Location.java
com.fjaviermo.model.Profile.java