increased touch target for GPX export button + smaller bug fixes.

This commit is contained in:
y20k 2017-05-22 14:39:28 +02:00
parent 4b2ad8d140
commit 7f3979d4f4
9 changed files with 58 additions and 34 deletions

View file

@ -2,14 +2,14 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 25 compileSdkVersion 25
buildToolsVersion '25.0.0' buildToolsVersion '25.0.3'
defaultConfig { defaultConfig {
applicationId "org.y20k.trackbook" applicationId "org.y20k.trackbook"
minSdkVersion 22 minSdkVersion 22
targetSdkVersion 25 targetSdkVersion 25
versionCode 8 versionCode 9
versionName "1.0.1 (Astronomy Domine)" versionName "1.0.2 (Astronomy Domine)"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
} }
buildTypes { buildTypes {
@ -22,9 +22,9 @@ android {
dependencies { dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs') compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.2.0' compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.2.0' compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.2.0' compile 'com.android.support:cardview-v7:25.3.1'
compile 'org.osmdroid:osmdroid-android:5.6.4' compile 'org.osmdroid:osmdroid-android:5.6.4'
compile 'com.google.code.gson:gson:2.8.0' compile 'com.google.code.gson:gson:2.8.0'
} }

View file

@ -124,6 +124,9 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
mDropdownAdapter.notifyDataSetChanged(); mDropdownAdapter.notifyDataSetChanged();
mDropdown.setAdapter(mDropdownAdapter); mDropdown.setAdapter(mDropdownAdapter);
mDropdown.setSelection(0, true); mDropdown.setSelection(0, true);
// remove onboarding if necessary
switchOnboardingLayout();
} }
} }
}; };
@ -295,7 +298,6 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
} }
@Override @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) { public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
@ -321,8 +323,6 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
} }
/* Displays map and statistics for track */ /* Displays map and statistics for track */
private void displayTrack() { private void displayTrack() {
GeoPoint position; GeoPoint position;
@ -428,9 +428,11 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
public void onClick(View view) { public void onClick(View view) {
// get text elements for delete dialog // get text elements for delete dialog
int dialogTitle = R.string.dialog_delete_title; int dialogTitle = R.string.dialog_delete_title;
String dialogMessage = getString(R.string.dialog_delete_content) + " " + mTrack.getTrackDuration() + " | " + mTrack.getTrackDistance();
int dialogPositiveButton = R.string.dialog_delete_action_delete; int dialogPositiveButton = R.string.dialog_delete_action_delete;
int dialogNegativeButton = R.string.dialog_default_action_cancel; int dialogNegativeButton = R.string.dialog_default_action_cancel;
DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.getDefault());
String recordingStartDate = df.format(mTrack.getRecordingStart());
String dialogMessage = getString(R.string.dialog_delete_content) + " " + recordingStartDate + " | " + mTrack.getTrackDistance();
// show delete dialog - results are handles by onActivityResult // show delete dialog - results are handles by onActivityResult
DialogFragment dialogFragment = DialogHelper.newInstance(dialogTitle, dialogMessage, dialogPositiveButton, dialogNegativeButton); DialogFragment dialogFragment = DialogHelper.newInstance(dialogTitle, dialogMessage, dialogPositiveButton, dialogNegativeButton);
@ -448,9 +450,11 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
public void onClick(View view) { public void onClick(View view) {
// dialog text components // dialog text components
int dialogTitle; int dialogTitle;
String dialogMessage;
int dialogPositiveButton; int dialogPositiveButton;
int dialogNegativeButton; int dialogNegativeButton;
DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.getDefault());
String recordingStartDate = df.format(mTrack.getRecordingStart());
String dialogMessage;
// create an ExportHelper // create an ExportHelper
final ExportHelper exportHelper = new ExportHelper(mActivity); final ExportHelper exportHelper = new ExportHelper(mActivity);
@ -459,7 +463,7 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
if (exportHelper.gpxFileExists(mTrack)) { if (exportHelper.gpxFileExists(mTrack)) {
// CASE: OVERWRITE - GPX file exists // CASE: OVERWRITE - GPX file exists
dialogTitle = R.string.dialog_export_title_overwrite; dialogTitle = R.string.dialog_export_title_overwrite;
dialogMessage = getString(R.string.dialog_export_content_overwrite) + " (" + mTrack.getTrackDuration() + " | " + mTrack.getTrackDistance() + ")"; dialogMessage = getString(R.string.dialog_export_content_overwrite) + " (" + recordingStartDate + " | " + mTrack.getTrackDistance() + ")";
dialogPositiveButton = R.string.dialog_export_action_overwrite; dialogPositiveButton = R.string.dialog_export_action_overwrite;
dialogNegativeButton = R.string.dialog_default_action_cancel; dialogNegativeButton = R.string.dialog_default_action_cancel;
} else { } else {

View file

@ -76,9 +76,10 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
@Override @Override
public int onStartCommand(Intent intent, int flags, int startId) { public void onCreate() {
super.onCreate();
// listen for finished save operation // receiver: listen track request issued by the main map - in onResume
mTrackRequestReceiver = new BroadcastReceiver() { mTrackRequestReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
@ -100,9 +101,15 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
// create content observer for changes in System Settings // create content observer for changes in System Settings
mSettingsContentObserver = new SettingsContentObserver(new Handler()); mSettingsContentObserver = new SettingsContentObserver(new Handler());
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// check if user did turn off location in device settings // check if user did turn off location in device settings
if (!mLocationSystemSetting) { if (!mLocationSystemSetting) {
LogHelper.v(LOG_TAG, "Location Setting is turned off."); LogHelper.i(LOG_TAG, "Location Setting is turned off.");
Toast.makeText(getApplicationContext(), R.string.toast_message_location_offline, Toast.LENGTH_LONG).show(); Toast.makeText(getApplicationContext(), R.string.toast_message_location_offline, Toast.LENGTH_LONG).show();
stopTracking(); stopTracking();
return START_STICKY; return START_STICKY;
@ -110,7 +117,8 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
// checking for empty intent // checking for empty intent
if (intent == null) { if (intent == null) {
LogHelper.v(LOG_TAG, "Null-Intent received. Stopping self."); LogHelper.e(LOG_TAG, "Null-Intent received. Stopping self.");
// stopSelf triggers onDestroy
stopSelf(); stopSelf();
} }
@ -225,7 +233,7 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
if (stepCounter != null) { if (stepCounter != null) {
mSensorManager.registerListener(this, stepCounter, SensorManager.SENSOR_DELAY_UI); mSensorManager.registerListener(this, stepCounter, SensorManager.SENSOR_DELAY_UI);
} else { } else {
LogHelper.v(LOG_TAG, "Pedometer Sensor not available"); LogHelper.i(LOG_TAG, "Pedometer Sensor not available");
mTrack.setStepCount(-1); mTrack.setStepCount(-1);
} }
@ -313,12 +321,14 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
/* Broadcasts a track update */ /* Broadcasts a track update */
private void sendTrackUpdate() { private void sendTrackUpdate() {
if (mTrack != null) {
Intent i = new Intent(); Intent i = new Intent();
i.setAction(ACTION_TRACK_UPDATED); i.setAction(ACTION_TRACK_UPDATED);
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);
} }
}
/* Creates a location listener */ /* Creates a location listener */

View file

@ -59,7 +59,7 @@ public class DialogHelper extends DialogFragment implements TrackbookKeys {
if (title != -1) { if (title != -1) {
dialogBuilder.setTitle(title); dialogBuilder.setTitle(title);
} }
dialogBuilder.setTitle(message); dialogBuilder.setMessage(message);
dialogBuilder.setPositiveButton(positiveButton, dialogBuilder.setPositiveButton(positiveButton,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) { public void onClick(DialogInterface dialog, int whichButton) {

View file

@ -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

View file

@ -44,9 +44,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end|center" android:layout_gravity="end|center"
android:layout_marginStart="@dimen/activity_horizontal_margin" android:paddingStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin" android:paddingEnd="@dimen/activity_horizontal_margin"
android:background="@drawable/ic_export_white_24dp" android:src="@drawable/ic_export_white_24dp"
android:background="@android:color/transparent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:contentDescription="@string/descr_export_button" /> android:contentDescription="@string/descr_export_button" />
<ImageButton <ImageButton
android:visibility="gone" android:visibility="gone"
@ -54,9 +57,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end|center" android:layout_gravity="end|center"
android:layout_marginStart="@dimen/activity_horizontal_margin" android:paddingStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin" android:paddingEnd="@dimen/activity_horizontal_margin"
android:background="@drawable/ic_delete_forever_white_24dp" android:paddingTop="8dp"
android:paddingBottom="8dp"
android:src="@drawable/ic_delete_forever_white_24dp"
android:background="@android:color/transparent"
android:contentDescription="@string/descr_delete_button" /> android:contentDescription="@string/descr_delete_button" />
</LinearLayout> </LinearLayout>

View file

@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources> <resources>
<string name="app_name">Trackbook</string> <string name="app_name">Trackbook</string> <!-- please do not translate app_name - transcription into different alphabet types is fine though -->
<string name="title_activity_infosheet">情報シート</string> <string name="title_activity_infosheet">情報シート</string>
<string name="menu_my_location">私の場所</string> <string name="menu_my_location">私の場所</string>

View file

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources><string name="app_name">Sporingsbok</string> <string name="title_activity_infosheet">Infoark</string> <resources>
<string name="app_name">Trackbook</string> <!-- please do not translate app_name - transcription into different alphabet types is fine though -->
<string name="title_activity_infosheet">Infoark</string>
<string name="menu_my_location">Min plasssering</string> <string name="menu_my_location">Min plasssering</string>
<string name="menu_about">Om</string> <string name="menu_about">Om</string>

View file

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources><string name="app_name">Trackbook</string> <string name="title_activity_infosheet">Informatieblad</string> <resources>
<string name="app_name">Trackbook</string> <!-- please do not translate app_name - transcription into different alphabet types is fine though -->
<string name="title_activity_infosheet">Informatieblad</string>
<string name="menu_my_location">Mijn locatie</string> <string name="menu_my_location">Mijn locatie</string>
<string name="menu_about">Over</string> <string name="menu_about">Over</string>