Skip to content

Commit

Permalink
bump compileSDK to 33
Browse files Browse the repository at this point in the history
Added App Info Dialog
Allow customizing app's display name, description, category, album
App can be hidden via App Info Dialog
Added preliminary shortcut system
Added customization package support, yet not functional
  • Loading branch information
EmiyaSyahriel committed Dec 17, 2022
1 parent 53779f5 commit 29420f8
Show file tree
Hide file tree
Showing 27 changed files with 1,081 additions and 171 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript{


dependencies {
classpath("com.android.tools.build:gradle:7.1.2")
classpath("com.android.tools.build:gradle:7.2.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")

// NOTE: Do not place your application dependencies here; they belong
Expand Down
24 changes: 3 additions & 21 deletions customization_example/customizer_pkg/PARAM.INI
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
[CROSS_LAUNCHER_CUSTOMIZER]
; Type of the customization, it can be SYSTEM, PLUGIN, GAME or APPS
; SYSTEM : launcher's built-in icons
; PLUGIN : Plugins
; GAME or APPS : Android Game or Application (they behave the same)
TYPE=GAME
[PKG_METADATA]
Name=

; ID of the customized item icon
; for Android apps / games, it's usually "app.packageName_activityName"
; The activity name will have it's prefix removed in case the prefix is equals to app packageName
; e.g "id.psw.vshlauncher_activities.XMB" (This app), "jp.co.bandainamcoent.BNEI0242_stage.StageUnityPlayerActivity" (iMAS CGSS)
; for plugins, check the plugin icon customization guide, or find their icon ID
TITLE_ID=id.psw.vshlauncher_activities.XMB

; Author of the customization content
; The one (or the corporation / company) who made the content, e.g Icons, Animated Icons, Backdrop, Background Sound
AUTHOR=Icons by EmiyaSyahriel, Background Sound by PSW Software

; Author of the package
PACKAGER=EmiyaSyahriel

;
[P01]
40 changes: 40 additions & 0 deletions customization_example/customizer_pkg/PARAM.INI.README
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[PKG_METADATA]
; Title of this package file
TITLE=CrossLauncher custom package

; Author of the customization content
; The one (or the corporation / company) who made the content, e.g Icons, Animated Icons, Backdrop, Background Sound
AUTHOR=Icons by EmiyaSyahriel, Background Sound by PSW Software

; Author of the package
PACKAGER=EmiyaSyahriel

; If present, Only installable if any of these apps is installed, separated by semicolon (';')
CHECK_INSTALL=id.psw.crosslauncher;id.psw.xl

; Main icon of this package file
ICON=pkg/pkg_icon.png

; Folder name, case sensitive
[P01]

; Type of the customization, it can be SYSTEM, PLUGIN, GAME or APPS
; SYSTEM : launcher's built-in icons
; PLUGIN : Plugins
; GAME or APPS : Android Game or Application (they behave the same)
TYPE=GAME

; ID of the customized item icon
; for Android apps / games, it's usually "app.packageName_activityName"
; The activity name will have it's prefix removed in case the prefix is equals to app packageName
; e.g "id.psw.vshlauncher_activities.XMB" (This app), "jp.co.bandainamcoent.BNEI0242_stage.StageUnityPlayerActivity" (iMAS CGSS)
; for plugins, check the plugin icon customization guide, or find their icon ID
TITLE_ID=id.psw.vshlauncher_activities.XMB

; Where to unpack this folder's files, depending on specified type:
; SYSTEM : relative to CrossLauncher's Virtual PS3 File System
; PLUGIN : (fsroot)/home/00000000/plugins/(TITLE_ID)
; GAME/APPS : (fsroot)/games/(TITLE_ID)
; (fsroot) = CrossLauncher
ROOT=/

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Jan 13 08:34:12 ICT 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
2 changes: 1 addition & 1 deletion launcher_app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins{
}

android {
compileSdk = 32
compileSdk = 33

// buildToolVersion = "30.0.2"

Expand Down
12 changes: 12 additions & 0 deletions launcher_app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@
<action android:name="android.intent.action.INSTALL_PACKAGE"/>
<action android:name="android.intent.action.UNINSTALL_PACKAGE"/>
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.OPENABLE"/>
<category android:name="android.intent.category.BROWSABLE"/>

<data android:host="*"/>
<data android:mimeType="application/psw.crosslauncher-package"/>
<data android:pathPattern=".*\\.xpkg"/>
<data android:scheme="*"/>
</intent-filter>
</activity>
<activity
android:name=".test_activity.XMBWaveTestActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ fun VSH.appCategorySortingName(it : XMBItemCategory) : String{

fun VSH.reloadAppList(){
threadPool.execute {
XMBAppItem.showHiddenByConfig = false
val gameCat = categories.find {it.id == VSH.ITEM_CATEGORY_GAME }
if(gameCat != null){
synchronized(gameCat){
Expand Down
11 changes: 11 additions & 0 deletions launcher_app/src/main/java/id/psw/vshlauncher/VSH.Customization.kt
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
package id.psw.vshlauncher

import android.content.Intent


fun VSH.isXPKGIntent(intent:Intent) : Boolean{
return intent.action == Intent.ACTION_VIEW && intent.data?.path?.endsWith(".xpkg") == true
}

fun VSH.showInstallPkgDialog(intent: Intent) {

}
19 changes: 18 additions & 1 deletion launcher_app/src/main/java/id/psw/vshlauncher/VSH.Settings.1.kt
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ private fun VSH.createCategorySystem() : XMBSettingsCategory{
GamepadSubmodule.Key.spotMarkedByX.select(1,0)).apply()
})



content.add(XMBSettingsItem(vsh, "settings_system_epimsg_disable",
R.string.settings_system_disable_splash_message_title,
R.string.settings_system_disable_splash_message_desc,
Expand Down Expand Up @@ -192,7 +194,7 @@ private fun VSH.createCategorySystem() : XMBSettingsCategory{
)

content.add(
XMBSettingsItem(vsh, "settings_systemsetsys_skip_gameboot",
XMBSettingsItem(vsh, "settings_system_skip_gameboot",
R.string.setting_show_gameboot_name,
R.string.setting_show_gameboot_desc,
R.drawable.icon_dynamic_theme_effect, {
Expand All @@ -210,6 +212,21 @@ private fun VSH.createCategorySystem() : XMBSettingsCategory{
}
)

content.add(
XMBSettingsItem(vsh, "settings_system_show_hidden_app",
R.string.settings_system_show_hidden_app_name,
R.string.settings_system_show_hidden_app_desc,
R.drawable.icon_hidden, {
getString(XMBAppItem.showHiddenByConfig.select(
R.string.common_yes,
R.string.common_no
))
}
){
XMBAppItem.showHiddenByConfig = !XMBAppItem.showHiddenByConfig
}
)

content.add(
XMBSettingsItem(vsh, "settings_system_info_dialog_open",
R.string.setting_systeminfo_name,
Expand Down
72 changes: 72 additions & 0 deletions launcher_app/src/main/java/id/psw/vshlauncher/VSH.Shortcuts.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package id.psw.vshlauncher

import android.content.Context
import android.content.Intent
import android.content.pm.LauncherApps
import android.os.Build
import android.os.UserManager
import android.util.Log
import id.psw.vshlauncher.VSH.Companion.ITEM_CATEGORY_SHORTCUT
import id.psw.vshlauncher.types.XMBItem
import id.psw.vshlauncher.types.XMBShortcutInfo
import id.psw.vshlauncher.types.items.XMBShortcutItem


fun VSH.reloadShortcutList(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
Log.d("SHORTCUT", "Getting shortcuts...")
val apl = getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
if(apl.hasShortcutHostPermission()){
for(p in apl.profiles){
val q = LauncherApps.ShortcutQuery()
val ss = apl.getShortcuts(q, p)
if( ss != null){
for(s in ss){
Log.d("SHORTCUT", "${s.id} - ${s.`package`} - ${s.intent} - ${s.activity?.packageName}")
}
}
}
}
} else {
TODO("VERSION.SDK_INT < LOLLIPOP")
}

threadPool.execute {
val h = addLoadHandle()
val c = categories.find { it.id == ITEM_CATEGORY_SHORTCUT }!!

for(i in c.content){
if(i.icon != XMBItem.TRANSPARENT_BITMAP){
i.icon.recycle()
}
}

c.content.clear()

val paths = getAllPathsFor(VshBaseDirs.USER_DIR, "shortcuts")
for(path in paths){
if(path.exists()){
val inis = path.listFiles { a, b ->
b.endsWith("ini", true)
}
if(inis != null){
for(ini in inis){
if(ini.exists()){
c.content.add(XMBShortcutItem(vsh, ini))
}
}
}
}
}

if(c.content.isNotEmpty()){
if(hiddenCategories.contains(ITEM_CATEGORY_SHORTCUT)){
hiddenCategories.remove(ITEM_CATEGORY_SHORTCUT)
}
}else{
hiddenCategories.add(ITEM_CATEGORY_SHORTCUT)
}

setLoadingFinished(h)
}
}
29 changes: 20 additions & 9 deletions launcher_app/src/main/java/id/psw/vshlauncher/VSH.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import android.graphics.Typeface
import android.media.AudioManager
import android.media.MediaPlayer
import android.media.SoundPool
import android.net.Uri
import android.os.*
import android.provider.Settings
import android.util.Log
import androidx.annotation.DrawableRes
import androidx.core.content.res.ResourcesCompat
Expand Down Expand Up @@ -47,6 +49,7 @@ class VSH : Application(), ServiceConnection {
const val ITEM_CATEGORY_APPS = "vsh_apps"
const val ITEM_CATEGORY_GAME = "vsh_game"
const val ITEM_CATEGORY_VIDEO = "vsh_video"
const val ITEM_CATEGORY_SHORTCUT = "vsh_shortcut"
const val ITEM_CATEGORY_MUSIC = "vsh_music"
const val ITEM_CATEGORY_SETTINGS = "vsh_settings"
const val COPY_DATA_SIZE_BUFFER = 10240
Expand Down Expand Up @@ -130,7 +133,7 @@ class VSH : Application(), ServiceConnection {
val notifications = arrayListOf<XMBNotification>()
val threadPool: ExecutorService = Executors.newFixedThreadPool(8)
val loadingHandles = arrayListOf<XMBLoadingHandle>()
private val hiddenCategories = arrayListOf(ITEM_CATEGORY_MUSIC, ITEM_CATEGORY_VIDEO)
val hiddenCategories = arrayListOf(ITEM_CATEGORY_MUSIC, ITEM_CATEGORY_VIDEO)

val bgmPlayer = MediaPlayer()
val systemBgmPlayer = MediaPlayer()
Expand Down Expand Up @@ -170,6 +173,7 @@ class VSH : Application(), ServiceConnection {
listInstalledIconPlugins()
listInstalledWaveRenderPlugins()
reloadAppList()
reloadShortcutList()
fillSettingsCategory()
loadSfxData()
addHomeScreen()
Expand Down Expand Up @@ -237,6 +241,9 @@ class VSH : Application(), ServiceConnection {
selectedCategoryId = items[cIdx].id
xmbView?.state?.itemMenu?.selectedIndex = 0
vsh.playSfx(SFXType.Selection)

xmbView?.state?.crossMenu?.verticalMenu?.nameTextXOffset = 0.0f
xmbView?.state?.crossMenu?.verticalMenu?.descTextXOffset = 0.0f
}
}

Expand Down Expand Up @@ -271,6 +278,9 @@ class VSH : Application(), ServiceConnection {
selectedItemId = items[cIdx].id
}

xmbView?.state?.crossMenu?.verticalMenu?.nameTextXOffset = 0.0f
xmbView?.state?.crossMenu?.verticalMenu?.descTextXOffset = 0.0f

// Update hovering
items.forEach {
it.isHovered = it.id == selectedItemId
Expand Down Expand Up @@ -342,6 +352,7 @@ class VSH : Application(), ServiceConnection {
categories.add(XMBItemCategory(this, ITEM_CATEGORY_HOME, R.string.category_home, R.drawable.category_home, defaultSortIndex = 0))
categories.add(XMBItemCategory(this, ITEM_CATEGORY_SETTINGS, R.string.category_settings, R.drawable.category_setting, defaultSortIndex = 1))
categories.add(XMBItemCategory(this, ITEM_CATEGORY_VIDEO, R.string.category_videos, R.drawable.category_video, true, defaultSortIndex = 2))
categories.add(XMBItemCategory(this, ITEM_CATEGORY_SHORTCUT, R.string.category_shortcut, R.drawable.category_shortcut, true, defaultSortIndex = 2))
categories.add(XMBItemCategory(this, ITEM_CATEGORY_MUSIC, R.string.category_music, R.drawable.category_music, true, defaultSortIndex = 3))
categories.add(XMBItemCategory(this, ITEM_CATEGORY_GAME, R.string.category_games, R.drawable.category_games, true, defaultSortIndex = 4))
categories.add(XMBItemCategory(this, ITEM_CATEGORY_APPS, R.string.category_apps, R.drawable.category_apps, true, defaultSortIndex = 5))
Expand Down Expand Up @@ -420,14 +431,6 @@ class VSH : Application(), ServiceConnection {
}
}

fun saveCustomShortcut(intent: Intent) {

}

fun installShortcut(intent: Intent) {

}

fun restart() {
val pm = vsh.packageManager
val sndi = pm.getLaunchIntentForPackage(vsh.packageName)
Expand All @@ -444,4 +447,12 @@ class VSH : Application(), ServiceConnection {
NativeGL.destroy()
super.onTerminate()
}

fun showAppInfo(app: XMBAppItem) {
val i = Intent()
i.action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS
i.data = Uri.fromParts("package", app.resInfo.activityInfo.applicationInfo.packageName, null)
i.flags = Intent.FLAG_ACTIVITY_NEW_TASK
startActivity(i)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package id.psw.vshlauncher.activities

import android.content.ActivityNotFoundException
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.pm.ActivityInfo
import android.content.pm.PackageManager
import android.content.res.Configuration
import android.graphics.Color
import android.graphics.PointF
import android.hardware.input.InputManager
import android.net.Uri
import android.os.Build
import androidx.appcompat.app.AppCompatActivity
Expand All @@ -18,6 +20,7 @@ import android.view.*
import androidx.core.content.ContextCompat
import id.psw.vshlauncher.*
import id.psw.vshlauncher.submodules.GamepadSubmodule
import id.psw.vshlauncher.types.items.XMBAppItem
import id.psw.vshlauncher.views.VshViewPage
import id.psw.vshlauncher.views.XmbView
import id.psw.vshlauncher.views.dialogviews.UITestDialogView
Expand All @@ -38,6 +41,8 @@ class XMB : AppCompatActivity() {
super.onCreate(savedInstanceState)

readPreferences()
XMBAppItem.showHiddenByConfig = false // To make sure

if(vsh.useInternalWave){
setContentView(R.layout.layout_xmb)
xmbView = findViewById(R.id.xmb_view)
Expand Down Expand Up @@ -71,6 +76,9 @@ class XMB : AppCompatActivity() {
isShareIntent(intent) -> {
showShareIntentDialog(intent)
}
vsh.isXPKGIntent(intent) -> {
vsh.showInstallPkgDialog(intent)
}
intent.action == Consts.ACTION_WAVE_SETTINGS_WIZARD -> {
vsh.showXMBLiveWallpaperWizard()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ class GamepadSubmodule(ctx: VSH) {
if(remap.map.containsKey(key)) {
return remap.map[key]!!
}else{
val kbdRemap = keyRemaps[ANDROID_KEYBOARD]
if(kbdRemap.map.containsKey(key)) return kbdRemap.map[key] ?: Key.None
val kbdRemap = defaultAndroidKeyboardMap
if(kbdRemap.containsKey(key)) return kbdRemap[key] ?: Key.None
}
}
return Key.None
Expand Down
Loading

0 comments on commit 29420f8

Please sign in to comment.