-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip * Add extra onboarding step
- Loading branch information
Showing
8 changed files
with
186 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
app/src/main/java/eu/darken/capod/main/ui/onboarding/OnboardingFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package eu.darken.capod.main.ui.onboarding | ||
|
||
import android.os.Bundle | ||
import android.view.View | ||
import androidx.fragment.app.viewModels | ||
import dagger.hilt.android.AndroidEntryPoint | ||
import eu.darken.capod.R | ||
import eu.darken.capod.common.PrivacyPolicy | ||
import eu.darken.capod.common.WebpageTool | ||
import eu.darken.capod.common.uix.Fragment3 | ||
import eu.darken.capod.common.viewbinding.viewBinding | ||
import eu.darken.capod.databinding.OnboardingFragmentBinding | ||
import javax.inject.Inject | ||
|
||
|
||
@AndroidEntryPoint | ||
class OnboardingFragment : Fragment3(R.layout.onboarding_fragment) { | ||
|
||
override val vm: OnboardingFragmentVM by viewModels() | ||
override val ui: OnboardingFragmentBinding by viewBinding() | ||
|
||
@Inject lateinit var webpageTool: WebpageTool | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
ui.goPrivacyPolicy.setOnClickListener { webpageTool.open(PrivacyPolicy.URL) } | ||
ui.continueAction.setOnClickListener { vm.finishOnboarding() } | ||
super.onViewCreated(view, savedInstanceState) | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
app/src/main/java/eu/darken/capod/main/ui/onboarding/OnboardingFragmentVM.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package eu.darken.capod.main.ui.onboarding | ||
|
||
import androidx.lifecycle.SavedStateHandle | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import eu.darken.capod.common.coroutine.DispatcherProvider | ||
import eu.darken.capod.common.debug.logging.logTag | ||
import eu.darken.capod.common.uix.ViewModel3 | ||
import eu.darken.capod.main.core.GeneralSettings | ||
import kotlinx.coroutines.flow.* | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class OnboardingFragmentVM @Inject constructor( | ||
@Suppress("UNUSED_PARAMETER") handle: SavedStateHandle, | ||
private val dispatcherProvider: DispatcherProvider, | ||
private val generalSettings: GeneralSettings, | ||
) : ViewModel3(dispatcherProvider = dispatcherProvider) { | ||
|
||
fun finishOnboarding() = launch { | ||
generalSettings.isOnboardingDone.value = true | ||
OnboardingFragmentDirections.actionOnboardingFragmentToOverviewFragment().navigate() | ||
} | ||
|
||
companion object { | ||
val TAG = logTag("Onboarding", "Fragment", "VM") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:padding="32dp"> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<ImageView | ||
android:id="@+id/mascot" | ||
android:layout_width="96dp" | ||
android:layout_height="96dp" | ||
android:layout_marginTop="48dp" | ||
android:src="@drawable/splash_graphic2" | ||
app:layout_constraintEnd_toEndOf="@id/title" | ||
app:layout_constraintStart_toStartOf="@id/title" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<com.google.android.material.textview.MaterialTextView | ||
android:id="@+id/title" | ||
style="@style/TextAppearance.Material3.HeadlineLarge" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:text="@string/app_name" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/mascot" /> | ||
|
||
<com.google.android.material.textview.MaterialTextView | ||
android:id="@+id/body1" | ||
style="@style/TextAppearance.MaterialComponents.Body1" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="32dp" | ||
android:text="@string/onboarding_body1" | ||
app:layout_constraintTop_toBottomOf="@id/title" /> | ||
|
||
<com.google.android.material.textview.MaterialTextView | ||
android:id="@+id/body2" | ||
style="@style/TextAppearance.MaterialComponents.Body1" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="8dp" | ||
android:text="@string/onboarding_body2" | ||
app:layout_constraintTop_toBottomOf="@id/body1" /> | ||
|
||
<com.google.android.material.textview.MaterialTextView | ||
android:id="@+id/body3" | ||
style="@style/TextAppearance.MaterialComponents.Body1" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="8dp" | ||
android:text="@string/onboarding_body3" | ||
app:layout_constraintTop_toBottomOf="@id/body2" /> | ||
|
||
<com.google.android.material.textview.MaterialTextView | ||
android:id="@+id/body4" | ||
style="@style/TextAppearance.MaterialComponents.Body1" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="8dp" | ||
android:text="@string/onboarding_body4" | ||
app:layout_constraintTop_toBottomOf="@id/body3" /> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/go_privacy_policy" | ||
style="@style/Widget.Material3.Button.TonalButton" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginVertical="32dp" | ||
android:text="@string/settings_privacy_policy_label" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/body4" /> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/continue_action" | ||
style="@style/Widget.Material3.Button" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginHorizontal="32dp" | ||
android:layout_marginTop="32dp" | ||
android:text="@string/general_continue_action" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/go_privacy_policy" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
|
||
</ScrollView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters