Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #11455 from t895/about-dialog
Android: Add about dialog
- Loading branch information
Showing
19 changed files
with
894 additions
and
22 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| // SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| package org.dolphinemu.dolphinemu.fragments | ||
|
|
||
| import android.os.Bundle | ||
| import android.text.method.LinkMovementMethod | ||
| import android.view.LayoutInflater | ||
| import android.view.View | ||
| import android.view.ViewGroup | ||
| import android.widget.Toast | ||
| import androidx.appcompat.app.AppCompatActivity | ||
| import androidx.core.content.ContextCompat | ||
| import com.google.android.material.bottomsheet.BottomSheetBehavior | ||
| import com.google.android.material.bottomsheet.BottomSheetDialogFragment | ||
| import org.dolphinemu.dolphinemu.BuildConfig | ||
| import org.dolphinemu.dolphinemu.R | ||
| import org.dolphinemu.dolphinemu.databinding.DialogAboutBinding | ||
| import org.dolphinemu.dolphinemu.databinding.DialogAboutTvBinding | ||
|
|
||
| class AboutDialogFragment : BottomSheetDialogFragment() { | ||
| private var _bindingMobile: DialogAboutBinding? = null | ||
| private var _bindingTv: DialogAboutTvBinding? = null | ||
|
|
||
| private val bindingMobile get() = _bindingMobile!! | ||
| private val bindingTv get() = _bindingTv!! | ||
|
|
||
| override fun onCreateView( | ||
| inflater: LayoutInflater, | ||
| container: ViewGroup?, | ||
| savedInstanceState: Bundle? | ||
| ): View { | ||
| if (activity is AppCompatActivity) { | ||
| _bindingMobile = DialogAboutBinding.inflate(layoutInflater) | ||
| return bindingMobile.root | ||
| } | ||
| _bindingTv = DialogAboutTvBinding.inflate(layoutInflater) | ||
| return bindingTv.root | ||
| } | ||
|
|
||
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
| if (!resources.getBoolean(R.bool.hasTouch)) { | ||
| BottomSheetBehavior.from<View>(view.parent as View).state = | ||
| BottomSheetBehavior.STATE_EXPANDED | ||
| } | ||
|
|
||
| val wark = resources.getString(R.string.wark) | ||
| val branch = String.format( | ||
| resources.getString(R.string.about_branch), | ||
| BuildConfig.BRANCH | ||
| ) | ||
| val revision = String.format( | ||
| resources.getString(R.string.about_revision), | ||
| BuildConfig.GIT_HASH | ||
| ) | ||
| if (activity is AppCompatActivity) { | ||
| bindingMobile.dolphinLogo.setOnLongClickListener { | ||
| Toast.makeText(requireContext(), wark, Toast.LENGTH_SHORT).show() | ||
| true | ||
| } | ||
|
|
||
| bindingMobile.websiteText.movementMethod = LinkMovementMethod.getInstance() | ||
| bindingMobile.githubText.movementMethod = LinkMovementMethod.getInstance() | ||
| bindingMobile.supportText.movementMethod = LinkMovementMethod.getInstance() | ||
|
|
||
| bindingMobile.versionText.text = BuildConfig.VERSION_NAME | ||
| bindingMobile.branchText.text = branch | ||
| bindingMobile.revisionText.text = revision | ||
| } else { | ||
| bindingTv.dolphinLogo.setOnLongClickListener { | ||
| Toast.makeText(requireContext(), wark, Toast.LENGTH_SHORT).show() | ||
| true | ||
| } | ||
|
|
||
| bindingTv.websiteText.movementMethod = LinkMovementMethod.getInstance() | ||
| bindingTv.githubText.movementMethod = LinkMovementMethod.getInstance() | ||
| bindingTv.supportText.movementMethod = LinkMovementMethod.getInstance() | ||
|
|
||
| bindingTv.versionText.text = BuildConfig.VERSION_NAME | ||
| bindingTv.branchText.text = branch | ||
| bindingTv.revisionText.text = revision | ||
|
|
||
| bindingTv.dolphinLogo.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_dolphin)) | ||
| } | ||
| } | ||
|
|
||
| override fun onDestroyView() { | ||
| super.onDestroyView() | ||
| _bindingMobile = null | ||
| } | ||
|
|
||
| companion object { | ||
| const val TAG = "AboutDialogFragment" | ||
| } | ||
| } |
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
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
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,20 @@ | ||
| <vector android:height="192dp" android:viewportHeight="500" | ||
| android:viewportWidth="500" android:width="192dp" | ||
| xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <path android:fillColor="#0057AB" android:fillType="nonZero" | ||
| android:pathData="M344.28,301.46C343.6,299.18 339.35,285.41 332.2,272.21C322.77,254.81 314.66,242.38 301.16,229.75C296.81,225.69 292.7,222.06 288.41,218.8L288.42,218.8C288.42,218.8 288.38,218.78 288.32,218.73C288.24,218.67 288.16,218.61 288.08,218.55C286.48,217.32 279.75,211.64 282.15,205.38C282.95,203.28 284.89,201.53 287.19,200.12L299.6,200.02L299.6,195.42L299.6,195.42C299.6,195.42 299.6,195.42 299.6,195.42C299.6,195.42 292.33,192.95 279.62,193.77C267.69,194.53 256.97,201.51 254.96,202.49C248.54,200.65 241.2,199.03 232.63,197.57C202.97,192.54 177.86,200.56 165.27,209.3C148.76,220.76 149.21,231.44 147.85,236.78C147.01,240.09 139.51,246.21 139.6,250.5L139.6,255.02L141.15,256.61L146.99,254.63L147.69,252.19C150.09,251.34 152.72,250.14 155.11,249.16C161.07,246.71 161.53,245.37 177.82,242.94C185.32,241.82 193.21,241.5 199.08,241.45C201.37,246.28 207.05,256.2 216.89,260.96C223.3,264.05 230.47,265.64 236.18,266.45L235.43,270.22L246.8,271.9L246.8,267.3L246.79,267.3C246.79,267.3 246.79,267.3 246.79,267.3C246.79,267.3 237.25,263.34 231.38,257.47C227.38,253.47 226.43,247.4 226.23,243.93L226.26,243.93C235.88,245.76 244.28,247.08 264.38,254.78C268.09,256.2 271.56,257.76 274.72,259.34L274.12,259.67L283.18,266.98L294,275.93L294,271.33L293.96,271.3C293.8,271.1 281.48,255.84 260.78,245.63C243.67,237.19 229.62,233.02 210.16,232.07C188.88,231.04 173.21,233.77 173.21,233.77C173.21,233.77 173.64,224.32 189.71,216.79C203.67,210.23 225.65,209.14 250.86,215.57C286.49,224.66 298.64,240.14 313.96,256.13C323.69,266.27 332.62,280.55 338.26,290.43L337.31,290L340.23,297.54L344.4,306.45L344.4,301.82L344.28,301.46z" | ||
| android:strokeColor="#00000000" android:strokeLineCap="butt" | ||
| android:strokeLineJoin="miter" android:strokeWidth="0.1"/> | ||
| <path android:fillType="nonZero" | ||
| android:pathData="M332.2,276.8C322.77,259.41 314.67,246.97 301.16,234.34C296.82,230.28 292.7,226.65 288.41,223.39L288.42,223.39C288.42,223.39 288.39,223.37 288.32,223.32C288.25,223.27 288.17,223.21 288.09,223.15C286.5,221.92 279.75,216.24 282.15,209.97C284.78,203.09 299.6,200.01 299.6,200.01C299.6,200.01 292.34,197.54 279.62,198.36C267.69,199.12 256.97,206.1 254.96,207.08C248.54,205.24 241.21,203.62 232.63,202.17C202.97,197.13 177.87,205.15 165.27,213.9C148.76,225.36 149.22,236.03 147.86,241.38C146.88,245.22 136.92,252.85 140.3,257.01C142.41,259.61 149.44,256.08 155.11,253.75C161.07,251.3 161.53,249.96 177.83,247.53C185.32,246.42 193.21,246.09 199.08,246.05C201.37,250.87 207.05,260.79 216.9,265.55C230.19,271.97 246.8,271.89 246.8,271.89C246.8,271.89 237.25,267.93 231.38,262.06C227.39,258.06 226.43,251.99 226.23,248.52L226.26,248.53C235.88,250.35 244.29,251.67 264.38,259.37C281.96,266.1 293.97,275.9 293.97,275.9C293.97,275.9 281.62,260.5 260.78,250.22C243.67,241.78 229.63,237.61 210.16,236.67C188.89,235.63 173.21,238.37 173.21,238.37C173.21,238.37 173.65,228.91 189.71,221.38C203.68,214.83 225.65,213.73 250.87,220.16C286.49,229.25 298.64,244.73 313.97,260.72C330.28,277.74 344.38,306.39 344.38,306.39C344.38,306.39 340.03,291.25 332.2,276.8z" | ||
| android:strokeColor="#00000000" android:strokeLineCap="butt" | ||
| android:strokeLineJoin="miter" android:strokeWidth="0.1"> | ||
| <aapt:attr name="android:fillColor"> | ||
| <gradient android:endX="139.6" android:endY="306.4" | ||
| android:startX="139.6" android:startY="198.2" android:type="linear"> | ||
| <item android:color="#FF46D4FF" android:offset="0"/> | ||
| <item android:color="#FF1792FF" android:offset="1"/> | ||
| </gradient> | ||
| </aapt:attr> | ||
| </path> | ||
| </vector> |
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="24dp" | ||
| android:height="24dp" | ||
| android:viewportHeight="24" | ||
| android:viewportWidth="24"> | ||
| <path | ||
| android:fillColor="@android:color/white" | ||
| android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z" /> | ||
| </vector> |
Oops, something went wrong.