Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4f865e6
Master and fork (#143)
jamescr Jul 5, 2018
e72630f
Minor fixes (#148)
jamescr Jul 14, 2018
35c97f9
new beta version - code42
jamescr Jul 14, 2018
7127129
Upgrade min API to 16
aton1698 Jul 20, 2018
83d8398
Fix the disappearing-when-scrolling icons in the track manager activity
xsaco07 Oct 16, 2018
01b4831
New preference: Minimum distance between subsequent track points
Oct 24, 2018
0ec283c
Merge branch 'master' of https://github.com/labexp/osmtracker-android…
aton1698 Nov 6, 2018
b33a3df
Merge pull request #168 from aton1698/develop
xsaco07 Nov 6, 2018
4f8fab4
Open keyboard automatically when creating a note
jameswestman Dec 25, 2018
cd327cf
Merge pull request #169 from xsaco07/Issue113
jamescr Jan 8, 2019
cf149e2
update gradle and build tools versions
jamescr Jan 8, 2019
a4c097e
Merge branch 'develop' of https://github.com/labexp/osmtracker-androi…
jamescr Jan 8, 2019
a25cc2a
The bug that deletes the saved tags before save the trace is solved
aton1698 Jan 10, 2019
340ccc6
Merge pull request #174 from flyingpimonster/master
aton1698 Jan 10, 2019
76feffd
New translations from Transifex
adam3497 Jan 10, 2019
33f2db0
Do not allow empty string in min_logging_distance
Jan 14, 2019
fa2dfe3
Merge pull request #176 from aton1698/Issue170
adam3497 Jan 15, 2019
ab66a6b
Merge pull request #177 from adam3497/update_translations
aton1698 Jan 18, 2019
2587f93
Merge pull request #165 from icrf2000/hz_min_log_distance
aton1698 Jan 18, 2019
6fb0981
Solving the issue #115 (#179)
adam3497 Jan 18, 2019
ae973d8
Changing app version to 0.7.1
aton1698 Feb 18, 2019
250f21c
Merge pull request #185 from aton1698/develop
xsaco07 Feb 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
buildToolsVersion = '28.0.3'

defaultConfig {
applicationId "net.osmtracker"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="net.osmtracker"
android:versionName="0.7" android:versionCode="42" android:installLocation="auto">
android:versionName="0.7.1" android:versionCode="43" android:installLocation="auto">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/net/osmtracker/OSMTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static final class Preferences {
public final static String KEY_GPS_CHECKSTARTUP = "gps.checkstartup";
public final static String KEY_GPS_IGNORE_CLOCK = "gps.ignoreclock";
public final static String KEY_GPS_LOGGING_INTERVAL = "gps.logging.interval";
public final static String KEY_GPS_LOGGING_MIN_DISTANCE = "gps.logging.min_distance";
public final static String KEY_OUTPUT_FILENAME = "gpx.filename";
public final static String KEY_OUTPUT_ACCURACY = "gpx.accuracy";
public final static String KEY_OUTPUT_GPX_HDOP_APPROXIMATION = "gpx.hdop.approximation";
Expand Down Expand Up @@ -53,6 +54,7 @@ public static final class Preferences {
public final static boolean VAL_GPS_CHECKSTARTUP = true;
public final static boolean VAL_GPS_IGNORE_CLOCK = false;
public final static String VAL_GPS_LOGGING_INTERVAL = "0";
public final static String VAL_GPS_LOGGING_MIN_DISTANCE = "0";

public final static String VAL_OUTPUT_FILENAME_NAME = "name";
public final static String VAL_OUTPUT_FILENAME_NAME_DATE = "name_date";
Expand Down
52 changes: 52 additions & 0 deletions app/src/main/java/net/osmtracker/activity/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.osmtracker.R;

import android.Manifest;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
Expand All @@ -22,6 +23,10 @@
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.Button;
import android.widget.EditText;


/**
Expand Down Expand Up @@ -110,6 +115,53 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
}
});

// Update GPS min. distance summary to the current value
pref = findPreference(OSMTracker.Preferences.KEY_GPS_LOGGING_MIN_DISTANCE);
pref.setSummary(
prefs.getString(OSMTracker.Preferences.KEY_GPS_LOGGING_MIN_DISTANCE, OSMTracker.Preferences.VAL_GPS_LOGGING_MIN_DISTANCE)
+ " " + getResources().getString(R.string.prefs_gps_logging_min_distance_meters)
+ ". " + getResources().getString(R.string.prefs_gps_logging_min_distance_summary));
pref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
// Set summary with the interval and "seconds"
preference.setSummary(newValue
+ " " + getResources().getString(R.string.prefs_gps_logging_min_distance_meters)
+ ". " + getResources().getString(R.string.prefs_gps_logging_min_distance_summary));
return true;
}
});

// don't allow the logging_min_distance to be empty
final EditText et = ((EditTextPreference)pref).getEditText();
final EditTextPreference etp = (EditTextPreference)pref;
et.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}

@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (s.length() >= 0) {
try {
Button bt_ok = ((AlertDialog) etp.getDialog()).getButton(AlertDialog.BUTTON_POSITIVE);
if (s.length() == 0) {
bt_ok.setEnabled(false);
} else {
((AlertDialog) etp.getDialog()).getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(true);
}
} catch (Exception ex) {
}
}
}

@Override
public void afterTextChanged(Editable s) {
}
}
);

pref = findPreference(OSMTracker.Preferences.KEY_GPS_OSSETTINGS);
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
Expand Down
20 changes: 17 additions & 3 deletions app/src/main/java/net/osmtracker/activity/TrackLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,24 @@ protected void onCreate(Bundle savedInstanceState) {
* Also, the default layout is excluded and the 'osmtracker' tag is added by default.
*/
private void saveTagsForTrack(){
//obtain the current track id and initialize the values variable
Uri trackUri = ContentUris.withAppendedId(TrackContentProvider.CONTENT_URI_TRACK, currentTrackId);
ContentValues values = new ContentValues();

//Checking for previously saved tags
Cursor cursor = getContentResolver().query( trackUri, null, null, null, null);
StringBuilder previouslySavedTags = new StringBuilder();
int index = cursor.getColumnIndex(TrackContentProvider.Schema.COL_TAGS);

while (cursor.moveToNext()) {
if(cursor.getString(index) != null)
previouslySavedTags.append(cursor.getString(index) + ",");
}

StringBuilder tags = new StringBuilder();

tags.append(previouslySavedTags);

ArrayList<String> fixedTags = new ArrayList<String>();

//covert the file name to simple layout name
Expand All @@ -232,9 +249,6 @@ private void saveTagsForTrack(){
tags.append(simpleName).append(",");
}

//obtain the current track id and initialize the values variable
Uri trackUri = ContentUris.withAppendedId(TrackContentProvider.CONTENT_URI_TRACK, currentTrackId);
ContentValues values = new ContentValues();

//set the values tag and update the table
values.put(TrackContentProvider.Schema.COL_TAGS, tags.toString());
Expand Down
51 changes: 37 additions & 14 deletions app/src/main/java/net/osmtracker/activity/TrackManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import android.view.View;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.CursorAdapter;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
Expand Down Expand Up @@ -69,15 +70,28 @@ public class TrackManager extends ListActivity {
/** Track Identifier to export after request for write permission **/
private long trackId = -1;

private ImageButton btnNewTrack;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.trackmanager);
setContentView(R.layout.trackmanager);
getListView().setEmptyView(findViewById(R.id.trackmgr_empty));
registerForContextMenu(getListView());
if (savedInstanceState != null) {
prevItemVisible = savedInstanceState.getInt(PREV_VISIBLE, -1);
}
//initialize the bottom start track
btnNewTrack = (ImageButton) findViewById(R.id.trackmgr_hint_icon);
//set a listener that makes the same functionality of (+) button in the main menu of this screen
btnNewTrack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startTrackLogger();
//makes the button invisible when is an active track
btnNewTrack.setVisibility(View.INVISIBLE);
}
});
}

@Override
Expand Down Expand Up @@ -109,6 +123,8 @@ protected void onResume() {
}
}
} else {
//set the button to start a new track visible when there isn't an active track
btnNewTrack.setVisibility(View.VISIBLE);
((TextView) findViewById(R.id.trackmgr_hint)).setText(R.string.trackmgr_newtrack_hint);

// Scroll to the previous listview position,
Expand Down Expand Up @@ -188,19 +204,7 @@ public boolean onPrepareOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.trackmgr_menu_newtrack:
// Start track logger activity
try {
Intent i = new Intent(this, TrackLogger.class);
// New track
currentTrackId = createNewTrack();
i.putExtra(TrackContentProvider.Schema.COL_TRACK_ID, currentTrackId);
startActivity(i);
} catch (CreateTrackException cte) {
Toast.makeText(this,
getResources().getString(R.string.trackmgr_newtrack_error).replace("{0}", cte.getMessage()),
Toast.LENGTH_LONG)
.show();
}
startTrackLogger();
break;
case R.id.trackmgr_menu_continuetrack:
Intent i = new Intent(this, TrackLogger.class);
Expand Down Expand Up @@ -265,6 +269,25 @@ public void onClick(DialogInterface dialog, int which) {
return super.onOptionsItemSelected(item);
}

/**
* This method prepare the new track and set an id, then start a new TrackLogger with the new track id
*/
private void startTrackLogger(){
// Start track logger activity
try {
Intent i = new Intent(this, TrackLogger.class);
// New track
currentTrackId = createNewTrack();
i.putExtra(TrackContentProvider.Schema.COL_TRACK_ID, currentTrackId);
startActivity(i);
} catch (CreateTrackException cte) {
Toast.makeText(this,
getResources().getString(R.string.trackmgr_newtrack_error).replace("{0}", cte.getMessage()),
Toast.LENGTH_LONG)
.show();
}
}


private void requestPermissionAndExport(int typeCode){
if (ContextCompat.checkSelfPermission(this,
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/net/osmtracker/db/TracklistAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ private View bind(Cursor cursor, View v, Context context) {
if (cursor.isNull(cursor.getColumnIndex(TrackContentProvider.Schema.COL_OSM_UPLOAD_DATE))) {
vUploadStatus.setVisibility(View.GONE);
}

else{
vUploadStatus.setImageResource(android.R.drawable.stat_sys_upload_done);
vUploadStatus.setVisibility(View.VISIBLE);
}

// Bind id
long trackId = cursor.getLong(cursor.getColumnIndex(TrackContentProvider.Schema.COL_ID));
String strTrackId = Long.toString(trackId);
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/java/net/osmtracker/service/gps/GPSLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public class GPSLogger extends Service implements LocationListener {
* the interval (in ms) to log GPS fixes defined in the preferences
*/
private long gpsLoggingInterval;
private long gpsLoggingMinDistance;

/**
* sensors for magnetic orientation
Expand Down Expand Up @@ -200,6 +201,8 @@ public void onCreate() {
//read the logging interval from preferences
gpsLoggingInterval = Long.parseLong(PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext()).getString(
OSMTracker.Preferences.KEY_GPS_LOGGING_INTERVAL, OSMTracker.Preferences.VAL_GPS_LOGGING_INTERVAL)) * 1000;
gpsLoggingMinDistance = Long.parseLong(PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext()).getString(
OSMTracker.Preferences.KEY_GPS_LOGGING_MIN_DISTANCE, OSMTracker.Preferences.VAL_GPS_LOGGING_MIN_DISTANCE));

// Register our broadcast receiver
IntentFilter filter = new IntentFilter();
Expand All @@ -214,8 +217,8 @@ public void onCreate() {
lmgr = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
lmgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
}
lmgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, gpsLoggingInterval, gpsLoggingMinDistance, this);
}

//register for Orientation updates
sensorListener.register(this);
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/net/osmtracker/view/TextNoteDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.WindowManager.LayoutParams;
import android.widget.EditText;

import net.osmtracker.db.TrackContentProvider;
Expand Down Expand Up @@ -109,6 +110,8 @@ protected void onStart() {
intent.putExtra(OSMTracker.INTENT_KEY_NAME, context.getResources().getString(R.string.gpsstatus_record_textnote));
context.sendBroadcast(intent);
}

getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

super.onStart();
}
Expand Down
19 changes: 11 additions & 8 deletions app/src/main/res/layout/tracklist_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,47 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:orientation="horizontal"
android:gravity="left|center_vertical"
android:gravity="start|center_vertical"
android:paddingLeft="3dp" android:paddingRight="3dp" android:paddingTop="5dp" android:paddingBottom="5dp"
>

<TextView android:id="@+id/trackmgr_item_id"
android:text="{id}"
android:layout_height="fill_parent" android:layout_width="wrap_content"
style="@android:style/TextAppearance.Medium"
android:gravity="left|center_vertical" android:layout_marginRight="5dp"/>
android:gravity="start|center_vertical" android:layout_marginRight="5dp"/>

<RelativeLayout android:layout_height="fill_parent"
android:gravity="left|center_vertical" android:layout_width="0dip" android:layout_weight="1">
android:gravity="start|center_vertical" android:layout_width="0dip" android:layout_weight="1">

<TextView android:layout_height="wrap_content" android:id="@+id/trackmgr_item_nameordate"
android:text="{start_date}" android:layout_width="wrap_content" style="@android:style/TextAppearance.Large"/>

<TextView android:layout_height="wrap_content" android:id="@+id/trackmgr_item_waypoints" android:layout_below="@+id/trackmgr_item_nameordate"
android:textStyle="bold" android:layout_marginRight="3dp" style="@android:style/TextAppearance.Small" android:text="@string/trackmgr_waypoints_count"
android:layout_width="wrap_content"></TextView>
android:layout_width="wrap_content"/>

<TextView android:layout_height="wrap_content"
android:layout_below="@id/trackmgr_item_nameordate" android:id="@+id/trackmgr_item_wps"
android:layout_toRightOf="@id/trackmgr_item_waypoints" android:text="{x}"
style="@android:style/TextAppearance.Small" android:layout_width="wrap_content"></TextView>
style="@android:style/TextAppearance.Small" android:layout_width="wrap_content"/>

<TextView android:layout_height="wrap_content" android:id="@+id/trackmgr_item_trackpoints" android:layout_toRightOf="@id/trackmgr_item_wps"
android:layout_below="@id/trackmgr_item_nameordate" android:layout_marginLeft="8dp"
android:textStyle="bold" android:layout_marginRight="3dp" style="@android:style/TextAppearance.Small"
android:text="@string/trackmgr_trackpoints_count" android:layout_width="wrap_content"></TextView>
android:text="@string/trackmgr_trackpoints_count" android:layout_width="wrap_content"/>
<TextView android:layout_height="wrap_content"
android:text="{y}" android:id="@+id/trackmgr_item_tps" android:layout_below="@id/trackmgr_item_nameordate"
android:layout_toRightOf="@id/trackmgr_item_trackpoints" style="@android:style/TextAppearance.Small" android:layout_width="wrap_content"></TextView>
android:layout_toRightOf="@id/trackmgr_item_trackpoints" style="@android:style/TextAppearance.Small" android:layout_width="wrap_content"/>

</RelativeLayout>

<ImageView android:id="@+id/trackmgr_item_statusicon"
android:layout_height="fill_parent" android:layout_width="wrap_content"
android:src="@android:drawable/presence_online"
android:paddingLeft="3dp"
android:layout_marginRight="3dp"
android:layout_marginLeft="3dp"
android:layout_gravity="center_horizontal|center_vertical"
android:paddingRight="3dp"
android:contentDescription="@string/acc.track_status" />
Expand All @@ -50,6 +52,7 @@
android:src="@android:drawable/stat_sys_upload_done"
android:paddingLeft="3dp"
android:layout_marginRight="3dp"
android:layout_marginLeft="3dp"
android:layout_gravity="center_horizontal|center_vertical"
android:paddingRight="3dp"
android:contentDescription="@string/acc.upload_status" />
Expand Down
Loading