From a0183cf45a502b5e6ef7ffe9ddd1aa80eb8a7f87 Mon Sep 17 00:00:00 2001 From: Amadeu Cavalcante Date: Tue, 27 Mar 2018 11:18:00 -0300 Subject: [PATCH] Added PhotoQualityOption return --- README.md | 2 +- build.gradle | 2 +- .../florent37/camerafragment/CameraFragmentApi.java | 3 +++ .../camerafragment/internal/ui/BaseAnncaFragment.java | 10 ++++++++++ .../internal/ui/model/PhotoQualityOption.java | 6 ++++++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a101d82..e87203e 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ CameraFragment comes with some default views In your module [![Download](https://api.bintray.com/packages/florent37/maven/CameraFragment/images/download.svg)](https://bintray.com/florent37/maven/CameraFragment/_latestVersion) ```groovy -compile 'com.github.florent37:camerafragment:1.0.9' +compile 'com.github.florent37:camerafragment:1.0.10' ``` # Community diff --git a/build.gradle b/build.gradle index e351cd7..7992eb0 100644 --- a/build.gradle +++ b/build.gradle @@ -22,6 +22,6 @@ ext { sdk = 25 buildTools = "25.0.0" //keep 25.0.0 for Continuous Integration minSdk = 10 - libraryVersion = "1.0.9" + libraryVersion = "1.0.10" supportVersion = "25.0.0" } diff --git a/camerafragment/src/main/java/com/github/florent37/camerafragment/CameraFragmentApi.java b/camerafragment/src/main/java/com/github/florent37/camerafragment/CameraFragmentApi.java index 2c3f974..9fbb59b 100644 --- a/camerafragment/src/main/java/com/github/florent37/camerafragment/CameraFragmentApi.java +++ b/camerafragment/src/main/java/com/github/florent37/camerafragment/CameraFragmentApi.java @@ -2,6 +2,7 @@ package com.github.florent37.camerafragment; import android.support.annotation.Nullable; +import com.github.florent37.camerafragment.internal.ui.model.PhotoQualityOption; import com.github.florent37.camerafragment.listeners.CameraFragmentControlsListener; import com.github.florent37.camerafragment.listeners.CameraFragmentResultListener; import com.github.florent37.camerafragment.listeners.CameraFragmentStateListener; @@ -17,6 +18,8 @@ public interface CameraFragmentApi { void openSettingDialog(); + PhotoQualityOption[] getPhotoQualities(); + void switchCameraTypeFrontBack(); void switchActionPhotoVideo(); diff --git a/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/ui/BaseAnncaFragment.java b/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/ui/BaseAnncaFragment.java index b27232f..3e68d19 100644 --- a/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/ui/BaseAnncaFragment.java +++ b/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/ui/BaseAnncaFragment.java @@ -50,6 +50,7 @@ import com.github.florent37.camerafragment.listeners.CameraFragmentStateListener import com.github.florent37.camerafragment.listeners.CameraFragmentVideoRecordTextListener; import java.io.File; +import java.util.ArrayList; /* * Created by memfis on 12/1/16. @@ -343,6 +344,15 @@ public abstract class BaseAnncaFragment extends Fragment implements Ca } } + public PhotoQualityOption[] getPhotoQualities() { + ArrayList photoQualityOptions = new ArrayList<>(); + + for (CharSequence photoQualitie: photoQualities) { + photoQualityOptions.add((PhotoQualityOption) photoQualitie); + } + return photoQualityOptions.toArray(new PhotoQualityOption[photoQualityOptions.size()]); + } + @Override public void openSettingDialog() { final Context context = getContext(); diff --git a/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/ui/model/PhotoQualityOption.java b/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/ui/model/PhotoQualityOption.java index 37efe86..bbc54f1 100644 --- a/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/ui/model/PhotoQualityOption.java +++ b/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/ui/model/PhotoQualityOption.java @@ -12,13 +12,19 @@ public class PhotoQualityOption implements CharSequence { @Configuration.MediaQuality private int mediaQuality; private String title; + private Size size; public PhotoQualityOption(@Configuration.MediaQuality int mediaQuality, Size size) { this.mediaQuality = mediaQuality; + this.size = size; title = String.valueOf(size.getWidth()) + " x " + String.valueOf(size.getHeight()); } + public Size getSize() { + return size; + } + @Configuration.MediaQuality public int getMediaQuality() { return mediaQuality;