a lot of code clean-up
This commit is contained in:
parent
6e4baddefc
commit
df00311ff6
13 changed files with 71 additions and 313 deletions
|
@ -4,7 +4,7 @@ README
|
||||||
Trackbook - Movement Recorder for Android
|
Trackbook - Movement Recorder for Android
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
**upcoming Version 1.0.x ("Astronomy Domine")**
|
**Version 1.0.x ("Astronomy Domine")**
|
||||||
|
|
||||||
Trackbook is a bare bones app for recording your movements. Trackbook is great for hiking, vacation or workout. Once started it traces your movements on a map. The map data is provided by [OpenStreetMap (OSM)](https://www.openstreetmap.org/).
|
Trackbook is a bare bones app for recording your movements. Trackbook is great for hiking, vacation or workout. Once started it traces your movements on a map. The map data is provided by [OpenStreetMap (OSM)](https://www.openstreetmap.org/).
|
||||||
|
|
||||||
|
|
|
@ -74,15 +74,12 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
private SectionsPagerAdapter mSectionsPagerAdapter;
|
private SectionsPagerAdapter mSectionsPagerAdapter;
|
||||||
private NonSwipeableViewPager mViewPager;
|
private NonSwipeableViewPager mViewPager;
|
||||||
private boolean mTrackerServiceRunning;
|
private boolean mTrackerServiceRunning;
|
||||||
// private boolean mCurrentTrackVisible;
|
|
||||||
private boolean mPermissionsGranted;
|
private boolean mPermissionsGranted;
|
||||||
private boolean mFloatingActionButtonSubMenuVisible;
|
private boolean mFloatingActionButtonSubMenuVisible;
|
||||||
private List<String> mMissingPermissions;
|
private List<String> mMissingPermissions;
|
||||||
private FloatingActionButton mFloatingActionButton;
|
private FloatingActionButton mFloatingActionButton;
|
||||||
private LinearLayout mFloatingActionButtonSubMenu1;
|
private LinearLayout mFloatingActionButtonSubMenu1;
|
||||||
private LinearLayout mFloatingActionButtonSubMenu2;
|
private LinearLayout mFloatingActionButtonSubMenu2;
|
||||||
// private MainActivityMapFragment mMainActivityMapFragment;
|
|
||||||
// private MainActivityTrackFragment mMainActivityTrackFragment;
|
|
||||||
private BroadcastReceiver mTrackingStoppedReceiver;
|
private BroadcastReceiver mTrackingStoppedReceiver;
|
||||||
private int mFloatingActionButtonState;
|
private int mFloatingActionButtonState;
|
||||||
private int mSelectedTab;
|
private int mSelectedTab;
|
||||||
|
@ -118,34 +115,6 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
// // add listeners to button and submenu
|
|
||||||
// if (mFloatingActionButton != null) {
|
|
||||||
// mFloatingActionButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onClick(View view) {
|
|
||||||
// handleFloatingActionButtonClick(view);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// LogHelper.e(LOG_TAG, "mFloatingActionButton is null!");
|
|
||||||
// }
|
|
||||||
// if (mFloatingActionButtonSubMenu1 != null) {
|
|
||||||
// mFloatingActionButtonSubMenu1.setOnClickListener(new View.OnClickListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onClick(View view) {
|
|
||||||
// handleButtonSaveAndClearClick();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// if (mFloatingActionButtonSubMenu2 != null) {
|
|
||||||
// mFloatingActionButtonSubMenu2.setOnClickListener(new View.OnClickListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onClick(View view) {
|
|
||||||
// handleButtonClearClick();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// register broadcast receiver for stopped tracking
|
// register broadcast receiver for stopped tracking
|
||||||
mTrackingStoppedReceiver = createTrackingStoppedReceiver();
|
mTrackingStoppedReceiver = createTrackingStoppedReceiver();
|
||||||
IntentFilter trackingStoppedIntentFilter = new IntentFilter(ACTION_TRACKING_STOPPED);
|
IntentFilter trackingStoppedIntentFilter = new IntentFilter(ACTION_TRACKING_STOPPED);
|
||||||
|
@ -181,9 +150,7 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
|
|
||||||
// CASE MY LOCATION
|
// CASE MY LOCATION
|
||||||
case R.id.action_bar_my_location:
|
case R.id.action_bar_my_location:
|
||||||
LogHelper.v(LOG_TAG, "MainActivity: CASE MY LOCATION."); // todo remove
|
|
||||||
if (mSelectedTab != FRAGMENT_ID_MAP) {
|
if (mSelectedTab != FRAGMENT_ID_MAP) {
|
||||||
LogHelper.v(LOG_TAG, "MainActivity: ."); // todo remove
|
|
||||||
// show map fragment
|
// show map fragment
|
||||||
mSelectedTab = FRAGMENT_ID_MAP;
|
mSelectedTab = FRAGMENT_ID_MAP;
|
||||||
mViewPager.setCurrentItem(mSelectedTab);
|
mViewPager.setCurrentItem(mSelectedTab);
|
||||||
|
@ -200,7 +167,6 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
LogHelper.v(LOG_TAG, "onResume called.");
|
|
||||||
|
|
||||||
// load state of Floating Action Button
|
// load state of Floating Action Button
|
||||||
loadFloatingActionButtonState(this);
|
loadFloatingActionButtonState(this);
|
||||||
|
@ -210,7 +176,6 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
|
|
||||||
// if not in onboarding mode: set state of FloatingActionButton
|
// if not in onboarding mode: set state of FloatingActionButton
|
||||||
if (mFloatingActionButton != null) {
|
if (mFloatingActionButton != null) {
|
||||||
LogHelper.v(LOG_TAG, "onResume: setting state of FAB.");
|
|
||||||
setFloatingActionButtonState();
|
setFloatingActionButtonState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,10 +238,8 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
LogHelper.v(LOG_TAG, "onSaveInstanceState called.");
|
|
||||||
outState.putBoolean(INSTANCE_TRACKING_STATE, mTrackerServiceRunning);
|
outState.putBoolean(INSTANCE_TRACKING_STATE, mTrackerServiceRunning);
|
||||||
outState.putInt(INSTANCE_SELECTED_TAB, mSelectedTab);
|
outState.putInt(INSTANCE_SELECTED_TAB, mSelectedTab);
|
||||||
// outState.putInt(INSTANCE_FAB_STATE, mFloatingActionButtonState);
|
|
||||||
outState.putBoolean(INSTANCE_FAB_SUB_MENU_VISIBLE, mFloatingActionButtonSubMenuVisible);
|
outState.putBoolean(INSTANCE_FAB_SUB_MENU_VISIBLE, mFloatingActionButtonSubMenuVisible);
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
}
|
}
|
||||||
|
@ -285,31 +248,19 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
@Override
|
@Override
|
||||||
public void onRestoreInstanceState(Bundle savedInstanceState) {
|
public void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||||
super.onRestoreInstanceState(savedInstanceState);
|
super.onRestoreInstanceState(savedInstanceState);
|
||||||
LogHelper.v(LOG_TAG, "onRestoreInstanceState called.");
|
|
||||||
mTrackerServiceRunning = savedInstanceState.getBoolean(INSTANCE_TRACKING_STATE, false);
|
mTrackerServiceRunning = savedInstanceState.getBoolean(INSTANCE_TRACKING_STATE, false);
|
||||||
mSelectedTab = savedInstanceState.getInt(INSTANCE_SELECTED_TAB, 0);
|
mSelectedTab = savedInstanceState.getInt(INSTANCE_SELECTED_TAB, 0);
|
||||||
// mFloatingActionButtonState = savedInstanceState.getInt(INSTANCE_FAB_STATE, FAB_STATE_DEFAULT);
|
|
||||||
mFloatingActionButtonSubMenuVisible = savedInstanceState.getBoolean(INSTANCE_FAB_SUB_MENU_VISIBLE, false);
|
mFloatingActionButtonSubMenuVisible = savedInstanceState.getBoolean(INSTANCE_FAB_SUB_MENU_VISIBLE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// protected void onNewIntent(Intent intent) {
|
|
||||||
// super.onNewIntent(intent);
|
|
||||||
// LogHelper.v(LOG_TAG, "onNewIntent called.");
|
|
||||||
// handleIncomingIntent(intent);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
/* Loads state of Floating Action Button from preferences */
|
/* Loads state of Floating Action Button from preferences */
|
||||||
private void loadFloatingActionButtonState(Context context) {
|
private void loadFloatingActionButtonState(Context context) {
|
||||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
mFloatingActionButtonState = settings.getInt(PREFS_FAB_STATE, FAB_STATE_DEFAULT);
|
mFloatingActionButtonState = settings.getInt(PREFS_FAB_STATE, FAB_STATE_DEFAULT);
|
||||||
// mCurrentTrackVisible = settings.getBoolean(PREFS_TRACK_VISIBLE, false); // TODO remove mCurrentTrackVisible completely
|
|
||||||
// mCurrentTrackVisible is handled / saved by fragment
|
|
||||||
// LogHelper.v(LOG_TAG, "Loading state. Track visibility: " + mCurrentTrackVisible);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Saves state of Floating Action Button */
|
/* Saves state of Floating Action Button */
|
||||||
private void saveFloatingActionButtonState(Context context) {
|
private void saveFloatingActionButtonState(Context context) {
|
||||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
@ -442,12 +393,10 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
|
|
||||||
// change state
|
// change state
|
||||||
mTrackerServiceRunning = true;
|
mTrackerServiceRunning = true;
|
||||||
// mCurrentTrackVisible = true;
|
|
||||||
mFloatingActionButtonState = FAB_STATE_RECORDING;
|
mFloatingActionButtonState = FAB_STATE_RECORDING;
|
||||||
setFloatingActionButtonState();
|
setFloatingActionButtonState();
|
||||||
|
|
||||||
// get last location from MainActivity Fragment
|
// get last location from MainActivity Fragment
|
||||||
// Location lastLocation = mMainActivityMapFragment.getCurrentBestLocation();
|
|
||||||
MainActivityMapFragment mainActivityMapFragment = (MainActivityMapFragment) mSectionsPagerAdapter.getFragment(FRAGMENT_ID_MAP);
|
MainActivityMapFragment mainActivityMapFragment = (MainActivityMapFragment) mSectionsPagerAdapter.getFragment(FRAGMENT_ID_MAP);
|
||||||
Location lastLocation = mainActivityMapFragment.getCurrentBestLocation();
|
Location lastLocation = mainActivityMapFragment.getCurrentBestLocation();
|
||||||
|
|
||||||
|
@ -500,17 +449,13 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
|
|
||||||
/* Handles tap on the save and clear button */
|
/* Handles tap on the save and clear button */
|
||||||
private void handleButtonSaveAndClearClick() {
|
private void handleButtonSaveAndClearClick() {
|
||||||
LogHelper.v(LOG_TAG, "User chose SAVE and CLEAR");
|
|
||||||
|
|
||||||
// clear map and save track
|
// clear map and save track
|
||||||
MainActivityMapFragment mainActivityMapFragment = (MainActivityMapFragment) mSectionsPagerAdapter.getFragment(FRAGMENT_ID_MAP);
|
MainActivityMapFragment mainActivityMapFragment = (MainActivityMapFragment) mSectionsPagerAdapter.getFragment(FRAGMENT_ID_MAP);
|
||||||
mainActivityMapFragment.clearMap(true);
|
mainActivityMapFragment.clearMap(true);
|
||||||
// mCurrentTrackVisible = false;
|
|
||||||
|
|
||||||
// display and update track tab
|
// display and update track tab
|
||||||
mSelectedTab = FRAGMENT_ID_TRACK;
|
mSelectedTab = FRAGMENT_ID_TRACK;
|
||||||
mViewPager.setCurrentItem(mSelectedTab);
|
mViewPager.setCurrentItem(mSelectedTab);
|
||||||
// mMainActivityTrackFragment.refreshTrackView();
|
|
||||||
|
|
||||||
// dismiss notification
|
// dismiss notification
|
||||||
NotificationHelper.stop();
|
NotificationHelper.stop();
|
||||||
|
@ -526,12 +471,9 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
|
|
||||||
/* Handles tap on the clear button */
|
/* Handles tap on the clear button */
|
||||||
private void handleButtonClearClick() {
|
private void handleButtonClearClick() {
|
||||||
LogHelper.v(LOG_TAG, "User chose CLEAR");
|
|
||||||
|
|
||||||
// clear map, do not save track
|
// clear map, do not save track
|
||||||
MainActivityMapFragment mainActivityMapFragment = (MainActivityMapFragment) mSectionsPagerAdapter.getFragment(FRAGMENT_ID_MAP);
|
MainActivityMapFragment mainActivityMapFragment = (MainActivityMapFragment) mSectionsPagerAdapter.getFragment(FRAGMENT_ID_MAP);
|
||||||
mainActivityMapFragment.clearMap(false);
|
mainActivityMapFragment.clearMap(false);
|
||||||
// mCurrentTrackVisible = false;
|
|
||||||
|
|
||||||
// dismiss notification
|
// dismiss notification
|
||||||
NotificationHelper.stop();
|
NotificationHelper.stop();
|
||||||
|
@ -584,25 +526,14 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
|
|
||||||
/* Handles new incoming intents */
|
/* Handles new incoming intents */
|
||||||
private void handleIncomingIntent() {
|
private void handleIncomingIntent() {
|
||||||
LogHelper.v(LOG_TAG, "Main Activity received intent.");
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
|
LogHelper.v(LOG_TAG, "Main Activity received intent. Content: " + intent.toString());
|
||||||
String intentAction = intent.getAction();
|
String intentAction = intent.getAction();
|
||||||
switch (intentAction) {
|
switch (intentAction) {
|
||||||
case ACTION_SHOW_MAP:
|
case ACTION_SHOW_MAP:
|
||||||
|
// show map fragment
|
||||||
mSelectedTab = FRAGMENT_ID_MAP;
|
mSelectedTab = FRAGMENT_ID_MAP;
|
||||||
mViewPager.setCurrentItem(mSelectedTab);
|
mViewPager.setCurrentItem(mSelectedTab);
|
||||||
// if (intent.hasExtra(EXTRA_TRACKING_STATE)) {
|
|
||||||
// mTrackerServiceRunning = intent.getBooleanExtra(EXTRA_TRACKING_STATE, false);
|
|
||||||
// if (mTrackerServiceRunning) {
|
|
||||||
// // set FAB state
|
|
||||||
// mFloatingActionButtonState = FAB_STATE_RECORDING;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Intent i = new Intent();
|
|
||||||
// i.setAction(ACTION_TRACK_REQUEST);
|
|
||||||
// LocalBroadcastManager.getInstance(this).sendBroadcast(i);
|
|
||||||
// LogHelper.v(LOG_TAG, "MapActivity: requesting updated track from service.");
|
|
||||||
|
|
||||||
// clear intent
|
// clear intent
|
||||||
intent.setAction(ACTION_DEFAULT);
|
intent.setAction(ACTION_DEFAULT);
|
||||||
|
@ -610,7 +541,6 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LogHelper.v(LOG_TAG, "Doing nothing. Type of ACTION: " + intentAction);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -709,21 +639,6 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
super.destroyItem(container, position, object);
|
super.destroyItem(container, position, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public Object instantiateItem(ViewGroup container, int position) {
|
|
||||||
// Fragment createdFragment = (Fragment) super.instantiateItem(container, position);
|
|
||||||
// // save references to created Fragments
|
|
||||||
// switch (position) {
|
|
||||||
// case FRAGMENT_ID_MAP:
|
|
||||||
// mMainActivityMapFragment = (MainActivityMapFragment)createdFragment;
|
|
||||||
// break;
|
|
||||||
// case FRAGMENT_ID_TRACK:
|
|
||||||
// mMainActivityTrackFragment = (MainActivityTrackFragment)createdFragment;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// return createdFragment;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Fragment getFragment(final int position) {
|
public Fragment getFragment(final int position) {
|
||||||
final WeakReference<Fragment> wr = instantiatedFragments.get(position);
|
final WeakReference<Fragment> wr = instantiatedFragments.get(position);
|
||||||
|
|
|
@ -97,8 +97,6 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
LogHelper.v(LOG_TAG, "MainActivityMapFragment onCreate called.");
|
|
||||||
|
|
||||||
// get activity
|
// get activity
|
||||||
mActivity = getActivity();
|
mActivity = getActivity();
|
||||||
|
|
||||||
|
@ -111,7 +109,6 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
loadTrackerServiceState(mActivity);
|
loadTrackerServiceState(mActivity);
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
mFirstStart = savedInstanceState.getBoolean(INSTANCE_FIRST_START, true);
|
mFirstStart = savedInstanceState.getBoolean(INSTANCE_FIRST_START, true);
|
||||||
// mTrackerServiceRunning = savedInstanceState.getBoolean(INSTANCE_TRACKING_STATE, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create storage helper
|
// create storage helper
|
||||||
|
@ -197,22 +194,6 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
mFirstStart = false;
|
mFirstStart = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// // restore track
|
|
||||||
// StorageHelper storageHelper = new StorageHelper(mActivity, FILETYPE_TEMP);
|
|
||||||
// if (storageHelper.tempFileExists()) {
|
|
||||||
// // load track from temp file if it exists
|
|
||||||
// LoadTempTrackAsyncHelper loadTempTrackAsyncHelper = new LoadTempTrackAsyncHelper();
|
|
||||||
// loadTempTrackAsyncHelper.execute();
|
|
||||||
// LogHelper.v(LOG_TAG, "MapFragment: getting track from temp file.");
|
|
||||||
// } else if (savedInstanceState != null) {
|
|
||||||
// // load track from saved instance
|
|
||||||
// mTrack = savedInstanceState.getParcelable(INSTANCE_TRACK_MAIN_MAP);
|
|
||||||
// if (mTrack != null) {
|
|
||||||
// drawTrackOverlay(mTrack);
|
|
||||||
// LogHelper.v(LOG_TAG, "MapFragment: got track from saved instance.");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// load track from saved instance
|
// load track from saved instance
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
mTrack = savedInstanceState.getParcelable(INSTANCE_TRACK_MAIN_MAP);
|
mTrack = savedInstanceState.getParcelable(INSTANCE_TRACK_MAIN_MAP);
|
||||||
|
@ -244,7 +225,6 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
Intent i = new Intent();
|
Intent i = new Intent();
|
||||||
i.setAction(ACTION_TRACK_REQUEST);
|
i.setAction(ACTION_TRACK_REQUEST);
|
||||||
LocalBroadcastManager.getInstance(mActivity).sendBroadcast(i);
|
LocalBroadcastManager.getInstance(mActivity).sendBroadcast(i);
|
||||||
LogHelper.v(LOG_TAG, "MapFragment: requesting updated track from service.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CASE 2: recording stopped - temp file exists
|
// CASE 2: recording stopped - temp file exists
|
||||||
|
@ -252,19 +232,17 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
// load track from temp file if it exists
|
// load track from temp file if it exists
|
||||||
LoadTempTrackAsyncHelper loadTempTrackAsyncHelper = new LoadTempTrackAsyncHelper();
|
LoadTempTrackAsyncHelper loadTempTrackAsyncHelper = new LoadTempTrackAsyncHelper();
|
||||||
loadTempTrackAsyncHelper.execute();
|
loadTempTrackAsyncHelper.execute();
|
||||||
LogHelper.v(LOG_TAG, "MapFragment: getting track from temp file.");
|
|
||||||
|
|
||||||
// CASE 3: not recording and no temp file
|
// CASE 3: not recording and no temp file
|
||||||
} else if (mTrack != null) {
|
} else if (mTrack != null) {
|
||||||
// just draw existing track data
|
// just draw existing track data (from saved instance)
|
||||||
drawTrackOverlay(mTrack);
|
drawTrackOverlay(mTrack);
|
||||||
LogHelper.v(LOG_TAG, "MapFragment: got track from saved instance.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// show/hide the location off notification bar
|
// show/hide the location off notification bar
|
||||||
toggleLocationOffBar();
|
toggleLocationOffBar();
|
||||||
|
|
||||||
// start preliminary tracking - if no TrackerService is running // TODO check if this still works in tabbed ui
|
// start preliminary tracking - if no TrackerService is running
|
||||||
if (!mTrackerServiceRunning && mFragmentVisible) {
|
if (!mTrackerServiceRunning && mFragmentVisible) {
|
||||||
startPreliminaryTracking();
|
startPreliminaryTracking();
|
||||||
}
|
}
|
||||||
|
@ -286,9 +264,6 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
|
|
||||||
// disable content observer for changes in System Settings
|
// disable content observer for changes in System Settings
|
||||||
mActivity.getContentResolver().unregisterContentObserver(mSettingsContentObserver);
|
mActivity.getContentResolver().unregisterContentObserver(mSettingsContentObserver);
|
||||||
|
|
||||||
// // save state of track visibility
|
|
||||||
// saveTrackVisibilityState(mActivity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -375,7 +350,6 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
LogHelper.v(LOG_TAG, "MapFragment: onSaveInstanceState called. mTrack object is Null: " + (mTrack == null));
|
|
||||||
outState.putBoolean(INSTANCE_FIRST_START, mFirstStart);
|
outState.putBoolean(INSTANCE_FIRST_START, mFirstStart);
|
||||||
outState.putBoolean(INSTANCE_TRACKING_STATE, mTrackerServiceRunning);
|
outState.putBoolean(INSTANCE_TRACKING_STATE, mTrackerServiceRunning);
|
||||||
outState.putParcelable(INSTANCE_CURRENT_LOCATION, mCurrentBestLocation);
|
outState.putParcelable(INSTANCE_CURRENT_LOCATION, mCurrentBestLocation);
|
||||||
|
@ -391,14 +365,6 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
public void setTrackingState(boolean trackingState) {
|
public void setTrackingState(boolean trackingState) {
|
||||||
mTrackerServiceRunning = trackingState;
|
mTrackerServiceRunning = trackingState;
|
||||||
|
|
||||||
// // got a new track (from notification)
|
|
||||||
// // todo check for ACTION
|
|
||||||
// Intent intent = mActivity.getIntent();
|
|
||||||
// if (intent != null && intent.hasExtra(EXTRA_TRACK)) {
|
|
||||||
// mTrack = intent.getParcelableExtra(EXTRA_TRACK);
|
|
||||||
// LogHelper.v(LOG_TAG, "MapFragment: getting track from intent.");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// turn on/off tracking for MainActivity Fragment - prevent double tracking
|
// turn on/off tracking for MainActivity Fragment - prevent double tracking
|
||||||
if (mTrackerServiceRunning) {
|
if (mTrackerServiceRunning) {
|
||||||
stopPreliminaryTracking();
|
stopPreliminaryTracking();
|
||||||
|
@ -436,75 +402,15 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
SaveTrackAsyncHelper saveTrackAsyncHelper = new SaveTrackAsyncHelper();
|
SaveTrackAsyncHelper saveTrackAsyncHelper = new SaveTrackAsyncHelper();
|
||||||
saveTrackAsyncHelper.execute();
|
saveTrackAsyncHelper.execute();
|
||||||
Toast.makeText(mActivity, mActivity.getString(R.string.toast_message_save_track), Toast.LENGTH_LONG).show();
|
Toast.makeText(mActivity, mActivity.getString(R.string.toast_message_save_track), Toast.LENGTH_LONG).show();
|
||||||
LogHelper.v(LOG_TAG, "!!! MapFragment: Saving current track. Start == End -> " + (mTrack.getRecordingStart().equals(mTrack.getRecordingStop())) ); // TODO REMOVE
|
|
||||||
} else {
|
} else {
|
||||||
// clear track object and delete temp file
|
// clear track object and delete temp file
|
||||||
mTrack = null;
|
mTrack = null;
|
||||||
mStorageHelper.deleteTempFile();
|
mStorageHelper.deleteTempFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
// // save track state
|
|
||||||
// saveTrackVisibilityState(mActivity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// public void updateTrackingState(boolean trackerServiceRunning, Track track) {
|
|
||||||
// mTrackerServiceRunning = trackerServiceRunning;
|
|
||||||
// mTrack = track;
|
|
||||||
// if (mTrackerServiceRunning && mTrack != null) {
|
|
||||||
// drawTrackOverlay(mTrack);
|
|
||||||
// // remove the blue "my location" dot
|
|
||||||
// mMapView.getOverlays().remove(mMyLocationOverlay);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// /* Handles new incoming intents */
|
|
||||||
// private void handleIncomingIntent() {
|
|
||||||
// LogHelper.v(LOG_TAG, "Map Fragment received intent.");
|
|
||||||
// Intent intent = mActivity.getIntent();
|
|
||||||
// String intentAction = intent.getAction();
|
|
||||||
// switch (intentAction) {
|
|
||||||
// case ACTION_SHOW_MAP:
|
|
||||||
//// if (intent.hasExtra(EXTRA_TRACK)) {
|
|
||||||
//// LogHelper.v(LOG_TAG, "MapFragment: Intent received drawing map.");
|
|
||||||
//// mTrack = intent.getParcelableExtra(EXTRA_TRACK);
|
|
||||||
//// drawTrackOverlay(mTrack);
|
|
||||||
//// }
|
|
||||||
////
|
|
||||||
//// if (intent.hasExtra(EXTRA_TRACKING_STATE)) {
|
|
||||||
//// mTrackerServiceRunning = intent.getBooleanExtra(EXTRA_TRACKING_STATE, false);
|
|
||||||
//// mMapView.getOverlays().remove(mMyLocationOverlay);
|
|
||||||
//// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// if (intent.hasExtra(EXTRA_TRACKING_STATE)) {
|
|
||||||
// // store tracker service state
|
|
||||||
// mTrackerServiceRunning = intent.getBooleanExtra(EXTRA_TRACKING_STATE, false);
|
|
||||||
//
|
|
||||||
// // get most current track (from notification) - if recording is active
|
|
||||||
// if (mTrackerServiceRunning && intent.hasExtra(EXTRA_TRACK)) {
|
|
||||||
// LogHelper.v(LOG_TAG, "MapFragment: Intent received drawing map.");
|
|
||||||
// mTrack = intent.getParcelableExtra(EXTRA_TRACK);
|
|
||||||
// drawTrackOverlay(mTrack);
|
|
||||||
// // remove the blue "my location" dot
|
|
||||||
// mMapView.getOverlays().remove(mMyLocationOverlay);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// // prevent multiple reactions to intent
|
|
||||||
// intent.setAction(ACTION_DEFAULT);
|
|
||||||
//
|
|
||||||
// break;
|
|
||||||
//
|
|
||||||
// default:
|
|
||||||
// LogHelper.v(LOG_TAG, "Doing nothing. Type of ACTION: " + intentAction);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
/* Start preliminary tracking for map */
|
/* Start preliminary tracking for map */
|
||||||
private void startPreliminaryTracking() {
|
private void startPreliminaryTracking() {
|
||||||
if (mLocationSystemSetting && !mLocalTrackerRunning) {
|
if (mLocationSystemSetting && !mLocalTrackerRunning) {
|
||||||
|
@ -580,7 +486,7 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
mMapView.getOverlays().remove(mTrackOverlay);
|
mMapView.getOverlays().remove(mTrackOverlay);
|
||||||
mTrackOverlay = null;
|
mTrackOverlay = null;
|
||||||
if (track != null) {
|
if (track != null) {
|
||||||
LogHelper.v(LOG_TAG, "MapFragment: drawing new track overlay.");
|
LogHelper.v(LOG_TAG, "Drawing track overlay.");
|
||||||
mTrackOverlay = MapHelper.createTrackOverlay(mActivity, track, mTrackerServiceRunning);
|
mTrackOverlay = MapHelper.createTrackOverlay(mActivity, track, mTrackerServiceRunning);
|
||||||
mMapView.getOverlays().add(mTrackOverlay);
|
mMapView.getOverlays().add(mTrackOverlay);
|
||||||
}
|
}
|
||||||
|
@ -618,6 +524,7 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if (intent.hasExtra(EXTRA_TRACK) && intent.hasExtra(EXTRA_LAST_LOCATION)) {
|
if (intent.hasExtra(EXTRA_TRACK) && intent.hasExtra(EXTRA_LAST_LOCATION)) {
|
||||||
|
LogHelper.v(LOG_TAG, "Track update received.");
|
||||||
// draw track on map
|
// draw track on map
|
||||||
mTrack = intent.getParcelableExtra(EXTRA_TRACK);
|
mTrack = intent.getParcelableExtra(EXTRA_TRACK);
|
||||||
drawTrackOverlay(mTrack);
|
drawTrackOverlay(mTrack);
|
||||||
|
@ -626,8 +533,6 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
mController.setCenter(convertToGeoPoint(mCurrentBestLocation));
|
mController.setCenter(convertToGeoPoint(mCurrentBestLocation));
|
||||||
// clear intent
|
// clear intent
|
||||||
intent.setAction(ACTION_DEFAULT);
|
intent.setAction(ACTION_DEFAULT);
|
||||||
LogHelper.v(LOG_TAG, "MapFragment: Track update received - drawing map.");
|
|
||||||
LogHelper.v(LOG_TAG, "!!! MapFragment: Track update received. Start == End -> " + (mTrack.getRecordingStart().equals(mTrack.getRecordingStop())) ); // TODO REMOVE
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -644,31 +549,6 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// /* Saves state of track visibility to SharedPreferences */
|
|
||||||
// private void saveTrackVisibilityState(Context context) {
|
|
||||||
// SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
// SharedPreferences.Editor editor = settings.edit();
|
|
||||||
// editor.putBoolean(PREFS_TRACK_VISIBLE, (mTrackOverlay != null));
|
|
||||||
// editor.apply();
|
|
||||||
// LogHelper.v(LOG_TAG, "Saving state: track visibility = " + (mTrackOverlay != null));
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// /* Saves state of map */
|
|
||||||
// private void saveMaoState(Context context) {
|
|
||||||
// SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
// SharedPreferences.Editor editor = settings.edit();
|
|
||||||
// editor.putInt(PREFS_ZOOM_LEVEL, mMapView.getZoomLevel());
|
|
||||||
// editor.apply();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// /* Loads app state from preferences */
|
|
||||||
// private void loadMapState(Context context) {
|
|
||||||
// SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
// int zoom = settings.getInt(PREFS_ZOOM_LEVEL, 16);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/* Loads state tracker service from preferences */
|
/* Loads state tracker service from preferences */
|
||||||
private void loadTrackerServiceState(Context context) {
|
private void loadTrackerServiceState(Context context) {
|
||||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
@ -724,7 +604,7 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
protected Void doInBackground(Void... voids) {
|
protected Void doInBackground(Void... voids) {
|
||||||
LogHelper.v(LOG_TAG, "Saving track object in background.");
|
LogHelper.v(LOG_TAG, "Saving track object in background.");
|
||||||
// save track object
|
// save track object
|
||||||
mStorageHelper.saveTrack(mTrack, FILETYPE_TRACK);
|
mStorageHelper.saveTrack(mTrack, FILE_TYPE_TRACK);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -753,7 +633,7 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
protected Void doInBackground(Void... voids) {
|
protected Void doInBackground(Void... voids) {
|
||||||
LogHelper.v(LOG_TAG, "Loading temporary track object in background.");
|
LogHelper.v(LOG_TAG, "Loading temporary track object in background.");
|
||||||
// load track object
|
// load track object
|
||||||
mTrack = mStorageHelper.loadTrack(FILETYPE_TEMP);
|
mTrack = mStorageHelper.loadTrack(FILE_TYPE_TEMP);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,14 +173,14 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
|
||||||
// react to state change
|
// react to state change
|
||||||
switch (newState) {
|
switch (newState) {
|
||||||
case BottomSheetBehavior.STATE_EXPANDED:
|
case BottomSheetBehavior.STATE_EXPANDED:
|
||||||
LogHelper.v(LOG_TAG,"Statistics sheet expanded");
|
// statistics sheet expanded
|
||||||
break;
|
break;
|
||||||
case BottomSheetBehavior.STATE_COLLAPSED:
|
case BottomSheetBehavior.STATE_COLLAPSED:
|
||||||
LogHelper.v(LOG_TAG,"Statistics sheet collapsed");
|
// statistics sheet collapsed
|
||||||
mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||||
break;
|
break;
|
||||||
case BottomSheetBehavior.STATE_HIDDEN:
|
case BottomSheetBehavior.STATE_HIDDEN:
|
||||||
LogHelper.v(LOG_TAG,"Statistics sheet hidden");
|
// statistics sheet hidden
|
||||||
mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -197,7 +197,6 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
|
||||||
statisticsView.setOnClickListener(new View.OnClickListener() {
|
statisticsView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
LogHelper.v(LOG_TAG,"Statistics view tapped");
|
|
||||||
if (mStatisticsSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
|
if (mStatisticsSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
|
||||||
mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||||
} else {
|
} else {
|
||||||
|
@ -214,14 +213,12 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
LogHelper.v(LOG_TAG, "TrackFragment: onResume called.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
LogHelper.v(LOG_TAG, "TrackFragment: onPause called.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -236,16 +233,17 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
LogHelper.v(LOG_TAG, "onDestroy called.");
|
||||||
|
|
||||||
// remove listener
|
// remove listener
|
||||||
LocalBroadcastManager.getInstance(mActivity).unregisterReceiver(mTrackSavedReceiver);
|
LocalBroadcastManager.getInstance(mActivity).unregisterReceiver(mTrackSavedReceiver);
|
||||||
|
|
||||||
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
LogHelper.v(LOG_TAG, "TrackFragment: onSaveInstanceState called.");
|
|
||||||
outState.putDouble(INSTANCE_LATITUDE_TRACK_MAP, mMapView.getMapCenter().getLatitude());
|
outState.putDouble(INSTANCE_LATITUDE_TRACK_MAP, mMapView.getMapCenter().getLatitude());
|
||||||
outState.putDouble(INSTANCE_LONGITUDE_TRACK_MAP, mMapView.getMapCenter().getLongitude());
|
outState.putDouble(INSTANCE_LONGITUDE_TRACK_MAP, mMapView.getMapCenter().getLongitude());
|
||||||
outState.putInt(INSTANCE_ZOOM_LEVEL_TRACK_MAP, mMapView.getZoomLevel());
|
outState.putInt(INSTANCE_ZOOM_LEVEL_TRACK_MAP, mMapView.getZoomLevel());
|
||||||
|
@ -254,20 +252,6 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// /* Removes current track display */
|
|
||||||
// public void refreshTrackView() {
|
|
||||||
//
|
|
||||||
// // remove previous track
|
|
||||||
// if (mMapView != null && mTrackOverlay != null) {
|
|
||||||
// mMapView.getOverlays().remove(mTrackOverlay);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // listen for finished save
|
|
||||||
// IntentFilter trackSavedReceiverIntentFilter = new IntentFilter(ACTION_TRACK_SAVE);
|
|
||||||
// LocalBroadcastManager.getInstance(mActivity).registerReceiver(mTrackSavedReceiver, trackSavedReceiverIntentFilter);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
/* Displays map and statistics for track */
|
/* Displays map and statistics for track */
|
||||||
private void displayTrack() {
|
private void displayTrack() {
|
||||||
GeoPoint position;
|
GeoPoint position;
|
||||||
|
@ -320,7 +304,7 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
|
||||||
LogHelper.v(LOG_TAG, "Loading track object in background.");
|
LogHelper.v(LOG_TAG, "Loading track object in background.");
|
||||||
// load track object
|
// load track object
|
||||||
StorageHelper storageHelper = new StorageHelper(mActivity);
|
StorageHelper storageHelper = new StorageHelper(mActivity);
|
||||||
mTrack = storageHelper.loadTrack(FILETYPE_TRACK);
|
mTrack = storageHelper.loadTrack(FILE_TYPE_TRACK);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
|
||||||
// stop timer
|
// stop timer
|
||||||
mTimer.cancel();
|
mTimer.cancel();
|
||||||
|
|
||||||
// TODO test for race condition
|
// broadcast an updated track
|
||||||
sendTrackUpdate();
|
sendTrackUpdate();
|
||||||
|
|
||||||
// save a temp file in case the activity has been killed
|
// save a temp file in case the activity has been killed
|
||||||
|
@ -318,7 +318,6 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
|
||||||
i.putExtra(EXTRA_TRACK, mTrack);
|
i.putExtra(EXTRA_TRACK, mTrack);
|
||||||
i.putExtra(EXTRA_LAST_LOCATION, mCurrentBestLocation);
|
i.putExtra(EXTRA_LAST_LOCATION, mCurrentBestLocation);
|
||||||
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(i);
|
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(i);
|
||||||
LogHelper.v(LOG_TAG, "!!! sendTrackUpdate. Start == End -> " + (mTrack.getRecordingStart().equals(mTrack.getRecordingStop())) ); // TODO REMOVE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -425,7 +424,7 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
|
||||||
LogHelper.v(LOG_TAG, "Saving temporary track object in background.");
|
LogHelper.v(LOG_TAG, "Saving temporary track object in background.");
|
||||||
// save track object
|
// save track object
|
||||||
StorageHelper storageHelper = new StorageHelper(TrackerService.this);
|
StorageHelper storageHelper = new StorageHelper(TrackerService.this);
|
||||||
storageHelper.saveTrack(mTrack, FILETYPE_TEMP);
|
storageHelper.saveTrack(mTrack, FILE_TYPE_TEMP);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ public class Track implements TrackbookKeys, Parcelable {
|
||||||
|
|
||||||
/* Sets end time and date of recording */
|
/* Sets end time and date of recording */
|
||||||
public void setRecordingEnd () {
|
public void setRecordingEnd () {
|
||||||
mRecordingStop = GregorianCalendar.getInstance().getTime();;
|
mRecordingStop = GregorianCalendar.getInstance().getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,6 +211,20 @@ public class Track implements TrackbookKeys, Parcelable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Determines which unit system the device is using (metric or imperial) */
|
||||||
|
private int getUnitSystem(Locale locale) {
|
||||||
|
// America (US), Liberia (LR), Myanmar(MM) use the imperial system
|
||||||
|
List<String> imperialSystemCountries = Arrays.asList("US", "LR", "MM");
|
||||||
|
String countryCode = locale.getCountry();
|
||||||
|
|
||||||
|
if (imperialSystemCountries.contains(countryCode)){
|
||||||
|
return IMPERIAL;
|
||||||
|
} else {
|
||||||
|
return METRIC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -229,18 +243,5 @@ public class Track implements TrackbookKeys, Parcelable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Determines which unit system the device is using (metric or imperial) */
|
|
||||||
private int getUnitSystem(Locale locale) {
|
|
||||||
// America (US), Liberia (LR), Myanmar(MM) use the imperial system
|
|
||||||
List<String> imperialSystemCountries = Arrays.asList("US", "LR", "MM");
|
|
||||||
String countryCode = locale.getCountry();
|
|
||||||
|
|
||||||
if (imperialSystemCountries.contains(countryCode)){
|
|
||||||
return IMPERIAL;
|
|
||||||
} else {
|
|
||||||
return METRIC;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,6 @@ public class WayPoint implements Parcelable {
|
||||||
|
|
||||||
/* Constructor used by CREATOR */
|
/* Constructor used by CREATOR */
|
||||||
protected WayPoint(Parcel in) {
|
protected WayPoint(Parcel in) {
|
||||||
// mLocation = in.readParcelable(Location.class.getClassLoader());
|
|
||||||
mLocation = Location.CREATOR.createFromParcel(in);
|
mLocation = Location.CREATOR.createFromParcel(in);
|
||||||
mIsStopOver = in.readByte() != 0;
|
mIsStopOver = in.readByte() != 0;
|
||||||
mDistanceToStartingPoint = in.readFloat();
|
mDistanceToStartingPoint = in.readFloat();
|
||||||
|
@ -116,7 +115,6 @@ public class WayPoint implements Parcelable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel parcel, int flags) {
|
public void writeToParcel(Parcel parcel, int flags) {
|
||||||
// parcel.writeParcelable(mLocation, flags);
|
|
||||||
mLocation.setExtras(null); // necessary because Location Extras cause cannot be serialized properly by GSON
|
mLocation.setExtras(null); // necessary because Location Extras cause cannot be serialized properly by GSON
|
||||||
mLocation.writeToParcel(parcel, flags);
|
mLocation.writeToParcel(parcel, flags);
|
||||||
parcel.writeByte((byte) (mIsStopOver ? 1 : 0));
|
parcel.writeByte((byte) (mIsStopOver ? 1 : 0));
|
||||||
|
|
|
@ -139,8 +139,6 @@ public final class LocationHelper implements TrackbookKeys {
|
||||||
public static boolean isNewWayPoint(Location lastLocation, Location newLocation, float averageSpeed) {
|
public static boolean isNewWayPoint(Location lastLocation, Location newLocation, float averageSpeed) {
|
||||||
float distance = newLocation.distanceTo(lastLocation);
|
float distance = newLocation.distanceTo(lastLocation);
|
||||||
long timeDifference = newLocation.getElapsedRealtimeNanos() - lastLocation.getElapsedRealtimeNanos();
|
long timeDifference = newLocation.getElapsedRealtimeNanos() - lastLocation.getElapsedRealtimeNanos();
|
||||||
// String providerLastLocation = lastLocation.getProvider();
|
|
||||||
// String providerNewLocation = newLocation.getProvider();
|
|
||||||
|
|
||||||
if (newLocation.getProvider().equals(LocationManager.NETWORK_PROVIDER)) {
|
if (newLocation.getProvider().equals(LocationManager.NETWORK_PROVIDER)) {
|
||||||
// calculate speed difference
|
// calculate speed difference
|
||||||
|
|
|
@ -26,7 +26,7 @@ import android.util.Log;
|
||||||
*/
|
*/
|
||||||
public final class LogHelper {
|
public final class LogHelper {
|
||||||
|
|
||||||
private final static boolean mTesting = true;
|
private final static boolean mTesting = false;
|
||||||
|
|
||||||
public static void d(final String tag, String message) {
|
public static void d(final String tag, String message) {
|
||||||
// include logging only in debug versions
|
// include logging only in debug versions
|
||||||
|
|
|
@ -56,7 +56,6 @@ public final class MapHelper {
|
||||||
} else {
|
} else {
|
||||||
newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_dot_grey_24dp);
|
newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_dot_grey_24dp);
|
||||||
}
|
}
|
||||||
final GeoPoint position = new GeoPoint(currentBestLocation.getLatitude(), currentBestLocation.getLongitude());
|
|
||||||
OverlayItem overlayItem = createOverlayItem(context, currentBestLocation);
|
OverlayItem overlayItem = createOverlayItem(context, currentBestLocation);
|
||||||
overlayItem.setMarker(newMarker);
|
overlayItem.setMarker(newMarker);
|
||||||
|
|
||||||
|
@ -68,14 +67,14 @@ public final class MapHelper {
|
||||||
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
|
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
|
public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
|
||||||
|
// tap on My Location dot icon
|
||||||
Toast.makeText(context, item.getTitle() + " | " + item.getSnippet(), Toast.LENGTH_LONG).show();
|
Toast.makeText(context, item.getTitle() + " | " + item.getSnippet(), Toast.LENGTH_LONG).show();
|
||||||
LogHelper.v(LOG_TAG, "Tap on the My Location dot icon detected.");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongPress(final int index, final OverlayItem item) {
|
public boolean onItemLongPress(final int index, final OverlayItem item) {
|
||||||
LogHelper.v(LOG_TAG, "Long press on the My Location dot icon detected.");
|
// long press on My Location dot icon
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}, context);
|
}, context);
|
||||||
|
@ -151,14 +150,14 @@ public final class MapHelper {
|
||||||
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
|
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
|
public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
|
||||||
|
// tap on waypoint
|
||||||
Toast.makeText(context, item.getTitle(), Toast.LENGTH_LONG).show();
|
Toast.makeText(context, item.getTitle(), Toast.LENGTH_LONG).show();
|
||||||
LogHelper.v(LOG_TAG, "Tap on waypoint. " + item.getTitle());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongPress(final int index, final OverlayItem item) {
|
public boolean onItemLongPress(final int index, final OverlayItem item) {
|
||||||
LogHelper.v(LOG_TAG, "Long press on waypoint. " + item.getSnippet());
|
// long press on waypoint
|
||||||
Toast.makeText(context, item.getSnippet(), Toast.LENGTH_LONG).show();
|
Toast.makeText(context, item.getSnippet(), Toast.LENGTH_LONG).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,14 +72,11 @@ public class NotificationHelper implements TrackbookKeys {
|
||||||
NotificationManager notificationManager = (NotificationManager) mService.getSystemService(Context.NOTIFICATION_SERVICE);
|
NotificationManager notificationManager = (NotificationManager) mService.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
notificationManager.notify(TRACKER_SERVICE_NOTIFICATION_ID, mNotification);
|
notificationManager.notify(TRACKER_SERVICE_NOTIFICATION_ID, mNotification);
|
||||||
|
|
||||||
LogHelper.v(LOG_TAG, "!!! Notification: Received updated Track. Start == End -> " + (track.getRecordingStart().equals(track.getRecordingStop())) ); // TODO REMOVE
|
|
||||||
|
|
||||||
if (!tracking) {
|
if (!tracking) {
|
||||||
// make notification swipe-able
|
// make notification swipe-able
|
||||||
mService.stopForeground(false);
|
mService.stopForeground(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,11 +51,9 @@ public class StorageHelper implements TrackbookKeys {
|
||||||
private static final String LOG_TAG = StorageHelper.class.getSimpleName();
|
private static final String LOG_TAG = StorageHelper.class.getSimpleName();
|
||||||
|
|
||||||
/* Main class variables */
|
/* Main class variables */
|
||||||
private final String mDirectoryName = "tracks";
|
|
||||||
private final String mFileExtension = ".trackbook";
|
|
||||||
private final Context mActivity;
|
private final Context mActivity;
|
||||||
private File mFolder;
|
private File mFolder;
|
||||||
private File mTempFile;
|
private final File mTempFile;
|
||||||
|
|
||||||
|
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
|
@ -64,7 +62,7 @@ public class StorageHelper implements TrackbookKeys {
|
||||||
mActivity = activity;
|
mActivity = activity;
|
||||||
|
|
||||||
// get "tracks" folder
|
// get "tracks" folder
|
||||||
mFolder = mActivity.getExternalFilesDir(mDirectoryName);
|
mFolder = mActivity.getExternalFilesDir(DIRECTORY_NAME);
|
||||||
// mFolder = getTracksDirectory();
|
// mFolder = getTracksDirectory();
|
||||||
|
|
||||||
// create folder if necessary
|
// create folder if necessary
|
||||||
|
@ -74,7 +72,7 @@ public class StorageHelper implements TrackbookKeys {
|
||||||
}
|
}
|
||||||
|
|
||||||
// create temp file object
|
// create temp file object
|
||||||
mTempFile = new File(mFolder.toString() + "/" + FILENAME_TEMP + mFileExtension);
|
mTempFile = new File(mFolder.toString() + "/" + FILE_NAME_TEMP + FILE_TYPE_EXTENSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +92,7 @@ public class StorageHelper implements TrackbookKeys {
|
||||||
public boolean saveTrack(@Nullable Track track, int fileType) {
|
public boolean saveTrack(@Nullable Track track, int fileType) {
|
||||||
|
|
||||||
// get "tracks" folder
|
// get "tracks" folder
|
||||||
mFolder = mActivity.getExternalFilesDir(mDirectoryName);
|
mFolder = mActivity.getExternalFilesDir(DIRECTORY_NAME);
|
||||||
|
|
||||||
Date recordingStart = null;
|
Date recordingStart = null;
|
||||||
if (track != null) {
|
if (track != null) {
|
||||||
|
@ -104,13 +102,13 @@ public class StorageHelper implements TrackbookKeys {
|
||||||
if (mFolder != null && mFolder.exists() && mFolder.isDirectory() && mFolder.canWrite() && recordingStart != null && track != null) {
|
if (mFolder != null && mFolder.exists() && mFolder.isDirectory() && mFolder.canWrite() && recordingStart != null && track != null) {
|
||||||
// create file object
|
// create file object
|
||||||
String fileName;
|
String fileName;
|
||||||
if (fileType == FILETYPE_TEMP) {
|
if (fileType == FILE_TYPE_TEMP) {
|
||||||
// case: temp file
|
// case: temp file
|
||||||
fileName = FILENAME_TEMP + mFileExtension;
|
fileName = FILE_NAME_TEMP + FILE_TYPE_EXTENSION;
|
||||||
} else {
|
} else {
|
||||||
// case: regular file
|
// case: regular file
|
||||||
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.US);
|
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.US);
|
||||||
fileName = dateFormat.format(recordingStart) + mFileExtension;
|
fileName = dateFormat.format(recordingStart) + FILE_TYPE_EXTENSION;
|
||||||
}
|
}
|
||||||
File file = new File(mFolder.toString() + "/" + fileName);
|
File file = new File(mFolder.toString() + "/" + fileName);
|
||||||
|
|
||||||
|
@ -130,7 +128,7 @@ public class StorageHelper implements TrackbookKeys {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if write was successful delete old track files - only if not a temp file
|
// if write was successful delete old track files - only if not a temp file
|
||||||
if (fileType != FILETYPE_TEMP) {
|
if (fileType != FILE_TYPE_TEMP) {
|
||||||
// include temp file if it exists
|
// include temp file if it exists
|
||||||
deleteOldTracks(true);
|
deleteOldTracks(true);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +148,7 @@ public class StorageHelper implements TrackbookKeys {
|
||||||
|
|
||||||
// get file reference
|
// get file reference
|
||||||
File file;
|
File file;
|
||||||
if (fileType == FILETYPE_TEMP) {
|
if (fileType == FILE_TYPE_TEMP) {
|
||||||
file = getTempFile();
|
file = getTempFile();
|
||||||
} else {
|
} else {
|
||||||
file = getMostCurrentTrack();
|
file = getMostCurrentTrack();
|
||||||
|
@ -194,13 +192,13 @@ public class StorageHelper implements TrackbookKeys {
|
||||||
private File getMostCurrentTrack() {
|
private File getMostCurrentTrack() {
|
||||||
|
|
||||||
// get "tracks" folder
|
// get "tracks" folder
|
||||||
mFolder = mActivity.getExternalFilesDir(mDirectoryName);
|
mFolder = mActivity.getExternalFilesDir(DIRECTORY_NAME);
|
||||||
|
|
||||||
if (mFolder != null && mFolder.isDirectory()) {
|
if (mFolder != null && mFolder.isDirectory()) {
|
||||||
// get files and sort them
|
// get files and sort them
|
||||||
File[] files = mFolder.listFiles();
|
File[] files = mFolder.listFiles();
|
||||||
files = sortFiles(files);
|
files = sortFiles(files);
|
||||||
if (files.length > 0 && files[0].getName().endsWith(mFileExtension) && !files[0].equals(mTempFile)){
|
if (files.length > 0 && files[0].getName().endsWith(FILE_TYPE_EXTENSION) && !files[0].equals(mTempFile)){
|
||||||
// return latest track
|
// return latest track
|
||||||
return files[0];
|
return files[0];
|
||||||
}
|
}
|
||||||
|
@ -224,10 +222,10 @@ public class StorageHelper implements TrackbookKeys {
|
||||||
private void deleteOldTracks(boolean includeTempFile) {
|
private void deleteOldTracks(boolean includeTempFile) {
|
||||||
|
|
||||||
// get "tracks" folder
|
// get "tracks" folder
|
||||||
mFolder = mActivity.getExternalFilesDir(mDirectoryName);
|
mFolder = mActivity.getExternalFilesDir(DIRECTORY_NAME);
|
||||||
|
|
||||||
if (mFolder != null && mFolder.isDirectory()) {
|
if (mFolder != null && mFolder.isDirectory()) {
|
||||||
LogHelper.v(LOG_TAG, "Deleting old Track files.");
|
LogHelper.v(LOG_TAG, "Deleting older recordings.");
|
||||||
|
|
||||||
// get files and sort them
|
// get files and sort them
|
||||||
File[] files = mFolder.listFiles();
|
File[] files = mFolder.listFiles();
|
||||||
|
@ -239,7 +237,7 @@ public class StorageHelper implements TrackbookKeys {
|
||||||
// keep the latest ten (mMaxTrackFiles) track files
|
// keep the latest ten (mMaxTrackFiles) track files
|
||||||
int index = MAXIMUM_TRACK_FILES;
|
int index = MAXIMUM_TRACK_FILES;
|
||||||
// iterate through array
|
// iterate through array
|
||||||
while (index < numberOfFiles && files[index].getName().endsWith(mFileExtension) && !files[index].equals(mTempFile)) {
|
while (index < numberOfFiles && files[index].getName().endsWith(FILE_TYPE_EXTENSION) && !files[index].equals(mTempFile)) {
|
||||||
files[index].delete();
|
files[index].delete();
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
@ -262,8 +260,8 @@ public class StorageHelper implements TrackbookKeys {
|
||||||
public int compare(File file1, File file2) {
|
public int compare(File file1, File file2) {
|
||||||
|
|
||||||
// discard temp file and files not ending with ".trackbook"
|
// discard temp file and files not ending with ".trackbook"
|
||||||
boolean file1IsTrack = file1.getName().endsWith(mFileExtension) && !file1.equals(mTempFile);
|
boolean file1IsTrack = file1.getName().endsWith(FILE_TYPE_EXTENSION) && !file1.equals(mTempFile);
|
||||||
boolean file2IsTrack = file2.getName().endsWith(mFileExtension) && !file2.equals(mTempFile);
|
boolean file2IsTrack = file2.getName().endsWith(FILE_TYPE_EXTENSION) && !file2.equals(mTempFile);
|
||||||
|
|
||||||
// note: "greater" means higher index in array
|
// note: "greater" means higher index in array
|
||||||
if (!file1IsTrack && file2IsTrack) {
|
if (!file1IsTrack && file2IsTrack) {
|
||||||
|
@ -281,11 +279,11 @@ public class StorageHelper implements TrackbookKeys {
|
||||||
});
|
});
|
||||||
|
|
||||||
// log sorting result // TODO comment out for release
|
// log sorting result // TODO comment out for release
|
||||||
String fileList = "";
|
// String fileList = "";
|
||||||
for (File file : files) {
|
// for (File file : files) {
|
||||||
fileList = fileList + file.getName() + "\n";
|
// fileList = fileList + file.getName() + "\n";
|
||||||
}
|
// }
|
||||||
LogHelper.v(LOG_TAG, "+++ List of files +++\n" + fileList);
|
// LogHelper.v(LOG_TAG, "+++ List of files +++\n" + fileList);
|
||||||
|
|
||||||
// hand back sorted array of files
|
// hand back sorted array of files
|
||||||
return files;
|
return files;
|
||||||
|
@ -294,7 +292,7 @@ public class StorageHelper implements TrackbookKeys {
|
||||||
|
|
||||||
/* Return a write-able sub-directory from external storage */
|
/* Return a write-able sub-directory from external storage */
|
||||||
private File getTracksDirectory() {
|
private File getTracksDirectory() {
|
||||||
File[] storage = mActivity.getExternalFilesDirs(mDirectoryName);
|
File[] storage = mActivity.getExternalFilesDirs(DIRECTORY_NAME);
|
||||||
for (File file : storage) {
|
for (File file : storage) {
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
String state = EnvironmentCompat.getStorageState(file);
|
String state = EnvironmentCompat.getStorageState(file);
|
||||||
|
|
|
@ -36,37 +36,24 @@ public interface TrackbookKeys {
|
||||||
String EXTRA_TRACK = "TRACK";
|
String EXTRA_TRACK = "TRACK";
|
||||||
String EXTRA_LAST_LOCATION = "LAST_LOCATION";
|
String EXTRA_LAST_LOCATION = "LAST_LOCATION";
|
||||||
String EXTRA_TRACKING_STATE = "TRACKING_STATE";
|
String EXTRA_TRACKING_STATE = "TRACKING_STATE";
|
||||||
String EXTRA_CLEAR_MAP = "CLEAR_MAP";
|
|
||||||
String EXTRA_INFOSHEET_TITLE = "EXTRA_INFOSHEET_TITLE";
|
String EXTRA_INFOSHEET_TITLE = "EXTRA_INFOSHEET_TITLE";
|
||||||
String EXTRA_INFOSHEET_CONTENT = "INFOSHEET_CONTENT";
|
String EXTRA_INFOSHEET_CONTENT = "INFOSHEET_CONTENT";
|
||||||
String EXTRA_SAVE_FINISHED = "SAVE_FINISHED";
|
String EXTRA_SAVE_FINISHED = "SAVE_FINISHED";
|
||||||
|
|
||||||
/* ARGS */
|
/* ARGS */
|
||||||
String ARG_PERMISSIONS_GRANTED = "ArgPermissionsGranted";
|
// String ARG_PERMISSIONS_GRANTED = "ArgPermissionsGranted";
|
||||||
String ARG_TRACKING_STATE = "ArgTrackingState";
|
// String ARG_TRACKING_STATE = "ArgTrackingState";
|
||||||
String ARG_TRACK = "ArgTrack";
|
// String ARG_TRACK = "ArgTrack";
|
||||||
String ARG_TRACK_VISIBLE = "ArgTrackVisible";
|
// String ARG_TRACK_VISIBLE = "ArgTrackVisible";
|
||||||
String ARG_TRACK_DISTANCE = "ArgTrackDistance";
|
// String ARG_TRACK_DISTANCE = "ArgTrackDistance";
|
||||||
|
|
||||||
/* TAGS */
|
|
||||||
String TAG_MAIN_ACTIVITY_FRAGMENT = "TagMainActivityFragment";
|
|
||||||
|
|
||||||
/* PREFS */
|
/* PREFS */
|
||||||
String PREFS_NAME = "org.y20k.trackbook.prefs";
|
|
||||||
String PREFS_TILE_SOURCE = "tileSourcePrefs";
|
|
||||||
String PREFS_LATITUDE = "latitudePrefs";
|
|
||||||
String PREFS_LONGITUDE = "longitudePrefs";
|
|
||||||
String PREFS_ZOOM_LEVEL = "zoomLevelPrefs";
|
|
||||||
String PREFS_SHOW_LOCATION = "showLocationPrefs";
|
|
||||||
String PREFS_SHOW_COMPASS = "showCompassPrefs";
|
|
||||||
String PREFS_FAB_STATE = "fabStatePrefs";
|
String PREFS_FAB_STATE = "fabStatePrefs";
|
||||||
String PREFS_TRACK_VISIBLE = "trackVisiblePrefs";
|
|
||||||
|
|
||||||
/* INSTANCE STATE */
|
/* INSTANCE STATE */
|
||||||
String INSTANCE_FIRST_START = "firstStart";
|
String INSTANCE_FIRST_START = "firstStart";
|
||||||
String INSTANCE_TRACKING_STATE = "trackingState";
|
String INSTANCE_TRACKING_STATE = "trackingState";
|
||||||
String INSTANCE_SELECTED_TAB = "selectedTab";
|
String INSTANCE_SELECTED_TAB = "selectedTab";
|
||||||
String INSTANCE_FAB_STATE = "fabState";
|
|
||||||
String INSTANCE_FAB_SUB_MENU_VISIBLE = "fabSubMenuVisible";
|
String INSTANCE_FAB_SUB_MENU_VISIBLE = "fabSubMenuVisible";
|
||||||
String INSTANCE_TRACK_MAIN_MAP = "trackMainMap";
|
String INSTANCE_TRACK_MAIN_MAP = "trackMainMap";
|
||||||
String INSTANCE_LATITUDE_MAIN_MAP = "latitudeMainMap";
|
String INSTANCE_LATITUDE_MAIN_MAP = "latitudeMainMap";
|
||||||
|
@ -102,10 +89,12 @@ public interface TrackbookKeys {
|
||||||
int FAB_STATE_DEFAULT = 0;
|
int FAB_STATE_DEFAULT = 0;
|
||||||
int FAB_STATE_RECORDING = 1;
|
int FAB_STATE_RECORDING = 1;
|
||||||
int FAB_STATE_SAVE = 2;
|
int FAB_STATE_SAVE = 2;
|
||||||
int FILETYPE_TEMP = 0;
|
int FILE_TYPE_TEMP = 0;
|
||||||
int FILETYPE_TRACK = 1;
|
int FILE_TYPE_TRACK = 1;
|
||||||
|
|
||||||
String FILENAME_TEMP = "temp";
|
String DIRECTORY_NAME = "tracks";
|
||||||
|
String FILE_TYPE_EXTENSION = ".trackbook";
|
||||||
|
String FILE_NAME_TEMP = "temp";
|
||||||
|
|
||||||
double DEFAULT_LATITUDE = 49.41667; // latitude Nordkapp, Norway
|
double DEFAULT_LATITUDE = 49.41667; // latitude Nordkapp, Norway
|
||||||
double DEFAULT_LONGITUDE = 8.67201; // longitude Nordkapp, Norway
|
double DEFAULT_LONGITUDE = 8.67201; // longitude Nordkapp, Norway
|
||||||
|
|
Loading…
Reference in a new issue