Beispiel #1
0
        void cameraCaptureUI()
        {
            GUILayout.Label("Camera Capture");
            if (GUILayout.Button("Start Camera Capture"))
            {
                EtceteraAndroid.startCameraCapture(false, 160, 100, Screen.width - 180, Screen.height - 120);
            }


            if (GUILayout.Button("Stop Camera Capture"))
            {
                EtceteraAndroid.stopCameraCapture();
            }


            if (GUILayout.Button("Set Frame of Camera Preview"))
            {
                EtceteraAndroid.cameraCaptureSetFrame(40, 40, 300, 200);
            }


            if (GUILayout.Button("Set Frame of Camera Preview"))
            {
                EtceteraAndroid.cameraCaptureSetFrame(300, 300, 800, 800);
            }
        }
Beispiel #2
0
        void notificationsUI()
        {
            GUILayout.Label("Notifications");
            if (GUILayout.Button("Schedule Notification in 5s"))
            {
                var noteConfig = new AndroidNotificationConfiguration(5, "Notification Title - 5 Seconds", "The subtitle of the notification", "Ticker text gets ticked")
                {
                    extraData = "five-second-note",
                    groupKey  = "my-note-group"
                };

                // turn off sound and vibration for this notification
                noteConfig.sound   = false;
                noteConfig.vibrate = false;

                _fiveSecondNotificationId = EtceteraAndroid.scheduleNotification(noteConfig);
                Debug.Log("notificationId: " + _fiveSecondNotificationId);
            }


            if (GUILayout.Button("Schedule Group Summary Notification in 5s"))
            {
                var noteConfig = new AndroidNotificationConfiguration(5, "Group Summary Title", "Group Summary Subtitle - Stuff Happened", "Ticker text")
                {
                    extraData      = "group-summary-note",
                    groupKey       = "my-note-group",
                    isGroupSummary = true
                };
                EtceteraAndroid.scheduleNotification(noteConfig);
            }


            if (GUILayout.Button("Cancel 5s Notification"))
            {
                EtceteraAndroid.cancelNotification(_fiveSecondNotificationId);
            }


            if (GUILayout.Button("Check for Notifications"))
            {
                EtceteraAndroid.checkForNotifications();
            }


            if (GUILayout.Button("Cancel All Notifications"))
            {
                EtceteraAndroid.cancelAllNotifications();
            }
        }
 void photoChooserSucceededEvent(string imagePath)
 {
     Debug.Log("photoChooserSucceededEvent: " + imagePath);
     Debug.Log("image size: " + EtceteraAndroid.getImageSizeAtPath(imagePath));
 }
Beispiel #4
0
        void OnGUI()
        {
            beginColumn();


            if (GUILayout.Button("Show Inline Web View"))
            {
                EtceteraAndroid.inlineWebViewShow("http://prime31.com/", 160, 430, Screen.width - 160, Screen.height - 100);
            }


            if (GUILayout.Button("Close Inline Web View"))
            {
                EtceteraAndroid.inlineWebViewClose();
            }


            if (GUILayout.Button("Set Url of Inline Web View"))
            {
                EtceteraAndroid.inlineWebViewSetUrl("http://google.com");
            }


            if (GUILayout.Button("Set Frame of Inline Web View"))
            {
                EtceteraAndroid.inlineWebViewSetFrame(80, 50, 300, 400);
            }


            if (GUILayout.Button("Get First 25 Contacts"))
            {
                EtceteraAndroid.loadContacts(0, 25);
            }


            endColumn(true);


            if (GUILayout.Button("Schedule Notification in 5s"))
            {
                var noteConfig = new AndroidNotificationConfiguration(5, "Notification Title - 5 Seconds", "The subtitle of the notification", "Ticker text gets ticked")
                {
                    extraData = "five-second-note",
                    groupKey  = "my-note-group"
                };

                // turn off sound and vibration for this notification
                noteConfig.sound   = false;
                noteConfig.vibrate = false;

                _fiveSecondNotificationId = EtceteraAndroid.scheduleNotification(noteConfig);
                Debug.Log("notificationId: " + _fiveSecondNotificationId);
            }


            if (GUILayout.Button("Schedule Notification in 10s"))
            {
                var noteConfig = new AndroidNotificationConfiguration(10, "Notification Title - 10 Seconds", "The subtitle of the notification", "Ticker text gets ticked")
                {
                    extraData = "ten-second-note",
                    groupKey  = "my-note-group"
                };
                _tenSecondNotificationId = EtceteraAndroid.scheduleNotification(noteConfig);
                Debug.Log("notificationId: " + _tenSecondNotificationId);
            }


            if (GUILayout.Button("Schedule Group Summary Notification in 5s"))
            {
                var noteConfig = new AndroidNotificationConfiguration(5, "Group Summary Title", "Group Summary Subtitle - Stuff Happened", "Ticker text")
                {
                    extraData      = "group-summary-note",
                    groupKey       = "my-note-group",
                    isGroupSummary = true
                };
                EtceteraAndroid.scheduleNotification(noteConfig);
            }


            if (GUILayout.Button("Cancel 5s Notification"))
            {
                EtceteraAndroid.cancelNotification(_fiveSecondNotificationId);
            }


            if (GUILayout.Button("Cancel 10s Notification"))
            {
                EtceteraAndroid.cancelNotification(_tenSecondNotificationId);
            }


            if (GUILayout.Button("Check for Notifications"))
            {
                EtceteraAndroid.checkForNotifications();
            }


            if (GUILayout.Button("Cancel All Notifications"))
            {
                EtceteraAndroid.cancelAllNotifications();
            }


            if (GUILayout.Button("Quit App"))
            {
                Application.Quit();
            }


            endColumn();


            if (bottomRightButton("Previous Scene"))
            {
                Application.LoadLevel("EtceteraTestScene");
            }
        }
Beispiel #5
0
        void OnGUI()
        {
            beginColumn();

            if (GUILayout.Button("Show Toast"))
            {
                EtceteraAndroid.showToast("Hi. Something just happened in the game and I want to tell you but not interrupt you", true);
            }


            if (GUILayout.Button("Play Video"))
            {
                Debug.Log("persistance: " + Application.persistentDataPath);
                Debug.Log("caches: " + Application.temporaryCachePath);
                // closeOnTouch has no effect if you are showing controls
                EtceteraAndroid.playMovie("http://techslides.com/demos/sample-videos/small.3gp", 0xFF0000, false, EtceteraAndroid.ScalingMode.AspectFit, true);
            }


            if (GUILayout.Button("Show Alert"))
            {
                EtceteraAndroid.showAlert("Alert Title Here", "Something just happened.  Do you want to have a snack?", "Yes", "Not Now");
            }


            if (GUILayout.Button("Single Field Prompt"))
            {
                EtceteraAndroid.showAlertPrompt("Enter Digits", "I'll call you if you give me your number", "phone number", "867-5309", "Send", "Not a Chance");
            }


            if (GUILayout.Button("Two Field Prompt"))
            {
                EtceteraAndroid.showAlertPromptWithTwoFields("Need Info", "Enter your credentials:", "username", "harry_potter", "password", string.Empty, "OK", "Cancel");
            }


            if (GUILayout.Button("Show Progress Dialog"))
            {
                EtceteraAndroid.showProgressDialog("Progress is happening", "it will be over in just a second...");
                Invoke("hideProgress", 1);
            }


            if (GUILayout.Button("Text to Speech Speak"))
            {
                EtceteraAndroid.setPitch(Random.Range(0, 5));
                EtceteraAndroid.setSpeechRate(Random.Range(0.5f, 1.5f));
                EtceteraAndroid.speak("Howdy. Im a robot voice");
            }


            if (GUILayout.Button("Prompt for Video"))
            {
                EtceteraAndroid.promptToTakeVideo("fancyVideo");
            }



            endColumn(true);


            if (GUILayout.Button("Show Web View"))
            {
                EtceteraAndroid.showWebView("http://prime31.com");
            }


            if (GUILayout.Button("Email Composer"))
            {
                // grab an attachment for this email, in this case a screenshot
                StartCoroutine(saveScreenshotToSDCard(path =>
                {
                    EtceteraAndroid.showEmailComposer("*****@*****.**", "Message subject", "click <a href='http://somelink.com'>here</a> for a present", true, path);
                }));
            }


            if (GUILayout.Button("SMS Composer"))
            {
                EtceteraAndroid.showSMSComposer("I did something really cool in this game!");
            }


            if (GUILayout.Button("Share Image Natively"))
            {
                StartCoroutine(saveScreenshotToSDCard(path =>
                {
                    EtceteraAndroid.shareImageWithNativeShareIntent(path, "Sharing a screenshot...");
                }));
            }


            if (GUILayout.Button("Share Text and Image Natively"))
            {
                StartCoroutine(saveScreenshotToSDCard(path =>
                {
                    EtceteraAndroid.shareWithNativeShareIntent("Check this out!", "Some Subject", "Sharing a screenshot and text...", path);
                }));
            }


            if (GUILayout.Button("Prompt to Take Photo"))
            {
                EtceteraAndroid.promptToTakePhoto("photo.jpg");
            }


            if (GUILayout.Button("Prompt for Album Image"))
            {
                EtceteraAndroid.promptForPictureFromAlbum("albumImage.jpg");
            }


            if (GUILayout.Button("Save Image to Gallery"))
            {
                StartCoroutine(saveScreenshotToSDCard(path =>
                {
                    var didSave = EtceteraAndroid.saveImageToGallery(path, "My image from Unity");
                    Debug.Log("did save to gallery: " + didSave);
                }));
            }


            if (GUILayout.Button("Ask For Review"))
            {
                // reset just in case you accidentally press dont ask again while playing with the demo scene
                EtceteraAndroid.resetAskForReview();
                EtceteraAndroid.askForReviewNow("Please rate my app!", "It will really make me happy if you do...");
            }


            endColumn();


            if (bottomRightButton("Next Scene"))
            {
                Application.LoadLevel("EtceteraTestSceneTwo");
            }
        }
Beispiel #6
0
 // Texture loading delegates
 public void imageLoaded(string imagePath)
 {
     // scale the image down to a reasonable size before loading
     EtceteraAndroid.scaleImageAtPath(imagePath, 0.1f);
     testPlane.renderer.material.mainTexture = EtceteraAndroid.textureFromFileAtPath(imagePath);
 }
Beispiel #7
0
 private void hideProgress()
 {
     EtceteraAndroid.hideProgressDialog();
 }
Beispiel #8
0
 void Start()
 {
     // kick off the TTS system so it is ready for use later
     EtceteraAndroid.initTTS();
     EtceteraAndroid.setAlertDialogTheme(3);
 }
Beispiel #9
0
        void OnGUI()
        {
            beginColumn();


            if (GUILayout.Button("Show Inline Web View"))
            {
                EtceteraAndroid.inlineWebViewShow("http://prime31.com/", 160, 430, Screen.width - 160, Screen.height - 100);
            }


            if (GUILayout.Button("Close Inline Web View"))
            {
                EtceteraAndroid.inlineWebViewClose();
            }


            if (GUILayout.Button("Set Url of Inline Web View"))
            {
                EtceteraAndroid.inlineWebViewSetUrl("http://google.com");
            }


            if (GUILayout.Button("Set Frame of Inline Web View"))
            {
                EtceteraAndroid.inlineWebViewSetFrame(80, 50, 300, 400);
            }


            if (GUILayout.Button("Get First 25 Contacts"))
            {
                EtceteraAndroid.loadContacts(0, 25);
            }


            GUILayout.Label("Request M Permissions");

            if (GUILayout.Button("Request Permission"))
            {
                EtceteraAndroid.requestPermissions(new string[] { "android.permission.READ_PHONE_STATE" });
            }


            if (GUILayout.Button("Should Show Permission Rationale"))
            {
                var shouldShow = EtceteraAndroid.shouldShowRequestPermissionRationale("android.permission.READ_PHONE_STATE");
                Debug.Log("shouldShowRequestPermissionRationale: " + shouldShow);
            }


            if (GUILayout.Button("Check Permission"))
            {
                var shouldShow = EtceteraAndroid.checkSelfPermission("android.permission.READ_PHONE_STATE");
                Debug.Log("checkSelfPermission: " + shouldShow);
            }


            endColumn(true);


            if (toggleButtonState("Camera Capture"))
            {
                notificationsUI();
            }
            else
            {
                cameraCaptureUI();
            }

            GUILayout.Space(30);
            toggleButton("Camera Capture", "Notifications");

            endColumn();


            if (bottomRightButton("Previous Scene"))
            {
                loadLevel("EtceteraTestScene");
            }
        }