Commit a9b7340972d42dbc8035e929ac3a0bef7d6d83f9
1 parent
c5042f3c
Exists in
master
and in
3 other branches
Bug Fix
Showing
5 changed files
with
145 additions
and
51 deletions
Show diff stats
Assets/Plugins/Android/AndroidManifest.xml
@@ -7,20 +7,13 @@ | @@ -7,20 +7,13 @@ | ||
7 | <uses-sdk android:minSdkVersion="14" /> | 7 | <uses-sdk android:minSdkVersion="14" /> |
8 | <uses-permission android:name="android.permission.INTERNET" /> | 8 | <uses-permission android:name="android.permission.INTERNET" /> |
9 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 9 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
10 | - <meta-data android:name="unityplayer.UnityActivity" android:value="true" /> | 10 | + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> |
11 | + | ||
11 | <application | 12 | <application |
12 | android:icon="@drawable/app_icon" | 13 | android:icon="@drawable/app_icon" |
13 | android:label="@string/app_name" | 14 | android:label="@string/app_name" |
14 | android:screenOrientation="portrait" | 15 | android:screenOrientation="portrait" |
15 | - android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> | ||
16 | - | ||
17 | - <activity android:name="unityplayer.UnityActivity" | ||
18 | - android:label="@string/app_name" | ||
19 | - android:screenOrientation="portrait" | ||
20 | - android:configChanges="orientation"> | ||
21 | - | ||
22 | - </activity> | ||
23 | - | 16 | + android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> |
24 | <activity android:name=".MainActivity" | 17 | <activity android:name=".MainActivity" |
25 | android:label="@string/app_name" | 18 | android:label="@string/app_name" |
26 | android:screenOrientation="portrait" | 19 | android:screenOrientation="portrait" |
Assets/Plugins/Android/AndroidManifest.xml.meta
Assets/Scenes/Main.unity
@@ -683,7 +683,7 @@ RectTransform: | @@ -683,7 +683,7 @@ RectTransform: | ||
683 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | 683 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
684 | m_Children: [] | 684 | m_Children: [] |
685 | m_Father: {fileID: 1530408465} | 685 | m_Father: {fileID: 1530408465} |
686 | - m_RootOrder: 2 | 686 | + m_RootOrder: 1 |
687 | m_AnchorMin: {x: 0, y: 1.7} | 687 | m_AnchorMin: {x: 0, y: 1.7} |
688 | m_AnchorMax: {x: 0.97, y: 2.2} | 688 | m_AnchorMax: {x: 0.97, y: 2.2} |
689 | m_AnchoredPosition: {x: 0, y: 0} | 689 | m_AnchoredPosition: {x: 0, y: 0} |
@@ -1369,6 +1369,48 @@ CanvasRenderer: | @@ -1369,6 +1369,48 @@ CanvasRenderer: | ||
1369 | type: 2} | 1369 | type: 2} |
1370 | m_PrefabInternal: {fileID: 0} | 1370 | m_PrefabInternal: {fileID: 0} |
1371 | m_GameObject: {fileID: 228512393} | 1371 | m_GameObject: {fileID: 228512393} |
1372 | +--- !u!1 &239812357 | ||
1373 | +GameObject: | ||
1374 | + m_ObjectHideFlags: 0 | ||
1375 | + m_PrefabParentObject: {fileID: 133590, guid: 5ccb0ba277304a14b9bb8d4e34161675, type: 2} | ||
1376 | + m_PrefabInternal: {fileID: 0} | ||
1377 | + serializedVersion: 4 | ||
1378 | + m_Component: | ||
1379 | + - 224: {fileID: 239812358} | ||
1380 | + - 222: {fileID: 239812359} | ||
1381 | + m_Layer: 5 | ||
1382 | + m_Name: container | ||
1383 | + m_TagString: progress | ||
1384 | + m_Icon: {fileID: 0} | ||
1385 | + m_NavMeshLayer: 0 | ||
1386 | + m_StaticEditorFlags: 0 | ||
1387 | + m_IsActive: 1 | ||
1388 | +--- !u!224 &239812358 | ||
1389 | +RectTransform: | ||
1390 | + m_ObjectHideFlags: 0 | ||
1391 | + m_PrefabParentObject: {fileID: 22474260, guid: 5ccb0ba277304a14b9bb8d4e34161675, | ||
1392 | + type: 2} | ||
1393 | + m_PrefabInternal: {fileID: 0} | ||
1394 | + m_GameObject: {fileID: 239812357} | ||
1395 | + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} | ||
1396 | + m_LocalPosition: {x: 0, y: 0, z: -0.0000000121053745} | ||
1397 | + m_LocalScale: {x: 0.9999999, y: 1, z: 0} | ||
1398 | + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
1399 | + m_Children: [] | ||
1400 | + m_Father: {fileID: 1530408465} | ||
1401 | + m_RootOrder: 4 | ||
1402 | + m_AnchorMin: {x: 0, y: 1.7} | ||
1403 | + m_AnchorMax: {x: 0.97, y: 2.2} | ||
1404 | + m_AnchoredPosition: {x: 0, y: 0} | ||
1405 | + m_SizeDelta: {x: -237.39001, y: 0} | ||
1406 | + m_Pivot: {x: 1, y: 0} | ||
1407 | +--- !u!222 &239812359 | ||
1408 | +CanvasRenderer: | ||
1409 | + m_ObjectHideFlags: 0 | ||
1410 | + m_PrefabParentObject: {fileID: 22202710, guid: 5ccb0ba277304a14b9bb8d4e34161675, | ||
1411 | + type: 2} | ||
1412 | + m_PrefabInternal: {fileID: 0} | ||
1413 | + m_GameObject: {fileID: 239812357} | ||
1372 | --- !u!1 &253021235 | 1414 | --- !u!1 &253021235 |
1373 | GameObject: | 1415 | GameObject: |
1374 | m_ObjectHideFlags: 0 | 1416 | m_ObjectHideFlags: 0 |
@@ -1721,17 +1763,17 @@ RectTransform: | @@ -1721,17 +1763,17 @@ RectTransform: | ||
1721 | type: 2} | 1763 | type: 2} |
1722 | m_PrefabInternal: {fileID: 0} | 1764 | m_PrefabInternal: {fileID: 0} |
1723 | m_GameObject: {fileID: 291722901} | 1765 | m_GameObject: {fileID: 291722901} |
1724 | - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | 1766 | + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
1725 | m_LocalPosition: {x: 0, y: 0, z: 0} | 1767 | m_LocalPosition: {x: 0, y: 0, z: 0} |
1726 | - m_LocalScale: {x: 1, y: 1, z: 0} | 1768 | + m_LocalScale: {x: 0.99986213, y: 1, z: 0} |
1727 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | 1769 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
1728 | m_Children: [] | 1770 | m_Children: [] |
1729 | m_Father: {fileID: 1530408465} | 1771 | m_Father: {fileID: 1530408465} |
1730 | - m_RootOrder: 1 | 1772 | + m_RootOrder: 5 |
1731 | m_AnchorMin: {x: 0, y: 1.7} | 1773 | m_AnchorMin: {x: 0, y: 1.7} |
1732 | m_AnchorMax: {x: 0.97, y: 2.2} | 1774 | m_AnchorMax: {x: 0.97, y: 2.2} |
1733 | - m_AnchoredPosition: {x: 0, y: 0} | ||
1734 | - m_SizeDelta: {x: -237.39001, y: 0} | 1775 | + m_AnchoredPosition: {x: -0.0002913475, y: 0} |
1776 | + m_SizeDelta: {x: -236.39003, y: 0} | ||
1735 | m_Pivot: {x: 1, y: 0} | 1777 | m_Pivot: {x: 1, y: 0} |
1736 | --- !u!114 &291722903 | 1778 | --- !u!114 &291722903 |
1737 | MonoBehaviour: | 1779 | MonoBehaviour: |
@@ -3859,7 +3901,7 @@ RectTransform: | @@ -3859,7 +3901,7 @@ RectTransform: | ||
3859 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | 3901 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
3860 | m_Children: [] | 3902 | m_Children: [] |
3861 | m_Father: {fileID: 1530408465} | 3903 | m_Father: {fileID: 1530408465} |
3862 | - m_RootOrder: 5 | 3904 | + m_RootOrder: 3 |
3863 | m_AnchorMin: {x: 0, y: 1.7} | 3905 | m_AnchorMin: {x: 0, y: 1.7} |
3864 | m_AnchorMax: {x: 0.97, y: 2.2} | 3906 | m_AnchorMax: {x: 0.97, y: 2.2} |
3865 | m_AnchoredPosition: {x: 0, y: 0} | 3907 | m_AnchoredPosition: {x: 0, y: 0} |
@@ -5993,7 +6035,7 @@ RectTransform: | @@ -5993,7 +6035,7 @@ RectTransform: | ||
5993 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | 6035 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
5994 | m_Children: [] | 6036 | m_Children: [] |
5995 | m_Father: {fileID: 1530408465} | 6037 | m_Father: {fileID: 1530408465} |
5996 | - m_RootOrder: 4 | 6038 | + m_RootOrder: 2 |
5997 | m_AnchorMin: {x: 0, y: 1.7} | 6039 | m_AnchorMin: {x: 0, y: 1.7} |
5998 | m_AnchorMax: {x: 0.97, y: 2.2} | 6040 | m_AnchorMax: {x: 0.97, y: 2.2} |
5999 | m_AnchoredPosition: {x: 0, y: 0} | 6041 | m_AnchoredPosition: {x: 0, y: 0} |
@@ -7139,7 +7181,7 @@ GameObject: | @@ -7139,7 +7181,7 @@ GameObject: | ||
7139 | m_Icon: {fileID: 0} | 7181 | m_Icon: {fileID: 0} |
7140 | m_NavMeshLayer: 0 | 7182 | m_NavMeshLayer: 0 |
7141 | m_StaticEditorFlags: 0 | 7183 | m_StaticEditorFlags: 0 |
7142 | - m_IsActive: 0 | 7184 | + m_IsActive: 1 |
7143 | --- !u!224 &1059619783 | 7185 | --- !u!224 &1059619783 |
7144 | RectTransform: | 7186 | RectTransform: |
7145 | m_ObjectHideFlags: 0 | 7187 | m_ObjectHideFlags: 0 |
@@ -11112,11 +11154,12 @@ RectTransform: | @@ -11112,11 +11154,12 @@ RectTransform: | ||
11112 | m_LocalEulerAnglesHint: {x: 0, y: 0.92300004, z: 0} | 11154 | m_LocalEulerAnglesHint: {x: 0, y: 0.92300004, z: 0} |
11113 | m_Children: | 11155 | m_Children: |
11114 | - {fileID: 1059619783} | 11156 | - {fileID: 1059619783} |
11115 | - - {fileID: 291722902} | ||
11116 | - {fileID: 160532052} | 11157 | - {fileID: 160532052} |
11117 | - - {fileID: 1910480222} | ||
11118 | - {fileID: 935965593} | 11158 | - {fileID: 935965593} |
11119 | - {fileID: 581668677} | 11159 | - {fileID: 581668677} |
11160 | + - {fileID: 239812358} | ||
11161 | + - {fileID: 291722902} | ||
11162 | + - {fileID: 1910480222} | ||
11120 | m_Father: {fileID: 1620867682} | 11163 | m_Father: {fileID: 1620867682} |
11121 | m_RootOrder: 4 | 11164 | m_RootOrder: 4 |
11122 | m_AnchorMin: {x: 0, y: 0} | 11165 | m_AnchorMin: {x: 0, y: 0} |
@@ -13139,17 +13182,17 @@ RectTransform: | @@ -13139,17 +13182,17 @@ RectTransform: | ||
13139 | type: 2} | 13182 | type: 2} |
13140 | m_PrefabInternal: {fileID: 0} | 13183 | m_PrefabInternal: {fileID: 0} |
13141 | m_GameObject: {fileID: 1910480221} | 13184 | m_GameObject: {fileID: 1910480221} |
13142 | - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | 13185 | + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
13143 | m_LocalPosition: {x: 0, y: 0, z: 0} | 13186 | m_LocalPosition: {x: 0, y: 0, z: 0} |
13144 | - m_LocalScale: {x: 1, y: 1, z: 0} | 13187 | + m_LocalScale: {x: 0.99986213, y: 1, z: 0} |
13145 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | 13188 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
13146 | m_Children: [] | 13189 | m_Children: [] |
13147 | m_Father: {fileID: 1530408465} | 13190 | m_Father: {fileID: 1530408465} |
13148 | - m_RootOrder: 3 | 13191 | + m_RootOrder: 6 |
13149 | m_AnchorMin: {x: 0, y: 1.7} | 13192 | m_AnchorMin: {x: 0, y: 1.7} |
13150 | m_AnchorMax: {x: 0.97, y: 2.2} | 13193 | m_AnchorMax: {x: 0.97, y: 2.2} |
13151 | - m_AnchoredPosition: {x: 0, y: 0} | ||
13152 | - m_SizeDelta: {x: -237.39001, y: 0} | 13194 | + m_AnchoredPosition: {x: -0.0002913475, y: 0} |
13195 | + m_SizeDelta: {x: -237.39003, y: 0} | ||
13153 | m_Pivot: {x: 1, y: 0} | 13196 | m_Pivot: {x: 1, y: 0} |
13154 | --- !u!114 &1910480223 | 13197 | --- !u!114 &1910480223 |
13155 | MonoBehaviour: | 13198 | MonoBehaviour: |
Assets/Scripts/Export Video/ExportVideo.cs
@@ -53,8 +53,10 @@ public class ExportVideo : MonoBehaviour { | @@ -53,8 +53,10 @@ public class ExportVideo : MonoBehaviour { | ||
53 | Debug.Log("onClickShare pressed"); | 53 | Debug.Log("onClickShare pressed"); |
54 | screenManager.changeExportStates(ExportLayers.ExportLayer.Export_Layer,false); | 54 | screenManager.changeExportStates(ExportLayers.ExportLayer.Export_Layer,false); |
55 | screenManager.changeExportStates(ExportLayers.ExportLayer.Progress_Layer, true); | 55 | screenManager.changeExportStates(ExportLayers.ExportLayer.Progress_Layer, true); |
56 | - | ||
57 | - | 56 | + MediaShareAndroid mediaShare = new MediaShareAndroid(); |
57 | + mediaShare.ShareActivity("Download", "Baixe", "Exemplo"); | ||
58 | + | ||
59 | + | ||
58 | Debug.Log("Hiding export button and showing progress loading"); | 60 | Debug.Log("Hiding export button and showing progress loading"); |
59 | 61 | ||
60 | } | 62 | } |
@@ -73,6 +75,7 @@ public class ExportVideo : MonoBehaviour { | @@ -73,6 +75,7 @@ public class ExportVideo : MonoBehaviour { | ||
73 | 75 | ||
74 | /* Function that asks the user whether downlaod or not | 76 | /* Function that asks the user whether downlaod or not |
75 | * the video by presenting a Dialog Box.**/ | 77 | * the video by presenting a Dialog Box.**/ |
78 | + | ||
76 | public void onDownloadClick() | 79 | public void onDownloadClick() |
77 | { | 80 | { |
78 | 81 | ||
@@ -84,6 +87,7 @@ public class ExportVideo : MonoBehaviour { | @@ -84,6 +87,7 @@ public class ExportVideo : MonoBehaviour { | ||
84 | 87 | ||
85 | 88 | ||
86 | } | 89 | } |
90 | + | ||
87 | 91 | ||
88 | /** Delegate function which waits for YES or NO from the MobileDialog | 92 | /** Delegate function which waits for YES or NO from the MobileDialog |
89 | * and attach a action to each option**/ | 93 | * and attach a action to each option**/ |
@@ -110,6 +114,13 @@ public class ExportVideo : MonoBehaviour { | @@ -110,6 +114,13 @@ public class ExportVideo : MonoBehaviour { | ||
110 | screenManager.changeExportStates(ExportLayers.ExportLayer.Share_Layer, true); | 114 | screenManager.changeExportStates(ExportLayers.ExportLayer.Share_Layer, true); |
111 | } | 115 | } |
112 | 116 | ||
117 | + public void OnDownloadCancel() | ||
118 | + { | ||
119 | + Debug.Log("User canceled the download, resetting states to default"); | ||
120 | + screenManager.changeExportStates(ExportLayers.ExportLayer.All, false); | ||
121 | + screenManager.changeExportStates(ExportLayers.ExportLayer.Share_Layer, true); | ||
122 | + } | ||
123 | + | ||
113 | 124 | ||
114 | private IEnumerator requestVideoInfo(string gloss) | 125 | private IEnumerator requestVideoInfo(string gloss) |
115 | { | 126 | { |
Assets/Scripts/Export Video/MediaShareAndroid.cs
1 | -using UnityEngine; | 1 | +/********************** |
2 | +********LAVID********** | ||
3 | +***VLibras Project***** | ||
4 | +*------------------------------------------------------------------------ | ||
5 | +*Description: | ||
6 | +* | ||
7 | +*This class is a Android Plugin that makes available the sharing function. | ||
8 | +*--------------------------------------------------------------------------- | ||
9 | +*Plugin directory: | ||
10 | +* - Assets/Plugins/Android | ||
11 | +*References: | ||
12 | +* - http://docs.unity3d.com/ScriptReference/AndroidJavaClass.html | ||
13 | +*------------------------------------------------------------------------ | ||
14 | +*Author: Thiago Filipe | ||
15 | +*thiago.filipe@lavid.ufpb.br | ||
16 | +***********************/ | ||
17 | +using UnityEngine; | ||
2 | using System.Collections; | 18 | using System.Collections; |
19 | +using System.IO; | ||
3 | 20 | ||
4 | -public class MediaShareAndroid { | ||
5 | 21 | ||
6 | - private static AndroidJavaObject activity = null; | ||
7 | 22 | ||
8 | - private static void CreateActivity() | ||
9 | - { | ||
10 | -#if UNITY_ANDROID && !UNITY_EDITOR | ||
11 | - if(activity == null) | ||
12 | - activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"). | ||
13 | - GetStatic<AndroidJavaObject>("currentActivity"); | ||
14 | -#endif | 23 | +public class MediaShareAndroid : MonoBehaviour |
24 | +{ | ||
25 | + | ||
26 | + private string MediaType = "text/plain"; | ||
27 | + private string TitleMessage = "Compartilhar Vídeo"; | ||
28 | + private string SubtitleMessage = "VLibras"; | ||
29 | + private string Media = "Compartilhar"; | ||
30 | + private string path = Application.persistentDataPath + "/expl.jpg"; | ||
31 | + | ||
15 | 32 | ||
16 | - } | ||
17 | 33 | ||
18 | - public static void ShareActivity(string title, string subject, string body) | 34 | + public void ShareActivity(string title, string subject, string body) |
19 | { | 35 | { |
20 | - CreateActivity(); | ||
21 | - AndroidJavaObject sharingIntent = new AndroidJavaObject("android.content.Intent", "android.intent.action.SEND") | ||
22 | - .Call<AndroidJavaObject>("setType", "text/plain") | ||
23 | - .Call<AndroidJavaObject>("putExtra", "android.intent.extra.TEXT", body) | ||
24 | - .Call<AndroidJavaObject>("putExtra", "android.intent.extra.SUBJECT", subject); | ||
25 | - | ||
26 | - AndroidJavaObject intent = new AndroidJavaObject("android.content.Intent", activity) | ||
27 | - .CallStatic<AndroidJavaObject>("createChooser", sharingIntent, title); | ||
28 | - activity.Call("startActivity", intent); | 36 | + |
37 | +#if UNITY_ANDROID | ||
38 | + // Create Refernece of AndroidJavaClass class for intent | ||
39 | + AndroidJavaClass intentClass = new AndroidJavaClass("android.content.Intent"); | ||
40 | + // Create Refernece of AndroidJavaObject class intent | ||
41 | + AndroidJavaObject intentObject = new AndroidJavaObject("android.content.Intent"); | ||
42 | + // Set action for intent | ||
43 | + intentObject.Call<AndroidJavaObject>("setAction", intentClass.GetStatic<string>("ACTION_SEND")); | ||
44 | + intentObject.Call<AndroidJavaObject>("setType", MediaType); | ||
45 | + //Set Subject of action | ||
46 | + intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_SUBJECT"), SubtitleMessage); | ||
47 | + //Set title of action or intent | ||
48 | + intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_TITLE"), TitleMessage); | ||
49 | + | ||
50 | + | ||
51 | + // Set actual data which you want to share | ||
52 | + intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_TEXT"), Media); | ||
53 | + AndroidJavaClass unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); | ||
54 | + AndroidJavaObject currentActivity = unity.GetStatic<AndroidJavaObject>("currentActivity"); | ||
55 | + // Invoke android activity for passing intent to share data | ||
56 | + currentActivity.Call("startActivity", intentObject); | ||
57 | + | ||
58 | + | ||
59 | + /* AndroidJavaClass uriClass = new AndroidJavaClass("android.net.Uri"); | ||
60 | + AndroidJavaClass fileClass = new AndroidJavaClass("java.io.File"); | ||
61 | + AndroidJavaObject fileObject = new AndroidJavaObject("java.io.File", path);// Set Image Path Here | ||
62 | + AndroidJavaObject uriObject = uriClass.CallStatic<AndroidJavaObject>("fromFile", fileObject); | ||
63 | + // string uriPath = uriObject.Call("getPath"); | ||
64 | + bool fileExist = fileObject.Call<bool>("exists"); | ||
65 | + Debug.Log("File exist : " + fileExist); | ||
66 | + // Attach image to intent | ||
67 | + if (fileExist) | ||
68 | + intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<AndroidJavaObject>("EXTRA_STREAM"), uriObject); | ||
69 | + AndroidJavaClass unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); | ||
70 | + AndroidJavaObject currentActivity = unity.GetStatic<AndroidJavaObject>("currentActivity"); | ||
71 | + currentActivity.Call("startActivity", intentObject); | ||
72 | + */ | ||
73 | +#endif | ||
29 | } | 74 | } |
30 | } | 75 | } |
76 | + | ||
77 | + |