Permalink
Browse files

improve process of finding the smallest possible preview size

Signed-off-by: Stefan Nussbaumer <st9fan@gmail.com>
  • Loading branch information...
nuss committed Mar 9, 2017
1 parent 3e1d54a commit 523860edebe558564292c664e230997619368259
Showing with 9 additions and 9 deletions.
  1. +1 −1 app/build.gradle
  2. +2 −2 app/src/main/AndroidManifest.xml
  3. +6 −6 app/src/main/java/net/videosc/VideOSC.java
View
@@ -16,7 +16,7 @@ android {
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(output.outputFile.parent,
output.outputFile.name.replace("app-release", "VideOSC-1.1")
output.outputFile.name.replace("app-release", "VideOSC-1.1.1")
// output.outputFile.name.replace("app-", "VideOSC-")
)
}
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.videosc"
android:versionCode="4"
android:versionName="1.1" >
android:versionCode="5"
android:versionName="1.1.1" >
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="22"
android:maxSdkVersion="25"/>
@@ -117,14 +117,14 @@ public void setup() {
// detect smallest possible preview size as that's totally sufficient for our purposes
Camera camera = Camera.open();
List<Camera.Size> camResList = camera.getParameters().getSupportedPreviewSizes();
ArrayList<Integer> productList = new ArrayList<Integer>();
Camera.Size res = camResList.get(0);
for (int i = 1; i < camResList.size(); i++) {
if (camResList.get(i).width * camResList.get(i).width < camResList.get(i-1)
.width * camResList.get(i-1).height) {
res = camResList.get(i);
}
for (Camera.Size size : camResList) {
productList.add(size.width * size.height);
}
int minIndex = productList.indexOf(Collections.min(productList));
Camera.Size res = camResList.get(minIndex);
camera.release();
VideOSCSensors.initSensors(this);

0 comments on commit 523860e

Please sign in to comment.