Added ability to filter 2D apps

This commit is contained in:
tverona1
2019-07-26 01:09:08 -07:00
parent 2b6ebb6e73
commit de5225c19a
9 changed files with 688 additions and 69 deletions
+36 -12
View File
@@ -3,6 +3,9 @@ package aaa.QuestAppLauncher.App;
import com.unity3d.player.UnityPlayerActivity;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageInfo;
import android.content.pm.FeatureInfo;
import android.content.pm.ApplicationInfo;
import android.os.Bundle;
import android.util.Log;
@@ -28,18 +31,6 @@ public class AppInfo extends UnityPlayerActivity {
continue;
}
if (null == app.metaData)
{
// Skip non vr_only apps
continue;
}
String vrAppMode = app.metaData.getString("com.samsung.android.vr.application.mode");
if (null == vrAppMode || !vrAppMode.equals("vr_only")) {
// Skip non vr_only apps
continue;
}
installedApps.add(app);
}
}
@@ -56,6 +47,39 @@ public class AppInfo extends UnityPlayerActivity {
return (String)this.getPackageManager().getApplicationLabel(installedApps.get(i));
}
public boolean isQuestApp(int i) {
try {
PackageInfo info = this.getPackageManager().getPackageInfo(getPackageName(i), 0);
if (null == info.reqFeatures) {
return false;
}
for (FeatureInfo f : info.reqFeatures) {
if (f.name != null && f.name.equals("android.hardware.vr.headtracking")) {
return true;
}
}
} catch (NameNotFoundException e) {
e.printStackTrace();
}
return false;
}
public boolean is2DApp(int i)
{
ApplicationInfo app = this.installedApps.get(i);
if (null == app.metaData)
{
return true;
}
String vrAppMode = app.metaData.getString("com.samsung.android.vr.application.mode");
if (null == vrAppMode || !vrAppMode.equals("vr_only")) {
return true;
}
return false;
}
public byte[] getIcon(int i) {
BitmapDrawable icon = (BitmapDrawable)this.getPackageManager().getApplicationIcon(installedApps.get(i));
Bitmap bmp = icon.getBitmap();
+1 -1
View File
@@ -12,6 +12,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 20553fac56ec59645857c0732b787431, type: 3}
m_Name: OVRBuildConfig
m_EditorClassIdentifier:
androidSDKPath: C:\Users\tvero\AppData\Local\Android\Sdk
androidSDKPath:
gradlePath:
jdkPath:
+534 -9
View File
@@ -377,6 +377,163 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 79656235}
m_CullTransparentMesh: 0
--- !u!1 &87081338
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 87081339}
- component: {fileID: 87081341}
- component: {fileID: 87081340}
m_Layer: 5
m_Name: Label
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &87081339
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 87081338}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 302656573}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 500, y: -75}
m_SizeDelta: {x: 400, y: 150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &87081340
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 87081338}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_text: Show 2D
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_outlineColor:
serializedVersion: 2
rgba: 4278190080
m_fontSize: 86
m_fontSizeBase: 86
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_textAlignment: 513
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 0
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_firstOverflowCharacterIndex: -1
m_linkedTextComponent: {fileID: 0}
m_isLinkedTextComponent: 0
m_isTextTruncated: 0
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_ignoreRectMaskCulling: 0
m_ignoreCulling: 1
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_VertexBufferAutoSizeReduction: 1
m_firstVisibleCharacter: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_textInfo:
textComponent: {fileID: 87081340}
characterCount: 7
spriteCount: 0
spaceCount: 1
wordCount: 2
linkCount: 0
lineCount: 1
pageCount: 1
materialCount: 1
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_spriteAnimator: {fileID: 0}
m_hasFontAssetChanged: 0
m_subTextObjects:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &87081341
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 87081338}
m_CullTransparentMesh: 0
--- !u!1 &129491541
GameObject:
m_ObjectHideFlags: 0
@@ -407,7 +564,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1950750522}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
@@ -568,7 +725,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -0.0000915765}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &159978201
@@ -843,6 +1000,133 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 284714161}
m_CullTransparentMesh: 0
--- !u!1 &302656572
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 302656573}
- component: {fileID: 302656576}
- component: {fileID: 302656575}
- component: {fileID: 302656574}
m_Layer: 5
m_Name: Show_2D
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &302656573
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 302656572}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 987583755}
- {fileID: 87081339}
m_Father: {fileID: 883330324}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 500, y: -675}
m_SizeDelta: {x: 800, y: 150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &302656574
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 302656572}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
--- !u!65 &302656575
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 302656572}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 800, y: 150, z: 0.05}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &302656576
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 302656572}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 987583756}
toggleTransition: 1
graphic: {fileID: 2047630437}
m_Group: {fileID: 0}
onValueChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
m_IsOn: 1
--- !u!1 &306805916
GameObject:
m_ObjectHideFlags: 0
@@ -2589,6 +2873,7 @@ RectTransform:
m_Children:
- {fileID: 1106898771}
- {fileID: 949458750}
- {fileID: 302656573}
m_Father: {fileID: 1213035640}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -2681,6 +2966,7 @@ MonoBehaviour:
gridRows: {fileID: 1398590893}
gridRowsText: {fileID: 604462431}
gridPopulation: {fileID: 1860838374}
show2DToggle: {fileID: 302656572}
--- !u!65 &883330329
BoxCollider:
m_ObjectHideFlags: 0
@@ -2694,6 +2980,81 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 2802, y: 2000, z: 0}
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &907885703
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 907885704}
- component: {fileID: 907885706}
- component: {fileID: 907885705}
m_Layer: 5
m_Name: Tab_Container
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &907885704
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 907885703}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1950750522}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &907885705
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 907885703}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 6
m_Spacing: 0
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
--- !u!114 &907885706
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 907885703}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2fafe2cfe61f6974895a912c3755e8f1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_AllowSwitchOff: 0
--- !u!1 &949458749
GameObject:
m_ObjectHideFlags: 0
@@ -3008,6 +3369,82 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &987583754
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 987583755}
- component: {fileID: 987583757}
- component: {fileID: 987583756}
m_Layer: 5
m_Name: Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &987583755
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 987583754}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 2047630436}
m_Father: {fileID: 302656573}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 100, y: -75}
m_SizeDelta: {x: 200, y: 150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &987583756
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 987583754}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.24313727, g: 0.427451, b: 0.6627451, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &987583757
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 987583754}
m_CullTransparentMesh: 0
--- !u!1 &997522264
GameObject:
m_ObjectHideFlags: 0
@@ -5326,6 +5763,7 @@ GameObject:
- component: {fileID: 1684574661}
- component: {fileID: 1684574664}
- component: {fileID: 1684574660}
- component: {fileID: 1684574663}
m_Layer: 5
m_Name: Scroll View
m_TagString: Untagged
@@ -5346,12 +5784,12 @@ RectTransform:
m_Children:
- {fileID: 363824040}
m_Father: {fileID: 1950750522}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 2802, y: 2000}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!65 &1684574660
BoxCollider:
@@ -5404,6 +5842,18 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1684574658}
m_CullTransparentMesh: 0
--- !u!114 &1684574663
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1684574658}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bfe52246b03c5b747a5406863e688439, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1684574664
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -5919,7 +6369,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
gridContainer: {fileID: 1950750521}
scrollView: {fileID: 1684574658}
gridContent: {fileID: 159978199}
prefab: {fileID: 4824380111246446992, guid: 8767e935b90413e48ae368ff87547352, type: 3}
--- !u!4 &1860838376
@@ -6693,7 +7142,7 @@ GameObject:
m_Component:
- component: {fileID: 1950750522}
m_Layer: 5
m_Name: Grid_Container
m_Name: Panel_Container
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -6710,6 +7159,7 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 907885704}
- {fileID: 1684574659}
- {fileID: 129491542}
- {fileID: 2124784240}
@@ -7040,6 +7490,81 @@ MeshFilter:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2025011530}
m_Mesh: {fileID: 4300000, guid: 37ba10a26a648144fa2390c8adfb2c8a, type: 3}
--- !u!1 &2047630435
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2047630436}
- component: {fileID: 2047630438}
- component: {fileID: 2047630437}
m_Layer: 5
m_Name: Checkmark
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2047630436
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2047630435}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 987583755}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 150, y: 150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2047630437
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2047630435}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &2047630438
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2047630435}
m_CullTransparentMesh: 0
--- !u!1001 &2047659140
PrefabInstance:
m_ObjectHideFlags: 0
@@ -7667,7 +8192,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1950750522}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
+1
View File
@@ -23,6 +23,7 @@ namespace QuestAppLauncher
}
public GridSize gridSize = new GridSize();
public bool show2D = false;
}
/// <summary>
+42 -32
View File
@@ -28,15 +28,15 @@ namespace QuestAppLauncher
// Grid container game object
public GameObject gridContainer;
// Scroll view game object
public GameObject scrollView;
// Grid content game object
public GameObject gridContent;
// App info GameObject (a cell in the grid content)
public GameObject prefab;
// Reference to executing populate routine
private Coroutine populateCoroutine;
#region MonoBehaviour handler
void Start()
@@ -47,11 +47,8 @@ namespace QuestAppLauncher
// Initialize the core platform
Core.AsyncInitialize();
// Process configuration
StartCoroutine(ProcessConfig());
// Populate the grid
StartCoroutine(Populate());
StartPopulate();
}
void Update()
@@ -126,20 +123,6 @@ namespace QuestAppLauncher
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
/// <summary>
/// Loads & processes config
/// </summary>
/// <returns></returns>
IEnumerator ProcessConfig()
{
// Load configuration
Config config = new Config();
ConfigPersistence.LoadConfig(config);
SetGridSize(config.gridSize.rows, config.gridSize.cols);
yield return null;
}
public void SetGridSize(int rows, int cols)
{
// Make sure grid size have sane value
@@ -176,25 +159,41 @@ namespace QuestAppLauncher
(float)((gridTransform.rect.height - 2000) / 2.0),
gridTransform.anchoredPosition3D.z);
gridTransform.anchoredPosition3D = gridPosition;
}
// Adjust scroll view rect transform
var scrollViewRectTransform = this.scrollView.GetComponent<RectTransform>();
scrollViewRectTransform.sizeDelta = new Vector2(width, height);
// Adjust scroll view box collider
var scrollViewBoxCollider = this.scrollView.GetComponent<BoxCollider>();
scrollViewBoxCollider.size = new Vector3(width, height, 0);
public void StartPopulate()
{
// Ensure we only exeucte on populate routine at a time
if (null != this.populateCoroutine)
{
StopCoroutine(this.populateCoroutine);
}
this.populateCoroutine = this.StartCoroutine(Populate());
}
/// <summary>
/// Populate the grid from installed apps
/// </summary>
/// <returns></returns>
IEnumerator Populate()
private IEnumerator Populate()
{
var persistentDataPath = UnityEngine.Application.persistentDataPath;
Debug.Log("Persistent data path: " + persistentDataPath);
// Load configuration
Config config = new Config();
ConfigPersistence.LoadConfig(config);
// Clear any existing elements in grid
for (int i = 0; i < this.gridContent.transform.childCount; i++)
{
Destroy(this.gridContent.transform.GetChild(i).gameObject);
}
// Set grid size
SetGridSize(config.gridSize.rows, config.gridSize.cols);
using (AndroidJavaClass unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
using (AndroidJavaObject currentActivity = unity.GetStatic<AndroidJavaObject>("currentActivity"))
{
@@ -232,11 +231,22 @@ namespace QuestAppLauncher
if (excludedPackageNames.Contains(packageName))
{
Debug.Log("Skipping [" + i + "] package: " + packageName + ", name: " + appName);
// Skip exluded package
// Skip excluded package
Debug.LogFormat("Skipping Excluded [{0}] Package: {1}, name: {2}", i, packageName, appName);
continue;
}
if (!config.show2D)
{
var is2D = currentActivity.Call<bool>("is2DApp", i);
if (is2D)
{
// Skip 2D apps
Debug.LogFormat("Skipping 2D [{0}] Package: {1}, name: {2}", i, packageName, appName);
continue;
}
}
packageNameToAppName.Add(packageName, (i, appName));
Debug.Log("[" + i + "] package: " + packageName + ", name: " + appName);
yield return null;
@@ -291,7 +301,7 @@ namespace QuestAppLauncher
foreach (var app in packageNameToAppName.OrderBy(key => key.Value.AppName))
{
// Create new instances of our app info prefab
var newObj = (GameObject)Instantiate(prefab, gridContent.transform);
var newObj = (GameObject)Instantiate(this.prefab, this.gridContent.transform);
// Set app entry info
var appEntry = newObj.GetComponent("AppEntry") as AppEntry;
+43 -14
View File
@@ -18,6 +18,7 @@ namespace QuestAppLauncher
public GameObject gridRows;
public GameObject gridRowsText;
public GameObject gridPopulation;
public GameObject show2DToggle;
private Config config = new Config();
@@ -43,12 +44,15 @@ namespace QuestAppLauncher
var rowsText = this.gridRowsText.GetComponent<TextMeshProUGUI>();
rowsText.text = string.Format("{0} Rows", this.config.gridSize.rows);
// Set 2D toggle
this.show2DToggle.GetComponent<Toggle>().SetIsOnWithoutNotify(this.config.show2D);
}
public void CloseSettings()
{
// Resize grid if necessary
ResizeGrid();
// Persist any config changes
PersistConfig();
Debug.Log("Close Settings");
this.gridContainer.SetActive(true);
@@ -77,27 +81,52 @@ namespace QuestAppLauncher
rowsText.text = string.Format("{0} Rows", rows);
}
private void ResizeGrid()
private void PersistConfig()
{
bool saveConfig = false;
bool resizeGrid = false;
bool rePopulate = false;
// Update grid size
var cols = (int)gridCols.GetComponent<Slider>().value;
var rows = (int)gridRows.GetComponent<Slider>().value;
if (cols == this.config.gridSize.cols &&
rows == this.config.gridSize.rows)
if (cols != this.config.gridSize.cols ||
rows != this.config.gridSize.rows)
{
// Nothing was resized, so no work to do
return;
this.config.gridSize.cols = cols;
this.config.gridSize.rows = rows;
resizeGrid = true;
saveConfig = true;
}
Debug.Log(string.Format("Resizing grid: {0} x {1}", cols, rows));
// Update 2D toggle
var show2D = this.show2DToggle.GetComponent<Toggle>().isOn;
if (show2D != this.config.show2D)
{
this.config.show2D = show2D;
saveConfig = true;
rePopulate = true;
}
// Update configuration
this.config.gridSize.cols = cols;
this.config.gridSize.rows = rows;
ConfigPersistence.SaveConfig(this.config);
if (saveConfig)
{
// Persist configuration
ConfigPersistence.SaveConfig(this.config);
}
// Update grid size
this.gridPopulation.GetComponent<GridPopulation>().SetGridSize(this.config.gridSize.rows, this.config.gridSize.cols);
if (rePopulate)
{
// Re-populate grid
Debug.Log("Re-populating panel");
this.gridPopulation.GetComponent<GridPopulation>().StartPopulate();
}
else if (resizeGrid)
{
// Update grid size
Debug.Log(string.Format("Resizing pael: {0} x {1}", cols, rows));
this.gridPopulation.GetComponent<GridPopulation>().SetGridSize(this.config.gridSize.rows, this.config.gridSize.cols);
}
}
}
}
+19
View File
@@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
namespace QuestAppLauncher
{
public class ScrollViewResize : UIBehaviour
{
protected override void OnRectTransformDimensionsChange()
{
var rect = transform.GetComponent<RectTransform>();
var boxCollider = transform.GetComponent<BoxCollider>();
boxCollider.size = new Vector3(rect.rect.width, rect.rect.height, 0);
Debug.LogFormat("Resizing box collider: {0} x {1}", boxCollider.size.x, boxCollider.size.y);
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bfe52246b03c5b747a5406863e688439
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+1 -1
View File
@@ -120,7 +120,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 0.1
bundleVersion: 0.4
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0