Commit a9b7340972d42dbc8035e929ac3a0bef7d6d83f9

Authored by Thiago Filipe Soares da Rocha
1 parent c5042f3c

Bug Fix

Assets/Plugins/Android/AndroidManifest.xml
... ... @@ -7,20 +7,13 @@
7 7 <uses-sdk android:minSdkVersion="14" />
8 8 <uses-permission android:name="android.permission.INTERNET" />
9 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 12 <application
12 13 android:icon="@drawable/app_icon"
13 14 android:label="@string/app_name"
14 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 17 <activity android:name=".MainActivity"
25 18 android:label="@string/app_name"
26 19 android:screenOrientation="portrait"
... ...
Assets/Plugins/Android/AndroidManifest.xml.meta
1 1 fileFormatVersion: 2
2   -guid: 9a462ece95f547e47a1b71267f63d924
3   -timeCreated: 1442947850
  2 +guid: 11c5ef7d37a7e904a94afa7052198953
  3 +timeCreated: 1485793914
4 4 licenseType: Free
5 5 TextScriptImporter:
6 6 userData:
... ...
Assets/Scenes/Main.unity
... ... @@ -683,7 +683,7 @@ RectTransform:
683 683 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
684 684 m_Children: []
685 685 m_Father: {fileID: 1530408465}
686   - m_RootOrder: 2
  686 + m_RootOrder: 1
687 687 m_AnchorMin: {x: 0, y: 1.7}
688 688 m_AnchorMax: {x: 0.97, y: 2.2}
689 689 m_AnchoredPosition: {x: 0, y: 0}
... ... @@ -1369,6 +1369,48 @@ CanvasRenderer:
1369 1369 type: 2}
1370 1370 m_PrefabInternal: {fileID: 0}
1371 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 1414 --- !u!1 &253021235
1373 1415 GameObject:
1374 1416 m_ObjectHideFlags: 0
... ... @@ -1721,17 +1763,17 @@ RectTransform:
1721 1763 type: 2}
1722 1764 m_PrefabInternal: {fileID: 0}
1723 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 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 1769 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
1728 1770 m_Children: []
1729 1771 m_Father: {fileID: 1530408465}
1730   - m_RootOrder: 1
  1772 + m_RootOrder: 5
1731 1773 m_AnchorMin: {x: 0, y: 1.7}
1732 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 1777 m_Pivot: {x: 1, y: 0}
1736 1778 --- !u!114 &291722903
1737 1779 MonoBehaviour:
... ... @@ -3859,7 +3901,7 @@ RectTransform:
3859 3901 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
3860 3902 m_Children: []
3861 3903 m_Father: {fileID: 1530408465}
3862   - m_RootOrder: 5
  3904 + m_RootOrder: 3
3863 3905 m_AnchorMin: {x: 0, y: 1.7}
3864 3906 m_AnchorMax: {x: 0.97, y: 2.2}
3865 3907 m_AnchoredPosition: {x: 0, y: 0}
... ... @@ -5993,7 +6035,7 @@ RectTransform:
5993 6035 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
5994 6036 m_Children: []
5995 6037 m_Father: {fileID: 1530408465}
5996   - m_RootOrder: 4
  6038 + m_RootOrder: 2
5997 6039 m_AnchorMin: {x: 0, y: 1.7}
5998 6040 m_AnchorMax: {x: 0.97, y: 2.2}
5999 6041 m_AnchoredPosition: {x: 0, y: 0}
... ... @@ -7139,7 +7181,7 @@ GameObject:
7139 7181 m_Icon: {fileID: 0}
7140 7182 m_NavMeshLayer: 0
7141 7183 m_StaticEditorFlags: 0
7142   - m_IsActive: 0
  7184 + m_IsActive: 1
7143 7185 --- !u!224 &1059619783
7144 7186 RectTransform:
7145 7187 m_ObjectHideFlags: 0
... ... @@ -11112,11 +11154,12 @@ RectTransform:
11112 11154 m_LocalEulerAnglesHint: {x: 0, y: 0.92300004, z: 0}
11113 11155 m_Children:
11114 11156 - {fileID: 1059619783}
11115   - - {fileID: 291722902}
11116 11157 - {fileID: 160532052}
11117   - - {fileID: 1910480222}
11118 11158 - {fileID: 935965593}
11119 11159 - {fileID: 581668677}
  11160 + - {fileID: 239812358}
  11161 + - {fileID: 291722902}
  11162 + - {fileID: 1910480222}
11120 11163 m_Father: {fileID: 1620867682}
11121 11164 m_RootOrder: 4
11122 11165 m_AnchorMin: {x: 0, y: 0}
... ... @@ -13139,17 +13182,17 @@ RectTransform:
13139 13182 type: 2}
13140 13183 m_PrefabInternal: {fileID: 0}
13141 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 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 13188 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
13146 13189 m_Children: []
13147 13190 m_Father: {fileID: 1530408465}
13148   - m_RootOrder: 3
  13191 + m_RootOrder: 6
13149 13192 m_AnchorMin: {x: 0, y: 1.7}
13150 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 13196 m_Pivot: {x: 1, y: 0}
13154 13197 --- !u!114 &1910480223
13155 13198 MonoBehaviour:
... ...
Assets/Scripts/Export Video/ExportVideo.cs
... ... @@ -53,8 +53,10 @@ public class ExportVideo : MonoBehaviour {
53 53 Debug.Log("onClickShare pressed");
54 54 screenManager.changeExportStates(ExportLayers.ExportLayer.Export_Layer,false);
55 55 screenManager.changeExportStates(ExportLayers.ExportLayer.Progress_Layer, true);
56   -
57   -
  56 + MediaShareAndroid mediaShare = new MediaShareAndroid();
  57 + mediaShare.ShareActivity("Download", "Baixe", "Exemplo");
  58 +
  59 +
58 60 Debug.Log("Hiding export button and showing progress loading");
59 61  
60 62 }
... ... @@ -73,6 +75,7 @@ public class ExportVideo : MonoBehaviour {
73 75  
74 76 /* Function that asks the user whether downlaod or not
75 77 * the video by presenting a Dialog Box.**/
  78 +
76 79 public void onDownloadClick()
77 80 {
78 81  
... ... @@ -84,6 +87,7 @@ public class ExportVideo : MonoBehaviour {
84 87  
85 88  
86 89 }
  90 +
87 91  
88 92 /** Delegate function which waits for YES or NO from the MobileDialog
89 93 * and attach a action to each option**/
... ... @@ -110,6 +114,13 @@ public class ExportVideo : MonoBehaviour {
110 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 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 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 +
... ...