Skip to content
Permalink
Browse files
Merge pull request #11455 from t895/about-dialog
Android: Add about dialog
  • Loading branch information
delroth committed Jan 24, 2023
2 parents caca662 + b598b6e commit 014d057
Show file tree
Hide file tree
Showing 19 changed files with 894 additions and 22 deletions.
@@ -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'
}
@@ -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"
}
}
@@ -129,7 +129,7 @@ private long createChannel(HomeScreenChannel subscription)
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;
@@ -21,6 +21,7 @@
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 boolean handleOptionSelection(int itemId, ComponentActivity activity)
new AfterDirectoryInitializationRunner().runWithLifecycle(activity,
() -> mView.launchOpenFileActivity(REQUEST_NAND_BIN_FILE));
return true;

case R.id.menu_about:
showAboutDialog();
}

return false;
@@ -337,4 +341,9 @@ private void launchWiiSystemMenu()
}
});
}

private void showAboutDialog()
{
new AboutDialogFragment().show(mActivity.getSupportFragmentManager(), AboutDialogFragment.TAG);
}
}
@@ -406,6 +406,10 @@ private ListRow buildSettingsRow()
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));

@@ -1,19 +1,27 @@
<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">
<vector
xmlns:aapt="http://schemas.android.com/aapt"
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="192dp"
android:height="192dp"
android:viewportHeight="2048"
android:viewportWidth="2048">
<path
android:fillColor="#0057ab"
android:pathData="m2046.8,1538.7c-6.8,-22.8 -49.3,-160.5 -120.8,-292.6 -94.3,-173.9 -175.3,-298.3 -310.4,-424.6 -43.4,-40.6 -84.6,-76.9 -127.4,-109.5l0,0c0,0 -0.3,-0.2 -0.9,-0.7 -0.8,-0.6 -1.6,-1.2 -2.4,-1.8 -16,-12.4 -83.3,-69.1 -59.4,-131.8 8,-21 27.4,-38.5 50.5,-52.6l124.1,-1v-46l-0,0c0,0 0,-0 0,-0 0,0 -72.7,-24.7 -199.8,-16.5 -119.3,7.7 -226.5,77.4 -246.6,87.2 -64.3,-18.4 -137.6,-34.6 -223.3,-49.2 -296.6,-50.3 -547.6,29.9 -673.6,117.3 -165.1,114.6 -160.5,221.4 -174.1,274.8 -8.4,33.1 -83.4,94.3 -82.5,137.2v45.2l15.5,16 58.4,-19.8 7,-24.4c24,-8.6 50.3,-20.5 74.2,-30.4 59.6,-24.5 64.2,-37.9 227.1,-62.2 75,-11.2 153.8,-14.4 212.6,-14.9 22.9,48.3 79.7,147.5 178.1,195 64,30.9 135.7,46.8 192.9,54.9l-7.5,37.7 113.7,16.8v-46l-0.1,-0c0,0 0,0 0,0 0,0 -95.4,-39.6 -154.1,-98.4 -40,-40 -49.5,-100.6 -51.6,-135.3l0.4,0c96.2,18.3 180.2,31.5 381.2,108.4 37.2,14.2 71.8,29.8 103.4,45.6l-5.9,3.3 90.6,73 108.2,89.5v-46l-0.4,-0.3c-1.6,-2 -124.8,-154.6 -331.8,-256.7 -171.1,-84.4 -311.6,-126.1 -506.2,-135.5 -212.8,-10.3 -369.5,17 -369.5,17 0,0 4.4,-94.5 165,-169.9 139.7,-65.5 359.4,-76.5 611.6,-12.1 356.3,90.9 477.8,245.6 631,405.6 97.2,101.5 186.6,244.2 243,343l-9.5,-4.3 29.2,75.4 41.8,89.1v-46.3l-1.2,-3.6z" />
<path android:pathData="m1926,1292c-94.3,-173.9 -175.3,-298.3 -310.4,-424.6 -43.4,-40.6 -84.6,-76.9 -127.4,-109.5l0,0c0,0 -0.3,-0.2 -1,-0.7 -0.8,-0.6 -1.5,-1.2 -2.3,-1.8 -15.9,-12.3 -83.4,-69.1 -59.4,-131.8 26.3,-68.8 174.6,-99.6 174.6,-99.6 0,0 -72.7,-24.7 -199.8,-16.5 -119.3,7.7 -226.5,77.4 -246.6,87.2 -64.3,-18.4 -137.6,-34.6 -223.3,-49.2 -296.6,-50.3 -547.6,29.9 -673.6,117.3 -165.1,114.6 -160.5,221.4 -174.1,274.8 -9.8,38.4 -109.4,114.8 -75.5,156.4 21.1,26 91.4,-9.3 148.1,-32.6 59.6,-24.5 64.2,-37.9 227.1,-62.2 75,-11.2 153.8,-14.4 212.6,-14.9 22.9,48.3 79.7,147.5 178.1,195 132.9,64.2 299,63.4 299,63.4 0,0 -95.4,-39.6 -154.1,-98.4 -40,-40 -49.5,-100.6 -51.6,-135.3l0.4,0c96.2,18.3 180.2,31.5 381.2,108.4 175.8,67.3 295.9,165.3 295.9,165.3 0,0 -123.5,-154 -331.9,-256.8 -171.1,-84.4 -311.6,-126.1 -506.2,-135.5 -212.8,-10.3 -369.5,17 -369.5,17 0,0 4.4,-94.5 165,-169.9 139.7,-65.5 359.4,-76.5 611.6,-12.1 356.3,90.9 477.8,245.6 631,405.6 163.1,170.2 304.1,456.7 304.1,456.7 0,0 -43.5,-151.4 -121.8,-295.9z">
<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
android:endX="0"
android:endY="1588"
android:startX="0"
android:startY="506"
android:type="linear">
<item
android:color="#FF46D4FF"
android:offset="0" />
<item
android:color="#FF1792FF"
android:offset="1" />
</gradient>
</aapt:attr>
</path>
@@ -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>
@@ -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>

0 comments on commit 014d057

Please sign in to comment.