-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16216 from wordpress-mobile/issue/16109-blogging-…
…prompts-introduction-dialog-ui Implement Blogging Prompts introduction dialog UI
- Loading branch information
Showing
18 changed files
with
543 additions
and
155 deletions.
There are no files selected for viewing
19 changes: 0 additions & 19 deletions
19
WordPress/src/main/java/org/wordpress/android/models/usecases/GetBloggingPromptUseCase.kt
This file was deleted.
Oops, something went wrong.
8 changes: 5 additions & 3 deletions
8
...va/org/wordpress/android/ui/bloggingprompts/onboarding/BloggingPromptsOnboardingAction.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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
package org.wordpress.android.ui.bloggingprompts.onboarding | ||
|
||
import org.wordpress.android.models.bloggingprompts.BloggingPrompt | ||
|
||
sealed class BloggingPromptsOnboardingAction { | ||
data class OpenEditor(val bloggingPrompt: BloggingPrompt) : BloggingPromptsOnboardingAction() | ||
object OpenEditor : BloggingPromptsOnboardingAction() | ||
|
||
object OpenSitePicker : BloggingPromptsOnboardingAction() | ||
|
||
object OpenRemindersIntro : BloggingPromptsOnboardingAction() | ||
} |
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
14 changes: 13 additions & 1 deletion
14
...a/org/wordpress/android/ui/bloggingprompts/onboarding/BloggingPromptsOnboardingUiState.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 |
---|---|---|
@@ -1,3 +1,15 @@ | ||
package org.wordpress.android.ui.bloggingprompts.onboarding | ||
|
||
sealed class BloggingPromptsOnboardingUiState | ||
import androidx.annotation.StringRes | ||
|
||
sealed class BloggingPromptsOnboardingUiState { | ||
data class Ready( | ||
@StringRes val promptRes: Int, | ||
@StringRes val answersRes: Int, | ||
val answersCount: Int, | ||
@StringRes val contentTopRes: Int, | ||
@StringRes val contentBottomRes: Int, | ||
@StringRes val contentNoteTitle: Int, | ||
@StringRes val contentNoteContent: Int | ||
) : BloggingPromptsOnboardingUiState() | ||
} |
19 changes: 19 additions & 0 deletions
19
...wordpress/android/ui/bloggingprompts/onboarding/BloggingPromptsOnboardingUiStateMapper.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,19 @@ | ||
package org.wordpress.android.ui.bloggingprompts.onboarding | ||
|
||
import org.wordpress.android.R | ||
import org.wordpress.android.ui.bloggingprompts.onboarding.BloggingPromptsOnboardingUiState.Ready | ||
import javax.inject.Inject | ||
|
||
class BloggingPromptsOnboardingUiStateMapper @Inject constructor() { | ||
fun mapReady(): Ready = Ready( | ||
promptRes = R.string.blogging_prompts_onboarding_card_prompt, | ||
answersRes = R.string.my_site_blogging_prompt_card_number_of_answers, | ||
answersCount = ANSWER_COUNT, | ||
contentTopRes = R.string.blogging_prompts_onboarding_content_top, | ||
contentBottomRes = R.string.blogging_prompts_onboarding_content_bottom, | ||
contentNoteTitle = R.string.blogging_prompts_onboarding_content_note_title, | ||
contentNoteContent = R.string.blogging_prompts_onboarding_content_note_content | ||
) | ||
} | ||
|
||
private const val ANSWER_COUNT = 19 |
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
79 changes: 79 additions & 0 deletions
79
...in/java/org/wordpress/android/ui/featureintroduction/FeatureIntroductionDialogFragment.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,79 @@ | ||
package org.wordpress.android.ui.featureintroduction | ||
|
||
import android.app.Dialog | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.annotation.DrawableRes | ||
import androidx.annotation.StringRes | ||
import androidx.core.content.res.ResourcesCompat | ||
import androidx.fragment.app.DialogFragment | ||
import org.wordpress.android.R | ||
import org.wordpress.android.databinding.FeatureIntroductionDialogFragmentBinding | ||
import org.wordpress.android.util.extensions.setStatusBarAsSurfaceColor | ||
|
||
@Suppress("TooManyFunctions") | ||
abstract class FeatureIntroductionDialogFragment : DialogFragment() { | ||
private var _binding: FeatureIntroductionDialogFragmentBinding? = null | ||
private val binding get() = _binding ?: throw NullPointerException("_binding cannot be null") | ||
|
||
override fun getTheme(): Int { | ||
return R.style.FeatureIntroductionDialogFragment | ||
} | ||
|
||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
val dialog = super.onCreateDialog(savedInstanceState) | ||
dialog.setStatusBarAsSurfaceColor() | ||
return dialog | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View = FeatureIntroductionDialogFragmentBinding.inflate(inflater).root | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
_binding = FeatureIntroductionDialogFragmentBinding.bind(view) | ||
setupCloseButton() | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
|
||
fun setPrimaryButtonListener(listener: () -> Unit) { | ||
binding.primaryButton.setOnClickListener { listener() } | ||
} | ||
|
||
fun setPrimaryButtonText(@StringRes textRes: Int) { | ||
binding.primaryButton.text = getString(textRes) | ||
} | ||
|
||
fun setSecondaryButtonListener(listener: () -> Unit) { | ||
binding.secondaryButton.setOnClickListener { listener() } | ||
} | ||
|
||
fun setSecondaryButtonText(@StringRes textRes: Int) { | ||
binding.secondaryButton.text = getString(textRes) | ||
} | ||
|
||
fun setHeaderTitle(@StringRes headerTitleRes: Int) { | ||
binding.headerTitle.text = getString(headerTitleRes) | ||
} | ||
|
||
fun setHeaderIcon(@DrawableRes headerIconRes: Int) { | ||
binding.headerIcon.setImageDrawable(ResourcesCompat.getDrawable(resources, headerIconRes, context?.theme)) | ||
} | ||
|
||
fun setContent(view: View) { | ||
binding.contentContainer.addView(view) | ||
} | ||
|
||
private fun setupCloseButton() { | ||
binding.closeButton.setOnClickListener { dismiss() } | ||
} | ||
} |
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<gradient xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:angle="90" | ||
android:startColor="#E25781" | ||
android:endColor="#DEB100" | ||
android:type="linear" /> |
8 changes: 8 additions & 0 deletions
8
WordPress/src/main/res/drawable/bg_rectangle_black_60_radius_2dp.xml
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,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<corners android:radius="@dimen/default_cardview_radius" /> | ||
<stroke | ||
android:width="@dimen/unelevated_card_stroke_width" | ||
android:color="@color/on_surface_divider" /> | ||
</shape> |
10 changes: 10 additions & 0 deletions
10
WordPress/src/main/res/drawable/ic_outline_lightbulb_orange_gradient_40dp.xml
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,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="40dp" | ||
android:height="40dp" | ||
android:viewportHeight="24" | ||
android:viewportWidth="24"> | ||
|
||
<path | ||
android:fillColor="@color/lightbulb_orange_background" | ||
android:pathData="M9,21c0,0.55 0.45,1 1,1h4c0.55,0 1,-0.45 1,-1v-1L9,20v1zM12,2C8.14,2 5,5.14 5,9c0,2.38 1.19,4.47 3,5.74L8,17c0,0.55 0.45,1 1,1h6c0.55,0 1,-0.45 1,-1v-2.26c1.81,-1.27 3,-3.36 3,-5.74 0,-3.86 -3.14,-7 -7,-7zM14.85,13.1l-0.85,0.6L14,16h-4v-2.3l-0.85,-0.6C7.8,12.16 7,10.63 7,9c0,-2.76 2.24,-5 5,-5s5,2.24 5,5c0,1.63 -0.8,3.16 -2.15,4.1z" /> | ||
</vector> |
Oops, something went wrong.