adds an About section to Settings (+ updated libraries)
This commit is contained in:
parent
e9c03d46b2
commit
2e8b02c845
12 changed files with 94 additions and 10 deletions
|
@ -68,17 +68,17 @@ dependencies {
|
|||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0"
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation "androidx.core:core-ktx:1.2.0"
|
||||
implementation "androidx.core:core-ktx:1.3.0"
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
|
||||
implementation "androidx.preference:preference-ktx:1.1.1"
|
||||
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
|
||||
|
||||
|
||||
implementation "com.google.android.material:material:1.1.0-beta01"
|
||||
implementation "com.google.android.material:material:1.2.0-beta01"
|
||||
implementation "com.google.code.gson:gson:2.8.6"
|
||||
|
||||
implementation "org.osmdroid:osmdroid-android:6.1.6"
|
||||
|
|
|
@ -19,7 +19,10 @@ package org.y20k.trackbook
|
|||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.StrictMode
|
||||
import android.os.StrictMode.VmPolicy
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.navigation.fragment.NavHostFragment
|
||||
import androidx.navigation.ui.setupWithNavController
|
||||
|
@ -50,6 +53,16 @@ class MainActivity : AppCompatActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// todo remove after testing finished
|
||||
if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
StrictMode.setVmPolicy(
|
||||
VmPolicy.Builder()
|
||||
.detectNonSdkApiUsage()
|
||||
.penaltyLog()
|
||||
.build()
|
||||
)
|
||||
}
|
||||
|
||||
// set user agent to prevent getting banned from the osm servers
|
||||
Configuration.getInstance().userAgentValue = BuildConfig.APPLICATION_ID
|
||||
// set the path for osmdroid's files (e.g. tile cache)
|
||||
|
|
|
@ -19,9 +19,14 @@ package org.y20k.trackbook
|
|||
|
||||
|
||||
import YesNoDialog
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.preference.*
|
||||
import kotlinx.coroutines.*
|
||||
import org.y20k.trackbook.core.Tracklist
|
||||
|
@ -123,6 +128,36 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
|
|||
return@setOnPreferenceClickListener true
|
||||
}
|
||||
|
||||
// set up "App Version" preference
|
||||
val preferenceAppVersion: Preference = Preference(context)
|
||||
preferenceAppVersion.title = getString(R.string.pref_app_version_title)
|
||||
preferenceAppVersion.setIcon(R.drawable.ic_info_24dp)
|
||||
preferenceAppVersion.summary = "${getString(R.string.pref_app_version_summary)} ${BuildConfig.VERSION_NAME} (${getString(
|
||||
R.string.app_version_name)})"
|
||||
preferenceAppVersion.setOnPreferenceClickListener {
|
||||
// copy to clipboard
|
||||
val clip: ClipData = ClipData.newPlainText("simple text", preferenceAppVersion.summary)
|
||||
val cm: ClipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
cm.setPrimaryClip(clip)
|
||||
Toast.makeText(activity as Context, R.string.toast_message_copied_to_clipboard, Toast.LENGTH_LONG).show()
|
||||
return@setOnPreferenceClickListener true
|
||||
}
|
||||
|
||||
// set up "Report Issue" preference
|
||||
val preferenceReportIssue: Preference = Preference(context)
|
||||
preferenceReportIssue.title = getString(R.string.pref_report_issue_title)
|
||||
preferenceReportIssue.setIcon(R.drawable.ic_bug_report_24dp)
|
||||
preferenceReportIssue.summary = getString(R.string.pref_report_issue_summary)
|
||||
preferenceReportIssue.setOnPreferenceClickListener {
|
||||
// open web browser
|
||||
val intent = Intent().apply {
|
||||
action = Intent.ACTION_VIEW
|
||||
data = Uri.parse("https://github.com/y20k/trackbook/issues")
|
||||
}
|
||||
startActivity(intent)
|
||||
return@setOnPreferenceClickListener true
|
||||
}
|
||||
|
||||
// set preference categories
|
||||
val preferenceCategoryGeneral: PreferenceCategory = PreferenceCategory(activity as Context)
|
||||
preferenceCategoryGeneral.title = getString(R.string.pref_general_title)
|
||||
|
@ -137,6 +172,11 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
|
|||
preferenceCategoryAdvanced.contains(preferenceAccuracyThreshold)
|
||||
preferenceCategoryAdvanced.contains(preferenceResetAdvanced)
|
||||
|
||||
val preferenceCategoryAbout: PreferenceCategory = PreferenceCategory(context)
|
||||
preferenceCategoryAbout.title = getString(R.string.pref_about_title)
|
||||
preferenceCategoryAbout.contains(preferenceAppVersion)
|
||||
preferenceCategoryAbout.contains(preferenceReportIssue)
|
||||
|
||||
// setup preference screen
|
||||
screen.addPreference(preferenceCategoryGeneral)
|
||||
screen.addPreference(preferenceGpsOnly)
|
||||
|
@ -147,6 +187,9 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
|
|||
screen.addPreference(preferenceCategoryAdvanced)
|
||||
screen.addPreference(preferenceAccuracyThreshold)
|
||||
screen.addPreference(preferenceResetAdvanced)
|
||||
screen.addPreference(preferenceCategoryAbout)
|
||||
screen.addPreference(preferenceAppVersion)
|
||||
screen.addPreference(preferenceReportIssue)
|
||||
preferenceScreen = screen
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ data class MapFragmentLayoutHolder(var context: Context, var inflater: LayoutInf
|
|||
// basic map setup
|
||||
controller = mapView.controller
|
||||
mapView.isTilesScaledToDpi = true
|
||||
mapView.setTilesScaledToDpi(true)
|
||||
mapView.setTileSource(TileSourceFactory.MAPNIK)
|
||||
mapView.setMultiTouchControls(true)
|
||||
mapView.zoomController.setVisibility(org.osmdroid.views.CustomZoomButtonsController.Visibility.NEVER)
|
||||
|
|
|
@ -99,7 +99,7 @@ data class TrackFragmentLayoutHolder(var context: Context, var inflater: LayoutI
|
|||
|
||||
// basic map setup
|
||||
controller = mapView.controller
|
||||
mapView.isTilesScaledToDpi = true
|
||||
mapView.setTilesScaledToDpi(true)
|
||||
mapView.setTileSource(TileSourceFactory.MAPNIK)
|
||||
mapView.setMultiTouchControls(true)
|
||||
mapView.zoomController.setVisibility(org.osmdroid.views.CustomZoomButtonsController.Visibility.NEVER)
|
||||
|
|
9
app/src/main/res/drawable/ic_bug_report_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_bug_report_24dp.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@color/icon_default"
|
||||
android:pathData="M20,8h-2.81c-0.45,-0.78 -1.07,-1.45 -1.82,-1.96L17,4.41 15.59,3l-2.17,2.17C12.96,5.06 12.49,5 12,5s-0.96,0.06 -1.41,0.17L8.41,3 7,4.41l1.62,1.63C7.88,6.55 7.26,7.22 6.81,8L4,8v2h2.09c-0.05,0.33 -0.09,0.66 -0.09,1v1L4,12v2h2v1c0,0.34 0.04,0.67 0.09,1L4,16v2h2.81c1.04,1.79 2.97,3 5.19,3s4.15,-1.21 5.19,-3L20,18v-2h-2.09c0.05,-0.33 0.09,-0.66 0.09,-1v-1h2v-2h-2v-1c0,-0.34 -0.04,-0.67 -0.09,-1L20,10L20,8zM16,12v3c0,0.22 -0.03,0.47 -0.07,0.7l-0.1,0.65 -0.37,0.65c-0.72,1.24 -2.04,2 -3.46,2s-2.74,-0.77 -3.46,-2l-0.37,-0.64 -0.1,-0.65C8.03,15.48 8,15.23 8,15v-4c0,-0.23 0.03,-0.48 0.07,-0.7l0.1,-0.65 0.37,-0.65c0.3,-0.52 0.72,-0.97 1.21,-1.31l0.57,-0.39 0.74,-0.18c0.31,-0.08 0.63,-0.12 0.94,-0.12 0.32,0 0.63,0.04 0.95,0.12l0.68,0.16 0.61,0.42c0.5,0.34 0.91,0.78 1.21,1.31l0.38,0.65 0.1,0.65c0.04,0.22 0.07,0.47 0.07,0.69v1zM10,14h4v2h-4zM10,10h4v2h-4z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_info_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_info_24dp.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@color/icon_default"
|
||||
android:pathData="M11,7h2v2h-2zM11,11h2v6h-2zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
|
||||
</vector>
|
|
@ -29,6 +29,7 @@
|
|||
android:background="@drawable/shape_statistics_background_collapsed"
|
||||
app:behavior_hideable="false"
|
||||
app:behavior_peekHeight="54dp"
|
||||
app:gestureInsetBottomIgnored="true"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
|
||||
|
||||
<ScrollView
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
<string name="dialog_error_empty_recording_message">Trackbook hat noch keine Wegpunkte aufgenommen.</string>
|
||||
<string name="dialog_error_empty_recording_action_resume">Aufnahme fortsetzen</string>
|
||||
<!-- toast messages -->
|
||||
<string name="toast_message_copied_to_clipboard">In die Zwischenablage kopiert.</string>
|
||||
<string name="toast_message_elevation_info">Hinweis: Die Genauigkeit der Höhenmeter-Werte ist geräteabhängig. Gemessen werden Steigungen und Gefälle der Gesamtstrecke.</string>
|
||||
<string name="toast_message_install_file_helper">Speichern nicht möglich. Bitte zunächst einen Dateimanager installieren.</string>
|
||||
<!-- map markers -->
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<!-- App Name -->
|
||||
<string name="app_name">Trackbook</string>
|
||||
<!-- please do not translate app_name - transcription into different alphabet types is fine though -->
|
||||
<string name="app_version_name" translatable="false">\"Echoes\"</string>
|
||||
<!-- Tabs -->
|
||||
<string name="tab_map">Map</string>
|
||||
<string name="tab_tracks">Tracks</string>
|
||||
|
@ -39,6 +40,7 @@
|
|||
<string name="dialog_yes_no_message_delete_non_starred">Delete all non-starred recordings? This action cannot be undone.</string>
|
||||
<string name="dialog_yes_no_message_delete_recording">Delete this recording?</string>
|
||||
<!-- Toast Messages -->
|
||||
<string name="toast_message_copied_to_clipboard">Copied to clipboard.</string>
|
||||
<string name="toast_message_elevation_info">Hint: The accuracy of elevation data depends on your device. The uphill and downhill elevation of the whole route is measured.</string>
|
||||
<string name="toast_message_install_file_helper">Unable to save. Please install a file manager first.</string>
|
||||
<string name="toast_message_save_gpx">Saving recording as GPX.</string>
|
||||
|
@ -69,6 +71,9 @@
|
|||
<string name="track_list_onboarding_h1_part_1">Your recorded tracks</string>
|
||||
<string name="track_list_onboarding_h1_part_2">… will show up here.</string>
|
||||
<!-- Settings -->
|
||||
<string name="pref_about_title">About</string>
|
||||
<string name="pref_app_version_summary">Version</string>
|
||||
<string name="pref_app_version_title">App Version</string>
|
||||
<string name="pref_accuracy_threshold_summary">Discard location fixes with an accuracy larger than:</string>
|
||||
<string name="pref_accuracy_threshold_title">Accuracy Threshold</string>
|
||||
<string name="pref_advanced_title">Advanced</string>
|
||||
|
@ -82,6 +87,8 @@
|
|||
<string name="pref_imperial_measurement_units_summary_metric">Currently using metric units (Kilometer, Meter).</string>
|
||||
<string name="pref_imperial_measurement_units_summary_imperial">Currently using imperial units (Miles, Feet).</string>
|
||||
<string name="pref_imperial_measurement_units_title">Use Imperial Measurements</string>
|
||||
<string name="pref_report_issue_summary">Report bugs and suggest improvements on GitHub.</string>
|
||||
<string name="pref_report_issue_title">Report Issue</string>
|
||||
<string name="pref_reset_advanced_summary">Reset advanced settings to defaults.</string>
|
||||
<string name="pref_reset_advanced_title">Reset</string>
|
||||
<string name="pref_theme_selection_mode_dark">Dark mode</string>
|
||||
|
|
|
@ -8,9 +8,9 @@ buildscript {
|
|||
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.6.3'
|
||||
classpath 'com.android.tools.build:gradle:4.0.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.2.2"
|
||||
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0"
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Wed Feb 26 14:43:25 CET 2020
|
||||
#Sat May 30 22:16:24 CEST 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
|
|
Loading…
Reference in a new issue