From d61840b281ba15c7f78e2df17dfce1cca99dd37e Mon Sep 17 00:00:00 2001 From: MRSa Date: Tue, 29 Dec 2020 21:08:58 +0900 Subject: [PATCH] =?utf8?q?Theta=20V=20=E3=81=AB=E5=AF=BE=E5=BF=9C=E3=81=95?= =?utf8?q?=E3=81=9B=E3=82=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .idea/codeStyles/Project.xml | 18 ++++++++++++++++++ .idea/compiler.xml | 6 ++++++ .idea/gradle.xml | 1 + .idea/misc.xml | 2 +- app/build.gradle | 10 +++++----- .../pkremote/camera/utils/SimpleHttpClient.java | 20 ++++++++++++++++++++ .../connection/ThetaCameraConnectSequence.java | 10 +++++----- .../theta/wrapper/playback/ThetaPlaybackControl.java | 12 ++++++------ build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 10 files changed, 65 insertions(+), 20 deletions(-) create mode 100644 .idea/compiler.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 681f41a..0d15693 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -1,5 +1,23 @@ + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 4bb39d7..334463e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -74,7 +74,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index c4b4d4f..e247652 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "net.osdn.gokigen.pkremote" minSdkVersion 14 targetSdkVersion 29 - versionCode 10800 - versionName "1.8.0" + versionCode 10801 + versionName "1.8.1" } buildTypes { release { @@ -20,10 +20,10 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'androidx.exifinterface:exifinterface:1.2.0' + implementation 'androidx.exifinterface:exifinterface:1.3.2' implementation 'androidx.preference:preference:1.1.1' - implementation 'com.google.android.material:material:1.2.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'com.google.android.material:material:1.2.1' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.vectordrawable:vectordrawable:1.1.0' api files('libs/olycamerakit.jar') diff --git a/app/src/main/java/net/osdn/gokigen/pkremote/camera/utils/SimpleHttpClient.java b/app/src/main/java/net/osdn/gokigen/pkremote/camera/utils/SimpleHttpClient.java index 43f95c9..a064758 100644 --- a/app/src/main/java/net/osdn/gokigen/pkremote/camera/utils/SimpleHttpClient.java +++ b/app/src/main/java/net/osdn/gokigen/pkremote/camera/utils/SimpleHttpClient.java @@ -146,6 +146,16 @@ public class SimpleHttpClient httpCommandBytes(url, "POST", postData, setProperty, null, timeoutMs, callback); } + /** + * + * + * + */ + public static void httpPostBytesWithHeader(String url, String postData, Map setProperty, @Nullable String contentType, int timeoutMs, @NonNull IReceivedMessageCallback callback) + { + httpCommandBytes(url, "POST", postData, setProperty, contentType, timeoutMs, callback); + } + private static void httpCommandBytes(@NonNull String url, @NonNull String requestMethod, @Nullable String postData, @Nullable Map setProperty, @Nullable String contentType, int timeoutMs, @NonNull IReceivedMessageCallback callback) { HttpURLConnection httpConn = null; @@ -360,6 +370,16 @@ public class SimpleHttpClient * * */ + public static Bitmap httpPostBitmapWithHeader(String url, String postData, @Nullable Map setProperty, @Nullable String contentType, int timeoutMs) + { + return (httpCommandBitmap(url, "POST", postData, setProperty, contentType, timeoutMs)); + } + + /** + * + * + * + */ private static Bitmap httpCommandBitmap(@NonNull String url, @NonNull String requestMethod, @Nullable String postData, @Nullable Map setProperty, @Nullable String contentType, int timeoutMs) { HttpURLConnection httpConn = null; diff --git a/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/theta/wrapper/connection/ThetaCameraConnectSequence.java b/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/theta/wrapper/connection/ThetaCameraConnectSequence.java index cdd7a53..9cedada 100644 --- a/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/theta/wrapper/connection/ThetaCameraConnectSequence.java +++ b/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/theta/wrapper/connection/ThetaCameraConnectSequence.java @@ -93,10 +93,10 @@ public class ThetaCameraConnectSequence implements Runnable try { - String response = SimpleHttpClient.httpPost(commandsExecuteUrl, startSessionData, TIMEOUT_MS); + String response = SimpleHttpClient.httpPostWithHeader(commandsExecuteUrl, startSessionData, null, "application/json;charset=utf-8", TIMEOUT_MS); Log.v(TAG, " " + commandsExecuteUrl + " " + startSessionData + " " + response); - String response2 = SimpleHttpClient.httpPost(getStateUrl, "", TIMEOUT_MS); + String response2 = SimpleHttpClient.httpPostWithHeader(getStateUrl, "", null, "application/json;charset=utf-8", TIMEOUT_MS); Log.v(TAG, " " + getStateUrl + " " + response2); onConnectNotify(); @@ -117,10 +117,10 @@ public class ThetaCameraConnectSequence implements Runnable try { - String responseS = SimpleHttpClient.httpPost(commandsExecuteUrl, startSessionData, TIMEOUT_MS); + String responseS = SimpleHttpClient.httpPostWithHeader(commandsExecuteUrl, startSessionData, null, "application/json;charset=utf-8", TIMEOUT_MS); Log.v(TAG, " " + commandsExecuteUrl + " " + startSessionData + " " + responseS); - String response = SimpleHttpClient.httpPost(getStateUrl, "", TIMEOUT_MS); + String response = SimpleHttpClient.httpPostWithHeader(getStateUrl, "", null, "application/json;charset=utf-8", TIMEOUT_MS); Log.v(TAG, " " + getStateUrl + " " + response); if (response.length() > 0) { @@ -140,7 +140,7 @@ public class ThetaCameraConnectSequence implements Runnable String sessionId = jsonObject.getString("sessionId"); String setApiLevelData = "{\"name\":\"camera.setOptions\",\"parameters\":{" + "\"sessionId\" : \"" + sessionId + "\", \"options\":{ \"clientVersion\":2}}}"; - String response3 = SimpleHttpClient.httpPost(commandsExecuteUrl, setApiLevelData, TIMEOUT_MS); + String response3 = SimpleHttpClient.httpPostWithHeader(commandsExecuteUrl, setApiLevelData, null, "application/json;charset=utf-8", TIMEOUT_MS); Log.v(TAG, " " + commandsExecuteUrl + " " + setApiLevelData + " " + response3); } onConnectNotify(); diff --git a/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/theta/wrapper/playback/ThetaPlaybackControl.java b/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/theta/wrapper/playback/ThetaPlaybackControl.java index b7a3d44..9d08786 100644 --- a/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/theta/wrapper/playback/ThetaPlaybackControl.java +++ b/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/theta/wrapper/playback/ThetaPlaybackControl.java @@ -38,7 +38,7 @@ public class ThetaPlaybackControl implements IPlaybackControl private final int maxCount; private final boolean useThetaV21; - private List cameraContentList; + private final List cameraContentList; public ThetaPlaybackControl(@NonNull Activity activity, int timeoutMs, int maxCount) { @@ -101,7 +101,7 @@ public class ThetaPlaybackControl implements IPlaybackControl String postData = "{\"name\":\"camera.getImage\",\"parameters\":{\"_type\":\"thumb\",\"fileUri\":\"" + path + "\"}}"; //Log.v(TAG, " postData : " + postData); - Bitmap bmp = SimpleHttpClient.httpPostBitmap(url, postData, timeoutValue); + Bitmap bmp = SimpleHttpClient.httpPostBitmapWithHeader(url, postData, null, "application/json;charset=utf-8", timeoutValue); HashMap map = new HashMap<>(); map.put("Orientation", 0); callback.onCompleted(bmp, map); @@ -141,7 +141,7 @@ public class ThetaPlaybackControl implements IPlaybackControl { //Log.v(TAG, " exec getFileList"); String imageListurl = "http://192.168.1.1/osc/commands/execute"; - String contentList = SimpleHttpClient.httpPost(imageListurl, paramData, timeoutValue); + String contentList = SimpleHttpClient.httpPostWithHeader(imageListurl, paramData, null, "application/json;charset=utf-8", timeoutValue); if (contentList != null) { JSONObject resultsObject = new JSONObject(contentList).getJSONObject("results"); @@ -232,7 +232,7 @@ public class ThetaPlaybackControl implements IPlaybackControl String postData = "{\"name\":\"camera.getImage\",\"parameters\":{\"_type\":\"full\",\"fileUri\":\"" + path + "\"}}"; try { - SimpleHttpClient.httpPostBytes(urlToGet, postData, null, timeoutValue, new SimpleHttpClient.IReceivedMessageCallback() { + SimpleHttpClient.httpPostBytesWithHeader(urlToGet, postData, null, "application/json;charset=utf-8", timeoutValue, new SimpleHttpClient.IReceivedMessageCallback() { @Override public void onCompleted() { callback.onCompleted(); @@ -295,7 +295,7 @@ public class ThetaPlaybackControl implements IPlaybackControl String contentList; try { - contentList = SimpleHttpClient.httpPost(imageListurl, paramStr, timeoutValue); + contentList = SimpleHttpClient.httpPostWithHeader(imageListurl, paramStr, null, "application/json;charset=utf-8", timeoutValue); if (contentList == null) { // ぬるぽ発行 @@ -345,7 +345,7 @@ public class ThetaPlaybackControl implements IPlaybackControl { String paramStr = "{\"name\":\"camera.listFiles\",\"parameters\":{\"fileType\":\"all\",\"entryCount\":" + maxCount + ",\"maxThumbSize\":640,\"_detail\":false, \"_sort\":\"newest\"}}"; //Log.v(TAG, " paramStr : " + paramStr); - contentList = SimpleHttpClient.httpPost(imageListurl, paramStr, timeoutValue); + contentList = SimpleHttpClient.httpPostWithHeader(imageListurl, paramStr, null, "application/json;charset=utf-8", timeoutValue); if (contentList == null) { // ぬるぽ発行 diff --git a/build.gradle b/build.gradle index 0acabe9..9313af6 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.0.0' + classpath 'com.android.tools.build:gradle:4.1.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 693f1bb..37f7d30 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat May 30 16:01:16 JST 2020 +#Tue Dec 29 19:08:31 JST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip -- 2.11.0