Skip to content

Commit 06927be

Browse files
committed
Feature: Add a What's New slide to the App intro.
1 parent 4986abf commit 06927be

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ dependencies {
104104
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
105105
implementation 'androidx.appcompat:appcompat:1.7.0'
106106
implementation 'androidx.preference:preference:1.2.0'
107+
implementation 'androidx.preference:preference-ktx:1.2.1'
107108

108109
// Required -- JUnit 4 framework
109110
testImplementation 'junit:junit:4.13.2'

app/src/main/java/net/osmtracker/activity/Intro.kt

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package net.osmtracker.activity
22

33
import android.os.Bundle
4+
import androidx.activity.enableEdgeToEdge
5+
import androidx.core.content.ContextCompat
46
import androidx.fragment.app.Fragment
57
import androidx.preference.PreferenceManager
68
import com.github.appintro.AppIntro
@@ -11,9 +13,24 @@ import androidx.core.content.edit
1113

1214
class Intro : AppIntro() {
1315
override fun onCreate(savedInstanceState: Bundle?) {
16+
// Enable Edge-to-Edge support. Must be called before super.onCreate()
17+
enableEdgeToEdge()
1418
super.onCreate(savedInstanceState)
1519
// Make sure you don't call setContentView!
1620

21+
// Set the colors for the bottom bar elements
22+
val activeColor = ContextCompat.getColor(this, R.color.colorAccent)
23+
val inactiveColor = ContextCompat.getColor(this, R.color.colorPrimary)
24+
25+
setIndicatorColor(
26+
selectedIndicatorColor = activeColor,
27+
unselectedIndicatorColor = inactiveColor
28+
)
29+
30+
setColorDoneText(activeColor)
31+
setColorSkipButton(activeColor)
32+
setNextArrowColor(activeColor)
33+
1734
// Call addSlide passing your Fragments.
1835
// You can use AppIntroFragment to use a pre-built fragment
1936
addSlide(AppIntroFragment.createInstance(
@@ -23,6 +40,14 @@ class Intro : AppIntro() {
2340
description = getString(R.string.app_intro_slide1_description)
2441
))
2542

43+
// Whats new Fragment
44+
addSlide(AppIntroFragment.createInstance(
45+
title = getString(R.string.app_intro_slide_whats_new_title),
46+
imageDrawable = R.drawable.icon_100x100,
47+
backgroundColorRes = R.color.appintro_background_color,
48+
description = getString(R.string.app_intro_slide_whats_new_description)
49+
))
50+
2651
//TODO: change the image of slide number 2.
2752
addSlide(AppIntroFragment.createInstance(
2853
title = getString(R.string.app_intro_slide2_title),
@@ -40,8 +65,8 @@ class Intro : AppIntro() {
4065

4166
override fun onDonePressed(currentFragment: Fragment?) {
4267
super.onDonePressed(currentFragment)
43-
// Decide what to do when the user clicks on "Done"
44-
PreferenceManager.getDefaultSharedPreferences(baseContext).edit {
68+
// Use the KTX extension for cleaner SharedPreferences editing
69+
PreferenceManager.getDefaultSharedPreferences(this).edit {
4570
putBoolean(
4671
OSMTracker.Preferences.KEY_DISPLAY_APP_INTRO,
4772
false

app/src/main/res/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@
274274
<!--Intro - slide1-->
275275
<string name="app_intro_slide1_title">Welcome to OSMTracker for Android™ 👋</string>
276276
<string name="app_intro_slide1_description">This App is free software that respects your freedom!</string>
277+
<!--Intro - slide What's new-->
278+
<string name="app_intro_slide_whats_new_title">What\'s new in this version?</string>
279+
<string name="app_intro_slide_whats_new_description">Now we can upload notes to OSM, and CyclOSM and OpenTopo map tiles are available again. Enjoy! </string>
277280
<!--Intro - slide2-->
278281
<string name="app_intro_slide2_title">Happy tracking 🗺 😎</string>
279282
<string name="app_intro_slide2_description">OSMTracker for Android will use your GPS location to record trackpoints and waypoints, even when the App is running in background.

0 commit comments

Comments
 (0)