diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle index 8588c48cad..97cd3464cf 100644 --- a/Source/Android/app/build.gradle +++ b/Source/Android/app/build.gradle @@ -49,6 +49,9 @@ android { versionName "${getVersion()}" + buildConfigField "String", "GIT_HASH", "\"${getGitHash()}\"" + buildConfigField "String", "BRANCH", "\"${getBranch()}\"" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -172,7 +175,6 @@ def getVersion() { return versionNumber } - def getBuildVersionCode() { try { def versionNumber = 'git rev-list --first-parent --count HEAD'.execute([], project.rootDir).text @@ -184,3 +186,25 @@ def getBuildVersionCode() { return 1 } + +def getGitHash() { + try { + def gitHash = 'git rev-parse HEAD'.execute([], project.rootDir).text.trim() + return gitHash + } catch (Exception e) { + logger.error(e + ': Cannot find git, defaulting to dummy build hash') + } + + return 0 +} + +def getBranch() { + try { + def branch = 'git rev-parse --abbrev-ref HEAD'.execute([], project.rootDir).text.trim() + return branch + } catch (Exception e) { + logger.error(e + ': Cannot find git, defaulting to dummy build hash') + } + + return 'master' +} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/AboutDialogFragment.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/AboutDialogFragment.kt new file mode 100644 index 0000000000..059442ae98 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/AboutDialogFragment.kt @@ -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.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" + } +} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncChannelJobService.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncChannelJobService.java index 2e11049ab2..596f60cd8f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncChannelJobService.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncChannelJobService.java @@ -129,7 +129,7 @@ public class SyncChannelJobService extends JobService builder.build().toContentValues()); channelId = ContentUris.parseId(channelUrl); - Bitmap bitmap = TvUtil.convertToBitmap(context, R.drawable.ic_dolphin); + Bitmap bitmap = TvUtil.convertToBitmap(context, R.drawable.ic_dolphin_launcher); ChannelLogoUtils.storeChannelLogo(context, channelId, bitmap); return channelId; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java index 0115dba7cc..2e5d9c617f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java @@ -21,6 +21,7 @@ import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag; import org.dolphinemu.dolphinemu.features.sysupdate.ui.SystemUpdateProgressBarDialogFragment; import org.dolphinemu.dolphinemu.features.sysupdate.ui.SystemMenuNotInstalledDialogFragment; import org.dolphinemu.dolphinemu.features.sysupdate.ui.SystemUpdateViewModel; +import org.dolphinemu.dolphinemu.fragments.AboutDialogFragment; import org.dolphinemu.dolphinemu.model.GameFileCache; import org.dolphinemu.dolphinemu.services.GameFileCacheManager; import org.dolphinemu.dolphinemu.utils.AfterDirectoryInitializationRunner; @@ -135,6 +136,9 @@ public final class MainPresenter new AfterDirectoryInitializationRunner().runWithLifecycle(activity, () -> mView.launchOpenFileActivity(REQUEST_NAND_BIN_FILE)); return true; + + case R.id.menu_about: + showAboutDialog(); } return false; @@ -337,4 +341,9 @@ public final class MainPresenter } }); } + + private void showAboutDialog() + { + new AboutDialogFragment().show(mActivity.getSupportFragmentManager(), AboutDialogFragment.TAG); + } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java index 21a8fc2880..0e1f55154b 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java @@ -406,6 +406,10 @@ public final class TvMainActivity extends FragmentActivity R.drawable.ic_folder_tv, R.string.grid_menu_online_system_update)); + rowItems.add(new TvSettingsItem(R.id.menu_about, + R.drawable.ic_info_tv, + R.string.grid_menu_about)); + // Create a header for this row. HeaderItem header = new HeaderItem(R.string.settings, getString(R.string.settings)); diff --git a/Source/Android/app/src/main/res/drawable/ic_dolphin.xml b/Source/Android/app/src/main/res/drawable/ic_dolphin.xml index c43d170346..c2defe5980 100644 --- a/Source/Android/app/src/main/res/drawable/ic_dolphin.xml +++ b/Source/Android/app/src/main/res/drawable/ic_dolphin.xml @@ -1,19 +1,27 @@ - - - + + + - - - + + + diff --git a/Source/Android/app/src/main/res/drawable/ic_dolphin_launcher.xml b/Source/Android/app/src/main/res/drawable/ic_dolphin_launcher.xml new file mode 100644 index 0000000000..c43d170346 --- /dev/null +++ b/Source/Android/app/src/main/res/drawable/ic_dolphin_launcher.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + diff --git a/Source/Android/app/src/main/res/drawable/ic_info_tv.xml b/Source/Android/app/src/main/res/drawable/ic_info_tv.xml new file mode 100644 index 0000000000..6fa3a6c4f0 --- /dev/null +++ b/Source/Android/app/src/main/res/drawable/ic_info_tv.xml @@ -0,0 +1,10 @@ + + + diff --git a/Source/Android/app/src/main/res/layout-w600dp/dialog_about.xml b/Source/Android/app/src/main/res/layout-w600dp/dialog_about.xml new file mode 100644 index 0000000000..03006aa7cc --- /dev/null +++ b/Source/Android/app/src/main/res/layout-w600dp/dialog_about.xml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Android/app/src/main/res/layout-w600dp/dialog_about_tv.xml b/Source/Android/app/src/main/res/layout-w600dp/dialog_about_tv.xml new file mode 100644 index 0000000000..18da059c5f --- /dev/null +++ b/Source/Android/app/src/main/res/layout-w600dp/dialog_about_tv.xml @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Android/app/src/main/res/layout/dialog_about.xml b/Source/Android/app/src/main/res/layout/dialog_about.xml new file mode 100644 index 0000000000..6af5c19ab9 --- /dev/null +++ b/Source/Android/app/src/main/res/layout/dialog_about.xml @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Android/app/src/main/res/layout/dialog_about_tv.xml b/Source/Android/app/src/main/res/layout/dialog_about_tv.xml new file mode 100644 index 0000000000..0282005ca7 --- /dev/null +++ b/Source/Android/app/src/main/res/layout/dialog_about_tv.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Android/app/src/main/res/layout/tv_title.xml b/Source/Android/app/src/main/res/layout/tv_title.xml index 29786d47f5..ebcb9acfbf 100644 --- a/Source/Android/app/src/main/res/layout/tv_title.xml +++ b/Source/Android/app/src/main/res/layout/tv_title.xml @@ -25,7 +25,7 @@ android:id="@+id/badge" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:src="@drawable/ic_dolphin"/> + android:src="@drawable/ic_dolphin_launcher"/> diff --git a/Source/Android/app/src/main/res/menu/menu_game_grid.xml b/Source/Android/app/src/main/res/menu/menu_game_grid.xml index 47c551a51a..0e265097fb 100644 --- a/Source/Android/app/src/main/res/menu/menu_game_grid.xml +++ b/Source/Android/app/src/main/res/menu/menu_game_grid.xml @@ -50,6 +50,10 @@ android:id="@+id/menu_online_system_update" android:title="@string/grid_menu_online_system_update" app:showAsAction="never"/> - + + diff --git a/Source/Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/Source/Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index 202cd6f5ee..fefddc12df 100644 --- a/Source/Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/Source/Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/Source/Android/app/src/main/res/values-notouch/bools.xml b/Source/Android/app/src/main/res/values-notouch/bools.xml new file mode 100644 index 0000000000..c0b732c323 --- /dev/null +++ b/Source/Android/app/src/main/res/values-notouch/bools.xml @@ -0,0 +1,4 @@ + + + false + diff --git a/Source/Android/app/src/main/res/values/bools.xml b/Source/Android/app/src/main/res/values/bools.xml new file mode 100644 index 0000000000..758a374559 --- /dev/null +++ b/Source/Android/app/src/main/res/values/bools.xml @@ -0,0 +1,4 @@ + + + true + diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index d2aa1213d6..280c7d0d1f 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -463,6 +463,7 @@ Load Wii System Menu Load Wii System Menu (%s) Load vWii System Menu (%s) + About Importing… Exporting… Do not close the app! @@ -860,4 +861,16 @@ It can efficiently compress both junk data and encrypted Wii data. LZMA2 (slow) Zstandard (recommended) + + Dolphin + WARK WARK WARK + Dolphin logo + Branch:\n%s + Revision:\n%s + Dolphin is a free and open-source GameCube and Wii emulator.\n\nThis software should not be used to play games you do not legally own. + Website + GitHub + Support + \u00A9 2003–2015+ Dolphin Team. \u201cGameCube\u201d and \u201cWii\u201d are trademarks of Nintendo. Dolphin is not affiliated with Nintendo in any way. + diff --git a/Source/Android/app/src/main/res/values/themes.xml b/Source/Android/app/src/main/res/values/themes.xml index 3a361c693c..e2e24397b9 100644 --- a/Source/Android/app/src/main/res/values/themes.xml +++ b/Source/Android/app/src/main/res/values/themes.xml @@ -2,13 +2,13 @@