some clean-up
This commit is contained in:
		
							parent
							
								
									3487792ada
								
							
						
					
					
						commit
						614d151dea
					
				
					 8 changed files with 41 additions and 47 deletions
				
			
		|  | @ -396,6 +396,7 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O | |||
|             mDropdown.setAdapter(mDropdownAdapter); | ||||
|         } else { | ||||
|             LogHelper.e(LOG_TAG, "Unable to delete recording."); | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         if (mDropdownAdapter.isEmpty()) { | ||||
|  |  | |||
|  | @ -36,8 +36,8 @@ public class TrackBundle { | |||
|     private static final String LOG_TAG = TrackBundle.class.getSimpleName(); | ||||
| 
 | ||||
|     /* Main class variables */ | ||||
|     private File mTrackFile; | ||||
|     private String mTrackName; | ||||
|     private final File mTrackFile; | ||||
|     private final String mTrackName; | ||||
| 
 | ||||
| 
 | ||||
|     /* Constructor */ | ||||
|  |  | |||
|  | @ -46,7 +46,7 @@ public class DropdownAdapter extends BaseAdapter implements ThemedSpinnerAdapter | |||
| 
 | ||||
| 
 | ||||
|     /* Main class variables */ | ||||
|     private Activity mActivity; | ||||
|     private final Activity mActivity; | ||||
|     private final ThemedSpinnerAdapter.Helper mDropdownAdapterHelper; | ||||
|     private List<TrackBundle> mTrackBundleList; | ||||
| 
 | ||||
|  |  | |||
|  | @ -46,7 +46,7 @@ public class ExportHelper implements TrackbookKeys { | |||
|     /* Main class variables */ | ||||
| //    private final Track mTrack; | ||||
|     private final Context mContext; | ||||
|     private File mFolder; | ||||
|     private final File mFolder; | ||||
| 
 | ||||
| 
 | ||||
|     /* Constructor */ | ||||
|  | @ -135,7 +135,7 @@ public class ExportHelper implements TrackbookKeys { | |||
|     /* Creates Track */ | ||||
|     private String addTrack(Track track) { | ||||
|         StringBuilder gpxTrack = new StringBuilder(""); | ||||
|         DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); | ||||
|         DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US); | ||||
| 
 | ||||
|         // add opening track tag | ||||
|         gpxTrack.append("\t<trk>\n"); | ||||
|  |  | |||
|  | @ -52,8 +52,10 @@ public final class MapHelper { | |||
|         // create marker | ||||
|         Drawable newMarker; | ||||
|         if (locationIsNew) { | ||||
|             // noinspection RestrictedApi // TODO remove as soon as support library gets updated | ||||
|             newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_dot_blue_24dp); | ||||
|         } else { | ||||
|             //noinspection RestrictedApi | ||||
|             newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_dot_grey_24dp); | ||||
|         } | ||||
|         OverlayItem overlayItem = createOverlayItem(context, currentBestLocation); | ||||
|  | @ -102,9 +104,11 @@ public final class MapHelper { | |||
|             if (trackingActive && !currentPosition) { | ||||
|                 if (wayPoint.getIsStopOver()) { | ||||
|                     // stop over marker | ||||
|                     // noinspection RestrictedApi // TODO remove as soon as support library gets updated | ||||
|                     newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_crumb_grey_24dp); | ||||
|                 } else { | ||||
|                     // default marker for this case | ||||
|                     // noinspection RestrictedApi // TODO remove as soon as support library gets updated | ||||
|                     newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_crumb_red_24dp); | ||||
|                 } | ||||
|             } | ||||
|  | @ -113,9 +117,11 @@ public final class MapHelper { | |||
|             else if (trackingActive && currentPosition) { | ||||
|                 if (wayPoint.getIsStopOver()) { | ||||
|                     // stop over marker | ||||
|                     // noinspection RestrictedApi // TODO remove as soon as support library gets updated | ||||
|                     newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_dot_grey_24dp); | ||||
|                 } else { | ||||
|                     // default marker for this case | ||||
|                     // noinspection RestrictedApi // TODO remove as soon as support library gets updated | ||||
|                     newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_dot_red_24dp); | ||||
|                 } | ||||
|             } | ||||
|  | @ -124,9 +130,11 @@ public final class MapHelper { | |||
|             else if (!trackingActive && !currentPosition) { | ||||
|                 if (wayPoint.getIsStopOver()) { | ||||
|                     // stop over marker | ||||
|                     // noinspection RestrictedApi // TODO remove as soon as support library gets updated | ||||
|                     newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_crumb_grey_24dp); | ||||
|                 } else { | ||||
|                     // default marker for this case | ||||
|                     // noinspection RestrictedApi // TODO remove as soon as support library gets updated | ||||
|                     newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_crumb_blue_24dp); | ||||
|                 } | ||||
|             } | ||||
|  | @ -134,6 +142,7 @@ public final class MapHelper { | |||
|             // CASE 4: Tracking not active and WayPoint is current position | ||||
|             else { | ||||
|                 // default marker | ||||
|                 // noinspection RestrictedApi // TODO remove as soon as support library gets updated | ||||
|                 newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_crumb_blue_24dp); | ||||
|             } | ||||
| 
 | ||||
|  |  | |||
|  | @ -52,7 +52,7 @@ public class StorageHelper implements TrackbookKeys { | |||
| 
 | ||||
|     /* Main class variables */ | ||||
|     private final Context mContext; | ||||
|     private File mFolder; | ||||
|     private final File mFolder; | ||||
|     private final File mTempFile; | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -47,12 +47,6 @@ public interface TrackbookKeys { | |||
|     String ARG_DIALOG_BUTTON_POSITIVE = "ArgDialogButtonPositive"; | ||||
|     String ARG_DIALOG_BUTTON_NEGATIVE = "ArgDialogButtonNegative"; | ||||
| 
 | ||||
| //    String ARG_PERMISSIONS_GRANTED = "ArgPermissionsGranted"; | ||||
| //    String ARG_TRACKING_STATE = "ArgTrackingState"; | ||||
| //    String ARG_TRACK = "ArgTrack"; | ||||
| //    String ARG_TRACK_VISIBLE = "ArgTrackVisible"; | ||||
| //    String ARG_TRACK_DISTANCE = "ArgTrackDistance"; | ||||
| 
 | ||||
|     /* PREFS */ | ||||
|     String PREFS_FAB_STATE = "fabStatePrefs"; | ||||
|     String PREFS_TRACKER_SERVICE_RUNNING = "trackerServiceRunning"; | ||||
|  | @ -62,7 +56,6 @@ public interface TrackbookKeys { | |||
|     String INSTANCE_TRACKING_STATE = "trackingState"; | ||||
|     String INSTANCE_SELECTED_TAB = "selectedTab"; | ||||
|     String INSTANCE_FAB_SUB_MENU_VISIBLE = "fabSubMenuVisible"; | ||||
|     String INSTANCE_TRACK_MAIN_MAP = "trackMainMap"; | ||||
|     String INSTANCE_LATITUDE_MAIN_MAP = "latitudeMainMap"; | ||||
|     String INSTANCE_LONGITUDE_MAIN_MAP = "longitudeMainMap"; | ||||
|     String INSTANCE_ZOOM_LEVEL_MAIN_MAP = "zoomLevelMainMap"; | ||||
|  | @ -78,6 +71,10 @@ public interface TrackbookKeys { | |||
|     int FRAGMENT_ID_TRACK = 1; | ||||
| 
 | ||||
|     /* RESULTS */ | ||||
|     int RESULT_SAVE_DIALOG = 1; | ||||
|     int RESULT_CLEAR_DIALOG = 2; | ||||
|     int RESULT_DELETE_DIALOG = 3; | ||||
|     int RESULT_EXPORT_DIALOG = 4; | ||||
| 
 | ||||
|     /* CONSTANTS */ | ||||
|     long ONE_NANOSECOND = 1000000000L; | ||||
|  | @ -87,35 +84,32 @@ public interface TrackbookKeys { | |||
|     long TWO_MINUTES_IN_NANOSECONDS = 2L * 60000000000L; // defines an old location | ||||
|     int MAXIMUM_TRACK_FILES = 25; | ||||
| 
 | ||||
|     /* MISC */ | ||||
|     int CURRENT_TRACK_FORMAT_VERSION = 1; // incremental version number to prevent issues in case the Track format evolves | ||||
|     int REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS = 124; | ||||
|     int TRACKER_SERVICE_NOTIFICATION_ID = 1; | ||||
|     int INFOSHEET_CONTENT_ABOUT = 1; | ||||
|     int METRIC = 1; | ||||
|     int IMPERIAL = 2; | ||||
|     int FAB_STATE_DEFAULT = 0; | ||||
|     int FAB_STATE_RECORDING = 1; | ||||
|     int FAB_STATE_SAVE = 2; | ||||
|     int FILE_TEMP_TRACK = 0; | ||||
|     int FILE_MOST_CURRENT_TRACK = 1; | ||||
|     int NEW_DROPDOWN_ITEM = -1; | ||||
| 
 | ||||
|     int RESULT_SAVE_DIALOG = 1; | ||||
|     int RESULT_CLEAR_DIALOG = 2; | ||||
|     int RESULT_DELETE_DIALOG = 3; | ||||
|     int RESULT_EXPORT_DIALOG = 4; | ||||
| 
 | ||||
|     int STORAGE_TRACKS = 1; | ||||
|     int STORAGE_DOWNLOADS = 2; | ||||
| 
 | ||||
|     String TRACKS_DIRECTORY_NAME = "tracks"; | ||||
|     /* FILE */ | ||||
|     String FILE_TYPE_GPX_EXTENSION = ".gpx"; | ||||
|     String FILE_TYPE_TRACKBOOK_EXTENSION = ".trackbook"; | ||||
|     String FILE_NAME_TEMP = "temp"; | ||||
|     String TRACKS_DIRECTORY_NAME = "tracks"; | ||||
|     int FILE_TEMP_TRACK = 0; | ||||
|     int FILE_MOST_CURRENT_TRACK = 1; | ||||
| 
 | ||||
|     /* UNITS */ | ||||
|     int METRIC = 1; | ||||
|     int IMPERIAL = 2; | ||||
| 
 | ||||
|     /* FLOATING ACTION BUTTON */ | ||||
|     int FAB_STATE_DEFAULT = 0; | ||||
|     int FAB_STATE_RECORDING = 1; | ||||
|     int FAB_STATE_SAVE = 2; | ||||
| 
 | ||||
|     /* NOTIFICATION */ | ||||
|     int TRACKER_SERVICE_NOTIFICATION_ID = 1; | ||||
|     String NOTIFICATION_CHANEL_ID_RECORDING_CHANNEL ="notificationChannelIdRecordingChannel"; | ||||
| 
 | ||||
|     /* MISC */ | ||||
|     double DEFAULT_LATITUDE = 49.41667; // latitude Nordkapp, Norway | ||||
|     double DEFAULT_LONGITUDE = 8.67201; // longitude Nordkapp, Norway | ||||
|     int CURRENT_TRACK_FORMAT_VERSION = 1; // incremental version number to prevent issues in case the Track format evolves | ||||
|     int REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS = 124; | ||||
|     int INFOSHEET_CONTENT_ABOUT = 1; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -18,7 +18,6 @@ | |||
| package org.y20k.trackbook.layout; | ||||
| 
 | ||||
| import android.content.Context; | ||||
| import android.os.Build; | ||||
| import android.support.design.widget.CoordinatorLayout; | ||||
| import android.support.design.widget.Snackbar; | ||||
| import android.util.AttributeSet; | ||||
|  | @ -31,10 +30,6 @@ import android.view.View; | |||
|  */ | ||||
| public class DodgeAbleLayoutBehavior extends CoordinatorLayout.Behavior<View> { | ||||
| 
 | ||||
|     /* Main class variables */ | ||||
|     private static final boolean SNACKBAR_BEHAVIOR_ENABLED; | ||||
| 
 | ||||
| 
 | ||||
|     /* Constructor (default) */ | ||||
|     public DodgeAbleLayoutBehavior() { | ||||
|         super(); | ||||
|  | @ -49,7 +44,7 @@ public class DodgeAbleLayoutBehavior extends CoordinatorLayout.Behavior<View> { | |||
| 
 | ||||
|     @Override | ||||
|     public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) { | ||||
|         return SNACKBAR_BEHAVIOR_ENABLED && dependency instanceof Snackbar.SnackbarLayout; | ||||
|         return dependency instanceof Snackbar.SnackbarLayout; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -60,9 +55,4 @@ public class DodgeAbleLayoutBehavior extends CoordinatorLayout.Behavior<View> { | |||
|         return true; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     static { | ||||
|         SNACKBAR_BEHAVIOR_ENABLED = Build.VERSION.SDK_INT >= 11; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
		Loading…
	
		Reference in a new issue
	
	 y20k
						y20k