Implemented new camera capture flow.

A new, fullscreen camera capture flow that easily allows you to capture
and edit a photo before sending it. Replaces the current half-screen
camera button.
This commit is contained in:
Greyson Parrelli
2018-09-20 13:27:18 -07:00
parent e9a38bab1e
commit 08ace15f95
102 changed files with 1798 additions and 350 deletions

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="100"
android:interpolator="@android:anim/decelerate_interpolator"
android:fromXScale=".85"
android:fromYScale=".85"
android:toXScale="1.0"
android:toYScale="1.0"
android:pivotX="50%"
android:pivotY="50%" />
</set>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="100"
android:interpolator="@android:anim/decelerate_interpolator"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:toXScale=".85"
android:toYScale=".85"
android:pivotX="50%"
android:pivotY="50%" />
</set>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:interpolator="@android:anim/decelerate_interpolator"
android:duration="350"
android:fromYDelta="100%"
android:toYDelta="0%" />
</set>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:interpolator="@android:anim/decelerate_interpolator"
android:duration="250"
android:fromYDelta="0%"
android:toYDelta="100%" />
</set>

6
res/anim/fade_in.xml Normal file
View File

@@ -0,0 +1,6 @@
<alpha
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:interpolator/decelerate_quad"
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="@android:integer/config_shortAnimTime" />

6
res/anim/fade_out.xml Normal file
View File

@@ -0,0 +1,6 @@
<alpha
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:interpolator/decelerate_quad"
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="@android:integer/config_shortAnimTime" />

7
res/anim/stationary.xml Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="250"
android:fromYDelta="0%"
android:toYDelta="0%" />
</set>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 961 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 926 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 654 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 482 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 916 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 840 B

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="1dp"
android:color="@color/core_light_45" />
<solid
android:color="@color/transparent_black_90" />
<corners
android:radius="20dp" />
</shape>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/core_black">
<ImageView
android:id="@+id/camera_snapshot"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerInside"
tools:src="@color/grey_800"/>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:layout_gravity="right|end">
<Button
android:id="@+id/camera_capture_button"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_camera_shutter" />
<ImageButton
android:id="@+id/camera_flip_button"
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_below="@+id/camera_capture_button"
android:layout_marginTop="40dp"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_camera_front"
android:scaleType="fitCenter"
android:background="?selectableItemBackgroundBorderless"
android:visibility="gone"
tools:visibility="visible" />
</RelativeLayout>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_gravity="bottom">
<Button
android:id="@+id/camera_capture_button"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_camera_shutter" />
<ImageButton
android:id="@+id/camera_flip_button"
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/camera_capture_button"
android:layout_toStartOf="@+id/camera_capture_button"
android:layout_marginRight="40dp"
android:layout_marginEnd="40dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_camera_front"
android:scaleType="fitCenter"
android:background="?selectableItemBackgroundBorderless"
android:visibility="gone"
tools:visibility="visible" />
</RelativeLayout>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextureView
android:id="@+id/camera_preview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/camera_controls_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

View File

@@ -2,22 +2,10 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:context="org.thoughtcrime.securesms.scribbles.ScribbleActivity">
<org.thoughtcrime.securesms.scribbles.widget.ScribbleView
android:id="@+id/scribble_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center" />
<org.thoughtcrime.securesms.scribbles.ScribbleHud
android:id="@+id/scribble_hud"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</FrameLayout>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.thoughtcrime.securesms.scribbles.ScribbleActivity">
<org.thoughtcrime.securesms.scribbles.widget.ScribbleView
android:id="@+id/scribble_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center" />
<org.thoughtcrime.securesms.scribbles.ScribbleHud
android:id="@+id/scribble_hud"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.components.emoji.EmojiDrawer
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/emoji_drawer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/core_light_90"
android:visibility="gone" />

View File

@@ -1,89 +1,198 @@
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:parentTag="android.widget.LinearLayout"
tools:background="@color/core_light_60">
<ImageView
android:id="@+id/scribble_save_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:src="@drawable/ic_check_white_24dp"
android:padding="12dp"
android:background="?attr/selectableItemBackgroundBorderless"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ImageView
android:id="@+id/scribble_save_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left|start"
android:padding="12dp"
android:src="@drawable/ic_check_white_24dp"
android:background="?attr/selectableItemBackgroundBorderless"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right|end"
android:orientation="vertical"
android:animateLayoutChanges="true">
<ImageView
android:id="@+id/scribble_text_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_scribble_text"
android:padding="12dp"
android:background="?attr/selectableItemBackgroundBorderless"/>
<ImageView
android:id="@+id/scribble_draw_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_scribble_brush"
android:padding="12dp"
android:background="?attr/selectableItemBackgroundBorderless"/>
<ImageView
android:id="@+id/scribble_highlight_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_scribble_highlight"
android:padding="12dp"
android:background="?attr/selectableItemBackgroundBorderless"/>
<ImageView
android:id="@+id/scribble_sticker_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_scribble_sticker"
android:padding="12dp"
android:background="?attr/selectableItemBackgroundBorderless"/>
<ImageView
android:id="@+id/scribble_undo_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_scribble_undo"
android:padding="12dp"
android:background="?attr/selectableItemBackgroundBorderless"/>
<ImageView
android:id="@+id/scribble_delete_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_scribble_delete"
android:padding="12dp"
android:background="?attr/selectableItemBackgroundBorderless"/>
<org.thoughtcrime.securesms.scribbles.widget.VerticalSlideColorPicker
android:id="@+id/scribble_color_picker"
android:layout_width="26dp"
android:layout_height="170dp"
android:layout_gravity="center"
android:layout_marginTop="12dp"
app:pickerBorderWidth="4dp"
app:pickerBorderColor="@color/white"
app:pickerColors="@array/scribble_colors"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/scribble_color_palette"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_gravity="center_horizontal"/>
</LinearLayout>
</FrameLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right|top"
android:orientation="vertical"
android:animateLayoutChanges="true">
android:id="@+id/scribble_compose_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingBottom="6dp"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:id="@+id/scribble_text_button"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/ic_text_fields_white_24dp"
android:padding="12dp"
android:background="?attr/selectableItemBackgroundBorderless"/>
android:layout_weight="1"
android:paddingLeft="10dp"
android:paddingStart="10dp"
android:orientation="horizontal"
android:background="@drawable/compose_background_camera">
<ImageView
android:id="@+id/scribble_draw_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_brush_white_24dp"
android:padding="12dp"
android:background="?attr/selectableItemBackgroundBorderless"/>
<org.thoughtcrime.securesms.components.emoji.EmojiToggle
android:id="@+id/scribble_emoji_toggle"
android:layout_width="wrap_content"
android:layout_height="@dimen/conversation_compose_height"
android:layout_gravity="bottom"
android:paddingLeft="4dp"
android:paddingStart="4dp"
android:paddingRight="6dp"
android:paddingEnd="6dp"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/conversation_activity__emoji_toggle_description" />
<ImageView
android:id="@+id/scribble_highlight_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/baseline_highlight_white_24"
android:padding="12dp"
android:background="?attr/selectableItemBackgroundBorderless"/>
<Space
android:layout_width="0dp"
android:layout_height="@dimen/conversation_compose_height" />
<ImageView
android:id="@+id/scribble_sticker_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_tag_faces_white_24dp"
android:padding="12dp"
android:background="?attr/selectableItemBackgroundBorderless"/>
<org.thoughtcrime.securesms.components.ComposeText
style="@style/ComposeEditText"
android:id="@+id/scribble_compose_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:nextFocusForward="@+id/send_button"
android:nextFocusRight="@+id/send_button"
tools:visibility="invisible"
tools:hint="Send TextSecure message" />
<ImageView
android:id="@+id/scribble_undo_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_replay_white_24dp"
android:padding="12dp"
android:background="?attr/selectableItemBackgroundBorderless"/>
</LinearLayout>
<ImageView
android:id="@+id/scribble_delete_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_delete_white_24dp"
android:padding="12dp"
android:background="?attr/selectableItemBackgroundBorderless"/>
<FrameLayout
android:id="@+id/scribble_send_button_bkg"
android:layout_width="@dimen/conversation_compose_height"
android:layout_height="@dimen/conversation_compose_height"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:layout_gravity="bottom"
android:background="@drawable/circle_tintable"
tools:backgroundTint="@color/core_blue">
<org.thoughtcrime.securesms.scribbles.widget.VerticalSlideColorPicker
android:id="@+id/scribble_color_picker"
android:layout_width="26dp"
android:layout_height="170dp"
android:layout_gravity="center"
android:layout_marginTop="12dp"
app:pickerBorderWidth="4dp"
app:pickerBorderColor="@color/white"
app:pickerColors="@array/scribble_colors"/>
<org.thoughtcrime.securesms.components.SendButton
android:id="@+id/scribble_send_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingTop="6dp"
android:paddingRight="6dp"
android:paddingBottom="6dp"
android:paddingLeft="11dp"
android:scaleType="fitCenter"
android:contentDescription="@string/conversation_activity__send"
android:src="?conversation_transport_sms_indicator"
android:background="@drawable/circle_touch_highlight_background" />
<android.support.v7.widget.RecyclerView
android:id="@+id/scribble_color_palette"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_gravity="center_horizontal"/>
</FrameLayout>
</LinearLayout>
<TextView
android:id="@+id/scribble_characters_left"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:paddingBottom="6dp"
android:visibility="gone"
tools:visibility="visible"
tools:text="160/160 (1)" />
<ViewStub
android:id="@+id/scribble_emoji_drawer_stub"
android:layout="@layout/scribble_fragment_emojidrawer_stub"
android:inflatedId="@+id/emoji_drawer"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</merge>

View File

@@ -3,6 +3,5 @@
<style name="TextSecure.ScribbleTheme" parent="TextSecure.DarkNoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
</resources>

View File

@@ -77,6 +77,10 @@
<!-- CallScreen -->
<string name="CallScreen_Incoming_call">Incoming call</string>
<!-- CameraActivity -->
<string name="CameraActivity_camera_unavailable">Camera unavailable.</string>
<string name="CameraActivity_image_save_failure">Failed to save image.</string>
<!-- ClearProfileActivity -->
<string name="ClearProfileActivity_remove">Remove</string>
<string name="ClearProfileActivity_remove_profile_photo">Remove profile photo?</string>