Merge pull request #72 from geneanet/feature/update_UI
Feature/update ui
@@ -3,7 +3,9 @@
|
||||
"miniature": "Miniature",
|
||||
"capture": "Capture",
|
||||
"acceptePicture": "Valid the picture",
|
||||
"declinePicture": "Decline the picture"
|
||||
"declinePicture": "Decline the picture",
|
||||
"zoomMin": "-",
|
||||
"zoomMax": "+"
|
||||
},
|
||||
"fr": {
|
||||
"miniature": "Miniature",
|
||||
|
||||
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 4.9 KiB |
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<solid android:color="@android:color/white" />
|
||||
<stroke
|
||||
android:width="8dp"
|
||||
android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@+id/seekbarProgress">
|
||||
<clip>
|
||||
<shape>
|
||||
<solid android:color="#444444" />
|
||||
<stroke
|
||||
android:width="6dp"
|
||||
android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 3.7 KiB |
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<solid android:color="@android:color/white" />
|
||||
<stroke
|
||||
android:width="4dp"
|
||||
android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@+id/seekbarProgress">
|
||||
<clip>
|
||||
<shape>
|
||||
<solid android:color="#444444" />
|
||||
<stroke
|
||||
android:width="3dp"
|
||||
android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<solid android:color="@android:color/white" />
|
||||
<stroke
|
||||
android:width="5dp"
|
||||
android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@+id/seekbarProgress">
|
||||
<clip>
|
||||
<shape>
|
||||
<solid android:color="#444444" />
|
||||
<stroke
|
||||
android:width="4dp"
|
||||
android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 6.0 KiB |
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<solid android:color="@android:color/white" />
|
||||
<stroke
|
||||
android:width="10dp"
|
||||
android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@+id/seekbarProgress">
|
||||
<clip>
|
||||
<shape>
|
||||
<solid android:color="#444444" />
|
||||
<stroke
|
||||
android:width="8dp"
|
||||
android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 8.4 KiB |
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<solid android:color="@android:color/white" />
|
||||
<stroke
|
||||
android:width="15dp"
|
||||
android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@+id/seekbarProgress">
|
||||
<clip>
|
||||
<shape>
|
||||
<solid android:color="#444444" />
|
||||
<stroke
|
||||
android:width="12dp"
|
||||
android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 9.9 KiB |
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<solid android:color="@android:color/white" />
|
||||
<stroke
|
||||
android:width="20dp"
|
||||
android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@+id/seekbarProgress">
|
||||
<clip>
|
||||
<shape>
|
||||
<solid android:color="#444444" />
|
||||
<stroke
|
||||
android:width="16dp"
|
||||
android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
@@ -1,37 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="5dip" />
|
||||
<gradient
|
||||
android:startColor="#ffffffff"
|
||||
android:centerColor="#ffdddddd"
|
||||
android:centerY="0.50"
|
||||
android:endColor="#ffffffff"
|
||||
android:angle="270" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@android:id/secondaryProgress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="5dip" />
|
||||
<gradient
|
||||
android:startColor="#FBFCFA"
|
||||
android:endColor="#FBFCFA"
|
||||
android:angle="90" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="5dip" />
|
||||
<gradient
|
||||
android:startColor="#777777"
|
||||
android:endColor="#777777"
|
||||
android:angle="90" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<solid android:color="@android:color/white" />
|
||||
<stroke
|
||||
android:width="14dp"
|
||||
android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@+id/seekbarProgress">
|
||||
<clip>
|
||||
<shape>
|
||||
<solid android:color="#444444" />
|
||||
<stroke
|
||||
android:width="12dp"
|
||||
android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
<size
|
||||
android:height="25dp"
|
||||
android:width="25dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<stroke android:width="21dp" android:color="@android:color/transparent" />
|
||||
<stroke android:width="7dp" android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval" >
|
||||
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#e26760"
|
||||
android:startColor="#e26760"
|
||||
/>
|
||||
|
||||
<size
|
||||
android:height="40dp"
|
||||
android:width="40dp" />
|
||||
|
||||
</shape>
|
||||
@@ -2,123 +2,183 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
|
||||
<!-- Always in first position to put the camera below every elements -->
|
||||
<FrameLayout
|
||||
android:id="@+id/camera_preview"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/photoResized"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/background"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:alpha="0.2"
|
||||
android:scaleType="fitXY" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/flash"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/actionBar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="60dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:onClick="switchFlash"
|
||||
android:src="@drawable/flash" />
|
||||
android:layout_gravity="top"
|
||||
android:background="@color/black"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/default_padding" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/switchCamera"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="false"
|
||||
android:layout_marginTop="150dp"
|
||||
android:src="@drawable/switch_camera"
|
||||
android:onClick="switchCamera" />
|
||||
<ImageButton
|
||||
android:id="@+id/leave"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:background="@android:color/transparent"
|
||||
android:onClick="leaveCamera"
|
||||
android:src="@drawable/back" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/switchCamera"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginLeft="@dimen/activity_vertical_margin"
|
||||
android:background="@android:color/transparent"
|
||||
android:onClick="switchCamera"
|
||||
android:src="@drawable/switch_camera" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/miniature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginLeft="@dimen/activity_vertical_margin"
|
||||
android:background="@android:color/transparent"
|
||||
android:onClick="toggleMiniature"
|
||||
android:src="@drawable/minimise" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/flash"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginLeft="@dimen/activity_vertical_margin"
|
||||
android:background="@android:color/transparent"
|
||||
android:onClick="switchFlash"
|
||||
android:src="@drawable/flash" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/beforePhoto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:gravity="bottom" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/miniature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:onClick="buttonMiniature"
|
||||
android:text="@string/miniature" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/capture"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/round_button"
|
||||
android:src="@drawable/capture" />
|
||||
|
||||
<org.geneanet.customcamera.VerticalSeekBar
|
||||
android:id="@+id/switchOpacity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="300dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="0"
|
||||
android:alpha="0.6"
|
||||
android:max="10"
|
||||
android:maxHeight="13dp"
|
||||
android:minHeight="0dp"
|
||||
android:progress="5"
|
||||
android:progressDrawable="@drawable/custom_opacity_bar"
|
||||
android:secondaryProgress="10"
|
||||
android:thumb="@drawable/thumb"
|
||||
android:thumbOffset="-0.9px" />
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/afterPhoto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/keepPhoto"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:alpha="0.8"
|
||||
android:background="@color/black"
|
||||
android:visibility="invisible" >
|
||||
android:layout_marginBottom="@dimen/default_padding"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/accept"
|
||||
android:layout_width="wrap_content"
|
||||
<TextView
|
||||
android:id="@+id/textZoomMin"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="acceptPhoto"
|
||||
android:src="@drawable/accept"
|
||||
android:background="@android:color/transparent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/decline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:gravity="right"
|
||||
android:text="@string/zoomMin"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/zoomLevel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="declinePhoto"
|
||||
android:src="@drawable/delete"
|
||||
android:background="@android:color/transparent" />
|
||||
android:layout_weight="0.6"
|
||||
android:visibility="visible"
|
||||
android:progressDrawable="@drawable/custom_seekbar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textZoomMax"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:text="@string/zoomMax"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/zoomLevel"
|
||||
android:layout_width="match_parent"
|
||||
<ImageButton
|
||||
android:id="@+id/capture"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/default_padding"
|
||||
android:background="@drawable/round_button"
|
||||
android:src="@drawable/capture" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/keepPhoto"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible" />
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="@color/black"
|
||||
android:visibility="gone" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/decline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="declinePhoto"
|
||||
android:src="@drawable/delete"
|
||||
android:background="@android:color/transparent"
|
||||
android:padding="@dimen/default_padding" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/accept"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="acceptPhoto"
|
||||
android:src="@drawable/accept"
|
||||
android:background="@android:color/transparent"
|
||||
android:padding="@dimen/default_padding" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<org.geneanet.customcamera.VerticalSeekBar
|
||||
android:id="@+id/switchOpacity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="250dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="@dimen/default_padding"
|
||||
android:max="10"
|
||||
android:progress="5"
|
||||
android:progressDrawable="@drawable/custom_seekbar" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="black">#000000</color>
|
||||
<color name="black">#99000000</color>
|
||||
<color name="white">#ffffff</color>
|
||||
</resources>
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="default_padding">10dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -13,4 +13,6 @@
|
||||
<string name="descImage">Il s\'agit de l\'image de fond de l\'appareil photo</string>
|
||||
<string name="acceptePicture">Accepter Photo</string>
|
||||
<string name="declinePicture">Refuser Photo</string>
|
||||
<string name="zoomMin">-</string>
|
||||
<string name="zoomMax">+</string>
|
||||
</resources>
|
||||
|
||||
@@ -4,12 +4,18 @@ import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.Resources.NotFoundException;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Bitmap.CompressFormat;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.DrawableContainer.DrawableContainerState;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.hardware.Camera;
|
||||
import android.hardware.Camera.CameraInfo;
|
||||
import android.hardware.Camera.PictureCallback;
|
||||
@@ -18,6 +24,8 @@ import android.hardware.Camera.Size;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Display;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
@@ -26,7 +34,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
@@ -34,10 +41,12 @@ import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.geneanet.customcamera.CameraPreview;
|
||||
import org.geneanet.customcamera.ManagerCamera;
|
||||
import org.geneanet.customcamera.TransferBigData;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -132,9 +141,9 @@ public class CameraActivity extends Activity {
|
||||
|
||||
zoomLevel.setMax(maxZoom);
|
||||
zoomLevel.setProgress(zoom);
|
||||
zoomLevel.setVisibility(View.VISIBLE);
|
||||
displayZoomLevel(View.VISIBLE);
|
||||
} else {
|
||||
zoomLevel.setVisibility(View.INVISIBLE);
|
||||
displayZoomLevel(View.GONE);
|
||||
}
|
||||
|
||||
updateStateFlash(stateFlash);
|
||||
@@ -185,7 +194,10 @@ public class CameraActivity extends Activity {
|
||||
ImageButton imgIcon = (ImageButton)findViewById(R.id.capture);
|
||||
final Activity currentActivity = this;
|
||||
|
||||
this.setCameraBackgroundColor(this.getIntent().getStringExtra("cameraBackgroundColor"));
|
||||
String backgroundColor = this.getIntent().getStringExtra("cameraBackgroundColor");
|
||||
this.setCameraBackgroundColor(backgroundColor);
|
||||
this.setThumbAtSeekBar((SeekBar)findViewById(R.id.zoomLevel), backgroundColor);
|
||||
this.setThumbAtSeekBar((SeekBar)findViewById(R.id.switchOpacity), backgroundColor);
|
||||
|
||||
imgIcon.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
@@ -270,7 +282,7 @@ public class CameraActivity extends Activity {
|
||||
// Hide the switch camera button if the number of cameras is lower than 2.
|
||||
if(Camera.getNumberOfCameras() < 2){
|
||||
ImageButton switchCamera = (ImageButton) findViewById(R.id.switchCamera);
|
||||
switchCamera.setVisibility(View.INVISIBLE);
|
||||
switchCamera.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,6 +364,40 @@ public class CameraActivity extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set thumb at a seekbar.
|
||||
*
|
||||
* @param color
|
||||
*/
|
||||
protected void setThumbAtSeekBar(SeekBar seekBar, String color) {
|
||||
int colorParsed = Color.parseColor(color);
|
||||
String colorAlpha = color.substring(1);
|
||||
colorAlpha = "#88"+colorAlpha;
|
||||
int colorAlphaParsed = Color.parseColor(colorAlpha);
|
||||
|
||||
StateListDrawable selectorThumb;
|
||||
Resources res = getResources();
|
||||
try {
|
||||
selectorThumb = (StateListDrawable) Drawable.createFromXml(res, res.getXml(R.drawable.custom_thumb));
|
||||
DrawableContainerState thumbState = (DrawableContainerState) selectorThumb.getConstantState();
|
||||
GradientDrawable thumb = (GradientDrawable) thumbState.getChildren()[0];
|
||||
thumb.setColor(colorParsed);
|
||||
Resources r = getResources();
|
||||
int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, r.getDisplayMetrics());
|
||||
thumb.setStroke(px, colorAlphaParsed);
|
||||
seekBar.setThumb(thumb);
|
||||
} catch (NotFoundException e) {
|
||||
Log.e("customCamera", "Xml resource is not found.");
|
||||
e.printStackTrace();
|
||||
} catch (XmlPullParserException e) {
|
||||
Log.e("customCamera", "Xml can't be parsed.");
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
Log.e("customCamera", "Error to create the thumb");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the space between the first two fingers.
|
||||
* @param MotionEvent event Current event which start this calculation.
|
||||
@@ -406,7 +452,7 @@ public class CameraActivity extends Activity {
|
||||
SeekBar zoomLevel = (SeekBar) findViewById(R.id.zoomLevel);
|
||||
zoomLevel.setMax(maxZoom);
|
||||
zoomLevel.setProgress(zoom * 2);
|
||||
zoomLevel.setVisibility(View.VISIBLE);
|
||||
displayZoomLevel(View.VISIBLE);
|
||||
}
|
||||
|
||||
/** To set background in the view. */
|
||||
@@ -474,25 +520,40 @@ public class CameraActivity extends Activity {
|
||||
*/
|
||||
public void buttonMiniature(View view) {
|
||||
ImageView background = (ImageView) findViewById(R.id.background);
|
||||
final Button miniature = (Button) view;
|
||||
ImageButton miniature = (ImageButton) view;
|
||||
|
||||
modeMiniature = true;
|
||||
// Set new size for miniature layout.
|
||||
setParamsMiniature(background, true);
|
||||
// Hide the miniature button.
|
||||
miniature.setVisibility(View.INVISIBLE);
|
||||
|
||||
// Add event on click action for the miniature picture.
|
||||
background.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
modeMiniature = false;
|
||||
ImageView background = (ImageView) view;
|
||||
// Resize miniature.
|
||||
background.setClickable(false);
|
||||
setBackground();
|
||||
miniature.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
if (!modeMiniature) {
|
||||
miniature.setImageResource(R.drawable.minimise);
|
||||
// Reset the default position and size for the background.
|
||||
setBackground();
|
||||
} else {
|
||||
miniature.setImageResource(R.drawable.maximise);
|
||||
// Set new size for miniature layout.
|
||||
setParamsMiniature(background, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the miniature function.
|
||||
*
|
||||
* @param view
|
||||
*/
|
||||
public void toggleMiniature(View view) {
|
||||
modeMiniature = !modeMiniature;
|
||||
buttonMiniature(view);
|
||||
}
|
||||
|
||||
/**
|
||||
* To manage the display of the zoom bar.
|
||||
* @param displayStatus
|
||||
*/
|
||||
public void displayZoomLevel(int displayStatus) {
|
||||
TextView textZoomMin = (TextView) findViewById(R.id.textZoomMin);
|
||||
TextView textZoomMax = (TextView) findViewById(R.id.textZoomMax);
|
||||
SeekBar zoomLevel = (SeekBar) findViewById(R.id.zoomLevel);
|
||||
textZoomMin.setVisibility(displayStatus);
|
||||
textZoomMax.setVisibility(displayStatus);
|
||||
zoomLevel.setVisibility(displayStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -518,17 +579,23 @@ public class CameraActivity extends Activity {
|
||||
* @param paramsMiniature The parameters of the layout.
|
||||
*/
|
||||
public void positioningMiniature(RelativeLayout.LayoutParams paramsMiniature) {
|
||||
if (photoTaken == null) {
|
||||
// Position at the bottom
|
||||
paramsMiniature.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0);
|
||||
paramsMiniature.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
|
||||
} else {
|
||||
// Position at the top
|
||||
paramsMiniature.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
|
||||
paramsMiniature.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
|
||||
}
|
||||
// In all cases, position at the left
|
||||
// Position at the bottom
|
||||
paramsMiniature.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0);
|
||||
paramsMiniature.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
|
||||
// Position at the left
|
||||
paramsMiniature.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
|
||||
|
||||
if (photoTaken != null) {
|
||||
Resources res = getResources();
|
||||
|
||||
int defaultPadding = (int)res.getDimension(R.dimen.default_padding);
|
||||
|
||||
BitmapDrawable image = (BitmapDrawable) res.getDrawable(R.drawable.accept);
|
||||
int marginBottom = image.getBitmap().getHeight() + (defaultPadding * 2);
|
||||
paramsMiniature.setMargins(0, 0, 0, marginBottom);
|
||||
} else {
|
||||
paramsMiniature.setMargins(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -536,31 +603,30 @@ public class CameraActivity extends Activity {
|
||||
*/
|
||||
public void manageDisplayButtons() {
|
||||
LinearLayout keepPhoto = (LinearLayout) findViewById(R.id.keepPhoto);
|
||||
Button miniature = (Button) findViewById(R.id.miniature);
|
||||
ImageButton miniature = (ImageButton) findViewById(R.id.miniature);
|
||||
ImageButton flash = (ImageButton) findViewById(R.id.flash);
|
||||
ImageButton photo = (ImageButton) findViewById(R.id.capture);
|
||||
ImageButton switchCamera = (ImageButton) findViewById(R.id.switchCamera);
|
||||
ImageView background = (ImageView) findViewById(R.id.background);
|
||||
SeekBar zoomLevel = (SeekBar) findViewById(R.id.zoomLevel);
|
||||
SeekBar switchOpacity = (SeekBar) findViewById(R.id.switchOpacity);
|
||||
|
||||
LayoutParams paramsLayoutMiniature = (LinearLayout.LayoutParams) miniature.getLayoutParams();
|
||||
Camera.Parameters paramsCamera = customCamera.getParameters();
|
||||
|
||||
if (!this.getIntent().getBooleanExtra("miniature", true)) {
|
||||
miniature.setVisibility(View.INVISIBLE);
|
||||
miniature.setVisibility(View.GONE);
|
||||
}
|
||||
if (!opacity) {
|
||||
switchOpacity.setVisibility(View.INVISIBLE);
|
||||
switchOpacity.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (photoTaken != null) {
|
||||
// Show/hide elements when a photo is taken
|
||||
keepPhoto.setVisibility(View.VISIBLE);
|
||||
photo.setVisibility(View.INVISIBLE);
|
||||
zoomLevel.setVisibility(View.INVISIBLE);
|
||||
flash.setVisibility(View.INVISIBLE);
|
||||
switchCamera.setVisibility(View.INVISIBLE);
|
||||
photo.setVisibility(View.GONE);
|
||||
displayZoomLevel(View.GONE);
|
||||
flash.setVisibility(View.GONE);
|
||||
switchCamera.setVisibility(View.GONE);
|
||||
|
||||
((LinearLayout.LayoutParams) paramsLayoutMiniature).gravity = Gravity.TOP;
|
||||
miniature.setLayoutParams(paramsLayoutMiniature);
|
||||
@@ -571,22 +637,22 @@ public class CameraActivity extends Activity {
|
||||
|
||||
} else {
|
||||
// Show/hide elements when a photo is not taken
|
||||
keepPhoto.setVisibility(View.INVISIBLE);
|
||||
keepPhoto.setVisibility(View.GONE);
|
||||
photo.setVisibility(View.VISIBLE);
|
||||
if (paramsCamera.isZoomSupported()) {
|
||||
zoomLevel.setVisibility(View.VISIBLE);
|
||||
displayZoomLevel(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (this.getIntent().getBooleanExtra("switchFlash", true) && hasFlash()) {
|
||||
flash.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
flash.setVisibility(View.INVISIBLE);
|
||||
flash.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (this.getIntent().getBooleanExtra("switchCamera", true)) {
|
||||
switchCamera.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
switchCamera.setVisibility(View.INVISIBLE);
|
||||
switchCamera.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
((LinearLayout.LayoutParams) paramsLayoutMiniature).gravity = Gravity.BOTTOM;
|
||||
@@ -814,10 +880,10 @@ public class CameraActivity extends Activity {
|
||||
Bitmap newBitmap = resizePictureTaken();
|
||||
photoResized.setImageBitmap(newBitmap);
|
||||
photoResized.setVisibility(View.VISIBLE);
|
||||
preview.setVisibility(View.INVISIBLE);
|
||||
preview.setVisibility(View.GONE);
|
||||
} else {
|
||||
customCamera.startPreview();
|
||||
photoResized.setVisibility(View.INVISIBLE);
|
||||
photoResized.setVisibility(View.GONE);
|
||||
preview.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@@ -912,6 +978,13 @@ public class CameraActivity extends Activity {
|
||||
this.finish();
|
||||
}
|
||||
|
||||
/**
|
||||
* When the leave button is pressed.
|
||||
*/
|
||||
public void leaveCamera(View v) {
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow to enable or disable the flash of the camera.
|
||||
* @param view The current view.
|
||||
|
||||