diff options
author | Charles Lombardo <clombardo169@gmail.com> | 2023-05-08 10:49:32 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:06:00 +0200 |
commit | f69bc78dc56eaf2a6e33f0bcee1ba1dd812fd9b4 (patch) | |
tree | 30faabf47a68d9a01324c3f84edec1874af21365 /src | |
parent | android: vulkan_device: Only compile OverrideBcnFormats when used. (diff) | |
download | yuzu-f69bc78dc56eaf2a6e33f0bcee1ba1dd812fd9b4.tar yuzu-f69bc78dc56eaf2a6e33f0bcee1ba1dd812fd9b4.tar.gz yuzu-f69bc78dc56eaf2a6e33f0bcee1ba1dd812fd9b4.tar.bz2 yuzu-f69bc78dc56eaf2a6e33f0bcee1ba1dd812fd9b4.tar.lz yuzu-f69bc78dc56eaf2a6e33f0bcee1ba1dd812fd9b4.tar.xz yuzu-f69bc78dc56eaf2a6e33f0bcee1ba1dd812fd9b4.tar.zst yuzu-f69bc78dc56eaf2a6e33f0bcee1ba1dd812fd9b4.zip |
Diffstat (limited to 'src')
13 files changed, 419 insertions, 2 deletions
diff --git a/src/android/app/build.gradle.kts b/src/android/app/build.gradle.kts index a9790b200..8c970609f 100644 --- a/src/android/app/build.gradle.kts +++ b/src/android/app/build.gradle.kts @@ -112,6 +112,12 @@ android { productFlavors { create("mainline") { dimension = "version" + buildConfigField("Boolean", "PREMIUM", "false") + } + + create("ea") { + dimension = "version" + buildConfigField("Boolean", "PREMIUM", "true") } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/HomeSettingAdapter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/HomeSettingAdapter.kt index 2b3956e6d..b719dd539 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/HomeSettingAdapter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/HomeSettingAdapter.kt @@ -1,11 +1,16 @@ +// SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + package org.yuzu.yuzu_emu.adapters import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.ContextCompat import androidx.core.content.res.ResourcesCompat import androidx.recyclerview.widget.RecyclerView +import org.yuzu.yuzu_emu.R import org.yuzu.yuzu_emu.databinding.CardHomeOptionBinding import org.yuzu.yuzu_emu.model.HomeSetting @@ -13,7 +18,8 @@ class HomeSettingAdapter(private val activity: AppCompatActivity, var options: L RecyclerView.Adapter<HomeSettingAdapter.HomeOptionViewHolder>(), View.OnClickListener { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HomeOptionViewHolder { - val binding = CardHomeOptionBinding.inflate(LayoutInflater.from(parent.context), parent, false) + val binding = + CardHomeOptionBinding.inflate(LayoutInflater.from(parent.context), parent, false) binding.root.setOnClickListener(this) return HomeOptionViewHolder(binding) } @@ -50,6 +56,14 @@ class HomeSettingAdapter(private val activity: AppCompatActivity, var options: L activity.theme ) ) + + when (option.titleId) { + R.string.get_early_access -> binding.optionLayout.background = + ContextCompat.getDrawable( + binding.optionCard.context, + R.drawable.premium_background + ) + } } } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EarlyAccessFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EarlyAccessFragment.kt new file mode 100644 index 000000000..d8bbc1ce4 --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EarlyAccessFragment.kt @@ -0,0 +1,83 @@ +// SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.yuzu.yuzu_emu.fragments + +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.core.view.ViewCompat +import androidx.core.view.WindowInsetsCompat +import androidx.core.view.updatePadding +import androidx.fragment.app.Fragment +import androidx.fragment.app.activityViewModels +import androidx.navigation.fragment.findNavController +import com.google.android.material.transition.MaterialSharedAxis +import org.yuzu.yuzu_emu.R +import org.yuzu.yuzu_emu.databinding.FragmentEarlyAccessBinding +import org.yuzu.yuzu_emu.model.HomeViewModel + +class EarlyAccessFragment : Fragment() { + private var _binding: FragmentEarlyAccessBinding? = null + private val binding get() = _binding!! + + private val homeViewModel: HomeViewModel by activityViewModels() + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + enterTransition = MaterialSharedAxis(MaterialSharedAxis.X, true) + returnTransition = MaterialSharedAxis(MaterialSharedAxis.X, false) + } + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + _binding = FragmentEarlyAccessBinding.inflate(layoutInflater) + return binding.root + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + homeViewModel.setNavigationVisibility(visible = false, animated = true) + homeViewModel.setStatusBarShadeVisibility(visible = false) + + binding.toolbarAbout.setNavigationOnClickListener { + parentFragmentManager.primaryNavigationFragment?.findNavController()?.popBackStack() + } + + binding.getEarlyAccessButton.setOnClickListener { openLink(getString(R.string.play_store_link)) } + + setInsets() + } + + private fun openLink(link: String) { + val intent = Intent(Intent.ACTION_VIEW, Uri.parse(link)) + startActivity(intent) + } + + private fun setInsets() = + ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _: View, windowInsets: WindowInsetsCompat -> + val barInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) + val cutoutInsets = windowInsets.getInsets(WindowInsetsCompat.Type.displayCutout()) + + val leftInsets = barInsets.left + cutoutInsets.left + val rightInsets = barInsets.right + cutoutInsets.right + + val mlpAppBar = binding.appbarEa.layoutParams as ViewGroup.MarginLayoutParams + mlpAppBar.leftMargin = leftInsets + mlpAppBar.rightMargin = rightInsets + binding.appbarEa.layoutParams = mlpAppBar + + binding.scrollEa.updatePadding( + left = leftInsets, + right = rightInsets, + bottom = barInsets.bottom + ) + + windowInsets + } +} diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt index ae920d692..3044ebf66 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt @@ -28,6 +28,7 @@ import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.LinearLayoutManager import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.transition.MaterialSharedAxis +import org.yuzu.yuzu_emu.BuildConfig import org.yuzu.yuzu_emu.R import org.yuzu.yuzu_emu.adapters.HomeSettingAdapter import org.yuzu.yuzu_emu.databinding.FragmentHomeSettingsBinding @@ -64,7 +65,7 @@ class HomeSettingsFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { mainActivity = requireActivity() as MainActivity - val optionsList: List<HomeSetting> = listOf( + val optionsList: MutableList<HomeSetting> = mutableListOf( HomeSetting( R.string.advanced_settings, R.string.settings_description, @@ -106,6 +107,21 @@ class HomeSettingsFragment : Fragment() { } ) + if (!BuildConfig.PREMIUM) { + optionsList.add( + 0, + HomeSetting( + R.string.get_early_access, + R.string.get_early_access_description, + R.drawable.ic_diamond + ) { + exitTransition = MaterialSharedAxis(MaterialSharedAxis.X, true) + parentFragmentManager.primaryNavigationFragment?.findNavController() + ?.navigate(R.id.action_homeSettingsFragment_to_earlyAccessFragment) + } + ) + } + binding.homeSettingsList.apply { layoutManager = LinearLayoutManager(requireContext()) adapter = HomeSettingAdapter(requireActivity() as AppCompatActivity, optionsList) diff --git a/src/android/app/src/main/res/drawable/ic_check_circle.xml b/src/android/app/src/main/res/drawable/ic_check_circle.xml new file mode 100644 index 000000000..49e6ecd71 --- /dev/null +++ b/src/android/app/src/main/res/drawable/ic_check_circle.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="?attr/colorControlNormal" + android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z" /> +</vector> diff --git a/src/android/app/src/main/res/drawable/ic_diamond.xml b/src/android/app/src/main/res/drawable/ic_diamond.xml new file mode 100644 index 000000000..3896e12e4 --- /dev/null +++ b/src/android/app/src/main/res/drawable/ic_diamond.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="?attr/colorControlNormal" + android:pathData="M19,3H5L2,9l10,12L22,9L19,3zM9.62,8l1.5,-3h1.76l1.5,3H9.62zM11,10v6.68L5.44,10H11zM13,10h5.56L13,16.68V10zM19.26,8h-2.65l-1.5,-3h2.65L19.26,8zM6.24,5h2.65l-1.5,3H4.74L6.24,5z" /> +</vector> diff --git a/src/android/app/src/main/res/drawable/premium_background.xml b/src/android/app/src/main/res/drawable/premium_background.xml new file mode 100644 index 000000000..c9c41ddbe --- /dev/null +++ b/src/android/app/src/main/res/drawable/premium_background.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <gradient + android:type="linear" + android:angle="45" + android:startColor="@color/yuzu_ea_background_start" + android:endColor="@color/yuzu_ea_background_end" /> + <corners android:radius="12dp" /> +</shape> diff --git a/src/android/app/src/main/res/layout/card_home_option.xml b/src/android/app/src/main/res/layout/card_home_option.xml index aa535943f..dc289db17 100644 --- a/src/android/app/src/main/res/layout/card_home_option.xml +++ b/src/android/app/src/main/res/layout/card_home_option.xml @@ -14,6 +14,7 @@ android:focusable="true"> <LinearLayout + android:id="@+id/option_layout" android:layout_width="match_parent" android:layout_height="wrap_content"> diff --git a/src/android/app/src/main/res/layout/fragment_early_access.xml b/src/android/app/src/main/res/layout/fragment_early_access.xml new file mode 100644 index 000000000..644b4dd45 --- /dev/null +++ b/src/android/app/src/main/res/layout/fragment_early_access.xml @@ -0,0 +1,242 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.coordinatorlayout.widget.CoordinatorLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/coordinator_about" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="?attr/colorSurface"> + + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/appbar_ea" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:fitsSystemWindows="true"> + + <com.google.android.material.appbar.MaterialToolbar + android:id="@+id/toolbar_about" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + app:navigationIcon="@drawable/ic_back" + app:title="@string/early_access" /> + + </com.google.android.material.appbar.AppBarLayout> + + <androidx.core.widget.NestedScrollView + android:id="@+id/scroll_ea" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:clipToPadding="false" + android:paddingBottom="20dp" + android:scrollbars="vertical" + android:fadeScrollbars="false" + app:layout_behavior="@string/appbar_scrolling_view_behavior"> + + <LinearLayout + android:id="@+id/card_ea" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginVertical="32dp" + android:layout_marginHorizontal="20dp" + android:background="@drawable/premium_background" + android:orientation="vertical"> + + <com.google.android.material.textview.MaterialTextView + style="@style/TextAppearance.Material3.TitleLarge" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:layout_marginHorizontal="20dp" + android:text="@string/early_access_benefits" + android:textAlignment="center" + android:textStyle="bold" /> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="32dp" + android:layout_marginHorizontal="20dp" + android:orientation="horizontal"> + + <ImageView + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_gravity="center_vertical" + android:src="@drawable/ic_check_circle" + app:tint="?attr/colorOnSurface" /> + + <com.google.android.material.textview.MaterialTextView + style="@style/TextAppearance.Material3.BodyLarge" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="20dp" + android:text="@string/cutting_edge_features" + android:textAlignment="viewStart" + android:layout_gravity="start|center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="32dp" + android:layout_marginHorizontal="20dp" + android:orientation="horizontal"> + + <ImageView + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_gravity="center_vertical" + android:src="@drawable/ic_check_circle" + app:tint="?attr/colorOnSurface" /> + + <com.google.android.material.textview.MaterialTextView + style="@style/TextAppearance.Material3.BodyLarge" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="20dp" + android:text="@string/early_access_updates" + android:textAlignment="viewStart" + android:layout_gravity="start|center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="32dp" + android:layout_marginHorizontal="20dp" + android:orientation="horizontal"> + + <ImageView + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_gravity="center_vertical" + android:src="@drawable/ic_check_circle" + app:tint="?attr/colorOnSurface" /> + + <com.google.android.material.textview.MaterialTextView + style="@style/TextAppearance.Material3.BodyLarge" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="20dp" + android:text="@string/no_manual_installation" + android:textAlignment="viewStart" + android:layout_gravity="start|center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="32dp" + android:layout_marginHorizontal="20dp" + android:orientation="horizontal"> + + <ImageView + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_gravity="center_vertical" + android:src="@drawable/ic_check_circle" + app:tint="?attr/colorOnSurface" /> + + <com.google.android.material.textview.MaterialTextView + style="@style/TextAppearance.Material3.BodyLarge" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="20dp" + android:text="@string/prioritized_support" + android:textAlignment="viewStart" + android:layout_gravity="start|center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="32dp" + android:layout_marginHorizontal="20dp" + android:orientation="horizontal"> + + <ImageView + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_gravity="center_vertical" + android:src="@drawable/ic_check_circle" + app:tint="?attr/colorOnSurface" /> + + <com.google.android.material.textview.MaterialTextView + style="@style/TextAppearance.Material3.BodyLarge" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="20dp" + android:text="@string/helping_game_preservation" + android:textAlignment="viewStart" + android:layout_gravity="start|center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="32dp" + android:layout_marginHorizontal="20dp" + android:orientation="horizontal"> + + <ImageView + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_gravity="center_vertical" + android:src="@drawable/ic_check_circle" + app:tint="?attr/colorOnSurface" /> + + <com.google.android.material.textview.MaterialTextView + style="@style/TextAppearance.Material3.BodyLarge" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="20dp" + android:text="@string/our_eternal_gratitude" + android:textAlignment="viewStart" + android:layout_gravity="start|center_vertical" /> + + </LinearLayout> + + <com.google.android.material.textview.MaterialTextView + style="@style/TextAppearance.Material3.TitleLarge" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/are_you_interested" + android:layout_marginTop="80dp" + android:layout_marginHorizontal="20dp" + android:textStyle="bold" + android:textAlignment="center" /> + + <com.google.android.material.card.MaterialCardView + style="?attr/materialCardViewFilledStyle" + android:id="@+id/get_early_access_button" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:layout_marginHorizontal="20dp" + android:layout_marginBottom="28dp" + android:background="?attr/selectableItemBackground" + android:backgroundTint="@android:color/black"> + + <com.google.android.material.textview.MaterialTextView + style="@style/TextAppearance.Material3.TitleLarge" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/get_early_access" + android:layout_marginHorizontal="20dp" + android:layout_marginVertical="8dp" + android:textColor="@android:color/white" + android:textStyle="bold" + android:textAlignment="center" /> + + </com.google.android.material.card.MaterialCardView> + + </LinearLayout> + + </androidx.core.widget.NestedScrollView> + +</androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/src/android/app/src/main/res/navigation/home_navigation.xml b/src/android/app/src/main/res/navigation/home_navigation.xml index f44eb3fed..2275ddc32 100644 --- a/src/android/app/src/main/res/navigation/home_navigation.xml +++ b/src/android/app/src/main/res/navigation/home_navigation.xml @@ -16,6 +16,9 @@ <action android:id="@+id/action_homeSettingsFragment_to_aboutFragment" app:destination="@id/aboutFragment" /> + <action + android:id="@+id/action_homeSettingsFragment_to_earlyAccessFragment" + app:destination="@id/earlyAccessFragment" /> </fragment> <fragment @@ -39,4 +42,9 @@ android:name="org.yuzu.yuzu_emu.fragments.AboutFragment" android:label="AboutFragment" /> + <fragment + android:id="@+id/earlyAccessFragment" + android:name="org.yuzu.yuzu_emu.fragments.EarlyAccessFragment" + android:label="EarlyAccessFragment" /> + </navigation> diff --git a/src/android/app/src/main/res/values-night/yuzu_colors.xml b/src/android/app/src/main/res/values-night/yuzu_colors.xml index 1e563a6f2..49d823324 100644 --- a/src/android/app/src/main/res/values-night/yuzu_colors.xml +++ b/src/android/app/src/main/res/values-night/yuzu_colors.xml @@ -31,4 +31,7 @@ <color name="yuzu_surfaceTint">#9DCAFF</color> <color name="yuzu_outlineVariant">#42474E</color> + <color name="yuzu_ea_background_start">#840099</color> + <color name="yuzu_ea_background_end">#005AE1</color> + </resources> diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index 629b21e08..8ee067ffd 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -85,6 +85,20 @@ <string name="website_link">https://yuzu-emu.org/</string> <string name="github_link">https://github.com/yuzu-emu</string> + <!-- Early access upgrade strings --> + <string name="early_access">Early Access</string> + <string name="get_early_access">Get Early Access</string> + <string name="play_store_link">https://play.google.com/store/apps/details?id=org.yuzu.yuzu_emu.ea</string> + <string name="get_early_access_description">Cutting-edge features, early access to updates, and more</string> + <string name="early_access_benefits">Early Access Benefits</string> + <string name="cutting_edge_features">Cutting-edge features</string> + <string name="early_access_updates">Early access to updates</string> + <string name="no_manual_installation">No manual installation</string> + <string name="prioritized_support">Prioritized support</string> + <string name="helping_game_preservation">Helping game preservation</string> + <string name="our_eternal_gratitude">Our eternal gratitude</string> + <string name="are_you_interested">Are you interested?</string> + <!-- General settings strings --> <string name="frame_limit_enable">Enable limit speed</string> <string name="frame_limit_enable_description">When enabled, emulation speed will be limited to a specified percentage of normal speed.</string> diff --git a/src/android/app/src/main/res/values/yuzu_colors.xml b/src/android/app/src/main/res/values/yuzu_colors.xml index 921149d88..5b7d189dc 100644 --- a/src/android/app/src/main/res/values/yuzu_colors.xml +++ b/src/android/app/src/main/res/values/yuzu_colors.xml @@ -31,4 +31,7 @@ <color name="yuzu_surfaceTint">#B52612</color> <color name="yuzu_outlineVariant">#D8C2BE</color> + <color name="yuzu_ea_background_start">#99FFE1</color> + <color name="yuzu_ea_background_end">#76C5FF</color> + </resources> |