Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

Commit

Permalink
improve process of finding the smallest possible preview size
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Nussbaumer <st9fan@gmail.com>
  • Loading branch information
nuss committed Mar 9, 2017
1 parent 3e1d54a commit 523860e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Expand Up @@ -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-")
)
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
@@ -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"/>
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/net/videosc/VideOSC.java
Expand Up @@ -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);
Expand Down

0 comments on commit 523860e

Please sign in to comment.