diff --git a/README.md b/README.md old mode 100755 new mode 100644 index 519c312..9dd0b46 --- a/README.md +++ b/README.md @@ -1,27 +1,31 @@ # Automatic Face Blur plug-in -# 1. Overview +Version: 1.7.0 This plug-in detects faces from spherical pictures and blur them. -# 2. Terms of Service +## History -> You agree to comply with all applicable export and import laws and regulations applicable to the jurisdiction in which the Software was obtained and in which it is used. Without limiting the foregoing, in connection with use of the Software, you shall not export or re-export the Software into any U.S. embargoed countries (currently including, but necessarily limited to, Crimea – Region of Ukraine, Cuba, Iran, North Korea, Sudan and Syria) or to anyone on the U.S. Treasury Department’s list of Specially Designated Nationals or the U.S. Department of Commerce Denied Person’s List or Entity List.  By using the Software, you represent and warrant that you are not located in any such country or on any such list.  You also agree that you will not use the Software for any purposes prohibited by any applicable laws, including, without limitation, the development, design, manufacture or production of missiles, nuclear, chemical or biological weapons. +* Version.1.7.0 (2022/10/25): THETA X is supported. +* Version.1.6.0 (2019/05/08): THETA Z1 is supported. +* Version.1.5.0 (2018/12/04): Terminate the plug-in when there is no space for Theta to take picture. +* Version.1.4.0 (2018/11/05): Check remaining space of Theta. +* Version.1.3.0 (2018/10/05): Bug fix. +* Version.1.2.0 (2018/08/08): Bug fix. +* Version.1.1.0 (2018/07/25): Initial version for GitHub. -By using the Automatic Face Blur plug-in, you are agreeing to the above and the license terms, [license.txt](license.txt). - -Copyright © 2019 Ricoh Company, Ltd. +## Development Environment -# 3. Development Environment +* RICOH THETA X (Version 1.20.0) +* RICOH THETA Z1 (Version 2.10.3) +* RICOH THETA V (Version 3.80.2) -* RICOH THETA V and Z1 -* Firmware version 2.50.1 (V), 1.03.5 (Z1) +Tips : How to update your RICOH THETA firmware: +> * [THETA X](https://support.theta360.com/en/manual/x/content/update/update_01.html) +> * [THETA Z1](https://support.theta360.com/en/manual/z1/content/update/update_01.html) +> * [THETA V](https://support.theta360.com/en/manual/v/content/update/update_01.html) - > How to update your RICOH THETA - > * [THETA V](https://support.theta360.com/en/manual/v/content/update/update_01.html) - > * [THETA Z1](https://support.theta360.com/en/manual/z1/content/update/update_01.html) - -# 4. Install +## Install Android Studio install apk after build automatically. Or use the following command after build. @@ -29,38 +33,38 @@ Android Studio install apk after build automatically. Or use the following comma adb install -r app-debug.apk ``` -### Give permissions for this plug-in. +### Give permissions for this plug-in. (THETA V/Z1 only) Using desktop viewing app as Vysor, open Settings app and turns on the permissions at "Apps" > "Automatic Face Blur" > "Permissions" -# 5. How to Use +## How to Use 1. Turn on the THETA. 2. Open RICOH THETA app on your Win/Mac. 3. Set this plug-in as an active plugin from "File" > "Plug-in management..." -4. Connect THETA to Wireless-LAN by client mode or access point mode. +4. Connect THETA to Wireless-LAN by client mode or access point mode. To connect THETA to Wireless-LAN by client mode, for example, let's assume that there is a macOS machine, - a THETA and an iPhone on the same wireless LAN. + a THETA and an iPhone on the same wireless LAN. We also recommend that the THETA be close to fully charged with an AC-USB adapter. -5. Set default plug-in - Open the THETA mobile app on an iOS/Android smartphone - Tap "Settings" at right bottom corner - Confirm "Connection" is "Wi-Fi" or "Wi-Fi+Bluetooth". - Tap "Camera settings" - Tap "Plug-in" - Select "Automatic Face Blur" -6. Check IP address of the camera - Back to the Camera settings - Check IP-address of THETA on smartphone app +5. Set default plug-in + Open the THETA mobile app on an iOS/Android smartphone + Tap "Settings" at right bottom corner + Confirm "Connection" is "Wi-Fi" or "Wi-Fi+Bluetooth". + Tap "Camera settings" + Tap "Plug-in" + Select "Automatic Face Blur" +6. Check IP address of the camera + Back to the Camera settings + Check IP-address of THETA on smartphone app If you use macOS type "dns-sd -q THETAYL01234567.local" in Terminal. Here "THETAYL01234567" is an example, please change to your serial number. -7. Launch plug-in +7. Launch plug-in Press Mode button till LED2 turns white or Open from the smartphone app (RICOH THETA) 8. If you use WebUI of the plug-in, when you connect with THETA by access point mode, - open the URL (http://192.168.1.1/:8888) on the browser. + open the URL (http://192.168.1.1/:8888) on the browser. When you connect with THETA by client mode, - open the URL (http://(ip-address):8888) on the browser. + open the URL (http://(ip-address):8888) on the browser. Here, (ip-address) is example. Change it to your THETA's IP address. 9. You can set options like shooting mode, shutter speed, ISO sensitivity, White balance and EV by WebUI of the plug-in. 10. Position the camera and press the shutter button on the WebUI of the plug-in to take a picture that will be blurred. @@ -69,16 +73,14 @@ adb install -r app-debug.apk 12. Audio will sound when you press the shutter button. Audio will sound when Automatic face blur process starts and finishes. 13. Press the Mode Button more than 2 seconds to finish this plugin. -# 6. History +--- +## Terms of Service -* v.1.1.0 (2018/07/25): Initial version for github. -* v.1.2.0 (2018/08/08): Bug fix. -* v.1.3.0 (2018/10/05): Bug fix. -* v.1.4.0 (2018/11/05): Check remaining space of Theta. -* v.1.5.0 (2018/12/04): Terminate the plug-in when there is no space for Theta to take picture. -* v.1.6.0 (2019/05/08): THETA Z1 is supported. +> You agree to comply with all applicable export and import laws and regulations applicable to the jurisdiction in which the Software was obtained and in which it is used. Without limiting the foregoing, in connection with use of the Software, you shall not export or re-export the Software into any U.S. embargoed countries (currently including, but necessarily limited to, Crimea ? Region of Ukraine, Cuba, Iran, North Korea, Sudan and Syria) or to anyone on the U.S. Treasury Department�fs list of Specially Designated Nationals or the U.S. Department of Commerce Denied Person�fs List or Entity List.? By using the Software, you represent and warrant that you are not located in any such country or on any such list.? You also agree that you will not use the Software for any purposes prohibited by any applicable laws, including, without limitation, the development, design, manufacture or production of missiles, nuclear, chemical or biological weapons. ---- +By using the Automatic Face Blur plug-in, you are agreeing to the above and the license terms, [license.txt](license.txt). + +Copyright © 2019 Ricoh Company, Ltd. ## Trademark Information @@ -87,6 +89,6 @@ The names of products and services described in this document are trademarks or * Android, Nexus, Google Chrome, Google Play, Google Play logo, Google Maps, Google+, Gmail, Google Drive, Google Cloud Print and YouTube are trademarks of Google Inc. * Apple, Apple logo, Macintosh, Mac, Mac OS, OS X, AppleTalk, Apple TV, App Store, AirPrint, Bonjour, iPhone, iPad, iPad mini, iPad Air, iPod, iPod mini, iPod classic, iPod touch, iWork, Safari, the App Store logo, the AirPrint logo, Retina and iPad Pro are trademarks of Apple Inc., registered in the United States and other countries. The App Store is a service mark of Apple Inc. * Microsoft, Windows, Windows Vista, Windows Live, Windows Media, Windows Server System, Windows Server, Excel, PowerPoint, Photosynth, SQL Server, Internet Explorer, Azure, Active Directory, OneDrive, Outlook, Wingdings, Hyper-V, Visual Basic, Visual C ++, Surface, SharePoint Server, Microsoft Edge, Active Directory, BitLocker, .NET Framework and Skype are registered trademarks or trademarks of Microsoft Corporation in the United States and other countries. The name of Skype, the trademarks and logos associated with it, and the "S" logo are trademarks of Skype or its affiliates. -* Wi-Fi™, Wi-Fi Certified Miracast, Wi-Fi Certified logo, Wi-Fi Direct, Wi-Fi Protected Setup, WPA, WPA 2 and Miracast are trademarks of the Wi-Fi Alliance. +* Wi-Fi?, Wi-Fi Certified Miracast, Wi-Fi Certified logo, Wi-Fi Direct, Wi-Fi Protected Setup, WPA, WPA 2 and Miracast are trademarks of the Wi-Fi Alliance. * The official name of Windows is Microsoft Windows Operating System. * All other trademarks belong to their respective owners. diff --git a/app/build.gradle b/app/build.gradle old mode 100755 new mode 100644 index fdd6835..67dcd8f --- a/app/build.gradle +++ b/app/build.gradle @@ -17,8 +17,8 @@ android { applicationId "com.theta360.automaticfaceblur" minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION) targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) - versionCode 6 - versionName "1.6.0" + versionCode 7 + versionName "1.7.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { @@ -40,7 +40,7 @@ dependencies { androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' implementation "com.jakewharton.timber:timber:${project.TIMBER_VERSION}" - implementation project(':pluginlibrary') + implementation 'com.theta360:pluginlibrary:3.0.3' implementation "com.koushikdutta.async:androidasync:${project.ANDROIDASYNC_VERSION}" implementation "com.google.code.gson:gson:${project.GSON_VERSION}" } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml old mode 100755 new mode 100644 index 95eb596..5889cde --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,6 +7,7 @@ + @@ -22,6 +23,7 @@ diff --git a/app/src/main/assets/css/receptor4.css b/app/src/main/assets/css/receptor4.css new file mode 100644 index 0000000..9e31e74 --- /dev/null +++ b/app/src/main/assets/css/receptor4.css @@ -0,0 +1,1596 @@ +@charset "UTF-8"; +/* ----------------------------------*/ + +/* reset */ + +/* ----------------------------------*/ + +html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary, time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + outline: 0; + font-size: 100%; + vertical-align: baseline; + background: transparent; +} + +html { + font-family: sans-serif; + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; +} + +body { + margin: 0; +} + +article, aside, details, figcaption, figure, footer, header, main, menu, nav, section, summary { + display: block; +} + +audio, canvas, progress, video { + display: inline-block; +} + +audio:not([controls]) { + display: none; + height: 0; +} + +progress { + vertical-align: baseline; +} + +template, [hidden] { + display: none; +} + +a { + background-color: transparent; + -webkit-text-decoration-skip: objects; +} + +a:active, a:hover { + outline-width: 0; +} + +abbr[title] { + border-bottom: none; + text-decoration: underline; + text-decoration: underline dotted; +} + +b, strong { + font-weight: inherit; +} + +b, strong { + font-weight: bolder; +} + +dfn { + font-style: italic; +} + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +mark { + background-color: #ff0; + color: #000; +} + +small { + font-size: 80%; +} + +sub, sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +img { + border-style: none; +} + +svg:not(:root) { + overflow: hidden; +} + +code, kbd, pre, samp { + font-family: monospace, monospace; + font-size: 1em; +} + +figure { + margin: 1em 40px; +} + +hr { + box-sizing: content-box; + height: 0; + overflow: visible; +} + +button, input, select, textarea { + font: inherit; + margin: 0; +} + +optgroup { + font-weight: bold; +} + +button, input { + overflow: visible; +} + +button, select { + text-transform: none; +} + +button, html [type="button"], [type="reset"], [type="submit"] { + -webkit-appearance: button; +} + +button::-moz-focus-inner, [type="button"]::-moz-focus-inner, [type="reset"]::-moz-focus-inner, [type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +button:-moz-focusring, [type="button"]:-moz-focusring, [type="reset"]:-moz-focusring, [type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +legend { + box-sizing: border-box; + color: inherit; + display: table; + max-width: 100%; + padding: 0; + white-space: normal; +} + +textarea { + overflow: auto; +} + +[type="checkbox"], [type="radio"] { + box-sizing: border-box; + padding: 0; +} + +[type="number"]::-webkit-inner-spin-button, [type="number"]::-webkit-outer-spin-button { + height: auto; +} + +[type="search"] { + -webkit-appearance: textfield; + outline-offset: -2px; +} + +[type="search"]::-webkit-search-cancel-button, [type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +::-webkit-input-placeholder { + color: inherit; + opacity: 0.54; +} + +::-webkit-file-upload-button { + -webkit-appearance: button; + font: inherit; +} + +* { + box-sizing: border-box; +} + +ul li { + list-style: none; +} + +html { + font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "ヒラギノ角ゴ ProN W3", Hiragino Kaku, Arial, Gothic ProN, "メイリオ", Meiryo, sans-serif; + font-size: 12px; + width: 100%; + height: 100%; +} + +body { + width: 100%; + height: 100%; +} + +img { + vertical-align: bottom; +} + +header { + background-color: #F7F7F7; + height: 44px; + border-bottom: 1px solid #ADADAD; + display: flex; + align-items: center; + justify-content: space-between; +} + +header .spacer { + display: block; + min-width: 30%; +} + +header .title { + width: 40%; + padding: 0px; + text-align: center; + color: #404040; + font-size: 16px; + font-weight: bold; +} + +header .btn { + min-width: 30%; + padding: 0px; + color: #404040; + text-indent: 0px; + font-size: 16px; + text-align: right; + padding-right: 16px; +} + +.plugin_base { + width: 100%; + height: 100%; + position: relative; + display: flex; + align-items: center; + justify-content: center; + background: #2f2f2f; +} + +.plugin_base.list { + background-color: #F0F0F0; +} + +.container { + width: 100vw; + height: 100vh; + overflow: hidden; + position: relative; + box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.5); +} + +.page { + position: absolute; + top: 0px; + left: 0px; + width: 100%; + height: 100%; + transition-property: all; + transition-duration: 400ms; + transition-delay: 0ms; + transition-timing-function: ease; +} + +.page.hide { + transform: translateX(-100%); +} + +.page.page--bottom { + transform: translateY(100%); +} + +.page.page--bottom.show { + transform: translateY(0%); +} + +.page.page--right { + transform: translateX(100%); +} + +.page.page--right.show { + transform: translateY(0%); +} + +@media screen and (max-width: 769px) { + .container { + width: 100%; + height: 100%; + overflow: hidden; + position: relative; + } +} + +.box--data { + height: 56px; + width: 110px; + text-indent: 0px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.box--data>div { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.box--data>div .box--data__key { + color: #FFF; + font-size: 10px; +} + +.box--data>div .box--data__value { + color: #FFF; + margin-top: 5px; + font-size: 16px; +} + +.box--data>div .box--data__value--bold { + color: #FFF; + font-size: 16px; + font-weight: bold; +} + +.box--data>div .box--data__value--icon { + background-color: transparent; + background-size: contain; + text-indent: -99999px; + display: block; + margin-top: 3px; + width: 28px; + height: 22px; + background-repeat: no-repeat; + background-position: center; +} + +.box--data>div .box--data__value--icon.icon--battery_full { + background-image: url(../../img/icon-battery-full-white.png); +} + +.icon { + height: 44px; + width: 44px; + position: relative; + display: block; + background-size: contain; + background-repeat: no-repeat; +} + +.icon.icon--alert-white-normal { + background-image: url(../../img/btn-alert-white-normal.png); +} + +.btn { + height: 54px; + width: 54px; + outline: 0; + box-shadow: none; + border: 0; + cursor: pointer; + box-sizing: border-box; + position: relative; + background-color: transparent; + background-size: contain; + background-repeat: no-repeat; + text-indent: -99999px; + -webkit-tap-highlight-color: transparent; +} + +.btn:active { + opacity: 0.8; +} + +.btn.btn--active { + opacity: 1; +} + +.btn.btn--disable { + opacity: 0.4; +} + +.btn.btn--label { + text-indent: 0px; + color: #FFF; + font-size: 14px; +} + +.btn.round_btn { + width: 80px; + height: 30px; + border-radius: 6px; + color: #FFF; + text-indent: 0px; + font-size: 12px; +} + +.btn.round_btn.round_dbtn--save { + background-color: #8c8c8c; +} + +.btn.round_btn.round_dbtn--delete { + background-color: #c72830; +} + +.btn.select-all-normal { + background-image: url(../../img/select-all-normal.png); +} + +.btn.select-deselect-normal { + background-image: url(../../img/select-deselect-normal.png); +} + +.btn.btn--exit { + text-indent: 0px; + width: 60px; + color: #FFF; + font-size: 20px; +} + +.btn.btn--setting { + background-image: url(../../img/btn-camerasetting.png); +} + +.btn.btn--back { + background-image: url(../../img/navigation-btn-back.png); +} + +.btn.btn--data { + height: 60px; + width: 110px; + text-indent: 0px; +} + +.btn.btn--data>div { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.btn.btn--data>div .btn--data__key { + color: #FFF; + font-size: 18px; +} + +.btn.btn--data>div .btn--data__value { + color: #FFF; + margin-top: 2px; + font-size:28px; +} + +.btn.btn--data>div .btn--data__value--icon { + background-color: transparent; + background-size: contain; + text-indent: -99999px; + display: block; + width: 36px; + height: 40px; + background-repeat: no-repeat; + background-position: center; +} + +.btn.btn--data>div .btn--data__value--icon.icon--battery_full { + background-image: url(../../img/icon-battery-full-white.png); +} + +.btn.btn--data>div .btn--data__value--icon.icon--wb_auto { + background-image: url(../../img/iconwb-auto-current.png); +} + +.btn.btn--data>div .btn--data__value--icon.icon--wb_inc_1 { + background-image: url(../../img/iconwb-incandescent-1-current.png); +} + +.btn.btn--data>div .btn--data__value--icon.icon--wb_inc_2 { + background-image: url(../../img/iconwb-incandescent-2-current.png); +} + +.btn.btn--data>div .btn--data__value--icon.icon--wb_sun-current { + background-image: url(../../img/iconwb-sun-current.png); +} + +.btn.btn--data>div .btn--data__value--icon.icon--wb_cloud-current { + background-image: url(../../img/iconwb-cloud-current.png); +} + +.btn.btn--data>div .btn--data__value--icon.icon--wb_shade-current { + background-image: url(../../img/iconwb-shade-current.png); +} + +.btn.btn--data>div .btn--data__value--icon.icon--wb_fluorescent-d-current { + background-image: url(../../img/iconwb-fluorescent-d-current.png); +} + +.btn.btn--data>div .btn--data__value--icon.icon--wb_fluorescent-l-current { + background-image: url(../../img/iconwb-fluorescent-l-current.png); +} + +.btn.btn--data>div .btn--data__value--icon.icon--wb_fluorescent-n-current { + background-image: url(../../img/iconwb-fluorescent-n-current.png); +} + +.btn.btn--data>div .btn--data__value--icon.icon--wb_fluorescent-w-current { + background-image: url(../../img/iconwb-fluorescent-w-current.png); +} + +.btn.btn--data>div .btn--data__value--icon.icon--wb_underwater-current { + background-image: url(../../img/iconwb-underwater-current.png); +} + +.btn.btn--data>div .btn--data__value--bold { + color: #FFF; + font-size: 16px; + font-weight: bold; +} + +.btn.btn--360 { + height: 82px; + width: 82px; + position: absolute; + bottom: 0px; + right: 0px; + background-image: url(../../img/view-btn-360-normal.png); +} + +.btn.btn--no_pano { + height: 82px; + width: 82px; + position: absolute; + bottom: 0px; + right: 0px; + background-image: url(../../img/view-btn-no-normal.png); +} + +.btn.btn--pano { + height: 82px; + width: 82px; + position: absolute; + bottom: 0px; + right: 0px; + background-image: url(../../img/view-btn-pano-normal.png); +} + +.btn.btn--camera-image-white-normal { + visibility: hidden; + background-image: url(../../img/btn-camera-image-white-normal.png); +} + +.btn.btn--select_mode { + background-position: 90% 0px; + background-image: url(../../img/navigation-btn-selectmode-black-normal.png); +} + +.btn.btn--mode-auto-normal { + background-image: url(../../img/btn-mode-auto-normal.png); +} + +.btn.btn--mode-iso-normal { + background-image: url(../../img/btn-mode-iso-normal.png); +} + +.btn.btn--mode-manual-normal { + background-image: url(../../img/btn-mode-manual-normal.png); +} + +.btn.btn--mode-shutter-normal { + background-image: url(../../img/btn-mode-shutter-normal.png); +} + +.btn.btn--mode-camera-on-normal { + background-image: url(../../img/btn-mode-camera-on-normal.png); +} + +.btn.btn--mode-camera-off-normal { + background-image: url(../../img/btn-mode-camera-off-normal.png); +} + +.btn.btn--mode-video-on-normal { + background-image: url(../../img/btn-mode-video-on-normal.png); +} + +.btn.btn--mode-video-off-normal { + background-image: url(../../img/btn-mode-video-off-normal.png); +} + +.btn.btn--shutter-normal { + height: 56px; + width: 56px; + background-image: url(../../img/btn-shutte-normal.png); +} + +.btn.btn--shutte-video-normal { + height: 56px; + width: 56px; + background-image: url(../../img/btn-shutte-video-normal.png); +} + +.btn.btn--shutter_recording-normal { + height: 56px; + width: 56px; + background-image: url(../../img/btn-shutte-recording-normal.png); +} + +input[type=checkbox] { + display: none; +} + +.checkbox { + opacity: 0; + box-sizing: border-box; + -webkit-transition: background-color 0.2s linear; + transition: background-color 0.2s linear; + vertical-align: middle; + cursor: pointer; + position: absolute; + top: 8px; + width: calc(100% - 16px); + height: calc(100% - 16px); + background-color: rgba(255, 255, 255, 0.6); + display: none; +} + +.checkbox:after { + position: absolute; + bottom: 5px; + right: 5px; + display: block; + width: 24px; + height: 24px; + content: ''; + background-repeat: no-repeat; + background-position: center; + background-size: contain; + background-image: url(../../img/icon_list_check.png); +} + +input[type=checkbox]:checked+.checkbox { + opacity: 1; +} + +.checkbox.show { + display: inline-block; +} + +input[type=radio] { + display: none !important; +} + +.segmented_ctrl { + flex-grow: 0; + flex-shrink: 0; + border: 1px solid #000; + border-radius: 4px; + display: flex; + align-items: center; + overflow: hidden; +} + +.segmented { + margin: 0px; + padding: 0px; + height: 25px; + display: inline-block; + min-width: 100px; + display: flex; + align-items: center; + justify-content: center; + background-color: #FFF; + color: #404040; + border-right: 1px solid #404040; +} + +.segmented:last-child { + border-right: 0px solid #404040; +} + +input[type=radio]:checked+.segmented { + background-color: #404040; + color: #FFF; +} + +.action { + border-bottom: 1px solid #D6D7D8; + text-indent: 0px; + color: #2F7CF6; + font-size: 18px; + height: 50px; + text-align: center; + width: 100%; + background-color: rgba(255, 255, 255, 0.9); + display: flex; + justify-content: center; + align-items: center; + position: relative; +} + +.action:last-child { + border-right: 0px solid #404040; +} + +input[type=radio]:checked+.action:after { + content: ""; + position: absolute; + right: 15px; + width: 20px; + height: 22px; + background-repeat: no-repeat; + background-position: center; + background-size: contain; + background-image: url(../../img/action_check.png); +} + +.form-switch { + display: inline-block; + cursor: pointer; + -webkit-tap-highlight-color: transparent; +} + +.form-switch i { + position: relative; + display: inline-block; + width: 46px; + height: 26px; + background-color: #e6e6e6; + border-radius: 23px; + vertical-align: text-bottom; + transition: all 0.2s linear; +} + +.form-switch i::after { + content: ""; + position: absolute; + left: 0; + width: 22px; + height: 22px; + background-color: #fff; + border-radius: 11px; + box-shadow: 0 2px 2px rgba(0, 0, 0, 0.24); + transform: translate3d(2px, 2px, 0); + transition: all 0.2s linear; +} + +.form-switch:active i::after { + transform: translate3d(2px, 2px, 0); +} + +.form-switch:active input:checked+i::after { + transform: translate3d(16px, 2px, 0); +} + +.form-switch input:checked+i { + background-color: #4BD763; +} + +.form-switch input:checked+i::before { + transform: translate3d(18px, 2px, 0) scale3d(0, 0, 0); +} + +.form-switch input:checked+i::after { + transform: translate3d(22px, 2px, 0); +} + +/* Slider */ + +.slick-slider { + position: relative; + display: block; + box-sizing: border-box; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-touch-callout: none; + -khtml-user-select: none; + -ms-touch-action: pan-y; + touch-action: pan-y; + -webkit-tap-highlight-color: transparent; +} + +.slick-list { + position: relative; + display: block; + overflow: hidden; + margin: 0; + padding: 0; +} + +.slick-list:focus { + outline: none; +} + +.slick-list.dragging { + cursor: pointer; + cursor: hand; +} + +.slick-slider .slick-track, .slick-slider .slick-list { + -webkit-transform: translate3d(0, 0, 0); + -moz-transform: translate3d(0, 0, 0); + -ms-transform: translate3d(0, 0, 0); + -o-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); +} + +.slick-track { + position: relative; + top: 0; + left: 0; + display: block; + margin-left: auto; + margin-right: auto; +} + +.slick-track:before, .slick-track:after { + display: table; + content: ''; +} + +.slick-track:after { + clear: both; +} + +.slick-loading .slick-track { + visibility: hidden; +} + +.slick-slide { + display: none; + float: left; + height: 100%; + min-height: 1px; +} + +[dir='rtl'] .slick-slide { + float: right; +} + +.slick-slide img { + display: block; +} + +.slick-slide.slick-loading img { + display: none; +} + +.slick-slide.dragging img { + pointer-events: none; +} + +.slick-initialized .slick-slide { + display: block; +} + +.slick-loading .slick-slide { + visibility: hidden; +} + +.slick-vertical .slick-slide { + display: block; + height: auto; + border: 1px solid transparent; +} + +.slick-arrow.slick-hidden { + display: none; +} + +/* Slider */ + +.slick-loading .slick-list { + background: #fff url("./ajax-loader.gif") center center no-repeat; +} + +/* Icons */ + +@font-face { + font-family: 'slick'; + font-weight: normal; + font-style: normal; + src: url("./fonts/slick.eot"); + src: url("./fonts/slick.eot?#iefix") format("embedded-opentype"), url("./fonts/slick.woff") format("woff"), url("./fonts/slick.ttf") format("truetype"), url("./fonts/slick.svg#slick") format("svg"); +} + +/* Arrows */ + +.slick-prev, .slick-next { + font-size: 0; + line-height: 0; + position: absolute; + top: 50%; + display: block; + width: 20px; + height: 20px; + padding: 0; + -webkit-transform: translate(0, -50%); + -ms-transform: translate(0, -50%); + transform: translate(0, -50%); + cursor: pointer; + color: transparent; + border: none; + outline: none; + background: transparent; +} + +.slick-prev:hover, .slick-prev:focus, .slick-next:hover, .slick-next:focus { + color: transparent; + outline: none; + background: transparent; +} + +.slick-prev:hover:before, .slick-prev:focus:before, .slick-next:hover:before, .slick-next:focus:before { + opacity: 1; +} + +.slick-prev.slick-disabled:before, .slick-next.slick-disabled:before { + opacity: .25; +} + +.slick-prev:before, .slick-next:before { + font-family: 'slick'; + font-size: 20px; + line-height: 1; + opacity: .75; + color: white; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.slick-prev { + left: -25px; +} + +[dir='rtl'] .slick-prev { + right: -25px; + left: auto; +} + +.slick-prev:before { + content: '←'; +} + +[dir='rtl'] .slick-prev:before { + content: '→'; +} + +.slick-next { + right: -25px; +} + +[dir='rtl'] .slick-next { + right: auto; + left: -25px; +} + +.slick-next:before { + content: '→'; +} + +[dir='rtl'] .slick-next:before { + content: '←'; +} + +/* Dots */ + +.slick-dotted.slick-slider { + margin-bottom: 30px; +} + +.slick-dots { + position: absolute; + bottom: -25px; + display: block; + width: 100%; + padding: 0; + margin: 0; + list-style: none; + text-align: center; +} + +.slick-dots li { + position: relative; + display: inline-block; + width: 20px; + height: 20px; + margin: 0 5px; + padding: 0; + cursor: pointer; +} + +.slick-dots li button { + font-size: 0; + line-height: 0; + display: block; + width: 20px; + height: 20px; + padding: 5px; + cursor: pointer; + color: transparent; + border: 0; + outline: none; + background: transparent; +} + +.slick-dots li button:hover, .slick-dots li button:focus { + outline: none; +} + +.slick-dots li button:hover:before, .slick-dots li button:focus:before { + opacity: 1; +} + +.slick-dots li button:before { + font-family: 'slick'; + font-size: 6px; + line-height: 20px; + position: absolute; + top: 0; + left: 0; + width: 20px; + height: 20px; + content: '•'; + text-align: center; + opacity: .25; + color: black; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.slick-dots li.slick-active button:before { + opacity: .75; + color: black; +} + +.pluginpreview { + background: #1A1A1A; + width: 100%; + height: 100%; +} + +.pluginpreview.pluginpreview--nopreview { + background-image: url("../../img/no-preview-logo.png"); + background-repeat: no-repeat; + background-position: center 42%; + background-size: 203px 59px; +} + +.pluginctrl .pluginctrl__shoot { + position: absolute; + bottom: 0px; + left: 0px; + width: 100%; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail { + display: none; + height: 64px; + width: 100%; + border-top: 1px solid #FFF; + border-bottom: 1px solid #FFF; + margin-bottom: -1px; + background-color: black; + position: relative; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.inithide { + opacity: 0; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.show { + display: block; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .pluginctrl__shoot__setting__detail__btn_wrap { + height: 40px; + width: auto; + margin-top: 11px; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .pluginctrl__shoot__setting__detail__btn_wrap .bw { + width: 100px; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn { + width: 70px; + color: #FFF; + height: 40px; + font-size: 22px; + box-sizing: border-box; + position: relative; + float: left; + display: flex; + align-items: center; + justify-content: center; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn.wb { + width: 50px; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn.wb i { + width: 30px; + height: 40px; + text-indent: -99999px; + background-size: contain; + background-repeat: no-repeat; + background-position: center; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn i { + opacity: 0.4; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn i.wbicon0 { + background-image: url(../../img/iconwb-auto-current.png); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn i.wbicon1 { + background-image: url(../../img/iconwb-sun-current.png); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn i.wbicon2 { + background-image: url(../../img/iconwb-shade-current.png); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn i.wbicon3 { + background-image: url(../../img/iconwb-cloud-current.png); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn i.wbicon4 { + background-image: url(../../img/iconwb-incandescent-1-current.png); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn i.wbicon5 { + background-image: url(../../img/iconwb-incandescent-2-current.png); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn i.wbicon6 { + background-image: url(../../img/iconwb-fluorescent-d-current.png); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn i.wbicon7 { + background-image: url(../../img/iconwb-fluorescent-n-current.png); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn i.wbicon8 { + background-image: url(../../img/iconwb-fluorescent-w-current.png); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn i.wbicon9 { + background-image: url(../../img/iconwb-fluorescent-l-current.png); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn i.wbicon10 { + background-image: url(../../img/iconwb-underwater-current.png); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn i.wbicon11 { + background-image: url(../../img/iconwb-auto-current.png); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn input[type=radio]:checked~i { + opacity: 1; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn:after { + content: ""; + width: 1px; + height: 100%; + display: block; + position: absolute; + right: 0px; + top: 0px; + background: #4e4e4e; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .scroll_btn:first-child:before { + content: ""; + width: 1px; + height: 100%; + display: block; + position: absolute; + left: 0px; + top: 0px; + background: #4e4e4e; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .btn { + height: 100%; + font-size: 16px; + width: auto; + float: left; + border-right: 1px solid rgba(255, 255, 255, 0.3); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .btn span { + opacity: 0.4; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .btn:last-child { + border-right: 0px solid rgba(255, 255, 255, 0.3); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail .btn.btn--active span { + opacity: 1; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail:after { + content: ""; + display: block; + position: absolute; + bottom: -6px; + width: 10px; + height: 10px; + background: #000; + transform: rotate(45deg); + border-bottom: 1px solid #FFF; + border-right: 1px solid #FFF; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position1_1:after { + left: calc(50% - 5px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position2_1:after { + left: calc(25% - 6px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position2_2:after { + left: calc(75% - 6px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position3_1:after { + left: calc(17% - 6px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position3_2:after { + left: calc(50% - 4px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position3_3:after { + left: calc(83% - 4px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position4_1:after { + left: calc(12% - 3px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position4_2:after { + left: calc(37% - 3px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position4_3:after { + left: calc(62% - 3px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position4_4:after { + left: calc(87% - 3px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position5_1:after { + left: calc(10% - 5px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position5_2:after { + left: calc(30% - 1px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position5_3:after { + left: calc(50% - 3px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position5_4:after { + left: calc(70% - 3px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting__detail.position5_5:after { + left: calc(90% - 5px); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__info { + height: 82px; + width: 100%; + position: absolute; + left: 0px; + bottom: 140px; + display: flex; + align-items: center; + justify-content: center; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__info .pluginctrl__shoot__status_txt { + font-size: 16px; + color: #FFF; + text-align: center; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting { + height: 78px; + border-top: 1px solid #FFF; + display: flex; + align-items: center; + justify-content: space-around; + background-color: rgba(0, 0, 0, 0.5); +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__setting.hide { + display: none; +} + +.pluginctrl .pluginctrl__shoot .pluginctrl__shoot__shutter { + height: 86px; + background-color: rgba(0, 0, 0, 0.5); + border-top: 1px solid #FFF; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0px 16px; +} + +.segmented_wrap { + background-color: #F0F0F0; + height: 44px; + display: flex; + align-items: center; + justify-content: center; +} + +.tableview { + -webkit-transition: 0.3s ease-out; + -moz-transition: 0.3s ease-out; + -ms-transition: 0.3s ease-out; + -o-transition: 0.3s ease-out; + transition: 0.3s ease-out; + height: calc(100% - 88px); + overflow-x: hidden; + overflow-y: auto; + position: absolute; + width: 100%; + background-color: #F0F0F0; +} + +.tableview.hasmenu { + height: calc(100% - 132px); +} + +.tableview ul { + margin: 0; + min-height: 1px; + overflow: hidden; + padding: 23px 0 0; + position: relative; +} + +.tableview ul .title { + bottom: auto; + min-height: 1px; + top: 0; +} + +.tableview ul li { + font-size: 20px; + margin: 0; + padding: 8px; + border-top: 1px solid #ccc; +} + +.tableview ul li .thumbs { + display: flex; + justify-content: flex-start; + flex-wrap: wrap; +} + +.tableview ul li .thumbs .thumb { + width: 25%; + padding: 8px; + position: relative; +} + +.tableview ul li .thumbs .thumb img { + background: #000; + width: 100%; + height: auto; +} + +.tableview .animated li { + bottom: 0; + top: auto; + z-index: 100; +} + +.footer_menu { + height: 44px; + background-color: #f7f7f7; + width: 100%; + position: absolute; + bottom: -44px; + left: 0px; + display: flex; + align-items: center; + justify-content: space-around; + -webkit-transition: 0.3s ease-out; + -moz-transition: 0.3s ease-out; + -ms-transition: 0.3s ease-out; + -o-transition: 0.3s ease-out; + transition: 0.3s ease-out; +} + +.footer_menu.show { + bottom: 0px; +} + +.tableview-wrapper { + font-family: Helvetica, Arial, sans-serif; + height: calc(100% - 88px); + overflow: visible; + position: relative; + zoom: 1; +} + +.tableview-wrapper .dummy-header { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + margin: 0; + z-index: 1000; +} + +.tableview-wrapper .dummy-header.hidden { + visibility: hidden; +} + +.tableview-wrapper .dummy-header, .tableview .title { + background: #E6E6E6; + color: #808080; + font-size: 16px; + line-height: 21px; + margin-top: 0; + padding: 2px 16px 0 16px; + position: absolute; + width: 100%; +} + +.setting_list { + height: calc(100% - 44px); + background-color: #F0F0F0; +} + +.setting_list .section_title { + color: #6d6d72; + font-size: 13px; + padding: 24px 16px 8px; +} + +.setting_list ul { + background-color: #FFF; + padding-left: 16px; + margin-bottom: 30px; +} + +.setting_list ul li { + display: flex; + align-items: center; + justify-content: space-between; + height: 45px; + border-bottom: 1px solid #C8C7CC; + padding-right: 16px; +} + +.setting_list ul li .label { + font-size: 14px; + color: #404040; +} + +.setting_list ul li .btn { + text-indent: 0px; + font-size: 14px; + color: #0088bd; + width: auto; + min-width: 80px; + text-align: right; + padding: 0px; +} + +.setting_list ul li .value { + font-size: 14px; + color: #808080; +} + +.setting_list ul li:last-child { + border-bottom: 0px solid #C8C7CC; +} + +.action_sheet { + position: absolute; + top: 0px; + left: 0px; + width: 100%; + height: 100%; + transform: translateY(100%); +} + +.action_sheet:before { + content: ""; + display: block; + width: 100%; + height: 100%; + transition-property: all; + transition-duration: 200ms; + transition-delay: 0ms; + transition-timing-function: ease; + background-color: transparent; +} + +.action_sheet .btn_wrap { + position: absolute; + bottom: 0px; + width: 100%; + padding: 12px; + transition-property: all; + transition-duration: 200ms; + transition-delay: 0ms; + transition-timing-function: ease; + transform: translateY(100%); +} + +.action_sheet .btn_wrap .btn { + text-indent: 0px; + color: #2F7CF6; + font-size: 18px; + height: 50px; + text-align: center; + width: 100%; + background-color: rgba(255, 255, 255, 0.9); + border-bottom: 1px solid #D6D7D8; +} + +.action_sheet .btn_wrap ul { + border-radius: 12px; + margin-bottom: 12px; + overflow: hidden; +} + +.action_sheet .btn_wrap ul li:last-child .btn { + border-bottom: 0px solid #D6D7D8; +} + +.action_sheet .btn_wrap .cancel_btn { + width: 100%; + border-radius: 12px; + background-color: #FFF; + font-size: 18px; + height: 50px; + font-weight: bold; +} + +.action_sheet.show .btn_wrap { + transform: translateY(0%); +} + +.action_sheet.show:before { + background-color: rgba(0, 0, 0, 0.4); +} \ No newline at end of file diff --git a/app/src/main/assets/fonts/NotoSansJP-Regular.otf b/app/src/main/assets/fonts/NotoSansJP-Regular.otf new file mode 100644 index 0000000..5791298 Binary files /dev/null and b/app/src/main/assets/fonts/NotoSansJP-Regular.otf differ diff --git a/app/src/main/assets/fonts/Roboto-Regular.woff b/app/src/main/assets/fonts/Roboto-Regular.woff new file mode 100644 index 0000000..b1a539e Binary files /dev/null and b/app/src/main/assets/fonts/Roboto-Regular.woff differ diff --git a/app/src/main/assets/img/btn-camera-image-white-normal.png b/app/src/main/assets/img/btn-camera-image-white-normal.png new file mode 100644 index 0000000..5a2e2e2 Binary files /dev/null and b/app/src/main/assets/img/btn-camera-image-white-normal.png differ diff --git a/app/src/main/assets/img/btn-camerasetting.png b/app/src/main/assets/img/btn-camerasetting.png new file mode 100644 index 0000000..ff60bc4 Binary files /dev/null and b/app/src/main/assets/img/btn-camerasetting.png differ diff --git a/app/src/main/assets/img/iconwb-underwater-current.png b/app/src/main/assets/img/iconwb-underwater-current.png new file mode 100644 index 0000000..d713d91 Binary files /dev/null and b/app/src/main/assets/img/iconwb-underwater-current.png differ diff --git a/app/src/main/assets/js/ThetaControls-receptor4.js b/app/src/main/assets/js/ThetaControls-receptor4.js new file mode 100644 index 0000000..8f2a215 --- /dev/null +++ b/app/src/main/assets/js/ThetaControls-receptor4.js @@ -0,0 +1,1173 @@ +/** + * @author qiao / https://github.com/qiao + * @author mrdoob / http://mrdoob.com + * @author alteredq / http://alteredqualia.com/ + * @author WestLangley / http://github.com/WestLangley + * @author erich666 / http://erichaines.com + */ +/*global THREE, console */ + +( function () { + + function OrbitConstraint ( object ) { + + this.object = object; + + // "target" sets the location of focus, where the object orbits around + // and where it pans with respect to. + this.target = new THREE.Vector3(); + + // Limits to how far you can dolly in and out ( PerspectiveCamera only ) + this.minDistance = 0; + this.maxDistance = 10; + + // Limits to how far you can zoom in and out ( OrthographicCamera only ) + this.minZoom = 0; + this.maxZoom = Infinity; + + // How far you can orbit vertically, upper and lower limits. + // Range is 0 to Math.PI radians. + this.minPolarAngle = 0; // radians + this.maxPolarAngle = Math.PI; // radians + + // How far you can orbit horizontally, upper and lower limits. + // If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ]. + this.minAzimuthAngle = - Infinity; // radians + this.maxAzimuthAngle = Infinity; // radians + + // Set to true to enable damping (inertia) + // If damping is enabled, you must call controls.update() in your animation loop + this.enableDamping = false; + this.dampingFactor = 0.25; + + //////////// + // internals + + var scope = this; + + var EPS = 0.000001; + + // Current position in spherical coordinate system. + var theta; + var phi; + + // Pending changes + var phiDelta = 0; + var thetaDelta = 0; + var scale = 1; + var panOffset = new THREE.Vector3(); + var zoomChanged = false; + + // API + + this.getPolarAngle = function () { + + return phi; + + }; + + this.getAzimuthalAngle = function () { + + return theta; + + }; + + this.rotateLeft = function ( angle ) { + + thetaDelta += angle; + + }; + + this.rotateUp = function ( angle ) { + + phiDelta += angle; + + }; + + // pass in distance in world space to move left + this.panLeft = function() { + + var v = new THREE.Vector3(); + + return function panLeft ( distance ) { + + var te = this.object.matrix.elements; + + // get X column of matrix + v.set( te[ 0 ], te[ 1 ], te[ 2 ] ); + v.multiplyScalar( - distance ); + + panOffset.add( v ); + + }; + + }(); + + // pass in distance in world space to move up + this.panUp = function() { + + var v = new THREE.Vector3(); + + return function panUp ( distance ) { + + var te = this.object.matrix.elements; + + // get Y column of matrix + v.set( te[ 4 ], te[ 5 ], te[ 6 ] ); + v.multiplyScalar( distance ); + + panOffset.add( v ); + + }; + + }(); + + // pass in x,y of change desired in pixel space, + // right and down are positive + this.pan = function ( deltaX, deltaY, screenWidth, screenHeight ) { + + if ( scope.object instanceof THREE.PerspectiveCamera ) { + + // perspective + var position = scope.object.position; + var offset = position.clone().sub( scope.target ); + var targetDistance = offset.length(); + + // half of the fov is center to top of screen + targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 ); + + // we actually don't use screenWidth, since perspective camera is fixed to screen height + scope.panLeft( 2 * deltaX * targetDistance / screenHeight ); + scope.panUp( 2 * deltaY * targetDistance / screenHeight ); + + } else if ( scope.object instanceof THREE.OrthographicCamera ) { + + // orthographic + scope.panLeft( deltaX * ( scope.object.right - scope.object.left ) / screenWidth ); + scope.panUp( deltaY * ( scope.object.top - scope.object.bottom ) / screenHeight ); + + } else { + + // camera neither orthographic or perspective + console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' ); + + } + + }; + + this.dollyIn = function ( dollyScale ) { + + if ( scope.object instanceof THREE.PerspectiveCamera ) { + + scale /= dollyScale; + + } else if ( scope.object instanceof THREE.OrthographicCamera ) { + + scope.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom * dollyScale ) ); + scope.object.updateProjectionMatrix(); + zoomChanged = true; + + } else { + + console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' ); + + } + + }; + + this.dollyOut = function ( dollyScale ) { + + if ( scope.object instanceof THREE.PerspectiveCamera ) { + + scale *= dollyScale; + + } else if ( scope.object instanceof THREE.OrthographicCamera ) { + + scope.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom / dollyScale ) ); + scope.object.updateProjectionMatrix(); + zoomChanged = true; + + } else { + + console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' ); + + } + + }; + + this.update = function() { + + var offset = new THREE.Vector3(); + + // so camera.up is the orbit axis + var quat = new THREE.Quaternion().setFromUnitVectors( object.up, new THREE.Vector3( 0, 1, 0 ) ); + var quatInverse = quat.clone().inverse(); + + var lastPosition = new THREE.Vector3(); + var lastQuaternion = new THREE.Quaternion(); + + return function () { + + var position = this.object.position; + + offset.copy( position ).sub( this.target ); + + // rotate offset to "y-axis-is-up" space + offset.applyQuaternion( quat ); + + // angle from z-axis around y-axis + + theta = Math.atan2( offset.x, offset.z ); + + // angle from y-axis + + phi = Math.atan2( Math.sqrt( offset.x * offset.x + offset.z * offset.z ), offset.y ); + + theta += thetaDelta; + phi += phiDelta; + + // restrict theta to be between desired limits + theta = Math.max( this.minAzimuthAngle, Math.min( this.maxAzimuthAngle, theta ) ); + + // restrict phi to be between desired limits + phi = Math.max( this.minPolarAngle, Math.min( this.maxPolarAngle, phi ) ); + + // restrict phi to be betwee EPS and PI-EPS + phi = Math.max( EPS, Math.min( Math.PI - EPS, phi ) ); + + var radius = offset.length() * scale; + + // restrict radius to be between desired limits + radius = Math.max( this.minDistance, Math.min( this.maxDistance, radius ) ); + + // move target to panned location + this.target.add( panOffset ); + + offset.x = radius * Math.sin( phi ) * Math.sin( theta ); + offset.y = radius * Math.cos( phi ); + offset.z = radius * Math.sin( phi ) * Math.cos( theta ); + + // rotate offset back to "camera-up-vector-is-up" space + offset.applyQuaternion( quatInverse ); + + position.copy( this.target ).add( offset ); + + this.object.lookAt( this.target ); + + if ( this.enableDamping === true ) { + + thetaDelta *= ( 1 - this.dampingFactor ); + phiDelta *= ( 1 - this.dampingFactor ); + + } else { + + thetaDelta = 0; + phiDelta = 0; + + } + + scale = 1; + panOffset.set( 0, 0, 0 ); + + // update condition is: + // min(camera displacement, camera rotation in radians)^2 > EPS + // using small-angle approximation cos(x/2) = 1 - x^2 / 8 + + if ( zoomChanged || + lastPosition.distanceToSquared( this.object.position ) > EPS || + 8 * ( 1 - lastQuaternion.dot( this.object.quaternion ) ) > EPS ) { + + lastPosition.copy( this.object.position ); + lastQuaternion.copy( this.object.quaternion ); + zoomChanged = false; + + return true; + + } + + return false; + + }; + + }(); + + }; + + + // This set of controls performs orbiting, dollying (zooming), and panning. It maintains + // the "up" direction as +Y, unlike the TrackballControls. Touch on tablet and phones is + // supported. + // + // Orbit - left mouse / touch: one finger move + // Zoom - middle mouse, or mousewheel / touch: two finger spread or squish + // Pan - right mouse, or arrow keys / touch: three finter swipe + + THREE.OrbitControls = function ( object, domElement ) { + + var constraint = new OrbitConstraint( object ); + + this.domElement = ( domElement !== undefined ) ? domElement : document; + + // API + + Object.defineProperty( this, 'constraint', { + + get: function() { + + return constraint; + + } + + } ); + + this.getPolarAngle = function () { + + return constraint.getPolarAngle(); + + }; + + this.getAzimuthalAngle = function () { + + return constraint.getAzimuthalAngle(); + + }; + + // Set to false to disable this control + this.enabled = true; + + // center is old, deprecated; use "target" instead + this.center = this.target; + + // This option actually enables dollying in and out; left as "zoom" for + // backwards compatibility. + // Set to false to disable zooming + this.enableZoom = true; + this.zoomSpeed = 1.0; + + // Set to false to disable rotating + this.enableRotate = true; + this.rotateSpeed = 0.2; + + // Set to false to disable panning + this.enablePan = true; + this.keyPanSpeed = 7.0; // pixels moved per arrow key push + + // Set to true to automatically rotate around the target + // If auto-rotate is enabled, you must call controls.update() in your animation loop + this.autoRotate = false; + this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60 + + // Set to false to disable use of the keys + this.enableKeys = true; + + // The four arrow keys + this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 }; + + // Mouse buttons + this.mouseButtons = { ORBIT: THREE.MOUSE.LEFT, ZOOM: THREE.MOUSE.MIDDLE, PAN: THREE.MOUSE.RIGHT }; + + //////////// + // internals + + var scope = this; + + var rotateStart = new THREE.Vector2(); + var rotateEnd = new THREE.Vector2(); + var rotateDelta = new THREE.Vector2(); + + var panStart = new THREE.Vector2(); + var panEnd = new THREE.Vector2(); + var panDelta = new THREE.Vector2(); + + var dollyStart = new THREE.Vector2(); + var dollyEnd = new THREE.Vector2(); + var dollyDelta = new THREE.Vector2(); + + var STATE = { NONE : - 1, ROTATE : 0, DOLLY : 1, PAN : 2, TOUCH_ROTATE : 3, TOUCH_DOLLY : 4, TOUCH_PAN : 5 }; + + var state = STATE.NONE; + + // for reset + + this.target0 = this.target.clone(); + this.position0 = this.object.position.clone(); + this.zoom0 = this.object.zoom; + + // events + + var changeEvent = { type: 'change' }; + var startEvent = { type: 'start' }; + var endEvent = { type: 'end' }; + + // 長押し対応 + let timer; + + // ダブルタップ対応 + var tapCount = 0; + var zoomFlag = false; + + // pass in x,y of change desired in pixel space, + // right and down are positive + function pan( deltaX, deltaY ) { + + var element = scope.domElement === document ? scope.domElement.body : scope.domElement; + + constraint.pan( deltaX, deltaY, element.clientWidth, element.clientHeight ); + + } + + this.update = function () { + + if ( this.autoRotate && state === STATE.NONE ) { + + constraint.rotateLeft( getAutoRotationAngle() ); + + } + + if ( constraint.update() === true ) { + + this.dispatchEvent( changeEvent ); + + } + + }; + + this.reset = function () { + + state = STATE.NONE; + + this.target.copy( this.target0 ); + this.object.position.copy( this.position0 ); + this.object.zoom = this.zoom0; + + this.object.updateProjectionMatrix(); + this.dispatchEvent( changeEvent ); + + this.update(); + + }; + + function getAutoRotationAngle() { + + return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed; + + } + + function getZoomScale() { + + return Math.pow( 0.95, scope.zoomSpeed ); + + } + + function onMouseDown( event ) { + + if ( scope.enabled === false ) return; + + event.preventDefault(); + + if ( event.button === scope.mouseButtons.ORBIT ) { + + if ( scope.enableRotate === false ) return; + + state = STATE.ROTATE; + + rotateStart.set( event.clientX, event.clientY ); + + } else if ( event.button === scope.mouseButtons.ZOOM ) { + + if ( scope.enableZoom === false ) return; + + state = STATE.DOLLY; + + dollyStart.set( event.clientX, event.clientY ); + + } else if ( event.button === scope.mouseButtons.PAN ) { + + if ( scope.enablePan === false ) return; + + state = STATE.PAN; + + panStart.set( event.clientX, event.clientY ); + + } + + if ( state !== STATE.NONE ) { + + document.addEventListener( 'mousemove', onMouseMove, false ); + document.addEventListener( 'mouseup', onMouseUp, false ); + scope.dispatchEvent( startEvent ); + + } + + } + + function onMouseMove( event ) { + + if ( scope.enabled === false ) return; + + event.preventDefault(); + + var element = scope.domElement === document ? scope.domElement.body : scope.domElement; + + if ( state === STATE.ROTATE ) { + + if ( scope.enableRotate === false ) return; + + rotateEnd.set( event.clientX, event.clientY ); + rotateDelta.subVectors( rotateEnd, rotateStart ); + + // rotating across whole screen goes 360 degrees around + constraint.rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed ); + + // rotating up and down along whole screen attempts to go 360, but limited to 180 + constraint.rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed ); + + rotateStart.copy( rotateEnd ); + + } else if ( state === STATE.DOLLY ) { + + if ( scope.enableZoom === false ) return; + + dollyEnd.set( event.clientX, event.clientY ); + dollyDelta.subVectors( dollyEnd, dollyStart ); + + if ( dollyDelta.y > 0 ) { + + constraint.dollyIn( getZoomScale() ); + + } else if ( dollyDelta.y < 0 ) { + + constraint.dollyOut( getZoomScale() ); + + } + + dollyStart.copy( dollyEnd ); + + } else if ( state === STATE.PAN ) { + + if ( scope.enablePan === false ) return; + + panEnd.set( event.clientX, event.clientY ); + panDelta.subVectors( panEnd, panStart ); + + pan( panDelta.x, panDelta.y ); + + panStart.copy( panEnd ); + + } + + if ( state !== STATE.NONE ) scope.update(); + + } + + function onMouseUp( /* event */ ) { + + if ( scope.enabled === false ) return; + + document.removeEventListener( 'mousemove', onMouseMove, false ); + document.removeEventListener( 'mouseup', onMouseUp, false ); + scope.dispatchEvent( endEvent ); + state = STATE.NONE; + + } + + function onMouseWheel( event ) { + + if ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return; + + event.preventDefault(); + event.stopPropagation(); + + var delta = 0; + + if ( event.wheelDelta !== undefined ) { + + // WebKit / Opera / Explorer 9 + + delta = event.wheelDelta; + + } else if ( event.detail !== undefined ) { + + // Firefox + + delta = - event.detail; + + } + + if ( delta > 0 ) { + + constraint.dollyOut( getZoomScale() ); + + } else if ( delta < 0 ) { + + constraint.dollyIn( getZoomScale() ); + + } + + + scope.update(); + scope.dispatchEvent( startEvent ); + scope.dispatchEvent( endEvent ); + + } + + function onKeyDown( event ) { + + if ( scope.enabled === false || scope.enableKeys === false || scope.enablePan === false ) return; + + switch ( event.keyCode ) { + + case scope.keys.UP: + pan( 0, scope.keyPanSpeed ); + scope.update(); + break; + + case scope.keys.BOTTOM: + pan( 0, - scope.keyPanSpeed ); + scope.update(); + break; + + case scope.keys.LEFT: + pan( scope.keyPanSpeed, 0 ); + scope.update(); + break; + + case scope.keys.RIGHT: + pan( - scope.keyPanSpeed, 0 ); + scope.update(); + break; + + } + + } + + function touchstart( event ) { + + if ( scope.enabled === false ) return; + + switch ( event.touches.length ) { + + case 1: // one-fingered touch: rotate + + // ダブルタップ対応 + if( !tapCount ) { + // タップ回数を増加 + ++tapCount ; + + // 350ミリ秒だけ、タップ回数を維持 + setTimeout( function() { + tapCount = 0 ; + }, 350 ) ; + + // ダブルタップの場合 + } else { + // ビューポートの変更(ズーム)を防止 + event.preventDefault() ; + + // ダブルタップイベントの処理内容 + if(!zoomFlag){ + constraint.dollyIn( 10 ); + scope.update(); + zoomFlag = true; + }else { + constraint.dollyOut( 10 ); + scope.update(); + zoomFlag = false; + } + // タップ回数をリセット + tapCount = 0 ; + } + + + // 長押し対応 + timer = setInterval(() => { + + if("none" == document.getElementById('mode_btn').style.display ){ + document.getElementById('mode_btn').style.display = "block" + }else if("block" == document.getElementById('mode_btn').style.display || "" == document.getElementById('mode_btn').style.display){ + document.getElementById('mode_btn').style.display = "none" + } + + clearInterval(timer); + + }, 1000); + + if ( scope.enableRotate === false ) return; + + state = STATE.TOUCH_ROTATE; + + rotateStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); + + break; + + case 2: // two-fingered touch: dolly + + if ( scope.enableZoom === false ) return; + + state = STATE.TOUCH_DOLLY; + + var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX; + var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY; + var distance = Math.sqrt( dx * dx + dy * dy ); + dollyStart.set( 0, distance ); + break; + + case 3: // three-fingered touch: pan + + if ( scope.enablePan === false ) return; + + state = STATE.TOUCH_PAN; + + panStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); + break; + + default: + + state = STATE.NONE; + + } + + if ( state !== STATE.NONE ) scope.dispatchEvent( startEvent ); + + } + + function touchmove( event ) { + + if ( scope.enabled === false ) return; + + event.preventDefault(); + event.stopPropagation(); + + var element = scope.domElement === document ? scope.domElement.body : scope.domElement; + + switch ( event.touches.length ) { + + case 1: // one-fingered touch: rotate + + // 長押し対応 + clearInterval(timer); + + if ( scope.enableRotate === false ) return; + if ( state !== STATE.TOUCH_ROTATE ) return; + + rotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); + rotateDelta.subVectors( rotateEnd, rotateStart ); + + // rotating across whole screen goes 360 degrees around + constraint.rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed ); + // rotating up and down along whole screen attempts to go 360, but limited to 180 + constraint.rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed ); + + rotateStart.copy( rotateEnd ); + + scope.update(); + break; + + case 2: // two-fingered touch: dolly + + if ( scope.enableZoom === false ) return; + if ( state !== STATE.TOUCH_DOLLY ) return; + + var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX; + var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY; + var distance = Math.sqrt( dx * dx + dy * dy ); + + dollyEnd.set( 0, distance ); + dollyDelta.subVectors( dollyEnd, dollyStart ); + + if ( dollyDelta.y > 0 ) { + + constraint.dollyOut( getZoomScale() ); + + } else if ( dollyDelta.y < 0 ) { + + constraint.dollyIn( getZoomScale() ); + + } + + dollyStart.copy( dollyEnd ); + + scope.update(); + break; + + case 3: // three-fingered touch: pan + + if ( scope.enablePan === false ) return; + if ( state !== STATE.TOUCH_PAN ) return; + + panEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); + panDelta.subVectors( panEnd, panStart ); + + pan( panDelta.x, panDelta.y ); + + panStart.copy( panEnd ); + + scope.update(); + break; + + default: + + state = STATE.NONE; + + } + + } + + function touchend( /* event */ ) { + + // 長押し対応 + clearInterval(timer); + + if ( scope.enabled === false ) return; + + scope.dispatchEvent( endEvent ); + state = STATE.NONE; + + } + + function contextmenu( event ) { + + event.preventDefault(); + + } + + this.dispose = function() { + + this.domElement.removeEventListener( 'contextmenu', contextmenu, false ); + this.domElement.removeEventListener( 'mousedown', onMouseDown, false ); + this.domElement.removeEventListener( 'mousewheel', onMouseWheel, false ); + this.domElement.removeEventListener( 'MozMousePixelScroll', onMouseWheel, false ); // firefox + + this.domElement.removeEventListener( 'touchstart', touchstart, false ); + this.domElement.removeEventListener( 'touchend', touchend, false ); + this.domElement.removeEventListener( 'touchmove', touchmove, false ); + + document.removeEventListener( 'mousemove', onMouseMove, false ); + document.removeEventListener( 'mouseup', onMouseUp, false ); + + window.removeEventListener( 'keydown', onKeyDown, false ); + + } + + this.domElement.addEventListener( 'contextmenu', contextmenu, false ); + + this.domElement.addEventListener( 'mousedown', onMouseDown, false ); + this.domElement.addEventListener( 'mousewheel', onMouseWheel, false ); + this.domElement.addEventListener( 'MozMousePixelScroll', onMouseWheel, false ); // firefox + + this.domElement.addEventListener( 'touchstart', touchstart, false ); + this.domElement.addEventListener( 'touchend', touchend, false ); + this.domElement.addEventListener( 'touchmove', touchmove, false ); + + window.addEventListener( 'keydown', onKeyDown, false ); + + // force an update at start + this.update(); + + }; + + THREE.OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype ); + THREE.OrbitControls.prototype.constructor = THREE.OrbitControls; + + Object.defineProperties( THREE.OrbitControls.prototype, { + + object: { + + get: function () { + + return this.constraint.object; + + } + + }, + + target: { + + get: function () { + + return this.constraint.target; + + }, + + set: function ( value ) { + + console.warn( 'THREE.OrbitControls: target is now immutable. Use target.set() instead.' ); + this.constraint.target.copy( value ); + + } + + }, + + minDistance : { + + get: function () { + + return this.constraint.minDistance; + + }, + + set: function ( value ) { + + this.constraint.minDistance = value; + + } + + }, + + maxDistance : { + + get: function () { + + return this.constraint.maxDistance; + + }, + + set: function ( value ) { + + this.constraint.maxDistance = value; + + } + + }, + + minZoom : { + + get: function () { + + return this.constraint.minZoom; + + }, + + set: function ( value ) { + + this.constraint.minZoom = value; + + } + + }, + + maxZoom : { + + get: function () { + + return this.constraint.maxZoom; + + }, + + set: function ( value ) { + + this.constraint.maxZoom = value; + + } + + }, + + minPolarAngle : { + + get: function () { + + return this.constraint.minPolarAngle; + + }, + + set: function ( value ) { + + this.constraint.minPolarAngle = value; + + } + + }, + + maxPolarAngle : { + + get: function () { + + return this.constraint.maxPolarAngle; + + }, + + set: function ( value ) { + + this.constraint.maxPolarAngle = value; + + } + + }, + + minAzimuthAngle : { + + get: function () { + + return this.constraint.minAzimuthAngle; + + }, + + set: function ( value ) { + + this.constraint.minAzimuthAngle = value; + + } + + }, + + maxAzimuthAngle : { + + get: function () { + + return this.constraint.maxAzimuthAngle; + + }, + + set: function ( value ) { + + this.constraint.maxAzimuthAngle = value; + + } + + }, + + enableDamping : { + + get: function () { + + return this.constraint.enableDamping; + + }, + + set: function ( value ) { + + this.constraint.enableDamping = value; + + } + + }, + + dampingFactor : { + + get: function () { + + return this.constraint.dampingFactor; + + }, + + set: function ( value ) { + + this.constraint.dampingFactor = value; + + } + + }, + + // backward compatibility + + noZoom: { + + get: function () { + + console.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' ); + return ! this.enableZoom; + + }, + + set: function ( value ) { + + console.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' ); + this.enableZoom = ! value; + + } + + }, + + noRotate: { + + get: function () { + + console.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' ); + return ! this.enableRotate; + + }, + + set: function ( value ) { + + console.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' ); + this.enableRotate = ! value; + + } + + }, + + noPan: { + + get: function () { + + console.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' ); + return ! this.enablePan; + + }, + + set: function ( value ) { + + console.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' ); + this.enablePan = ! value; + + } + + }, + + noKeys: { + + get: function () { + + console.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' ); + return ! this.enableKeys; + + }, + + set: function ( value ) { + + console.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' ); + this.enableKeys = ! value; + + } + + }, + + staticMoving : { + + get: function () { + + console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' ); + return ! this.constraint.enableDamping; + + }, + + set: function ( value ) { + + console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' ); + this.constraint.enableDamping = ! value; + + } + + }, + + dynamicDampingFactor : { + + get: function () { + + console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' ); + return this.constraint.dampingFactor; + + }, + + set: function ( value ) { + + console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' ); + this.constraint.dampingFactor = value; + + } + + } + + } ); + +}() ); diff --git a/app/src/main/assets/js/face-blur-client-receptor4.js b/app/src/main/assets/js/face-blur-client-receptor4.js new file mode 100644 index 0000000..9a0a47c --- /dev/null +++ b/app/src/main/assets/js/face-blur-client-receptor4.js @@ -0,0 +1,1007 @@ +var actions; +var actionsEn = { + mode: { + name: "mode", + items: [ + { + title: "Auto", + val: "auto", + select: "" + }, + { + icon: "", + title: "Shutter priority", + val: "shutter", + select: "" + }, + { + icon: "", + title: "ISO priority", + val: "iso", + select: "" + }, + { + icon: "", + title: "Manual", + val: "manual", + select: "" + } + ] + } +} +var actionsJp = { + mode: { + name: "mode", + items: [ + { + title: "オート", + val: "auto", + select: "" + }, + { + icon: "", + title: "シャッター優先", + val: "shutter", + select: "" + }, + { + icon: "", + title: "ISO優先", + val: "iso", + select: "" + }, + { + icon: "", + title: "マニュアル", + val: "manual", + select: "" + } + ] + } +} +var mIsoSupport = [50, 64, 80, 100, 125, 160, 200, 250, 320, 400, 500, 640, 800, 1000, 1250, 1600, 2000, 2500, 3200]; + +var mShutterSpeedSupport = [ + { val : "15", text : "15" }, + { val : "13", text : "13" }, + { val : "10", text : "10" }, + { val : "8", text : "8" }, + { val : "6", text : "6" }, + { val : "5", text : "5" }, + { val : "4", text : "4" }, + { val : "3.2", text : "3.2" }, + { val : "2.5", text : "2.5" }, + { val : "2", text : "2" }, + { val : "1.6", text : "1.6" }, + { val : "1.3", text : "1.3" }, + { val : "1", text : "1" }, + { val : "0.76923076", text : "1/1.3" }, + { val : "0.625", text : "1/1.6" }, + { val : "0.5", text : "1/2" }, + { val : "0.4", text : "1/2.5" }, + { val : "0.33333333", text : "1/3" }, + { val : "0.25", text : "1/4" }, + { val : "0.2", text : "1/5" }, + { val : "0.16666666", text : "1/6" }, + { val : "0.125", text : "1/8" }, + { val : "0.1", text : "1/10" }, + { val : "0.07692307", text : "1/13" }, + { val : "0.06666666", text : "1/15" }, + { val : "0.05", text : "1/20" }, + { val : "0.04", text : "1/25" }, + { val : "0.03333333", text : "1/30" }, + { val : "0.025", text : "1/40" }, + { val : "0.02", text : "1/50" }, + { val : "0.01666666", text : "1/60" }, + { val : "0.0125", text : "1/80" }, + { val : "0.01", text : "1/100" }, + { val : "0.008", text : "1/125" }, + { val : "0.00625", text : "1/160" }, + { val : "0.005", text : "1/200" }, + { val : "0.004", text : "1/250" }, + { val : "0.003125", text : "1/320" }, + { val : "0.0025", text : "1/400" }, + { val : "0.002", text : "1/500" }, + { val : "0.0015625", text : "1/640" }, + { val : "0.00125", text : "1/800" }, + { val : "0.001", text : "1/1000" }, + { val : "0.0008", text : "1/1250" }, + { val : "0.000625", text : "1/1600" }, + { val : "0.0005", text : "1/2000" }, + { val : "0.0004", text : "1/2500" }, + { val : "0.0003125", text : "1/3200" }, + { val : "0.00025", text : "1/4000" }, + { val : "0.0002", text : "1/5000" }, + { val : "0.00015625", text : "1/6400" }, + { val : "0.000125", text : "1/8000" }, + { val : "0.0001", text : "1/10000" }, + { val : "0.00008", text : "1/12500" }, + { val : "0.0000625", text : "1/16000" } +]; + +var mShutterSpeedSupportOnShutterSpeedMode = [ + { val : "60", text : "60" }, + { val : "50", text : "50" }, + { val : "40", text : "40" }, + { val : "30", text : "30" }, + { val : "25", text : "25" }, + { val : "20", text : "20" }, + { val : "15", text : "15" }, + { val : "13", text : "13" }, + { val : "10", text : "10" }, + { val : "8", text : "8" }, + { val : "6", text : "6" }, + { val : "5", text : "5" }, + { val : "4", text : "4" }, + { val : "3.2", text : "3.2" }, + { val : "2.5", text : "2.5" }, + { val : "2", text : "2" }, + { val : "1.6", text : "1.6" }, + { val : "1.3", text : "1.3" }, + { val : "1", text : "1" }, + { val : "0.76923076", text : "1/1.3" }, + { val : "0.625", text : "1/1.6" }, + { val : "0.5", text : "1/2" }, + { val : "0.4", text : "1/2.5" }, + { val : "0.33333333", text : "1/3" }, + { val : "0.25", text : "1/4" }, + { val : "0.2", text : "1/5" }, + { val : "0.16666666", text : "1/6" }, + { val : "0.125", text : "1/8" }, + { val : "0.1", text : "1/10" }, + { val : "0.07692307", text : "1/13" }, + { val : "0.06666666", text : "1/15" }, + { val : "0.05", text : "1/20" }, + { val : "0.04", text : "1/25" }, + { val : "0.03333333", text : "1/30" }, + { val : "0.025", text : "1/40" }, + { val : "0.02", text : "1/50" }, + { val : "0.01666666", text : "1/60" }, + { val : "0.0125", text : "1/80" }, + { val : "0.01", text : "1/100" }, + { val : "0.008", text : "1/125" }, + { val : "0.00625", text : "1/160" }, + { val : "0.005", text : "1/200" }, + { val : "0.004", text : "1/250" }, + { val : "0.003125", text : "1/320" }, + { val : "0.0025", text : "1/400" }, + { val : "0.002", text : "1/500" }, + { val : "0.0015625", text : "1/640" }, + { val : "0.00125", text : "1/800" }, + { val : "0.001", text : "1/1000" }, + { val : "0.0008", text : "1/1250" }, + { val : "0.000625", text : "1/1600" }, + { val : "0.0005", text : "1/2000" }, + { val : "0.0004", text : "1/2500" }, + { val : "0.0003125", text : "1/3200" }, + { val : "0.00025", text : "1/4000" }, + { val : "0.0002", text : "1/5000" }, + { val : "0.00015625", text : "1/6400" }, + { val : "0.000125", text : "1/8000" }, + { val : "0.0001", text : "1/10000" }, + { val : "0.00008", text : "1/12500" }, + { val : "0.0000625", text : "1/16000" } +]; + +var mEvSupport = [ -2.0, -1.7, -1.3, -1, -0.7, -0.3, 0.0, +0.3, +0.7, +1.0, +1.3, +1.7, +2.0]; + +var mWbSupport = [ + { val : "auto", text : "Auto" ,icon: "icon--wb_auto"}, + { val : "daylight", text : "Outdoor" ,icon: "icon--wb_sun-current"}, + { val : "shade", text : "Shade" ,icon: "icon--wb_shade-current"}, + { val : "cloudy-daylight", text : "Cloudy" ,icon: "icon--wb_cloud-current"}, + { val : "incandescent", text : "Incandescent light 1" ,icon: "icon--wb_inc_1"}, + { val : "_warmWhiteFluorescent", text : "Incandescent light 2" ,icon: "icon--wb_inc_2"}, + { val : "_dayLightFluorescent", text : "Daylight color fluorescent light" ,icon: "icon--wb_fluorescent-d-current"}, + { val : "_dayWhiteFluorescent", text : "Natural white fluorescent light" ,icon: "icon--wb_fluorescent-n-current"}, + { val : "fluorescent", text : "White fluorescent light" ,icon: "icon--wb_fluorescent-w-current"}, + { val : "_bulbFluorescent", text : "Light bulb color fluorescent light" ,icon: "icon--wb_fluorescent-l-current"}, + { val : "_underwater", text : "Underwater" ,icon: "icon--wb_underwater-current"} +]; + +var mOptionSupport; +var mOptionSupportEn = [ + { val: "off", text: "OFF"}, + { val: "Noise Reduction", text: "NR."}, + { val: "hdr", text: "HDR."} +]; +var mOptionSupportJp = [ + { val: "off", text: "OFF"}, + { val: "Noise Reduction", text: "NR"}, + { val: "hdr", text: "HDR"} +]; + +var mEvData = ""; +var mWBData = ""; +var mIsoData = ""; +var mShutterSpeedData = ""; +var mShutterSpeedPriorityData = ""; +var mOptionData = ""; + +$(function(){ + var language = (window.navigator.languages && window.navigator.languages[0]) || + window.navigator.language || + window.navigator.userLanguage || + window.navigator.browserLanguage; + if (language === 'ja' || language === 'ja-JP') { + actions = actionsJp; + mOptionSupport = mOptionSupportJp; + } else { + actions = actionsEn; + mOptionSupport = mOptionSupportEn; + } + + $("#shoot__setting-auto").removeClass("hide"); + $("#select_cancel_btn").hide(); + + initEvMenu(); + initISOMenu(); + initWBMenu(); + initWBManualMenu(); + initOptionMenu(); + initShutterSpeedMenu(); + initModeActionSheet(); + + $("#selectmode_btn").on("click", function(e){ + e.preventDefault(); + + $(".checkbox").addClass("show"); + $("#list_tableview").addClass("hasmenu"); + $("#list_footermenu").addClass("show"); + $("#selectmode_btn").hide(); + $("#select_cancel_btn").show(); + }); + + $("#select_cancel_btn").on("click", function(e){ + e.preventDefault(); + + $(".checkbox").removeClass("show"); + $("#list_tableview").removeClass("hasmenu"); + $("#list_footermenu").removeClass("show"); + $("#selectmode_btn").show(); + $("#select_cancel_btn").hide(); + }); + + $(".btn--data").on("click", function(e){ + e.preventDefault(); + + var setting = $(this).attr('data-setting'); + var position = $(this).attr('data-position'); + + if(!$( "#" + setting + "_menu" ).hasClass( "show" )){ + hideAllMenu(); + console.log("setting:" + setting); + console.log("position:" + position); + $("#" + setting + "_menu").addClass("show"); + $("#" + setting + "_menu").addClass("position" + position); + //initMenus(setting); + }else{ + hideAllMenu(); + } + + $("#" + setting + "_menu_wrap").slick("getSlick").reinit(); + + }); + + $("#aspect_btn").on("click", function(e){ + e.preventDefault(); + + showActionSheet(actions.setting.aspect); + }); + + $("#interval_btn").on("click", function(e){ + e.preventDefault(); + + showActionSheet(actions.setting.interval); + }); + + $("#shootcount_btn").on("click", function(e){ + e.preventDefault(); + + showActionSheet(actions.setting.shootcount); + }); + + $("#zenith_btn").on("click", function(e){ + e.preventDefault(); + + showActionSheet(actions.setting.zenith); + }); + + $("#stitch_btn").on("click", function(e){ + e.preventDefault(); + + showActionSheet(actions.setting.stitch); + }); + + $("#mode_btn").on("click", function(e){ + e.preventDefault(); + + var class_name = document.getElementById('mode_btn').classList; + + actions.mode.items[0].select = "" + actions.mode.items[1].select = "" + actions.mode.items[2].select = "" + actions.mode.items[3].select = "" + + if(class_name.contains("btn--mode-auto-normal")){ + actions.mode.items[0].select = "true" + }else if (class_name.contains("btn--mode-shutter-normal")){ + actions.mode.items[1].select = "true" + }else if (class_name.contains("btn--mode-iso-normal")){ + actions.mode.items[2].select = "true" + }else if (class_name.contains("btn--mode-manual-normal")){ + actions.mode.items[3].select = "true" + } + showActionSheet(actions.mode); + }); + + $(".actionsheet_cancel_btn").on("click", function(e){ + e.preventDefault(); + + hideActionSheet(); + }); + + $("#setting_btn").on("click", function(e){ + e.preventDefault(); + + showSetting(); + }); + + $("#setting_close_btn").on("click", function(e){ + e.preventDefault(); + + hideSetting(); + }); + + $("#back_btn").on("click", function(e){ + e.preventDefault(); + + hideCameraImageList(); + }); + + $( 'input[name="action"]:radio' ).on("change", function(e){ + console.log("s"); + }); + + $("#camera_image_btn").on("click", function(e){ + e.preventDefault(); + + showCameraImageList(); + }); + + $("#shutter_btn").on("click", function(e){ + e.preventDefault(); + + var btnstate = $.data($("#shutter_btn").get(0), "state"); + if(btnstate == "off" || btnstate == undefined){ + btnstate = "on"; + $.data($("#shutter_btn").get(0), "state", "on"); + $("#shutter_btn").removeClass("btn--shutter-normal"); + $("#shutter_btn").addClass("btn--shutter_recording-normal"); + }else{ + btnstate = "off"; + $.data($("#shutter_btn").get(0), "state", "off"); + $("#shutter_btn").removeClass("btn--shutter_recording-normal"); + $("#shutter_btn").addClass("btn--shutter-normal"); + } + + changeRecoadingState(btnstate); + }); + + $(window).on('orientationchange',function(){ + window.location.reload(); + }); + +}); + +function initEvMenu(){ + mEvData = ""; + for (var i = 0; i < mEvSupport.length; i++){ + mEvData += ""; + } + + $("#ev_menu_wrap").html(mEvData); + + $('#ev_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + variableWidth: true, + initialSlide: 6, + swipeToSlide: true + }); + + $("input[name='ev']:eq(5)").prop('checked', true); + + $('input[name="ev"]').on('click',function(event) { + + var htmlvalue = '

'+ $(event.target).toFixed(1).val()+'

'; + switch($("input[name='action']:checked").val()){ + case "auto": + $("#evlabel1").html(htmlvalue); + break; + case "shutter": + $("#evlabel2").html(htmlvalue); + break; + case "iso": + $("#evlabel3").html(htmlvalue); + break; + case "manual": + break; + } + }); + + setTimeout(function(){ + $("#ev_menu").removeClass("inithide"); + $("#ev_menu").removeClass("show"); + }, 1000); + + +} + +function initISOMenu(){ + mIsoData = ""; + for (var i = 0; i < mIsoSupport.length; i++){ + mIsoData += ""; + } + + $("#iso_menu_wrap").html(mIsoData); + + $('#iso_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + initialSlide: 3, + swipeToSlide: true + }); + + $('input[name=iso]:eq(2)').prop('checked', true); + + setTimeout(function(){ + $("#iso_menu").removeClass("inithide"); + $("#iso_menu").removeClass("show"); + }, 1000); + + $('input[name="iso"]').on('click',function(event) { + var htmlvalue = '

'+ $(event.target).val() +'

'; + switch($("input[name='action']:checked").val()){ + case "auto": + break; + case "shutter": + break; + case "iso": + $("#isolabel2").html(htmlvalue); + break; + case "manual": + $("#isolabel3").html(htmlvalue); + break; + } + }); + +$("#iso_menu_wrap").click(function() { + if(this.checked) { + document.getElementById("iso").innerHTML = + '

'+ $("input[name='iso']:checked").val() +'

'; + } +}); +} + +function initWBMenu(){ + mWBData = ""; + for (var i = 0; i < mWbSupport.length; i++){ + mWBData += ""; + } + + $("#wb_menu_wrap").html(mWBData); + + $('#wb_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + variableWidth: true, + initialSlide: 3, + swipeToSlide: true + }); + + $('input[name=wb]:eq(3)').prop('checked', true); + + setTimeout(function(){ + $("#wb_menu").removeClass("inithide"); + $("#wb_menu").removeClass("show"); + }, 1000); +} + +function initWBManualMenu(){ + var wb = 2500; + var setData = ""; + for (var i = 0; i < 76; i++){ + setData += ""; + wb += 100; + } + + $("#wbmanual_menu_wrap").html(setData); + + var htmlvalue = "

"; + $("#wblabel0").html(htmlvalue); + $("#wblabel1").html(htmlvalue); + $("#wblabel2").html(htmlvalue); + $("#wblabel3").html(htmlvalue); + + $('#wbmanual_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + variableWidth: true, +// initialSlide: 4, + swipeToSlide: true + }); + +// $('input[name=wbmanual]:eq(4)').prop('checked', true); + + $('input[name="wb"]').on('click',function(event) { + var htmlvalue = setWBLabel($(event.target).val()); + switch($("input[name='action']:checked").val()){ + case "auto": + $("#wblabel0").html(htmlvalue); + break; + case "shutter": + $("#wblabel1").html(htmlvalue); + break; + case "iso": + $("#wblabel2").html(htmlvalue); + break; + case "manual": + $("#wblabel3").html(htmlvalue); + break; + } + }); + + setTimeout(function(){ + $("#wbmanual_menu").removeClass("inithide"); + $("#wbmanual_menu").removeClass("show"); + }, 1000); +} + +function setWBLabel(value) { + var label = ""; + var index = 0; + var icon =""; + for (var i = 0; i < mWbSupport.length; i++){ + if (mWbSupport[i].val == value) { + label = mWbSupport[i].text; + icon = mWbSupport[i].icon; + index = i; + break; + } + } + + return "

" + label +"

"; +} + +function getWBMenuIndex(value) { + var label = ""; + var index = 0; + var icon =""; + for (var i = 0; i < mWbSupport.length; i++){ + if (mWbSupport[i].val == value) { + index = i; + break; + } + } + + return index; +} + +function initShutterSpeedMenu(){ + mShutterSpeedData = ""; + for (var i = 0; i < mShutterSpeedSupport.length; i++){ + mShutterSpeedData += ""; + } + + mShutterSpeedPriorityData = ""; + for (var i = 0; i < mShutterSpeedSupportOnShutterSpeedMode.length; i++){ + mShutterSpeedPriorityData += ""; + } + $("#shutter_menu_wrap").html(mShutterSpeedData); + + $('#shutter_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 5, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + initialSlide: 20, + swipeToSlide: true + }); + + $("input[name='shutterspeed']:eq(20)").prop('checked', true); + + $('input[name="shutterspeed"]').on('click',function(event) { + var htmlvalue = setSPLabel($(event.target).val()); + switch($("input[name='action']:checked").val()){ + case "auto": + break; + case "shutter": + $("#splabel1").html(htmlvalue); + break; + case "iso": + break; + case "manual": + $("#splabel2").html(htmlvalue); + break; + } + }); + + setTimeout(function(){ + $("#shutter_menu").removeClass("inithide"); + $("#shutter_menu").removeClass("show"); + }, 1000); +} + +function setSPLabel(value) { + var label = ""; + for (var i = 0; i < mShutterSpeedSupport.length; i++){ + if (mShutterSpeedSupport[i].val == value) { + label = mShutterSpeedSupport[i].text; + break; + } + } + return '

' + label +"

"; +} + +function getSPIndex(value) { + var index = 0; + for (var i = 0; i < mShutterSpeedSupport.length; i++){ + if (mShutterSpeedSupport[i].val == value) { + index = i; + break; + } + } + return index; +} + +function getSPModeIndex(value) { + var index = 0; + for (var i = 0; i < mShutterSpeedSupportOnShutterSpeedMode.length; i++){ + if (mShutterSpeedSupportOnShutterSpeedMode[i].val == value) { + index = i; + break; + } + } + return index; +} + +function initOptionMenu(){ + mOptionData = ""; + for (var i = 0; i < mOptionSupport.length; i++){ + mOptionData += ""; + } + + $("#option_menu_wrap").html(mOptionData); + + $('#option_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + initialSlide: 5, + swipeToSlide: true, + respondTo: 'slider', + responsive: [ + { + breakpoint: 2048, // 1024〜2048px + settings: { + slidesToShow: 5, + slidesToScroll: 5, + infinite: true, + dots: true + } + }, + { + breakpoint: 1024, // 600〜1023px + settings: { + slidesToShow: 4, + slidesToScroll: 4, + infinite: true, + dots: true + } + }, + { + breakpoint: 600, // 480〜599px + settings: { + slidesToShow: 3, + slidesToScroll: 3 + } + }, + { + breakpoint: 480, // 〜479px + settings: { + slidesToShow: 2, + slidesToScroll: 2 + } + } + ], }); + + $("input[name='filter']:eq(0)").prop('checked', true); + + $('input[name="filter"]').on('click',function(event) { + var htmlvalue = setOPLabel($(event.target).val()); + $("#ftlabel").html(htmlvalue); + }); + + setTimeout(function(){ + $("#option_menu").removeClass("inithide"); + $("#option_menu").removeClass("show"); + }, 1000); +} + +function setOPLabel(value) { + for (var i = 0; i < mOptionSupport.length; i++){ + if (mOptionSupport[i].val == value) { + label = mOptionSupport[i].text; + break; + } + } + return '

'+ label +'

'; +} + +function getOPIndex(value) { + var index = 0; + for (var i = 0; i < mOptionSupport.length; i++){ + if (mOptionSupport[i].val == value) { + index = i; + break; + } + } + return index; +} + +function hideAllMenu(){ + $("#ev_menu").removeAttr('class'); + $("#iso_menu").removeAttr('class'); + $("#wb_menu").removeAttr('class'); + $("#wb_menu").removeAttr('class'); + $("#shutter_menu").removeAttr('class'); + $("#wbmanual_menu").removeAttr('class'); + $("#option_menu").removeAttr('class'); + + $("#ev_menu").addClass("pluginctrl__shoot__setting__detail"); + $("#iso_menu").addClass("pluginctrl__shoot__setting__detail"); + $("#wb_menu").addClass("pluginctrl__shoot__setting__detail"); + $("#shutter_menu").addClass("pluginctrl__shoot__setting__detail"); + $("#option_menu").addClass("pluginctrl__shoot__setting__detail"); + $("#wbmanual_menu").addClass("pluginctrl__shoot__setting__detail"); + $("#option_menu").addClass("pluginctrl__shoot__setting__detail"); +} + +function showActionSheet(data,class_name){ + $("#action_sheet__btn_list").empty(); + for (var i = 0; i < data.items.length; i++){ + var id = "action" + i; + if(data.items[i].select == "true"){ + $("#action_sheet__btn_list").append("
  • "); + }else{ + $("#action_sheet__btn_list").append("
  • "); + } + } + console.log(data); + + $('input[name="action"]:radio').change( function() { + changeMenu($(this).val()); + hideActionSheet(); + setOptions(); + }); + + $(".action_sheet").css("transform", "translateY(0%)"); + $("#setting_action").addClass("show"); +} + +function initModeActionSheet(){ + $("#action_sheet__btn_list").empty(); + var data = actions.mode; + for (var i = 0; i < data.items.length; i++){ + var id = "action" + i; + if(data.items[i].val == "auto"){ + $("#action_sheet__btn_list").append("
  • "); + }else{ + $("#action_sheet__btn_list").append("
  • "); + } + } +} + +function hideActionSheet(){ + $("#setting_action").removeClass("show"); + setTimeout(function(){ + $(".action_sheet").css("transform", "translateY(100%)"); + }, 500); +} + +function changeMenu(menu){ + hideAllMenu(); + + $("#mode_btn").removeClass(); + + $("#shoot__setting-auto").addClass("hide"); + $("#shoot__setting-shutter").addClass("hide"); + $("#shoot__setting-iso").addClass("hide"); + $("#shoot__setting-manual").addClass("hide"); + + $('#shutter_menu_wrap').slick("unslick"); + + $('input[name="shutterspeed"]').on('click',function(event) { + var label = ""; + for (var i = 0; i < mShutterSpeedSupport.length; i++){ + if (mShutterSpeedSupport[i].val == $(event.target).val()) { + label = mShutterSpeedSupport[i].text; + break; + } + } + var htmlvalue = '

    '+ label +'

    '; + $("#splabel1").html(htmlvalue); + $("#splabel2").html(htmlvalue); + $("#splabel3").html(htmlvalue); + }); + + switch(menu){ + case "auto": + $("#shutter_menu_wrap").html(mShutterSpeedData); + $('#shutter_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 5, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + initialSlide: 40, + swipeToSlide: true + }); + $("#mode_btn").addClass("btn--mode-auto-normal"); + $("#shoot__setting-auto").removeClass("hide"); + $("input[name='action']:eq(0)").prop('checked', true); + break; + case "shutter": + $("#shutter_menu_wrap").html(mShutterSpeedPriorityData); + $('#shutter_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 5, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + initialSlide: 40, + swipeToSlide: true + }); + + $("#mode_btn").addClass("btn--mode-shutter-normal"); + $("#shoot__setting-shutter").removeClass("hide"); + + $("input[name='action']:eq(1)").prop('checked', true); + $("input[name='shutterspeed']:eq(40)").prop('checked', true); + $("input[name='ev']:eq(6)").prop('checked', true); + $('input[name=wb]:eq(5)').prop('checked', true); + $('input[name=wbmanual]:eq(5)').prop('checked', true); + break; + case "iso": + $("#shutter_menu_wrap").html(mShutterSpeedData); + $('#shutter_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 5, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + swipeToSlide: true + }); + $("#mode_btn").addClass("btn--mode-iso-normal"); + $("#shoot__setting-iso").removeClass("hide"); + + $("input[name='action']:eq(2)").prop('checked', true); + $('input[name=wbmanual]:eq(5)').prop('checked', true); + break; + case "manual": + $("#shutter_menu_wrap").html(mShutterSpeedData); + $('#shutter_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 5, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + swipeToSlide: true + }); + + $("#mode_btn").addClass("btn--mode-manual-normal"); + $("#shoot__setting-manual").removeClass("hide"); + + $("input[name='action']:eq(3)").prop('checked', true); + $('input[name=wb]:eq(0)').prop('checked', true); + $('input[name=wbmanual]:eq(5)').prop('checked', true); + break; + } + $("#mode_btn").addClass("btn"); +} + +function showSetting(){ + $("#setting_page").addClass("show"); +} + +function hideSetting(){ + $("#setting_page").removeClass("show"); +} + +function showCameraImageList(){ + $("#list_page").addClass("show"); + $("#shooting_page").addClass("hide"); +} + +function hideCameraImageList(){ + $("#list_page").removeClass("show"); + $("#shooting_page").removeClass("hide"); +} + +function changeRecoadingState(state){ + console.log(state); +} + +function disableShutterButton() { + $(".btn.btn--shutter-normal").prop("disabled", true); +} + +function enableShutterButton() { + $(".btn.btn--shutter-normal").prop("disabled", false); +} + +function getNumber(theNumber) +{ + if(theNumber > 0){ + return "+" + theNumber; + }else{ + return theNumber.toString(); + } +} \ No newline at end of file diff --git a/app/src/main/assets/js/face-blur-client.js b/app/src/main/assets/js/face-blur-client.js old mode 100755 new mode 100644 index e405f25..6bf10b2 --- a/app/src/main/assets/js/face-blur-client.js +++ b/app/src/main/assets/js/face-blur-client.js @@ -54,79 +54,130 @@ var actionsJp = { var mIsoSupport = [64, 80, 100, 125, 160, 200, 250, 320, 400, 500, 640, 800, 1000, 1250, 1600, 2000, 2500, 3200]; var mShutterSpeedSupport = [ - { val : "0.00004", text : "1/25000" }, - { val : "0.00005", text : "1/20000" }, - { val : "0.0000625", text : "1/16000" }, - { val : "0.00008", text : "1/12500" }, - { val : "0.0001", text : "1/10000" }, - { val : "0.000125", text : "1/8000" }, - { val : "0.00015625", text : "1/6400" }, - { val : "0.0002", text : "1/5000" }, - { val : "0.00025", text : "1/4000" }, - { val : "0.0003125", text : "1/3200" }, - { val : "0.0004", text : "1/2500" }, - { val : "0.0005", text : "1/2000" }, - { val : "0.000625", text : "1/1600" }, - { val : "0.0008", text : "1/1250" }, - { val : "0.001", text : "1/1000" }, - { val : "0.00125", text : "1/800" }, - { val : "0.0015625", text : "1/640" }, - { val : "0.002", text : "1/500" }, - { val : "0.0025", text : "1/400" }, - { val : "0.003125", text : "1/320" }, - { val : "0.004", text : "1/250" }, - { val : "0.005", text : "1/20" }, - { val : "0.06666666", text : "1/15" }, - { val : "0.07692307", text : "1/13" }, - { val : "0.1", text : "1/10" }, - { val : "0.125", text : "1/8" }, - { val : "0.16666666", text : "1/6" }, - { val : "0.2", text : "1/5" }, - { val : "0.25", text : "1/4" }, - { val : "0.33333333", text : "1/3" }, - { val : "0.4", text : "1/2.5" }, - { val : "0.5", text : "1/2" }, - { val : "0.625", text : "1/1.6" }, - { val : "0.76923076", text : "1/1.3" }, - { val : "1", text : "1" }, - { val : "1.3", text : "1.3" }, - { val : "1.6", text : "1.6" }, - { val : "2", text : "2" }, - { val : "2.5", text : "2.5" }, - { val : "3.2", text : "3.2" }, - { val : "4", text : "4" }, - { val : "5", text : "5" }, - { val : "6", text : "6" }, - { val : "8", text : "8" }, - { val : "10", text : "10" }, - { val : "13", text : "13" }, - { val : "15", text : "15" }, - { val : "20", text : "20" }, - { val : "25", text : "25" }, + { val : "60", text : "60" }, { val : "30", text : "30" }, - { val : "60", text : "60" } + { val : "25", text : "25" }, + { val : "20", text : "20" }, + { val : "15", text : "15" }, + { val : "13", text : "13" }, + { val : "10", text : "10" }, + { val : "8", text : "8" }, + { val : "6", text : "6" }, + { val : "5", text : "5" }, + { val : "4", text : "4" }, + { val : "3.2", text : "3.2" }, + { val : "2.5", text : "2.5" }, + { val : "2", text : "2" }, + { val : "1.6", text : "1.6" }, + { val : "1.3", text : "1.3" }, + { val : "1", text : "1" }, + { val : "0.76923076", text : "1/1.3" }, + { val : "0.625", text : "1/1.6" }, + { val : "0.5", text : "1/2" }, + { val : "0.4", text : "1/2.5" }, + { val : "0.33333333", text : "1/3" }, + { val : "0.25", text : "1/4" }, + { val : "0.2", text : "1/5" }, + { val : "0.16666666", text : "1/6" }, + { val : "0.125", text : "1/8" }, + { val : "0.1", text : "1/10" }, + { val : "0.07692307", text : "1/13" }, + { val : "0.06666666", text : "1/15" }, + { val : "0.05", text : "1/20" }, + { val : "0.04", text : "1/25" }, + { val : "0.03333333", text : "1/30" }, + { val : "0.025", text : "1/40" }, + { val : "0.02", text : "1/50" }, + { val : "0.01666666", text : "1/60" }, + { val : "0.0125", text : "1/80" }, + { val : "0.01", text : "1/100" }, + { val : "0.008", text : "1/125" }, + { val : "0.00625", text : "1/160" }, + { val : "0.005", text : "1/200" }, + { val : "0.004", text : "1/250" }, + { val : "0.003125", text : "1/320" }, + { val : "0.0025", text : "1/400" }, + { val : "0.002", text : "1/500" }, + { val : "0.0015625", text : "1/640" }, + { val : "0.00125", text : "1/800" }, + { val : "0.001", text : "1/1000" }, + { val : "0.0008", text : "1/1250" }, + { val : "0.000625", text : "1/1600" }, + { val : "0.0005", text : "1/2000" }, + { val : "0.0004", text : "1/2500" }, + { val : "0.0003125", text : "1/3200" }, + { val : "0.00025", text : "1/4000" }, + { val : "0.0002", text : "1/5000" }, + { val : "0.00015625", text : "1/6400" }, + { val : "0.000125", text : "1/8000" }, + { val : "0.0001", text : "1/10000" }, + { val : "0.00008", text : "1/12500" }, + { val : "0.0000625", text : "1/16000" }, + { val : "0.00005", text : "1/20000" }, + { val : "0.00004", text : "1/25000" } ]; var mShutterSpeedSupportOnShutterSpeedMode = [ - { val : "0.00004", text : "1/25000" }, - { val : "0.00005", text : "1/20000" }, - { val : "0.0000625", text : "1/16000" }, - { val : "0.00008", text : "1/12500" }, - { val : "0.0001", text : "1/10000" }, - { val : "0.000125", text : "1/8000" }, - { val : "0.00015625", text : "1/6400" }, - { val : "0.0002", text : "1/5000" }, - { val : "0.00025", text : "1/4000" }, - { val : "0.0003125", text : "1/3200" }, - { val : "0.0004", text : "1/2500" }, - { val : "0.0005", text : "1/2000" }, - { val : "0.000625", text : "1/1600" }, - { val : "0.0008", text : "1/1250" }, + { val : "15", text : "15" }, + { val : "13", text : "13" }, + { val : "10", text : "10" }, + { val : "8", text : "8" }, + { val : "6", text : "6" }, + { val : "5", text : "5" }, + { val : "4", text : "4" }, + { val : "3.2", text : "3.2" }, + { val : "2.5", text : "2.5" }, + { val : "2", text : "2" }, + { val : "1.6", text : "1.6" }, + { val : "1.3", text : "1.3" }, + { val : "1", text : "1" }, + { val : "0.76923076", text : "1/1.3" }, + { val : "0.625", text : "1/1.6" }, + { val : "0.5", text : "1/2" }, + { val : "0.4", text : "1/2.5" }, + { val : "0.33333333", text : "1/3" }, + { val : "0.25", text : "1/4" }, + { val : "0.2", text : "1/5" }, + { val : "0.16666666", text : "1/6" }, + { val : "0.125", text : "1/8" }, + { val : "0.1", text : "1/10" }, + { val : "0.07692307", text : "1/13" }, + { val : "0.06666666", text : "1/15" }, + { val : "0.05", text : "1/20" }, + { val : "0.04", text : "1/25" }, + { val : "0.03333333", text : "1/30" }, + { val : "0.025", text : "1/40" }, + { val : "0.02", text : "1/50" }, + { val : "0.01666666", text : "1/60" }, + { val : "0.0125", text : "1/80" }, + { val : "0.01", text : "1/100" }, + { val : "0.008", text : "1/125" }, + { val : "0.00625", text : "1/160" }, + { val : "0.005", text : "1/200" }, + { val : "0.004", text : "1/250" }, + { val : "0.003125", text : "1/320" }, + { val : "0.0025", text : "1/400" }, + { val : "0.002", text : "1/500" }, + { val : "0.0015625", text : "1/640" }, + { val : "0.00125", text : "1/800" }, { val : "0.001", text : "1/1000" }, - { val : "0.00125", text : "1/800" } + { val : "0.0008", text : "1/1250" }, + { val : "0.000625", text : "1/1600" }, + { val : "0.0005", text : "1/2000" }, + { val : "0.0004", text : "1/2500" }, + { val : "0.0003125", text : "1/3200" }, + { val : "0.00025", text : "1/4000" }, + { val : "0.0002", text : "1/5000" }, + { val : "0.00015625", text : "1/6400" }, + { val : "0.000125", text : "1/8000" }, + { val : "0.0001", text : "1/10000" }, + { val : "0.00008", text : "1/12500" }, + { val : "0.0000625", text : "1/16000" }, + { val : "0.00005", text : "1/20000" }, + { val : "0.00004", text : "1/25000" } ]; -var mEvSupport = [ -2, -1.7, -1.3, -1, -0.7, -0.3, 0, 0.3, 0.7, 1, 1.3, 1.7, 2]; +var mEvSupport = [ -2.0, -1.7, -1.3, -1.0, -0.7, -0.3, 0, +0.3, +0.7, +1.0, +1.3, +1.7, +2.0]; var mWbSupport = [ { val : "auto", text : "Auto" ,icon: "icon--wb_auto"}, @@ -323,8 +374,8 @@ function initEvMenu(){ var setData = ""; for (var i = 0; i < mEvSupport.length; i++){ setData += ""; } @@ -346,7 +397,7 @@ function initEvMenu(){ $("input[name='ev']:eq(5)").prop('checked', true); $('input[name="ev"]').on('click',function(event) { - var htmlvalue = '

    '+ $(event.target).val() +'

    '; + var htmlvalue = '

    '+ $(event.target).toFixed(1).val() +'

    '; switch($("input[name='action']:checked").val()){ case "auto": $("#evlabel1").html(htmlvalue); @@ -606,13 +657,14 @@ function setSPLabel(value) { break; } } - var htmlvalue = '

    '+ label +'

    '; + return '

    ' + label +"

    "; } function getSPIndex(value) { var index = 0; for (var i = 0; i < mShutterSpeedSupport.length; i++){ if (mShutterSpeedSupport[i].val == value) { + index = i; break; } } @@ -623,6 +675,7 @@ function getSPModeIndex(value) { var index = 0; for (var i = 0; i < mShutterSpeedSupportOnShutterSpeedMode.length; i++){ if (mShutterSpeedSupportOnShutterSpeedMode[i].val == value) { + index = i; break; } } @@ -907,3 +960,11 @@ function enableShutterButton() { $(".btn.btn--shutter-normal").prop("disabled", false); } +function getNumber(theNumber) +{ + if(theNumber > 0){ + return "+" + theNumber; + }else{ + return theNumber.toString(); + } +} diff --git a/app/src/main/assets/js/live-preview-receptor4.js b/app/src/main/assets/js/live-preview-receptor4.js new file mode 100644 index 0000000..9d7d86e --- /dev/null +++ b/app/src/main/assets/js/live-preview-receptor4.js @@ -0,0 +1,215 @@ +var timerTask; +var READYSTATE_COMPLETED = 4; +var READYSTATE_LOADING = 3; +var HTTP_STATUS_OK = 200; +var POST = 'POST'; +var CONTENT_TYPE = 'content-Type'; +var TYPE_JSON = 'application/json'; +var COMMAND = 'blur/commands/execute'; +var PREVIEW = 'blur/commands/execute'; +var status; + +//ここから + +window.addEventListener('load',(event) =>{ + + var touchStartY; + var touchMoveY; + var positionY + var startTime; + var swipearea = document.getElementById('swipearea') + + swipearea.addEventListener('touchstart',(event) =>{ + + event.preventDefault(); + startTime = +new Date(); + touchStartY = event.touches[0].pageY; + document.getElementById('menu_bar').style.visibility = "visible"; + + },{ passive: false }); + + swipearea.addEventListener('touchmove',(event) =>{ + + event.preventDefault(); + var now = +new Date(); + var diffTime = now - startTime; + + //タップが一瞬だった時反応しないよう書いている(反応が遅くなるのでいらないかもしれない...) + if (diffTime > 20) { + touchMoveY = event.changedTouches[0].pageY; + + movedY = touchStartY - touchMoveY; + positionY = -movedY; + + } + },{ passive: false }); + + swipearea.addEventListener('touchend',(event) =>{ + + //指を離した時にどの程度開いてたら自動で開くor閉じるの分岐 + if(positionY < -80){ + // 露出設定を上げる + upSwipMenu(); + // 閉じる動作のスワイプ時にタッチスタート箇所を制限してスワイプ範囲を制限する + }else if(touchStartY > 300) { + // 露出設定を下げる + downSwipMenu(); + } + document.getElementById('menu_bar').style.visibility = "hidden"; + },false); + +},false); + +//ここまで + + +function startLivePreview() { + + var command = {}; + command.name = 'camera.startLivePreview'; + var xmlHttpRequest = new XMLHttpRequest(); + xmlHttpRequest.onreadystatechange = function() { + if (this.readyState === READYSTATE_COMPLETED && + this.status === HTTP_STATUS_OK) { + console.log(this.responseText); + } else { + console.log('start live preview failed'); + } + getPreviewPicture(); + }; + xmlHttpRequest.open(POST, COMMAND, true); + xmlHttpRequest.setRequestHeader(CONTENT_TYPE, TYPE_JSON); + xmlHttpRequest.send(JSON.stringify(command)); +} + +function getPreviewPicture() { + var command = {}; + command.name = 'camera.getLivePreview'; + + var xmlHttpRequest = new XMLHttpRequest(); + xmlHttpRequest.onreadystatechange = function() { + + if (this.readyState === READYSTATE_COMPLETED && + this.status === HTTP_STATUS_OK) { + var reader = new FileReader(); + reader.onloadend = function onLoad() { + var img = document.getElementById('previewImage'); + img.src = reader.result; + }; + reader.readAsDataURL(this.response); + repeat() + } + }; + xmlHttpRequest.open(POST, COMMAND, true); + xmlHttpRequest.setRequestHeader(CONTENT_TYPE, TYPE_JSON); + xmlHttpRequest.responseType = 'blob'; + xmlHttpRequest.send(JSON.stringify(command)); +} + +function repeat() { + const d1 = new Date(); + while (true) { + const d2 = new Date(); + if (d2 - d1 > 30) { + break; + } + } + getPreviewPicture(); +} + +function init360LiveView() { + const width = window.innerWidth, + height = window.innerHeight; + + var scene = new THREE.Scene(); + + var geometry = new THREE.SphereGeometry(5, 60, 40); + geometry.scale(-1, 1, 1); + + var video = document.getElementById("previewImage"); + var texture = new THREE.VideoTexture(video); + texture.minFilter = THREE.LinearFilter; + + var material = new THREE.MeshBasicMaterial({ + map: texture + }); + sphere = new THREE.Mesh(geometry, material); + scene.add(sphere); + + var ambient = new THREE.AmbientLight(0x550000); + scene.add(ambient); + + var camera = new THREE.PerspectiveCamera(75, width / height, 1, 1000); + camera.position.set(7, 0, 0, 1); + camera.lookAt(sphere.position); + + var renderer = new THREE.WebGLRenderer(); + renderer.setSize(width, height); + renderer.setClearColor({ + color: 0x000000 + }); + document.getElementById('stage').appendChild(renderer.domElement); + renderer.render(scene, camera); + + var controls = new THREE.OrbitControls(camera, renderer.domElement); + + function render() { + requestAnimationFrame(render); + window.addEventListener('resize', onWindowResize, false); + renderer.render(scene, camera); + + controls.update(); + } + + render(); + + function onWindowResize() { + camera.aspect = width / height; + camera.updateProjectionMatrix(); + renderer.setSize(width, height); + } +} + +function checkStatus() { + setInterval(getStatus, 2000); +} + +function getStatus() { + var command = {}; + command.name = 'camera.getStatus'; + var xmlHttpRequest = new XMLHttpRequest(); + xmlHttpRequest.onreadystatechange = function() { + if (this.readyState === READYSTATE_COMPLETED && + this.status === HTTP_STATUS_OK) { + var json = JSON.parse(this.responseText); + status = json.status; + console.log(status); + if (status !== 'idle') { + disableShutterButton(); + } else { + enableShutterButton(); + } + } + }; + xmlHttpRequest.open(POST, COMMAND, true); + xmlHttpRequest.setRequestHeader(CONTENT_TYPE, TYPE_JSON); + xmlHttpRequest.send(JSON.stringify(command)); +} + +function upSwipMenu() { +// // 撮影モードを非表示にする +// document.getElementById('mode_btn').style.display ="none" +// // 露出設定を上げる +// document.getElementById('swipemenu').style.webkitTransform = 'translate(0px,-140px)'; +// // スワイプエリアを広げる(露出設定表示時はプレビュー画面の操作をNOPにするため) +// $('.swipearea').css('height','600px'); +} + +function downSwipMenu() { + // 露出設定を下げる + document.getElementById('swipemenu').style.webkitTransform = 'translate(0px,0px)'; + // スワイプエリアを狭める(露出設定非表示はプレビュー画面の操作範囲を広くするため) + $('.swipearea').css('height','10px'); + // 撮影モードを表示にする + document.getElementById('mode_btn').style.display ="block" +} \ No newline at end of file diff --git a/app/src/main/assets/js/settings-receptor4.js b/app/src/main/assets/js/settings-receptor4.js new file mode 100644 index 0000000..7d71850 --- /dev/null +++ b/app/src/main/assets/js/settings-receptor4.js @@ -0,0 +1,483 @@ +function setOptions() { + var option = new Object(); + option.exposureProgram = $("input[name='action']:checked").val() + var memberfilter = new Array(); + + if (typeof option.exposureProgram === "undefined" || option.exposureProgram === "auto") { + option.exposureProgram = "2"; + option.whiteBalance = $("input[name='wb']:checked").val() + option._filter = $("input[name='filter']:checked").val() + option.exposureCompensation = $("input[name='ev']:checked").val() + memberfilter.push('exposureProgram') + if (typeof option.whiteBalance != "undefined") { + memberfilter.push('whiteBalance') + } + if (typeof option._filter != "undefined") { + memberfilter.push('_filter') + } + if (typeof option.exposureCompensation != "undefined") { + memberfilter.push('exposureCompensation') + } + } + + if (option.exposureProgram === "shutter") { + option.exposureProgram = "4"; + option.shutterSpeed = $("input[name='shutterspeed']:checked").val() + option.exposureCompensation = $("input[name='ev']:checked").val() + option.whiteBalance = $("input[name='wb']:checked").val() + memberfilter.push('exposureProgram') + if (typeof option.shutterSpeed != "undefined") { + memberfilter.push('shutterSpeed') + } + if (typeof option.exposureCompensation != "undefined") { + memberfilter.push('exposureCompensation') + } + if (typeof option.whiteBalance != "undefined") { + memberfilter.push('whiteBalance') + } + } + + if (option.exposureProgram === "iso") { + option.exposureProgram = "9"; + option.iso = $("input[name='iso']:checked").val() + option.exposureCompensation = $("input[name='ev']:checked").val() + option.whiteBalance = $("input[name='wb']:checked").val() + memberfilter.push('exposureProgram') + if (typeof option.iso != "undefined") { + memberfilter.push('iso') + } + if (typeof option.exposureCompensation != "undefined") { + memberfilter.push('exposureCompensation') + } + if (typeof option.whiteBalance != "undefined") { + memberfilter.push('whiteBalance') + } + } + + if (option.exposureProgram === "manual") { + option.exposureProgram = "1"; + option.shutterSpeed = $("input[name='shutterspeed']:checked").val() + option.whiteBalance = $("input[name='wb']:checked").val() + option.iso = $("input[name='iso']:checked").val() + memberfilter.push('exposureProgram') + if (typeof option.shutterSpeed != "undefined") { + memberfilter.push('shutterSpeed') + } + if (typeof option.whiteBalance != "undefined") { + memberfilter.push('whiteBalance') + } + if (typeof option.iso != "undefined") { + memberfilter.push('iso') + } + } + + var setOptions = JSON.stringify(option, memberfilter, "\t"); + console.log(setOptions); + var setOptionsJSON = JSON.parse(setOptions); + + var _parameters = { + options: setOptionsJSON + }; + + var _commands = { + name: 'camera.setOptions', + parameters: _parameters + }; + + var xmlHttpRequest = new XMLHttpRequest(); + xmlHttpRequest.onreadystatechange = function() { + var READYSTATE_COMPLETED = 4; + var HTTP_STATUS_OK = 200; + + if (this.readyState == READYSTATE_COMPLETED && + this.status == HTTP_STATUS_OK) { + console.log('setOptions:' + this.responseText); + getOptions(false); + } + } + + xmlHttpRequest.open('POST', '/blur/commands/execute', true); + xmlHttpRequest.setRequestHeader('Content-Type', 'application/json'); + xmlHttpRequest.send(JSON.stringify(_commands)); +} + +function getOptions(EXPFlag) { + + var _parameters = { + optionNames: ['exposureProgram', 'iso', 'shutterSpeed', 'whiteBalance', '_colorTemperature', 'exposureCompensation', '_filter', "fileFormat"] + }; + + var _commands = { + name: 'camera.getOptions', + parameters: _parameters + }; + + var xmlHttpRequest = new XMLHttpRequest(); + xmlHttpRequest.onreadystatechange = function() { + var READYSTATE_COMPLETED = 4; + var HTTP_STATUS_OK = 200; + + if (this.readyState == READYSTATE_COMPLETED && + this.status == HTTP_STATUS_OK) { + var response = JSON.parse(this.responseText); + var options = response.results.options; + var exposurePrograms = []; + + switch (options.exposureProgram) { + case 2: + if (EXPFlag) { + hideAllMenu(); + + $("#mode_btn").removeClass(); + + $("#shoot__setting-auto").addClass("hide"); + $("#shoot__setting-shutter").addClass("hide"); + $("#shoot__setting-iso").addClass("hide"); + $("#shoot__setting-manual").addClass("hide"); + } + var evindex = mEvSupport.indexOf(options.exposureCompensation); + var wbindex = getWBMenuIndex(options.whiteBalance); + var opindex = getOPIndex(options._filter); + + $('#ev_menu_wrap').slick("unslick"); + $('#wb_menu_wrap').slick("unslick"); + $('#option_menu_wrap').slick("unslick"); + + $("#ev_menu_wrap").html(mEvData); + $('#ev_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + variableWidth: true, + initialSlide: evindex, + swipeToSlide: true + }); + $("#wb_menu_wrap").html(mWBData); + $('#wb_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + variableWidth: true, + initialSlide: wbindex, + swipeToSlide: true + }); + $("#option_menu_wrap").html(mOptionData); + $('#option_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + initialSlide: opindex, + swipeToSlide: true + }); + $("#mode_btn").addClass("btn--mode-auto-normal"); + $("#shoot__setting-auto").removeClass("hide"); + + $("input[name='action']:eq(0)").prop('checked', true); + $("#mode_btn").addClass("btn"); + + var htmlvalue = '

    ' + getNumber(options.exposureCompensation.toFixed(1)) + '

    '; + $("#evlabel1").html(htmlvalue); + $("#evlabel1").val(options.exposureCompensation); + $('input[name=ev]:eq(' + evindex + ')').prop('checked', true); + + htmlvalue = setWBLabel(options.whiteBalance); + $("#wblabel0").html(htmlvalue); + $("#wblabel0").val(options.whiteBalance); + $('input[name=wb]:eq(' + wbindex + ')').prop('checked', true); + + htmlvalue = setOPLabel(options._filter); + $("#ftlabel").html(htmlvalue); + $('input[name=filter]:eq(' + opindex + ')').prop('checked', true); + break; + case 4: + if (EXPFlag) { + hideAllMenu(); + + $("#mode_btn").removeClass(); + + $("#shoot__setting-auto").addClass("hide"); + $("#shoot__setting-shutter").addClass("hide"); + $("#shoot__setting-iso").addClass("hide"); + $("#shoot__setting-manual").addClass("hide"); + } + var spindex = getSPIndex(options.shutterSpeed); + var wbindex = getWBMenuIndex(options.whiteBalance); + var evindex = mEvSupport.indexOf(options.exposureCompensation); + + $('#shutter_menu_wrap').slick("unslick"); + $('#wb_menu_wrap').slick("unslick"); + $('#ev_menu_wrap').slick("unslick"); + + $('input[name="shutterspeed"]').on('click',function(event) { + var label = ""; + for (var i = 0; i < mShutterSpeedSupport.length; i++){ + if (mShutterSpeedSupport[i].val == $(event.target).val()) { + label = mShutterSpeedSupport[i].text; + break; + } + } + var htmlvalue = '

    '+ label +'

    '; + $("#splabel1").html(htmlvalue); + $("#splabel2").html(htmlvalue); + $("#splabel3").html(htmlvalue); + }); + + $("#shutter_menu_wrap").html(mShutterSpeedData); + $('#shutter_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 5, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + initialSlide: spindex, + swipeToSlide: true + }); + + $("#wb_menu_wrap").html(mWBData); + $('#wb_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + variableWidth: true, + initialSlide: wbindex, + swipeToSlide: true + }); + $("#ev_menu_wrap").html(mEvData); + $('#ev_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + variableWidth: true, + initialSlide: evindex, + swipeToSlide: true + }); + + $("#mode_btn").addClass("btn--mode-shutter-normal"); + $("#shoot__setting-shutter").removeClass("hide"); + + $("input[name='action']:eq(1)").prop('checked', true); + $("#mode_btn").addClass("btn"); + + var htmlvalue = setSPLabel(options.shutterSpeed); + $("#splabel1").html(htmlvalue); + $("#splabel1").val(options.shutterSpeed); + $('input[name=shutterspeed]:eq(' + spindex + ')').prop('checked', true); + + htmlvalue = '

    ' + getNumber(options.exposureCompensation.toFixed(1)) + '

    '; + $("#evlabel2").html(htmlvalue); + $("#evlabel2").val(options.exposureCompensation); + + $('input[name=ev]:eq(' + evindex + ')').prop('checked', true); + + htmlvalue = setWBLabel(options.whiteBalance); + $("#wblabel1").html(htmlvalue); + $("#wblabel1").val(options.whiteBalance); + + $('input[name=wb]:eq(' + wbindex + ')').prop('checked', true); + + break; + case 9: + if (EXPFlag) { + hideAllMenu(); + + $("#mode_btn").removeClass(); + + $("#shoot__setting-auto").addClass("hide"); + $("#shoot__setting-shutter").addClass("hide"); + $("#shoot__setting-iso").addClass("hide"); + $("#shoot__setting-manual").addClass("hide"); + } + + var isoindex = mIsoSupport.indexOf(options.iso); + var evindex = mEvSupport.indexOf(options.exposureCompensation); + var wbindex = getWBMenuIndex(options.whiteBalance); + + $('#iso_menu_wrap').slick("unslick"); + $('#wb_menu_wrap').slick("unslick"); + $('#ev_menu_wrap').slick("unslick"); + + $("#iso_menu_wrap").html(mIsoData); + $('#iso_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + initialSlide: isoindex, + swipeToSlide: true + }); + $("#wb_menu_wrap").html(mWBData); + $('#wb_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + variableWidth: true, + initialSlide: wbindex, + swipeToSlide: true + }); + $("#ev_menu_wrap").html(mEvData); + $('#ev_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + variableWidth: true, + initialSlide: evindex, + swipeToSlide: true + }); + + $("#mode_btn").addClass("btn--mode-iso-normal"); + $("#shoot__setting-iso").removeClass("hide"); + + $("input[name='action']:eq(2)").prop('checked', true); + $("#mode_btn").addClass("btn"); + + var htmlvalue = '

    ' + options.iso + '

    '; + $("#isolabel2").html(htmlvalue); + $("#isolabel2").val(options.iso); + + $('input[name=iso]:eq('+ isoindex +')').prop('checked', true); + + htmlvalue = '

    ' + getNumber(options.exposureCompensation.toFixed(1)) + '

    '; + $("#evlabel3").html(htmlvalue); + $("#evlabel3").val(options.exposureCompensation); + + $('input[name=ev]:eq(' + evindex + ')').prop('checked', true); + + htmlvalue = setWBLabel(options.whiteBalance); + $("#wblabel2").html(htmlvalue); + $("#wblabel2").val(options.whiteBalance); + + $('input[name=wb]:eq(' + wbindex + ')').prop('checked', true); + break; + case 1: + if (EXPFlag) { + hideAllMenu(); + $("#mode_btn").removeClass(); + + $("#shoot__setting-auto").addClass("hide"); + $("#shoot__setting-shutter").addClass("hide"); + $("#shoot__setting-iso").addClass("hide"); + $("#shoot__setting-manual").addClass("hide"); + } + var spindex = getSPIndex(options.shutterSpeed); + var isoindex = mIsoSupport.indexOf(options.iso); + var wbindex = getWBMenuIndex(options.whiteBalance); + + $('#shutter_menu_wrap').slick("unslick"); + $('#iso_menu_wrap').slick("unslick"); + $('#wb_menu_wrap').slick("unslick"); + + $('input[name="shutterspeed"]').on('click',function(event) { + var label = ""; + for (var i = 0; i < mShutterSpeedSupport.length; i++){ + if (mShutterSpeedSupport[i].val == $(event.target).val()) { + label = mShutterSpeedSupport[i].text; + break; + } + } + var htmlvalue = '

    '+ label +'

    '; + $("#splabel1").html(htmlvalue); + $("#splabel2").html(htmlvalue); + $("#splabel3").html(htmlvalue); + }); + + $("#shutter_menu_wrap").html(mShutterSpeedData); + $('#shutter_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 5, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + initialSlide: spindex, + swipeToSlide: true + }); + + $("#iso_menu_wrap").html(mIsoData); + $('#iso_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + initialSlide: isoindex, + swipeToSlide: true + }); + + $("#wb_menu_wrap").html(mWBData); + $('#wb_menu_wrap').slick({ + slidesToShow: 3, + slidesToScroll: 1, + infinite: false, + dots: false, + arrows: false, + centerMode: true, + focusOnSelect: true, + variableWidth: true, + initialSlide: wbindex, + swipeToSlide: true + }); + + $("#mode_btn").addClass("btn--mode-manual-normal"); + $("#shoot__setting-manual").removeClass("hide"); + $("input[name='action']:eq(3)").prop('checked', true); + + $("#mode_btn").addClass("btn"); + var htmlvalue = '

    ' + options.iso + '

    '; + $("#isolabel3").html(htmlvalue); + $("#isolabel3").val(options.iso); + $('input[name=iso]:eq('+ isoindex +')').prop('checked', true); + + htmlvalue = setSPLabel(options.shutterSpeed); + $("#splabel2").html(htmlvalue); + $("#splabel2").val(options.shutterSpeed); + $('input[name=shutterspeed]:eq(' + spindex + ')').prop('checked', true); + + htmlvalue = setWBLabel(options.whiteBalance); + $("#wblabel3").html(htmlvalue); + $("#wblabel3").val(options.whiteBalance); + $('input[name=wb]:eq(' + wbindex + ')').prop('checked', true); + break; + } + } + } + + xmlHttpRequest.open('POST', '/blur/commands/execute', true); + xmlHttpRequest.setRequestHeader('Content-Type', 'application/json'); + xmlHttpRequest.send(JSON.stringify(_commands)); +} \ No newline at end of file diff --git a/app/src/main/assets/js/settings.js b/app/src/main/assets/js/settings.js old mode 100755 new mode 100644 index f0e5f2c..e6af675 --- a/app/src/main/assets/js/settings.js +++ b/app/src/main/assets/js/settings.js @@ -99,7 +99,7 @@ function getOptions(EXPFlag) { if (EXPFlag) { changeMenu("auto"); } - var htmlvalue = '

    ' + options.exposureCompensation + '

    '; + var htmlvalue = '

    ' + getNumber(options.exposureCompensation.toFixed(1)) + '

    '; $("#evlabel1").html(htmlvalue); $("#evlabel1").val(options.exposureCompensation); var evindex = mEvSupport.indexOf(options.exposureCompensation); @@ -120,14 +120,13 @@ function getOptions(EXPFlag) { if (EXPFlag) { changeMenu("shutter"); } - $("#shutter_menu_wrap").html(mShutterSpeedPriorityData); var htmlvalue = setSPLabel(options.shutterSpeed); $("#splabel1").html(htmlvalue); $("#splabel1").val(options.shutterSpeed); var spindex = getSPModeIndex(options.shutterSpeed); $('input[name=shutterspeed]:eq(' + spindex + ')').prop('checked', true); - htmlvalue = '

    ' + options.exposureCompensation + '

    '; + htmlvalue = '

    ' + getNumber(options.exposureCompensation.toFixed(1)) + '

    '; $("#evlabel2").html(htmlvalue); $("#evlabel2").val(options.exposureCompensation); var evindex = mEvSupport.indexOf(options.exposureCompensation); @@ -150,7 +149,7 @@ function getOptions(EXPFlag) { var isoindex = mIsoSupport.indexOf(options.iso); $('input[name=iso]:eq('+ isoindex +')').prop('checked', true); - htmlvalue = '

    ' + options.exposureCompensation + '

    '; + htmlvalue = '

    ' + getNumber(options.exposureCompensation.toFixed(1)) + '

    '; $("#evlabel3").html(htmlvalue); $("#evlabel3").val(options.exposureCompensation); var evindex = mEvSupport.indexOf(options.exposureCompensation); diff --git a/app/src/main/assets/receptor4.html b/app/src/main/assets/receptor4.html new file mode 100644 index 0000000..e19c969 --- /dev/null +++ b/app/src/main/assets/receptor4.html @@ -0,0 +1,162 @@ + + + + + + + + + Automatic Face Blur BETA + + + + + + + + + + + + +
    +
    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    +
    +
    +
    +
      +
    +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/app/src/main/java/com/theta360/automaticfaceblur/MainActivity.java b/app/src/main/java/com/theta360/automaticfaceblur/MainActivity.java old mode 100755 new mode 100644 index bf23156..3cfe173 --- a/app/src/main/java/com/theta360/automaticfaceblur/MainActivity.java +++ b/app/src/main/java/com/theta360/automaticfaceblur/MainActivity.java @@ -16,11 +16,16 @@ package com.theta360.automaticfaceblur; import android.content.Intent; +import android.graphics.Color; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; +import android.os.Handler; +import android.os.Process; import android.text.TextUtils; import android.view.KeyEvent; +import android.webkit.WebView; +import android.webkit.WebViewClient; import com.koushikdutta.async.http.server.AsyncHttpServerResponse; import com.theta360.automaticfaceblur.network.WebServer; @@ -44,25 +49,37 @@ import com.theta360.automaticfaceblur.task.TakePictureTask.Callback; import com.theta360.automaticfaceblur.task.UpdatePreviewTask; import com.theta360.automaticfaceblur.view.MJpegInputStream; +import com.theta360.automaticfaceblur.view.MyProgressDialog; import com.theta360.pluginlibrary.activity.PluginActivity; +import com.theta360.pluginlibrary.activity.ThetaInfo; import com.theta360.pluginlibrary.callback.KeyCallback; import com.theta360.pluginlibrary.receiver.KeyReceiver; -import com.theta360.pluginlibrary.values.Display; +import com.theta360.pluginlibrary.values.OledDisplay; import com.theta360.pluginlibrary.values.LedColor; import com.theta360.pluginlibrary.values.LedTarget; +import com.theta360.pluginlibrary.values.TextArea; +import com.theta360.pluginlibrary.values.ThetaModel; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import timber.log.Timber; +import static com.theta360.pluginlibrary.values.ThetaModel.THETA_X; +import static com.theta360.pluginlibrary.values.ThetaModel.isZ1Model; + /** * MainActivity */ public class MainActivity extends PluginActivity { public static final String DCIM = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_DCIM).getPath(); + public static final String ACTION_FINISH_UPDATING ="ACTION_ASYNC_FINISH_UPDATING"; private TakePictureTask mTakePictureTask; private ImageProcessorTask mImageProcessorTask; private byte[] mPreviewByteArray; @@ -74,6 +91,12 @@ public class MainActivity extends PluginActivity { private int mExposureDelay; private static final String IMAGE = "image"; private boolean mIsStarted; + private boolean mIsChanged; + private boolean mIsEnded; + private JSONObject mJsonRecord = null; + static final String URL = "http://localhost:8888"; + private WebView webView; + private boolean takePictureComplete = false; /** * Set a KeyCallback when onCreate executes. @@ -84,6 +107,9 @@ public class MainActivity extends PluginActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + + getWindow().setStatusBarColor(Color.BLACK); + setKeyCallback(new KeyCallback() { /** * Receive the shutter key down when it is not during taking picture task or @@ -93,7 +119,7 @@ protected void onCreate(Bundle savedInstanceState) { */ @Override public void onKeyDown(int keyCode, KeyEvent keyEvent) { - if (keyCode == KeyReceiver.KEYCODE_CAMERA) { + if (keyCode == KeyReceiver.KEYCODE_CAMERA || keyCode == KeyEvent.KEYCODE_VOLUME_UP) { if (mTakePictureTask == null && mImageProcessorTask == null) { if (mUpdatePreviewTask != null) { mUpdatePreviewTask.cancel(false); @@ -112,16 +138,43 @@ public void onKeyUp(int i, KeyEvent keyEvent) { @Override public void onKeyLongPress(int keyCode, KeyEvent event) { + if (keyCode == KeyReceiver.KEYCODE_MEDIA_RECORD || keyCode == KeyReceiver.KEYCODE_FUNCTION) { +// if(isXCameraModel()) { + if (mTakePictureTask != null) { + mTakePictureTask.cancel(true); + mTakePictureTask = null; + } + if (mImageProcessorTask != null) { + mImageProcessorTask.cancel(true); + mImageProcessorTask = null; + } + if (mUpdatePreviewTask != null) { + mUpdatePreviewTask.cancel(false); + mUpdatePreviewTask = null; + } + + mWebServer.stop(); + finishTask(); +// } + } } }); - if (isZ1()) { - notificationOledDisplaySet(Display.BASIC); + + if (isXCameraModel()) { + Intent intent = new Intent("com.theta360.plugin.ACTION_PLUGIN_WEBAPI_CAMERA_OPEN"); + getBaseContext().sendBroadcast(intent); } else { - new GetRemainingSpaceTask(mGetRemainingSpaceTaskCallback).execute(); + if (isZ1Model()) { + notificationOledDisplaySet(OledDisplay.DISPLAY_BASIC); + } } - mIsStarted = true; + new GetRemainingSpaceTask(mGetRemainingSpaceTaskCallback).execute(); new GetCaptureModeTask(mGetCaptureModeTaskCallback).execute(); + + mIsStarted = true; + mIsEnded = false; + mJsonRecord = new JSONObject(); } /** @@ -133,6 +186,11 @@ protected void onResume() { super.onResume(); controlLedOnCreate(); mWebServer = new WebServer(getApplicationContext(), null, mWebServerCallback); + + webView = (WebView) findViewById(R.id.webView); + webView.setWebViewClient(new WebViewClient()); // WebViewを設定する + webView.getSettings().setJavaScriptEnabled(true); // JavaScriptを有効にする + webView.loadUrl(URL); // URLを読み込む } /** @@ -152,12 +210,10 @@ protected void onPause() { mUpdatePreviewTask.cancel(false); mUpdatePreviewTask = null; } + setAutoClose(false); - new SetCaptureModeTask(mSetCaptureModeTaskCallback, mCaptureMode, mExposureDelay, mIsStarted).execute(); - mWebServer.stop(); - setAutoClose(true); - super.onPause(); + super.onPause(); } /** @@ -173,11 +229,19 @@ public void onPreExecute() { public void onPictureGenerated(String fileUrl) { if (!TextUtils.isEmpty(fileUrl)) { notificationAudioOpen(); - if (isZ1()) { - notificationOledDisplaySet(Display.PLUGIN); - notificationOledTextShow("Processing", ""); + if(isXCameraModel()) { + MyProgressDialog pd = MyProgressDialog.newInstance(); + pd.show(getFragmentManager(), "Processing"); } else { - notificationLedBlink(LedTarget.LED4, LedColor.BLUE, 1000); + if (isZ1Model()) { + notificationOledDisplaySet(OledDisplay.DISPLAY_PLUGIN); + Map output = new HashMap<>(); + output.put(TextArea.MIDDLE, "Processing"); + output.put(TextArea.BOTTOM, ""); + notificationOledTextShow(output); + } else { + notificationLedBlink(LedTarget.LED4, LedColor.BLUE, 1000); + } } mImageProcessorTask = new ImageProcessorTask(mImageProcessorTaskCallback); mImageProcessorTask.execute(fileUrl); @@ -208,7 +272,11 @@ public void onSendCommand(AsyncHttpServerResponse response, CommandsRequest comm @Override public void onCompleted() { - setAutoClose(true); + if(isXCameraModel()) { + setAutoClose(false); + } else { + setAutoClose(true); + } } @Override @@ -323,10 +391,15 @@ public void onSuccess(Map fileUrlMap) { } mImageProcessorTask = null; notificationAudioClose(); - if (isZ1()) { - notificationOledDisplaySet(Display.BASIC); + takePictureComplete = true; + if(isXCameraModel()) { + closeDialog(); } else { - notificationLedShow(LedTarget.LED4); + if (isZ1Model()) { + notificationOledDisplaySet(OledDisplay.DISPLAY_BASIC); + } else { + notificationLedShow(LedTarget.LED4); + } } } @@ -363,7 +436,11 @@ public void onError() { private SetCaptureModeTask.Callback mSetCaptureModeTaskCallback = new SetCaptureModeTask.Callback() { @Override public void onSetExposureDelay() { - setAutoClose(true); + if (isXCameraModel()) { + setAutoClose(false); + } else { + setAutoClose(true); + } } @Override @@ -383,8 +460,25 @@ public void onSetCaptureModeFailed(Errors errors) { private GetCaptureModeTask.Callback mGetCaptureModeTaskCallback = new GetCaptureModeTask.Callback() { @Override - public void onGetCaptureMode(String captureMode) { - mCaptureMode = captureMode; + public void onGetCaptureMode(JSONObject json){ + try { + if(json != null) { + JSONObject result = json.getJSONObject("results"); + mCaptureMode = result.getJSONObject("options").getString("captureMode"); + if(mCaptureMode.equals("image")) { + mJsonRecord = result; + if(!result.getJSONObject("options").isNull("fileFormat")) { + if(result.getJSONObject("options").getJSONObject("fileFormat").getInt("width") == 11008 + && result.getJSONObject("options").getJSONObject("fileFormat").getInt("height") == 5504) { + mIsChanged = true; + } + } + } + } + } catch (JSONException jsonException) { + mCaptureMode = "image"; + jsonException.printStackTrace(); + } new GetExposureDelayTask(mGetExposureDelayTaskCallback).execute(); } }; @@ -393,7 +487,7 @@ public void onGetCaptureMode(String captureMode) { @Override public void onGetExposureDelay(int exposureDelay) { mExposureDelay = exposureDelay; - new SetCaptureModeTask(mSetCaptureModeTaskCallback, IMAGE, 0, mIsStarted).execute(); + new SetCaptureModeTask(mSetCaptureModeTaskCallback, IMAGE, 0, null, mIsStarted, mIsChanged, mIsEnded).execute(); mIsStarted = false; } }; @@ -455,6 +549,10 @@ public void commandsRequest(AsyncHttpServerResponse response, case GET_STATUS: if (mTakePictureTask == null && mImageProcessorTask == null) { mWebServer.sendStatus(response, new StatusResponse(Status.IDLE)); + if(takePictureComplete) { + takePictureComplete = false; + new ShowLiveViewTask(mShowLiveViewTaskCallback, response, commandsRequest).execute(); + } } else if (mImageProcessorTask == null) { mWebServer.sendStatus(response, new StatusResponse(Status.SHOOTING)); } else if (mTakePictureTask == null) { @@ -480,4 +578,37 @@ private void controlLedOnCreate() { notificationLedHide(LedTarget.LED7); notificationLedHide(LedTarget.LED8); } + + private void closeDialog() { + Intent intent = new Intent(); + intent.setAction(ACTION_FINISH_UPDATING); + sendBroadcast(intent); + } + + private void finishTask() { + mWebServer.stop(); + + if(isXCameraModel()) { + if (mCaptureMode.equals(IMAGE)) { + new SetCaptureModeTask(mSetCaptureModeTaskCallback, mCaptureMode, mExposureDelay, mJsonRecord, mIsStarted, mIsChanged, true).execute(); + } + } + + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + if(isXCameraModel()) { + Intent intent = new Intent("com.theta360.plugin.ACTION_PLUGIN_WEBAPI_CAMERA_CLOSE"); + getBaseContext().sendBroadcast(intent); + } + Process.killProcess(Process.myPid()); + } + }, 2000); + } + + public static Boolean isXCameraModel() { + ThetaModel model = ThetaModel.getValue(ThetaInfo.getThetaModelName()); + return model != THETA_X ? false : true; + } + } diff --git a/app/src/main/java/com/theta360/automaticfaceblur/network/HttpConnector.java b/app/src/main/java/com/theta360/automaticfaceblur/network/HttpConnector.java old mode 100755 new mode 100644 index c7a2c76..3a4656b --- a/app/src/main/java/com/theta360/automaticfaceblur/network/HttpConnector.java +++ b/app/src/main/java/com/theta360/automaticfaceblur/network/HttpConnector.java @@ -15,6 +15,9 @@ */ package com.theta360.automaticfaceblur.network; +import com.theta360.pluginlibrary.activity.ThetaInfo; +import com.theta360.pluginlibrary.values.ThetaModel; + import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -174,7 +177,7 @@ private String checkCaptureStatus(String commandId) { * * @return Error message (null is returned if successful) */ - public String setCaptureMode(String captureMode) { + public String setCaptureMode(String captureMode, JSONObject jsonRecord, boolean isEnded, boolean isChanged) { String errorMessage; try { @@ -183,6 +186,56 @@ public String setCaptureMode(String captureMode) { input.put("name", "camera.setOptions"); JSONObject parameters = new JSONObject(); JSONObject options = new JSONObject(); + JSONObject fileFormat = new JSONObject(); + if(jsonRecord != null && !jsonRecord.isNull("options")) { + String exposureProgram = jsonRecord.getJSONObject("options").getString("exposureProgram"); + switch (exposureProgram) { + case "2": // AUTO + options.put("exposureProgram", exposureProgram); + options.put("exposureCompensation", jsonRecord.getJSONObject("options").getString("exposureCompensation")); + options.put("whiteBalance", jsonRecord.getJSONObject("options").getString("whiteBalance")); + options.put("_filter", jsonRecord.getJSONObject("options").getString("_filter")); + break; + case "4": // Shutter + options.put("exposureProgram", exposureProgram); + options.put("shutterSpeed", jsonRecord.getJSONObject("options").getString("shutterSpeed")); + options.put("exposureCompensation", jsonRecord.getJSONObject("options").getString("exposureCompensation")); + options.put("whiteBalance", jsonRecord.getJSONObject("options").getString("whiteBalance")); + break; + case "9": // ISO + options.put("exposureProgram", exposureProgram); + options.put("iso", jsonRecord.getJSONObject("options").getString("iso")); + options.put("exposureCompensation", jsonRecord.getJSONObject("options").getString("exposureCompensation")); + options.put("whiteBalance", jsonRecord.getJSONObject("options").getString("whiteBalance")); + break; + case "1": // Manual + options.put("exposureProgram", exposureProgram); + options.put("shutterSpeed", jsonRecord.getJSONObject("options").getString("shutterSpeed")); + options.put("iso", jsonRecord.getJSONObject("options").getString("iso")); + options.put("whiteBalance", jsonRecord.getJSONObject("options").getString("whiteBalance")); + break; + default: + } + } + if(ThetaModel.getValue(ThetaInfo.getThetaModelName()).equals(ThetaModel.THETA_X)) { + if(!isEnded) { + if(isChanged) { + // 5.5K + fileFormat.put("type", "jpeg"); + fileFormat.put("width", 5504); + fileFormat.put("height", 2752); + options.put("fileFormat", fileFormat); + } + } else { + if(isChanged) { + // 11K + fileFormat.put("type", "jpeg"); + fileFormat.put("width", 11008); + fileFormat.put("height", 5504); + options.put("fileFormat", fileFormat); + } + } + } options.put("captureMode", captureMode); parameters.put("options", options); input.put("parameters", parameters); @@ -521,9 +574,6 @@ public void run() { */ public InputStream getLivePreview() throws IOException, JSONException { - // set capture mode to image - setCaptureMode(IMAGE); - HttpURLConnection postConnection = createHttpConnection("POST", "/osc/commands/execute"); JSONObject input = new JSONObject(); InputStream is; @@ -659,16 +709,81 @@ public int getExposureDelay() { return exposureDelay; } - public String getCaptureMode() { - String optionName = "captureMode"; - JSONObject options = getOptionsJSON(optionName); - String captureMode = null; + public JSONObject getCaptureMode() { + HttpURLConnection postConnection = createHttpConnection("POST", "/osc/commands/execute"); + JSONObject input = new JSONObject(); + String responseData; + InputStream is = null; + JSONObject output = null; + try { - captureMode = options.getString(optionName); + // send HTTP POST + input.put("name", "camera.getOptions"); + JSONObject parameters = new JSONObject(); + JSONArray optionNames = new JSONArray(); + optionNames.put("captureMode"); + optionNames.put("exposureProgram"); + optionNames.put("iso"); + optionNames.put("shutterSpeed"); + optionNames.put("whiteBalance"); + optionNames.put("_colorTemperature"); + optionNames.put("exposureCompensation"); + optionNames.put("_filter"); + optionNames.put("fileFormat"); + parameters.put("optionNames", optionNames); + input.put("parameters", parameters); + + OutputStream os = postConnection.getOutputStream(); + os.write(input.toString().getBytes()); + postConnection.connect(); + os.flush(); + os.close(); + + is = postConnection.getInputStream(); + responseData = InputStreamToString(is); + + // parse JSON data + output = new JSONObject(responseData); + + String status = output.getString("state"); + + if (status.equals("error")) { + JSONObject errors = output.getJSONObject("error"); + } + } catch (IOException e) { + e.printStackTrace(); + InputStream es = postConnection.getErrorStream(); + try { + if (es != null) { + String errorData = InputStreamToString(es); + output = new JSONObject(errorData); + } + } catch (IOException e1) { + e1.printStackTrace(); + } catch (JSONException e1) { + e1.printStackTrace(); + } finally { + if (es != null) { + try { + es.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } + } + } } catch (JSONException e) { e.printStackTrace(); + } finally { + if (is != null) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } } - return captureMode; + + return output; } private JSONObject getOptionsJSON(String optionName) { diff --git a/app/src/main/java/com/theta360/automaticfaceblur/network/WebServer.java b/app/src/main/java/com/theta360/automaticfaceblur/network/WebServer.java old mode 100755 new mode 100644 index 4bdccda..b31a9ad --- a/app/src/main/java/com/theta360/automaticfaceblur/network/WebServer.java +++ b/app/src/main/java/com/theta360/automaticfaceblur/network/WebServer.java @@ -34,16 +34,23 @@ import com.theta360.automaticfaceblur.network.model.responses.StatusResponse; import com.theta360.automaticfaceblur.network.model.values.Errors; import com.theta360.automaticfaceblur.network.model.values.State; +import com.theta360.pluginlibrary.activity.ThetaInfo; +import com.theta360.pluginlibrary.values.ThetaModel; +import org.json.JSONArray; +import org.json.JSONException; import org.json.JSONObject; import java.net.InetAddress; import java.text.DecimalFormat; import java.util.HashSet; import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import timber.log.Timber; +import static com.theta360.pluginlibrary.values.ThetaModel.THETA_X; /** * WebServer */ @@ -51,22 +58,30 @@ public class WebServer { private static final int HTTP_PORT = 8888; private static final String COMMANDS = "/blur/commands/execute"; private static final String PREVIEW_HTML = "index.html"; + private static final String PREVIEW_HTML_R4 = "receptor4.html"; private static final String TAKE_PICTURE_SCRIPT = "js/shooting.js"; private static final String SET_OPTIONS_SCRIPT = "js/settings.js"; + private static final String SET_OPTIONS_SCRIPT_R4 = "js/settings-receptor4.js"; private static final String GET_LIVE_PREVIEW_SCRIPT = "js/live-preview.js"; + private static final String GET_LIVE_PREVIEW_SCRIPT_R4 = "js/live-preview-receptor4.js"; private static final String JQUERY_SCRIPT = "js/jquery-1.12.2.min.js"; private static final String THREE_SCRIPT = "js/three.min.js"; private static final String ORBIT_CONTROL_SCRIPT = "js/ThetaControls.js"; + private static final String ORBIT_CONTROL_SCRIPT_R4 = "js/ThetaControls-receptor4.js"; private static final String SPHERE_SCRIPT = "js/sphere.js"; private static final String COMMON_CSS = "css/plugin.css"; + private static final String COMMON_CSS_R4 = "css/receptor4.css"; private static final String SLICK_SCRIPT = "js/slick.min.js"; private static final String CLIENT_SCRIPT = "js/face-blur-client.js"; + private static final String CLIENT_SCRIPT_R4 = "js/face-blur-client-receptor4.js"; private static final String JQUERY_1_8_3_SCRIPT = "js/jquery-1.8.3.min.js"; private static final String BTN_MODE_AUTO = "img/btn-mode-auto-normal.png"; private static final String BTN_MODE_ISO = "img/btn-mode-iso-normal.png"; private static final String BTN_MODE_MANUAL = "img/btn-mode-manual-normal.png"; private static final String BTN_MODE_SHUTTER = "img/btn-mode-shutter-normal.png"; private static final String BTN_SHUTTER = "img/btn-shutte-normal.png"; + private static final String BTN_SETTING = "img/btn-camerasetting.png"; + private static final String BTN_CAMERA_IMAGE = "img/btn-camera-image-white-normal.png"; private static final String ICONWB_AUTO_CURRENT = "img/iconwb-auto-current.png"; private static final String ICONWB_CLOUD_CURRENT = "img/iconwb-cloud-current.png"; private static final String ICONWB_FLUORESCENT_D_CURRENT = "img/iconwb-fluorescent-d-current.png"; @@ -77,12 +92,25 @@ public class WebServer { private static final String ICONWB_INCANDESCENT_2_CURRENT = "img/iconwb-incandescent-2-current.png"; private static final String ICONWB_SHADE_CURRENT = "img/iconwb-shade-current.png"; private static final String ICONWB_SUN_CURRENT = "img/iconwb-sun-current.png"; + private static final String ICONWB_UNDERWATER_CURRENT = "img/iconwb-underwater-current.png"; + private static final String FONTS_English = "fonts/Roboto-Regular.woff"; + private static final String FONTS_JP = "fonts/NotoSansJP-Regular.otf"; private static final String HOST = "Host"; private static final String APPLICATION_JSON = "application/json; charset=utf-8"; private static final String CONTENT_TYPE_OPTIONS = "X-Content-Type-Options"; private static final String CONTENT_TYPE_JPEG = "image/jpeg"; private static final String NOSNIFF = "nosniff"; + private static final String NAME = "name"; + private static final String PARAMETERS = "parameters"; + private static final String OPTION_NAMES = "optionNames"; + private static final String OPTIONS = "options"; + private static final String EXPOSURE_PROGRAM = "exposureProgram"; + private static final String ISO = "iso"; + private static final String SHUTTER_SPEED = "shutterSpeed"; + private static final String EXPOSURE_COMPENSATION = "exposureCompensation"; + private static final int characterLimit = 30; + private final Handler mWebDisconnectionHandler = new Handler(); private Context mContext; private AsyncServer mAsyncServer; @@ -92,6 +120,9 @@ public class WebServer { private int mAccessCounter = 0; private Runnable mWebDisconnectionRunnable = null; private Set mFileAccessSocketSet = new HashSet<>(); + private String regex = "^[0-9a-zA-Z ._-]+$"; + private String isNum = "[+-]?\\d*(\\.\\d+)?"; + private String[] optionsList = {"exposureProgram", "iso", "shutterSpeed", "whiteBalance", "colorTemperature", "exposureCompensation", "_filter"}; private HttpServerRequestCallback mCommandsRequestCallback = new HttpServerRequestCallback() { @Override @@ -104,11 +135,19 @@ public void onRequest(AsyncHttpServerRequest request, AsyncHttpServerResponse re json.toString(), CommandsRequest.class); CommandsName commandsName = commandsRequest.getCommandsName(); - if (commandsName != null) { - mCallback.commandsRequest(response, commandsRequest); + + if (jsonXssCheck(json)) { + if (commandsName != null) { + mCallback.commandsRequest(response, commandsRequest); + } else { + sendMissingParameter(response, CommandsName.COMMANDS_EXECUTE); + } } else { - sendMissingParameter(response, CommandsName.COMMANDS_EXECUTE); + sendUnknownCommand(response); } + } catch (JSONException je) { + je.printStackTrace(); + sendUnknownCommand(response); } catch (Exception e) { sendUnknownCommand(response); } @@ -170,23 +209,39 @@ public WebServer(@NonNull Context context, InetAddress inetAddress, mAsyncHttpServer = new AsyncHttpServerEx(mHttpServerCallback); mAsyncHttpServer.post(COMMANDS, mCommandsRequestCallback); - mAsyncHttpServer.directory(mContext, "/", PREVIEW_HTML); + if(isXCameraModel()) { + mAsyncHttpServer.directory(mContext, "/", PREVIEW_HTML_R4); + mAsyncHttpServer.directory(mContext, "/" + SET_OPTIONS_SCRIPT_R4, SET_OPTIONS_SCRIPT_R4); + mAsyncHttpServer.directory(mContext, "/" + GET_LIVE_PREVIEW_SCRIPT_R4, GET_LIVE_PREVIEW_SCRIPT_R4); + mAsyncHttpServer.directory(mContext, "/" + ORBIT_CONTROL_SCRIPT_R4, ORBIT_CONTROL_SCRIPT_R4); + mAsyncHttpServer.directory(mContext, "/" + COMMON_CSS_R4, COMMON_CSS_R4); + mAsyncHttpServer.directory(mContext, "/" + CLIENT_SCRIPT_R4, CLIENT_SCRIPT_R4); + } else { + mAsyncHttpServer.directory(mContext, "/", PREVIEW_HTML); + mAsyncHttpServer.directory(mContext, "/" + SET_OPTIONS_SCRIPT, SET_OPTIONS_SCRIPT); + mAsyncHttpServer.directory(mContext, "/" + GET_LIVE_PREVIEW_SCRIPT, GET_LIVE_PREVIEW_SCRIPT); + mAsyncHttpServer.directory(mContext, "/" + ORBIT_CONTROL_SCRIPT, ORBIT_CONTROL_SCRIPT); + mAsyncHttpServer.directory(mContext, "/" + COMMON_CSS, COMMON_CSS); + mAsyncHttpServer.directory(mContext, "/" + CLIENT_SCRIPT, CLIENT_SCRIPT); + } mAsyncHttpServer.directory(mContext, "/" + TAKE_PICTURE_SCRIPT, TAKE_PICTURE_SCRIPT); - mAsyncHttpServer.directory(mContext, "/" + SET_OPTIONS_SCRIPT, SET_OPTIONS_SCRIPT); - mAsyncHttpServer.directory(mContext, "/" + GET_LIVE_PREVIEW_SCRIPT, GET_LIVE_PREVIEW_SCRIPT); mAsyncHttpServer.directory(mContext, "/" + JQUERY_SCRIPT, JQUERY_SCRIPT); mAsyncHttpServer.directory(mContext, "/" + THREE_SCRIPT, THREE_SCRIPT); - mAsyncHttpServer.directory(mContext, "/" + ORBIT_CONTROL_SCRIPT, ORBIT_CONTROL_SCRIPT); mAsyncHttpServer.directory(mContext, "/" + SPHERE_SCRIPT, SPHERE_SCRIPT); - mAsyncHttpServer.directory(mContext, "/" + COMMON_CSS, COMMON_CSS); + // ================================================= + // 4号機用に追加 + mAsyncHttpServer.directory(mContext, "/" + FONTS_English, FONTS_English); + mAsyncHttpServer.directory(mContext, "/" + FONTS_JP, FONTS_JP); + // ================================================= mAsyncHttpServer.directory(mContext, "/" + JQUERY_1_8_3_SCRIPT, JQUERY_1_8_3_SCRIPT); mAsyncHttpServer.directory(mContext, "/" + SLICK_SCRIPT, SLICK_SCRIPT); - mAsyncHttpServer.directory(mContext, "/" + CLIENT_SCRIPT, CLIENT_SCRIPT); mAsyncHttpServer.directory(mContext, "/" + BTN_MODE_AUTO, BTN_MODE_AUTO); mAsyncHttpServer.directory(mContext, "/" + BTN_MODE_ISO, BTN_MODE_ISO); mAsyncHttpServer.directory(mContext, "/" + BTN_MODE_MANUAL, BTN_MODE_MANUAL); mAsyncHttpServer.directory(mContext, "/" + BTN_MODE_SHUTTER, BTN_MODE_SHUTTER); mAsyncHttpServer.directory(mContext, "/" + BTN_SHUTTER, BTN_SHUTTER); + mAsyncHttpServer.directory(mContext, "/" + BTN_SETTING, BTN_SETTING); + mAsyncHttpServer.directory(mContext, "/" + BTN_CAMERA_IMAGE, BTN_CAMERA_IMAGE); mAsyncHttpServer.directory(mContext, "/" + ICONWB_AUTO_CURRENT, ICONWB_AUTO_CURRENT); mAsyncHttpServer.directory(mContext, "/" + ICONWB_CLOUD_CURRENT, ICONWB_CLOUD_CURRENT); mAsyncHttpServer.directory(mContext, "/" + ICONWB_FLUORESCENT_D_CURRENT, ICONWB_FLUORESCENT_D_CURRENT); @@ -197,6 +252,7 @@ public WebServer(@NonNull Context context, InetAddress inetAddress, mAsyncHttpServer.directory(mContext, "/" + ICONWB_INCANDESCENT_2_CURRENT, ICONWB_INCANDESCENT_2_CURRENT); mAsyncHttpServer.directory(mContext, "/" + ICONWB_SHADE_CURRENT, ICONWB_SHADE_CURRENT); mAsyncHttpServer.directory(mContext, "/" + ICONWB_SUN_CURRENT, ICONWB_SUN_CURRENT); + mAsyncHttpServer.directory(mContext, "/" + ICONWB_UNDERWATER_CURRENT, ICONWB_UNDERWATER_CURRENT); mAsyncServer = new AsyncServer(); mAsyncServer.listen(inetAddress, HTTP_PORT, mAsyncHttpServer.getListenCallback()); } @@ -347,6 +403,84 @@ private String replaceCompletion(String json, Number completion) { return json; } + private boolean jsonXssCheck(JSONObject json) throws JSONException { + try { + //要素数が1(nameの存在チェック) + if(json.length() == 1 && !json.isNull(NAME)) { + //nameのパラメータチェック + return json.get(NAME).toString().matches(regex); + //要素数が2(nameとparametersの存在チェック) + } else if(json.length() == 2 && !json.isNull(NAME) && !json.isNull(PARAMETERS)) { + //nameのパラメータチェック(引っかかった場合Falseを返して終了) + if(json.get(NAME).toString().matches(regex)) { + //getOptions = parameters:optionNamesの存在チェック + if (!json.getJSONObject(PARAMETERS).isNull(OPTION_NAMES)) { + JSONArray optionNames = json.getJSONObject(PARAMETERS).getJSONArray(OPTION_NAMES); + //optionNames内の配列のパラメータチェック(引っかかった場合途中でもFalseを返して終了) + for (int i = 0; i < optionNames.length(); i++) { + if (optionNames.get(i).toString().length() < characterLimit) { + if(!checkLogic(regex, optionNames.get(i).toString())) { + return false; + } + } else { + return false; + } + } + return true; + //setOptions = parameters:optionsの存在チェック + } else if(!json.getJSONObject(PARAMETERS).isNull(OPTIONS)) { + JSONObject options = json.getJSONObject(PARAMETERS).getJSONObject(OPTIONS); + for(int i = 0; i < optionsList.length; i++) { + String optionsName = optionsList[i]; + if(options.has(optionsName)) { + if(options.getString(optionsName).length() < characterLimit) { + switch (optionsName) { + case EXPOSURE_PROGRAM: + case ISO: + case SHUTTER_SPEED: + case EXPOSURE_COMPENSATION: + if (!checkLogic(isNum, options.getString(optionsName))) { + return false; + } + break; + default: + if (!checkLogic(regex, options.getString(optionsName))) { + return false; + } + break; + + } + } else { + return false; + } + } + } + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (JSONException je){ + throw je; + } + } + + public static Boolean checkLogic(String regex, String target) { + Pattern p = Pattern.compile(regex); + Matcher m = p.matcher(target); + return m.matches(); + } + + public static Boolean isXCameraModel() { + ThetaModel model = ThetaModel.getValue(ThetaInfo.getThetaModelName()); + return model != THETA_X ? false : true; + } + public interface Callback { void commandsRequest(AsyncHttpServerResponse response, CommandsRequest commandsRequest); } diff --git a/app/src/main/java/com/theta360/automaticfaceblur/network/async/AsyncHttpServerEx.java b/app/src/main/java/com/theta360/automaticfaceblur/network/async/AsyncHttpServerEx.java old mode 100755 new mode 100644 index 3ff9829..21880d6 --- a/app/src/main/java/com/theta360/automaticfaceblur/network/async/AsyncHttpServerEx.java +++ b/app/src/main/java/com/theta360/automaticfaceblur/network/async/AsyncHttpServerEx.java @@ -463,6 +463,16 @@ public void onRequest(AsyncHttpServerRequest request, response.getHeaders().set("Content-Length", String.valueOf(pair.first)); response.code(200); response.getHeaders().add("Content-Type", getContentType(assetPath + path)); + if (assetPath.endsWith(".html") || assetPath.endsWith(".htm")) { + response.getHeaders().add("X-XSS-Protection", "1; mode=block"); + response.getHeaders().add("X-Frame-Options", "SAMEORIGIN"); + response.getHeaders().add("X-Content-Type-Options", "nosniff"); + } else if(assetPath.endsWith(".js")) { + response.getHeaders().add("X-XSS-Protection", "1; mode=block"); + response.getHeaders().add("Content-Security-Policy", "default-src 'self'; script-src 'self';"); + response.getHeaders().add("X-Frame-Options", "SAMEORIGIN"); + response.getHeaders().add("X-Content-Type-Options", "nosniff"); + } Util.pump(is, response, new CompletedCallback() { @Override public void onCompleted(Exception ex) { diff --git a/app/src/main/java/com/theta360/automaticfaceblur/task/GetCaptureModeTask.java b/app/src/main/java/com/theta360/automaticfaceblur/task/GetCaptureModeTask.java index 400809e..afa0a76 100644 --- a/app/src/main/java/com/theta360/automaticfaceblur/task/GetCaptureModeTask.java +++ b/app/src/main/java/com/theta360/automaticfaceblur/task/GetCaptureModeTask.java @@ -20,7 +20,10 @@ import com.theta360.automaticfaceblur.network.HttpConnector; -public class GetCaptureModeTask extends AsyncTask { +import org.json.JSONException; +import org.json.JSONObject; + +public class GetCaptureModeTask extends AsyncTask { private Callback mCallback; private HttpConnector mCamera; @@ -35,22 +38,26 @@ protected void onPreExecute() { } @Override - protected String doInBackground(Void... params) { + protected JSONObject doInBackground(Void... params) { mCamera = new HttpConnector(); return mCamera.getCaptureMode(); } @Override - protected void onPostExecute(String captureMode) { - mCallback.onGetCaptureMode(captureMode); + protected void onPostExecute(JSONObject result) { + try { + mCallback.onGetCaptureMode(result); + } catch (JSONException jsonException) { + jsonException.printStackTrace(); + } } @Override - protected void onCancelled(String result) { + protected void onCancelled(JSONObject result) { mCamera = null; } public interface Callback { - void onGetCaptureMode(String captureMode); + void onGetCaptureMode(JSONObject result) throws JSONException; } } diff --git a/app/src/main/java/com/theta360/automaticfaceblur/task/ImageProcessorTask.java b/app/src/main/java/com/theta360/automaticfaceblur/task/ImageProcessorTask.java old mode 100755 new mode 100644 index f6015c7..bec3d37 --- a/app/src/main/java/com/theta360/automaticfaceblur/task/ImageProcessorTask.java +++ b/app/src/main/java/com/theta360/automaticfaceblur/task/ImageProcessorTask.java @@ -16,6 +16,7 @@ package com.theta360.automaticfaceblur.task; import static com.theta360.automaticfaceblur.MainActivity.DCIM; +import static com.theta360.automaticfaceblur.MainActivity.isXCameraModel; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -56,8 +57,12 @@ public class ImageProcessorTask extends AsyncTask doInBackground(String... params) { Matcher matcher = Pattern.compile("/\\d{3}RICOH.*").matcher(params[0]); if (matcher.find()) { String fileUrl = DCIM + matcher.group(); + if(isXCameraModel()) { + //SDカードだった場合、読み込み先を変更する + fileUrl = fileUrl.replace(EMULATED + "/0", sdMount()); + } try { long start = System.currentTimeMillis(); Bitmap bitmap = blurInputFile(fileUrl); @@ -397,6 +406,19 @@ private void blur(int blurStartX, int blurStartY, int width, int height) { } } + public String sdMount() { + File file = new File(PATH_STORAGE); + String[] fileList = file.list(); + if(fileList.length >= 3) { + for (int i = 0; i < fileList.length; i++) { + if(!fileList[i].equals(EMULATED) && !fileList[i].equals(SELF)) { + return fileList[i]; + } + } + } + return EMULATED + "/0"; + } + private int getRightmostOfLeftImage() { return (int) (mBitmapToDetectFace.getWidth() * ONE_QUARTER_OF_EQUI); } diff --git a/app/src/main/java/com/theta360/automaticfaceblur/task/SetCaptureModeTask.java b/app/src/main/java/com/theta360/automaticfaceblur/task/SetCaptureModeTask.java index 638a375..12a2452 100644 --- a/app/src/main/java/com/theta360/automaticfaceblur/task/SetCaptureModeTask.java +++ b/app/src/main/java/com/theta360/automaticfaceblur/task/SetCaptureModeTask.java @@ -21,6 +21,8 @@ import com.theta360.automaticfaceblur.network.HttpConnector; import com.theta360.automaticfaceblur.network.model.values.Errors; +import org.json.JSONObject; + public class SetCaptureModeTask extends AsyncTask { private static final String STREAMING = "streaming"; private static final String VIDEO = "video"; @@ -29,13 +31,19 @@ public class SetCaptureModeTask extends AsyncTask { private HttpConnector mCamera; private String mCaptureMode; private int mExposureDelay; + private JSONObject mJsonRecord; private boolean mIsStart; + private boolean mIsChange; + private boolean mIsEnded; - public SetCaptureModeTask(Callback callback, String captureMode, int exposureDelay, boolean isStart) { + public SetCaptureModeTask(Callback callback, String captureMode, int exposureDelay, JSONObject jsonRecord, boolean isStart, boolean isChange, boolean isEnded) { this.mCallback = callback; this.mCaptureMode = captureMode; this.mExposureDelay = exposureDelay; + this.mJsonRecord = jsonRecord; this.mIsStart = isStart; + this.mIsChange = isChange; + this.mIsEnded = isEnded; } @@ -59,7 +67,7 @@ protected String doInBackground(Void... params) { if (mCaptureMode.equals(STREAMING)) { mCaptureMode = VIDEO; } - String errorMessage = mCamera.setCaptureMode(mCaptureMode); + String errorMessage = mCamera.setCaptureMode(mCaptureMode, mJsonRecord, mIsEnded, mIsChange); if (errorMessage != null) { mCallback.onSetCaptureModeFailed(Errors.UNEXPECTED); } diff --git a/app/src/main/java/com/theta360/automaticfaceblur/view/MyProgressDialog.java b/app/src/main/java/com/theta360/automaticfaceblur/view/MyProgressDialog.java new file mode 100644 index 0000000..370d1ed --- /dev/null +++ b/app/src/main/java/com/theta360/automaticfaceblur/view/MyProgressDialog.java @@ -0,0 +1,74 @@ +/** + * Copyright 2018 Ricoh Company, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.theta360.automaticfaceblur.view; + +import android.app.Dialog; +import android.app.DialogFragment; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.Bundle; + +import com.theta360.automaticfaceblur.MainActivity; +import com.theta360.automaticfaceblur.R; + +public class MyProgressDialog extends DialogFragment { + public MyProgressDialog(){ + + } + + public static MyProgressDialog newInstance() { + return new MyProgressDialog(); + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + IntentFilter intentFilter = new IntentFilter(); + intentFilter.addAction(MainActivity.ACTION_FINISH_UPDATING); + getActivity().registerReceiver(br, intentFilter); + } + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + Dialog dialog = new Dialog(getActivity()); + dialog.setContentView(R.layout.dialog_progress); + dialog.setCancelable(false); + return dialog; + } + + @Override + public void onDestroy() { + super.onDestroy(); + getActivity().unregisterReceiver(br); + } + + private void closeDialog() { + dismissAllowingStateLoss(); + } + + private BroadcastReceiver br = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + if(action != null && action.equals(MainActivity.ACTION_FINISH_UPDATING)) { + closeDialog(); + } + } + }; +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml old mode 100755 new mode 100644 index 25e3d7e..1c0db58 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,5 +1,5 @@ - - + + + + + + diff --git a/app/src/main/res/layout/dialog_progress.xml b/app/src/main/res/layout/dialog_progress.xml new file mode 100644 index 0000000..57b67a5 --- /dev/null +++ b/app/src/main/res/layout/dialog_progress.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml new file mode 100644 index 0000000..160e5fd --- /dev/null +++ b/app/src/main/res/values-ja/strings.xml @@ -0,0 +1,6 @@ + + Automatic Face Blur BETA + error while taking picture + error + 処理中… + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml old mode 100755 new mode 100644 index 284a00e..a505976 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2,4 +2,5 @@ Automatic Face Blur BETA error while taking picture error + Processing… diff --git a/build.gradle b/build.gradle old mode 100755 new mode 100644 index 374d94c..0421f76 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.2' + classpath 'com.android.tools.build:gradle:4.0.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -18,6 +18,7 @@ allprojects { repositories { google() jcenter() + maven { url 'https://github.com/ricohapi/theta-plugin-library/raw/master/repository' } } } diff --git a/gradle.properties b/gradle.properties old mode 100755 new mode 100644 index 39fd95d..73df659 --- a/gradle.properties +++ b/gradle.properties @@ -22,5 +22,5 @@ ANDROID_BUILD_TARGET_SDK_VERSION=25 ANDROID_SUPPORT_VERSION=27.0.2 TIMBER_VERSION=4.6.0 -GSON_VERSION=2.8.2 +GSON_VERSION=2.9.0 ANDROIDASYNC_VERSION=2.2.1 \ No newline at end of file diff --git a/pluginlibrary/.gitignore b/pluginlibrary/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/pluginlibrary/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/pluginlibrary/build.gradle b/pluginlibrary/build.gradle deleted file mode 100644 index 87b4c78..0000000 --- a/pluginlibrary/build.gradle +++ /dev/null @@ -1,33 +0,0 @@ -apply plugin: 'com.android.library' - -android { - compileSdkVersion 25 - buildToolsVersion "28.0.3" - defaultConfig { - minSdkVersion 25 - targetSdkVersion 25 - versionCode 6 - versionName "2.0.0" - - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - stage - } - lintOptions { - abortOnError false - } -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.android.support:appcompat-v7:25.4.0' - testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.1' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' -} diff --git a/pluginlibrary/proguard-rules.pro b/pluginlibrary/proguard-rules.pro deleted file mode 100644 index f1b4245..0000000 --- a/pluginlibrary/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/pluginlibrary/src/androidTest/java/com/theta360/pluginlibrary/ExampleInstrumentedTest.java b/pluginlibrary/src/androidTest/java/com/theta360/pluginlibrary/ExampleInstrumentedTest.java deleted file mode 100644 index b6a342b..0000000 --- a/pluginlibrary/src/androidTest/java/com/theta360/pluginlibrary/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.theta360.pluginlibrary; - -import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() throws Exception { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getTargetContext(); - - assertEquals("com.theta360.pluginlibrary.test", appContext.getPackageName()); - } -} diff --git a/pluginlibrary/src/main/AndroidManifest.xml b/pluginlibrary/src/main/AndroidManifest.xml deleted file mode 100644 index 1fd0ba6..0000000 --- a/pluginlibrary/src/main/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/UncaughtException.java b/pluginlibrary/src/main/java/com/theta360/pluginlibrary/UncaughtException.java deleted file mode 100644 index 48479bf..0000000 --- a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/UncaughtException.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright 2018 Ricoh Company, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.theta360.pluginlibrary; - -import android.content.Context; -import android.support.annotation.NonNull; -import java.lang.Thread.UncaughtExceptionHandler; - -/** - * UncaughtException - */ -public class UncaughtException implements UncaughtExceptionHandler { - private Context mContext; - private Callback mCallback; - private UncaughtExceptionHandler mUncaughtExceptionHandler; - - public UncaughtException(@NonNull Context context, @NonNull Callback callback) { - mContext = context; - mCallback = callback; - mUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler(); - } - - @Override - public void uncaughtException(Thread t, Throwable e) { - mCallback.onException(e.getMessage()); - } - - public interface Callback { - void onException(String message); - } -} diff --git a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/activity/Constants.java b/pluginlibrary/src/main/java/com/theta360/pluginlibrary/activity/Constants.java deleted file mode 100644 index 43039df..0000000 --- a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/activity/Constants.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.theta360.pluginlibrary.activity; - -/** - * Constants - */ -final class Constants { - static final String RECEPTOR = "com.theta360.receptor"; - static final String MODEL_V = "RICOH THETA V"; - static final String MODEL_Z1 = "RICOH THETA Z1"; - - static final String ACTION_MAIN_CAMERA_CLOSE = "com.theta360.plugin.ACTION_MAIN_CAMERA_CLOSE"; - static final String ACTION_MAIN_CAMERA_OPEN = "com.theta360.plugin.ACTION_MAIN_CAMERA_OPEN"; - static final String ACTION_FINISH_PLUGIN = "com.theta360.plugin.ACTION_FINISH_PLUGIN"; - static final String ACTION_ERROR_OCCURED = "com.theta360.plugin.ACTION_ERROR_OCCURED"; - static final String PACKAGE_NAME = "packageName"; - static final String EXIT_STATUS = "exitStatus"; - static final String MESSAGE = "message"; - - static final String ACTION_LED_SHOW = "com.theta360.plugin.ACTION_LED_SHOW"; - static final String ACTION_LED_BLINK = "com.theta360.plugin.ACTION_LED_BLINK"; - static final String ACTION_LED_HIDE = "com.theta360.plugin.ACTION_LED_HIDE"; - static final String TARGET = "target"; - static final String COLOR = "color"; - static final String PERIOD = "period"; - - static final String ACTION_AUDIO_SHUTTER = "com.theta360.plugin.ACTION_AUDIO_SHUTTER"; - static final String ACTION_AUDIO_SH_OPEN = "com.theta360.plugin.ACTION_AUDIO_SH_OPEN"; - static final String ACTION_AUDIO_SH_CLOSE = "com.theta360.plugin.ACTION_AUDIO_SH_CLOSE"; - static final String ACTION_AUDIO_MOVSTART = "com.theta360.plugin.ACTION_AUDIO_MOVSTART"; - static final String ACTION_AUDIO_MOVSTOP = "com.theta360.plugin.ACTION_AUDIO_MOVSTOP"; - static final String ACTION_AUDIO_SELF = "com.theta360.plugin.ACTION_AUDIO_SELF"; - static final String ACTION_AUDIO_WARNING = "com.theta360.plugin.ACTION_AUDIO_WARNING"; - - static final String ACTION_WLAN_OFF = "com.theta360.plugin.ACTION_WLAN_OFF"; - static final String ACTION_WLAN_AP = "com.theta360.plugin.ACTION_WLAN_AP"; - static final String ACTION_WLAN_CL = "com.theta360.plugin.ACTION_WLAN_CL"; - - static final String ACTION_DATABASE_UPDATE = "com.theta360.plugin.ACTION_DATABASE_UPDATE"; - static final String TARGETS = "targets"; - - static final String ACTION_OLED_DISPLAY_SET = "com.theta360.plugin.ACTION_OLED_DISPLAY_SET"; - static final String DISPLAY = "display"; - static final String ACTION_OLED_IMAGE_SHOW = "com.theta360.plugin.ACTION_OLED_IMAGE_SHOW"; - static final String ACTION_OLED_IMAGE_BLINK = "com.theta360.plugin.ACTION_OLED_IMAGE_BLINK"; - static final String BITMAP = "bitmap"; - static final String ACTION_OLED_TEXT_SHOW = "com.theta360.plugin.ACTION_OLED_TEXT_SHOW"; - static final String TEXT_MIDDLE = "text-middle"; - static final String TEXT_BOTTOM = "text-bottom"; - static final String ACTION_OLED_HIDE = "com.theta360.plugin.ACTION_OLED_HIDE"; - - static final String USER_OPTION = "USER_OPTION"; - static final String IS_AP_CONNECTED = "IS_AP_CONNECTED"; -} diff --git a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/activity/PluginActivity.java b/pluginlibrary/src/main/java/com/theta360/pluginlibrary/activity/PluginActivity.java deleted file mode 100644 index 7ab943a..0000000 --- a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/activity/PluginActivity.java +++ /dev/null @@ -1,412 +0,0 @@ -/** - * Copyright 2018 Ricoh Company, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.theta360.pluginlibrary.activity; - -import android.content.Intent; -import android.content.IntentFilter; -import android.content.pm.ActivityInfo; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.os.Build; -import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v7.app.AppCompatActivity; -import android.view.KeyEvent; -import com.theta360.pluginlibrary.UncaughtException; -import com.theta360.pluginlibrary.UncaughtException.Callback; -import com.theta360.pluginlibrary.callback.KeyCallback; -import com.theta360.pluginlibrary.receiver.KeyReceiver; -import com.theta360.pluginlibrary.values.Display; -import com.theta360.pluginlibrary.values.ExitStatus; -import com.theta360.pluginlibrary.values.LedColor; -import com.theta360.pluginlibrary.values.LedTarget; - -/** - * PluginActivity - */ -public abstract class PluginActivity extends AppCompatActivity { - private boolean isCamera = false; - private boolean isAutoClose = true; - private String mUserOption; - private boolean isApConnected = false; - - private KeyCallback mKeyCallback; - private KeyReceiver mKeyReceiver; - private KeyReceiver.Callback onKeyReceiver = new KeyReceiver.Callback() { - @Override - public void onKeyDownCallback(int keyCode, KeyEvent event) { - if (event.getKeyCode() == KeyReceiver.KEYCODE_MEDIA_RECORD - && event.isLongPress()) { - if (mKeyCallback != null) { - mKeyCallback.onKeyLongPress(keyCode, event); - } - if (isAutoClose) { - close(); - } - } else { - if (mKeyCallback != null) { - if (event.getRepeatCount() == 0) { - mKeyCallback.onKeyDown(keyCode, event); - } else if (event.isLongPress()) { - mKeyCallback.onKeyLongPress(keyCode, event); - } - } - } - } - - @Override - public void onKeyUpCallback(int keyCode, KeyEvent event) { - if (mKeyCallback != null) { - mKeyCallback.onKeyUp(keyCode, event); - } - } - }; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Fix to be portrait - UncaughtException uncaughtException = new UncaughtException(getApplicationContext(), - new Callback() { - @Override - public void onException(String message) { - notificationError(message); - } - }); - Thread.setDefaultUncaughtExceptionHandler(uncaughtException); - } - - @Override - protected void onResume() { - super.onResume(); - - Intent intent = getIntent(); - if (intent != null) { - mUserOption = intent.getStringExtra(Constants.USER_OPTION); - isApConnected = intent.getBooleanExtra(Constants.IS_AP_CONNECTED, false); - } - - mKeyReceiver = new KeyReceiver(onKeyReceiver); - IntentFilter keyFilter = new IntentFilter(); - keyFilter.addAction(KeyReceiver.ACTION_KEY_DOWN); - keyFilter.addAction(KeyReceiver.ACTION_KEY_UP); - registerReceiver(mKeyReceiver, keyFilter); - } - - @Override - protected void onPause() { - unregisterReceiver(mKeyReceiver); - - super.onPause(); - } - - public void setKeyCallback(KeyCallback keyCallback) { - mKeyCallback = keyCallback; - } - - /** - * Auto close setting - * - * @param autoClose true : auto close / false : not auto close - */ - public void setAutoClose(boolean autoClose) { - isAutoClose = autoClose; - } - - /** - * End processing - */ - public void close() { - if (isCamera) { - notificationCameraOpen(); - } - notificationSuccess(); - } - - public String getUserOption() { - return mUserOption; - } - - public boolean isApConnected() { - return isApConnected; - } - - public void notificationCameraOpen() { - isCamera = false; - sendBroadcast(new Intent(Constants.ACTION_MAIN_CAMERA_OPEN)); - } - - public void notificationCameraClose() { - isCamera = true; - sendBroadcast(new Intent(Constants.ACTION_MAIN_CAMERA_CLOSE)); - } - - /** - * Sound of normal capture - */ - public void notificationAudioShutter() { - sendBroadcast(new Intent(Constants.ACTION_AUDIO_SHUTTER)); - } - - /** - * Sound of starting long exposure capture - */ - public void notificationAudioOpen() { - sendBroadcast(new Intent(Constants.ACTION_AUDIO_SH_OPEN)); - } - - /** - * Sound of ending long exposure capture - */ - public void notificationAudioClose() { - sendBroadcast(new Intent(Constants.ACTION_AUDIO_SH_CLOSE)); - } - - /** - * Sound of starting movie recording - */ - public void notificationAudioMovStart() { - sendBroadcast(new Intent(Constants.ACTION_AUDIO_MOVSTART)); - } - - /** - * Sound of stopping movie recording - */ - public void notificationAudioMovStop() { - sendBroadcast(new Intent(Constants.ACTION_AUDIO_MOVSTOP)); - } - - /** - * Sound of working self-timer - */ - public void notificationAudioSelf() { - sendBroadcast(new Intent(Constants.ACTION_AUDIO_SELF)); - } - - /** - * Sound of warning - */ - public void notificationAudioWarning() { - sendBroadcast(new Intent(Constants.ACTION_AUDIO_WARNING)); - } - - /** - * Turn on LED3 with color - * - * @param ledColor target LED - */ - public void notificationLed3Show(@NonNull LedColor ledColor) { - Intent intent = new Intent(Constants.ACTION_LED_SHOW); - intent.putExtra(Constants.TARGET, LedTarget.LED3.toString()); - intent.putExtra(Constants.COLOR, ledColor.toString()); - sendBroadcast(intent); - } - - /** - * Turn on LED - * - * @param ledTarget target LED - */ - public void notificationLedShow(@NonNull LedTarget ledTarget) { - if (ledTarget == LedTarget.LED3) { - notificationLed3Show(LedColor.BLUE); - } else { - Intent intent = new Intent(Constants.ACTION_LED_SHOW); - intent.putExtra(Constants.TARGET, ledTarget.toString()); - sendBroadcast(intent); - } - } - - /** - * Blink LED - * - * @param ledTarget target LED - * @param ledColor color - * @param period period 250-2000 (msec) - */ - public void notificationLedBlink(@NonNull LedTarget ledTarget, LedColor ledColor, int period) { - if (ledColor == null) { - ledColor = LedColor.BLUE; - } - if (period < 250) { - period = 250; - } - if (period > 2000) { - period = 2000; - } - - Intent intent = new Intent(Constants.ACTION_LED_BLINK); - intent.putExtra(Constants.TARGET, ledTarget.toString()); - intent.putExtra(Constants.COLOR, ledColor.toString()); - intent.putExtra(Constants.PERIOD, period); - sendBroadcast(intent); - } - - /** - * Turn off LED - * - * @param ledTarget target LED - */ - public void notificationLedHide(@NonNull LedTarget ledTarget) { - Intent intent = new Intent(Constants.ACTION_LED_HIDE); - intent.putExtra(Constants.TARGET, ledTarget.toString()); - sendBroadcast(intent); - } - - public void notificationWlanOff() { - sendBroadcast(new Intent(Constants.ACTION_WLAN_OFF)); - } - - public void notificationWlanAp() { - sendBroadcast(new Intent(Constants.ACTION_WLAN_AP)); - } - - public void notificationWlanCl() { - sendBroadcast(new Intent(Constants.ACTION_WLAN_CL)); - } - - public void notificationDatabaseUpdate(@NonNull String[] targets) { - Intent intent = new Intent(Constants.ACTION_DATABASE_UPDATE); - intent.putExtra(Constants.TARGETS, targets); - sendBroadcast(intent); - } - - public void notificationOledImageShow(int id) { - BitmapFactory.Options options = new BitmapFactory.Options(); - options.inScaled = false; - Bitmap bitmap = BitmapFactory - .decodeResource(getResources(), id, options); - - notificationOledImageShow(bitmap); - } - - public void notificationOledDisplaySet(Display display) { - if (display == null) { - display = Display.PLUGIN; - } - Intent intent = new Intent(Constants.ACTION_OLED_DISPLAY_SET); - intent.putExtra(Constants.DISPLAY, display.toString()); - sendBroadcast(intent); - } - - public void notificationOledImageShow(Bitmap bitmap) { - Intent intent = new Intent(Constants.ACTION_OLED_IMAGE_SHOW); - intent.putExtra(Constants.BITMAP, bitmap); - sendBroadcast(intent); - } - - public void notificationOledImageBlink(int id, int period) { - if (period < 250) { - period = 250; - } - if (period > 2000) { - period = 2000; - } - - BitmapFactory.Options options = new BitmapFactory.Options(); - options.inScaled = false; - Bitmap bitmap = BitmapFactory - .decodeResource(getResources(), id, options); - - notificationOledImageBlink(bitmap, period); - } - - public void notificationOledImageBlink(Bitmap bitmap, int period) { - if (period < 250) { - period = 250; - } - if (period > 2000) { - period = 2000; - } - - Intent intent = new Intent(Constants.ACTION_OLED_IMAGE_BLINK); - intent.putExtra(Constants.BITMAP, bitmap); - intent.putExtra(Constants.PERIOD, period); - sendBroadcast(intent); - } - - public void notificationOledTextShow(String middle, String bottom) { - Intent intent = new Intent(Constants.ACTION_OLED_TEXT_SHOW); - intent.putExtra(Constants.TEXT_MIDDLE, middle); - intent.putExtra(Constants.TEXT_BOTTOM, bottom); - sendBroadcast(intent); - } - - public void notificationOledHide() { - sendBroadcast(new Intent(Constants.ACTION_OLED_HIDE)); - } - - /** - * Notifying Completion of Plug-in when the plug-in ends normally - */ - public void notificationSuccess() { - Intent intent = new Intent(Constants.ACTION_FINISH_PLUGIN); - intent.putExtra(Constants.PACKAGE_NAME, getPackageName()); - intent.putExtra(Constants.EXIT_STATUS, ExitStatus.SUCCESS.toString()); - sendBroadcast(intent); - - finishAndRemoveTask(); - } - - /** - * Notifying Completion of Plug-in when the plug-in ends with error - * - * @param message error message - */ - public void notificationError(String message) { - Intent intent = new Intent(Constants.ACTION_FINISH_PLUGIN); - intent.putExtra(Constants.PACKAGE_NAME, getPackageName()); - intent.putExtra(Constants.EXIT_STATUS, ExitStatus.FAILURE.toString()); - intent.putExtra(Constants.MESSAGE, message); - sendBroadcast(intent); - - finishAndRemoveTask(); - } - - /** - * Notifying Occurrences of Errors - */ - public void notificationErrorOccured() { - sendBroadcast(new Intent(Constants.ACTION_ERROR_OCCURED)); - } - - public boolean isZ1() { - if (Build.MODEL.equals(Constants.MODEL_Z1)) { - return true; - } - - return false; - } - - public int getReceptorVersion() { - try { - PackageInfo packageInfo = getPackageManager() - .getPackageInfo(Constants.RECEPTOR, PackageManager.GET_META_DATA); - if (packageInfo != null) { - return packageInfo.versionCode; - } - } catch (NameNotFoundException e) { - e.printStackTrace(); - } - - return 0; - } -} diff --git a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/callback/KeyCallback.java b/pluginlibrary/src/main/java/com/theta360/pluginlibrary/callback/KeyCallback.java deleted file mode 100644 index 76c8078..0000000 --- a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/callback/KeyCallback.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2018 Ricoh Company, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.theta360.pluginlibrary.callback; - -import android.view.KeyEvent; - -/** - * KeyCallback - */ -public interface KeyCallback { - void onKeyDown(int keyCode, KeyEvent event); - - void onKeyUp(int keyCode, KeyEvent event); - - void onKeyLongPress(int keyCode, KeyEvent event); -} diff --git a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/callback/TakePictureCallback.java b/pluginlibrary/src/main/java/com/theta360/pluginlibrary/callback/TakePictureCallback.java deleted file mode 100644 index 738ebaa..0000000 --- a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/callback/TakePictureCallback.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright 2018 Ricoh Company, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.theta360.pluginlibrary.callback; - -/** - * TakePictureCallback - */ -public interface TakePictureCallback { - void onTakePicture(String fileUrl); -} diff --git a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/receiver/KeyReceiver.java b/pluginlibrary/src/main/java/com/theta360/pluginlibrary/receiver/KeyReceiver.java deleted file mode 100644 index c03d8de..0000000 --- a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/receiver/KeyReceiver.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2018 Ricoh Company, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.theta360.pluginlibrary.receiver; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.support.annotation.NonNull; -import android.view.KeyEvent; - -/** - * KeyReceiver - */ -public class KeyReceiver extends BroadcastReceiver { - public static final int KEYCODE_CAMERA = 27; - public static final int KEYCODE_MEDIA_RECORD = 130; - public static final int KEYCODE_WLAN_ON_OFF = 284; - public static final int KEYCODE_FUNCTION = 119; - - public static final String ACTION_KEY_DOWN = "com.theta360.plugin.ACTION_KEY_DOWN"; - public static final String ACTION_KEY_UP = "com.theta360.plugin.ACTION_KEY_UP"; - private static final String KEY_CODE = "keyCode"; - private static final String KEY_EVENT = "KeyEvent"; - - private Callback mCallback; - - public KeyReceiver(@NonNull Callback callback) { - mCallback = callback; - } - - @Override - public void onReceive(Context context, Intent intent) { - final String action = intent.getAction(); - - int keyCode = intent.getIntExtra(KEY_CODE, 0); - KeyEvent event = intent.getParcelableExtra(KEY_EVENT); - switch (action) { - case ACTION_KEY_DOWN: - mCallback.onKeyDownCallback(keyCode, event); - break; - case ACTION_KEY_UP: - mCallback.onKeyUpCallback(keyCode, event); - break; - } - } - - public interface Callback { - void onKeyDownCallback(int keyCode, KeyEvent event); - - void onKeyUpCallback(int keyCode, KeyEvent event); - } -} diff --git a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/values/Display.java b/pluginlibrary/src/main/java/com/theta360/pluginlibrary/values/Display.java deleted file mode 100644 index 6afae3d..0000000 --- a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/values/Display.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.theta360.pluginlibrary.values; - -/** - * Display - */ -public enum Display { - PLUGIN("plug-in"), - BASIC("basic"),; - - private final String mDisplay; - - Display(final String display) { - this.mDisplay = display; - } - - @Override - public String toString() { - return this.mDisplay; - } -} diff --git a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/values/ExitStatus.java b/pluginlibrary/src/main/java/com/theta360/pluginlibrary/values/ExitStatus.java deleted file mode 100644 index 9f97704..0000000 --- a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/values/ExitStatus.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2018 Ricoh Company, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.theta360.pluginlibrary.values; - -/** - * ExitStatus - */ -public enum ExitStatus { - SUCCESS("success"), - FAILURE("failure"),; - - private final String mExitStatus; - - ExitStatus(final String exitStatus) { - this.mExitStatus = exitStatus; - } - - @Override - public String toString() { - return this.mExitStatus; - } -} diff --git a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/values/LedColor.java b/pluginlibrary/src/main/java/com/theta360/pluginlibrary/values/LedColor.java deleted file mode 100644 index 8b33aa9..0000000 --- a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/values/LedColor.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2018 Ricoh Company, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.theta360.pluginlibrary.values; - -/** - * LedColor - */ -public enum LedColor { - RED("red", 0b001), - GREEN("green", 0b010), - BLUE("blue", 0b100), - CYAN("cyan", 0b110), - MAGENTA("magenta", 0b101), - YELLOW("yellow", 0b011), - WHITE("white", 0b111),; - - private final String mLedColor; - private final int mLedColorInt; - - LedColor(final String ledColor, final int ledColorInt) { - this.mLedColor = ledColor; - this.mLedColorInt = ledColorInt; - } - - public static LedColor getValue(final String _ledColor) { - for (LedColor ledColor : LedColor.values()) { - if (ledColor.toString().equals(_ledColor)) { - return ledColor; - } - } - - return LedColor.BLUE; - } - - @Override - public String toString() { - return this.mLedColor; - } - - public int toInt() { - return this.mLedColorInt; - } -} diff --git a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/values/LedTarget.java b/pluginlibrary/src/main/java/com/theta360/pluginlibrary/values/LedTarget.java deleted file mode 100644 index cc22c5e..0000000 --- a/pluginlibrary/src/main/java/com/theta360/pluginlibrary/values/LedTarget.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2018 Ricoh Company, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.theta360.pluginlibrary.values; - -/** - * LedTarget - */ -public enum LedTarget { - LED3("LED3"),//WLAN - LED4("LED4"),//Still - LED5("LED5"),//Video - LED6("LED6"),//Live - LED7("LED7"),//Video recording - LED8("LED8");//Error - - private final String mLedTarget; - - LedTarget(final String ledTarget) { - this.mLedTarget = ledTarget; - } - - public static LedTarget getValue(String _ledTarget) { - for (LedTarget ledTarget : LedTarget.values()) { - if (ledTarget.toString().equals(_ledTarget)) { - return ledTarget; - } - } - - return null; - } - - @Override - public String toString() { - return this.mLedTarget; - } -} diff --git a/pluginlibrary/src/main/res/values/strings.xml b/pluginlibrary/src/main/res/values/strings.xml deleted file mode 100644 index 9259ebf..0000000 --- a/pluginlibrary/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - Plugin Library - diff --git a/pluginlibrary/src/test/java/com/theta360/pluginlibrary/ExampleUnitTest.java b/pluginlibrary/src/test/java/com/theta360/pluginlibrary/ExampleUnitTest.java deleted file mode 100644 index 1b649fe..0000000 --- a/pluginlibrary/src/test/java/com/theta360/pluginlibrary/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.theta360.pluginlibrary; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() throws Exception { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle old mode 100755 new mode 100644 index b7f947f..9d495b3 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1 @@ -include ':app', ':pluginlibrary' - -project(':pluginlibrary').projectDir = new File('./pluginlibrary') \ No newline at end of file +include ':app' \ No newline at end of file