Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
b48dbb18
There was an error fetching the commit references. Please try again later.
Commit
b48dbb18
authored
1 year ago
by
Charles Lombardo
Browse files
Options
Downloads
Patches
Plain Diff
android: Support dynamic app shortcuts
parent
a2f0caef
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt
+21
-0
21 additions, 0 deletions
...p/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt
with
21 additions
and
0 deletions
src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt
+
21
−
0
View file @
b48dbb18
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
package
org.yuzu.yuzu_emu.adapters
package
org.yuzu.yuzu_emu.adapters
import
android.content.Intent
import
android.graphics.drawable.BitmapDrawable
import
android.net.Uri
import
android.net.Uri
import
android.text.TextUtils
import
android.text.TextUtils
import
android.view.LayoutInflater
import
android.view.LayoutInflater
...
@@ -11,6 +13,9 @@ import android.view.ViewGroup
...
@@ -11,6 +13,9 @@ import android.view.ViewGroup
import
android.widget.ImageView
import
android.widget.ImageView
import
android.widget.Toast
import
android.widget.Toast
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatActivity
import
androidx.core.content.pm.ShortcutInfoCompat
import
androidx.core.content.pm.ShortcutManagerCompat
import
androidx.core.graphics.drawable.IconCompat
import
androidx.documentfile.provider.DocumentFile
import
androidx.documentfile.provider.DocumentFile
import
androidx.lifecycle.ViewModelProvider
import
androidx.lifecycle.ViewModelProvider
import
androidx.navigation.findNavController
import
androidx.navigation.findNavController
...
@@ -22,6 +27,7 @@ import androidx.recyclerview.widget.RecyclerView
...
@@ -22,6 +27,7 @@ import androidx.recyclerview.widget.RecyclerView
import
org.yuzu.yuzu_emu.HomeNavigationDirections
import
org.yuzu.yuzu_emu.HomeNavigationDirections
import
org.yuzu.yuzu_emu.R
import
org.yuzu.yuzu_emu.R
import
org.yuzu.yuzu_emu.YuzuApplication
import
org.yuzu.yuzu_emu.YuzuApplication
import
org.yuzu.yuzu_emu.activities.EmulationActivity
import
org.yuzu.yuzu_emu.adapters.GameAdapter.GameViewHolder
import
org.yuzu.yuzu_emu.adapters.GameAdapter.GameViewHolder
import
org.yuzu.yuzu_emu.databinding.CardGameBinding
import
org.yuzu.yuzu_emu.databinding.CardGameBinding
import
org.yuzu.yuzu_emu.model.Game
import
org.yuzu.yuzu_emu.model.Game
...
@@ -77,6 +83,21 @@ class GameAdapter(private val activity: AppCompatActivity) :
...
@@ -77,6 +83,21 @@ class GameAdapter(private val activity: AppCompatActivity) :
)
)
.
apply
()
.
apply
()
val
openIntent
=
Intent
(
YuzuApplication
.
appContext
,
EmulationActivity
::
class
.
java
).
apply
{
action
=
Intent
.
ACTION_VIEW
data
=
Uri
.
parse
(
holder
.
game
.
path
)
}
val
shortcut
=
ShortcutInfoCompat
.
Builder
(
YuzuApplication
.
appContext
,
holder
.
game
.
path
)
.
setShortLabel
(
holder
.
game
.
title
)
.
setIcon
(
IconCompat
.
createWithBitmap
(
(
holder
.
binding
.
imageGameScreen
.
drawable
as
BitmapDrawable
).
bitmap
)
)
.
setIntent
(
openIntent
)
.
build
()
ShortcutManagerCompat
.
pushDynamicShortcut
(
YuzuApplication
.
appContext
,
shortcut
)
val
action
=
HomeNavigationDirections
.
actionGlobalEmulationActivity
(
holder
.
game
)
val
action
=
HomeNavigationDirections
.
actionGlobalEmulationActivity
(
holder
.
game
)
view
.
findNavController
().
navigate
(
action
)
view
.
findNavController
().
navigate
(
action
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment