Repository navigation
ADFA-7274: Package name change dialog #2303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
74fa1bd
feat(ADFA-7274): Display package name change dialog
dara-abijo-adfa 56c3e28
feat(ADFA-7274): Defer auto-open last project
dara-abijo-adfa 281bd02
feat(ADFA-7274): Show package name change dialog at most once per week
dara-abijo-adfa 35b0ad7
feat(ADFA-7274): Navigate to blog
dara-abijo-adfa 0f01e73
Merge branch 'stage' into ADFA-7274-package-name-change-dialog
dara-abijo-adfa 14b585c
Merge branch 'stage' into ADFA-7274-package-name-change-dialog
hal-eisen-adfa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
59 changes: 59 additions & 0 deletions
59
app/src/main/java/com/itsaky/androidide/fragments/PackageNameChangeDialogFragment.kt
This file contains hidden or 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,59 @@ | ||
| package com.itsaky.androidide.fragments | ||
|
|
||
| import android.app.Dialog | ||
| import android.content.DialogInterface | ||
| import android.os.Bundle | ||
| import androidx.appcompat.app.AlertDialog | ||
| import androidx.appcompat.content.res.AppCompatResources | ||
| import androidx.core.graphics.drawable.DrawableCompat | ||
| import androidx.fragment.app.DialogFragment | ||
| import androidx.fragment.app.setFragmentResult | ||
| import com.google.android.material.color.MaterialColors | ||
| import com.itsaky.androidide.R | ||
| import com.itsaky.androidide.preferences.internal.GeneralPreferences | ||
| import com.itsaky.androidide.utils.DialogUtils | ||
| import com.itsaky.androidide.utils.UrlManager | ||
|
|
||
| class PackageNameChangeDialogFragment : DialogFragment() { | ||
| override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
| isCancelable = false | ||
|
|
||
| // Tint the info drawable | ||
| val icon = | ||
| AppCompatResources.getDrawable(requireContext(), R.drawable.ic_info)?.mutate()?.apply { | ||
| val tint = | ||
| MaterialColors.getColor( | ||
| requireContext(), | ||
| com.google.android.material.R.attr.colorSecondary, | ||
| 0, | ||
| ) | ||
| DrawableCompat.setTint(this, tint) | ||
| } | ||
|
|
||
| return DialogUtils | ||
| .newMaterialDialogBuilder(requireContext()) | ||
| .setIcon(icon) | ||
| .setTitle(R.string.package_name_change_title) | ||
| .setMessage(R.string.package_name_change_message) | ||
| .setPositiveButton(R.string.learn_more, null) | ||
| .setNegativeButton(R.string.msg_got_it) { _, _ -> | ||
| GeneralPreferences.packageNameChangeNoticeDismissedAt = System.currentTimeMillis() | ||
| setFragmentResult(REQUEST_KEY, Bundle.EMPTY) | ||
| }.create() | ||
| } | ||
|
|
||
| override fun onStart() { | ||
| super.onStart() | ||
| (dialog as? AlertDialog)?.getButton(DialogInterface.BUTTON_POSITIVE)?.setOnClickListener { | ||
| UrlManager.openUrl( | ||
| url = getString(R.string.package_name_change_learn_more_url), | ||
| context = requireActivity(), | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| companion object { | ||
| const val TAG = "PackageNameChangeDialog" | ||
| const val REQUEST_KEY = "package_name_change_dialog_dismissed" | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.