Skip to content

Commit

Permalink
Add camera preview to message composition
Browse files Browse the repository at this point in the history
  • Loading branch information
cherryasphalt authored and moxie0 committed Jul 8, 2015
1 parent 13eed3b commit c4a37e3
Show file tree
Hide file tree
Showing 55 changed files with 1,698 additions and 19 deletions.
1 change: 1 addition & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

<permission android:name="org.thoughtcrime.securesms.permission.C2D_MESSAGE"
Expand Down
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ repositories {
maven { // textdrawable
url 'https://dl.bintray.com/amulyakhare/maven'
}
maven {
url 'https://repo.commonsware.com.s3.amazonaws.com'
}
jcenter()
mavenLocal()
}
Expand Down Expand Up @@ -69,6 +72,7 @@ dependencies {
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.madgag.spongycastle:prov:1.51.0.0'
compile 'com.commonsware.cwac:camera:0.6.+'
provided 'com.squareup.dagger:dagger-compiler:1.2.2'

compile 'org.whispersystems:jobmanager:0.11.0'
Expand Down
Binary file added res/drawable-hdpi/quick_camera_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/quick_camera_exit_fullscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/quick_camera_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/quick_camera_fullscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/quick_camera_hide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/quick_camera_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/quick_camera_rear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/quick_shutter_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/quick_camera_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/quick_camera_exit_fullscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/quick_camera_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/quick_camera_fullscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/quick_camera_hide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/quick_camera_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/quick_camera_rear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/quick_shutter_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/quick_camera_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/quick_camera_exit_fullscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/quick_camera_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/quick_camera_fullscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/quick_camera_hide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/quick_camera_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/quick_camera_rear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/quick_shutter_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xxhdpi/quick_camera_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xxhdpi/quick_camera_exit_fullscreen.png
Binary file added res/drawable-xxhdpi/quick_camera_front.png
Binary file added res/drawable-xxhdpi/quick_camera_fullscreen.png
Binary file added res/drawable-xxhdpi/quick_camera_hide.png
Binary file added res/drawable-xxhdpi/quick_camera_light.png
Binary file added res/drawable-xxhdpi/quick_camera_rear.png
Binary file added res/drawable-xxhdpi/quick_shutter_button.png
27 changes: 27 additions & 0 deletions res/drawable/quick_camera_shutter_ring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thickness="2dp"
android:useLevel="false" >
<solid android:color="@android:color/white" />
<size
android:height="52dp"
android:width="52dp" />
</shape>
</item>
<item>
<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thickness="2dp"
android:useLevel="false" >
<solid android:color="#40ffffff" />
<size
android:height="52dp"
android:width="52dp" />
</shape>
</item>
</selector>
37 changes: 37 additions & 0 deletions res/layout-land/quick_camera_controls.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?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="match_parent"
android:gravity="bottom"
tools:background="@android:color/darker_gray">
<ImageButton
android:id="@+id/shutter_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/quick_camera_shutter_ring"
android:src="@drawable/quick_shutter_button"
android:padding="20dp"/>
<ImageButton
android:id="@+id/fullscreen_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="#00000000"
android:src="@drawable/quick_camera_fullscreen"
android:padding="20dp"/>
<ImageButton
android:id="@+id/swap_camera_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:background="#00000000"
android:src="@drawable/quick_camera_front"
android:padding="20dp"
android:visibility="invisible"
tools:visibility="visible"/>
</RelativeLayout>
16 changes: 16 additions & 0 deletions res/layout/conversation_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
android:background="?conversation_background"
android:orientation="vertical">

<org.thoughtcrime.securesms.components.QuickAttachmentDrawer
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/quick_attachment_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent">

<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
Expand Down Expand Up @@ -95,6 +101,14 @@
tools:hint="Send TextSecure message" />
</LinearLayout>

<ImageButton android:id="@+id/quick_attachment_toggle"
android:layout_width="wrap_content"
android:layout_height="44dp"
android:src="?quick_camera_icon"
android:background="@drawable/touch_highlight_background"
android:contentDescription="@string/conversation_activity__quick_attachment_drawer_toggle_description"
android:padding="10dp"/>

<org.thoughtcrime.securesms.components.AnimatingToggle
android:id="@+id/button_toggle"
android:layout_width="50dp"
Expand Down Expand Up @@ -141,4 +155,6 @@

</LinearLayout>
</RelativeLayout>

</org.thoughtcrime.securesms.components.QuickAttachmentDrawer>
</org.thoughtcrime.securesms.components.KeyboardAwareLinearLayout>
37 changes: 37 additions & 0 deletions res/layout/quick_camera_controls.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?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="match_parent"
android:gravity="bottom"
tools:background="@android:color/darker_gray">
<ImageButton
android:id="@+id/shutter_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@drawable/quick_camera_shutter_ring"
android:src="@drawable/quick_shutter_button"
android:padding="20dp"/>
<ImageButton
android:id="@+id/fullscreen_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="#00000000"
android:src="@drawable/quick_camera_fullscreen"
android:padding="20dp"/>
<ImageButton
android:id="@+id/swap_camera_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#00000000"
android:src="@drawable/quick_camera_front"
android:padding="20dp"
android:visibility="invisible"
tools:visibility="visible"/>
</RelativeLayout>
1 change: 1 addition & 0 deletions res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<attr name="emoji_category_places" format="reference"/>
<attr name="emoji_category_symbol" format="reference"/>
<attr name="emoji_category_emoticons" format="reference"/>
<attr name="quick_camera_icon" format="reference"/>

<attr name="conversation_item_background" format="reference"/>
<attr name="conversation_item_bubble_background" format="reference|color"/>
Expand Down
1 change: 1 addition & 0 deletions res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@

<dimen name="color_grid_extra_padding">32dp</dimen>
<dimen name="color_grid_item_size">48dp</dimen>
<dimen name="quick_media_drawer_default_height">250dp</dimen>
</resources>
4 changes: 4 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@
<string name="conversation_activity__compose_description">Message composition</string>
<string name="conversation_activity__emoji_toggle_description">Toggle emoji keyboard</string>
<string name="conversation_activity__attachment_thumbnail">Attachment Thumbnail</string>
<string name="conversation_activity__quick_attachment_drawer_toggle_description">Toggle attachment drawer</string>

<!-- conversation_item -->
<string name="conversation_item__mms_downloading_description">Media message downloading</string>
Expand Down Expand Up @@ -981,6 +982,9 @@
<!-- transport_selection_list_item -->
<string name="transport_selection_list_item__transport_icon">Transport icon</string>

<!-- quick_attachment_drawer -->
<string name="quick_camera_unavailable">Camera unavailable</string>

<!-- EOF -->

</resources>
6 changes: 6 additions & 0 deletions res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<item name="ic_arrow_forward">@drawable/ic_arrow_forward_dark</item>
<item name="lockscreen_watermark">@drawable/lockscreen_watermark_dark</item>
<item name="android:windowBackground">@color/black</item>
<item name="conversation_background">@color/black</item>
</style>

<style name="PopupAnimation" parent="@android:style/Animation">
Expand Down Expand Up @@ -124,6 +125,9 @@
<item name="conversation_item_sent_text_indicator_tab_color">#99000000</item>
<item name="conversation_item_received_text_primary_color">@color/white</item>
<item name="conversation_item_received_text_secondary_color">#BFffffff</item>

<item name="quick_camera_icon">@drawable/quick_camera_light</item>

<item name="conversation_item_background">@drawable/conversation_item_background</item>
<item name="conversation_item_sent_indicator_text_background">@drawable/conversation_item_sent_indicator_text_shape</item>

Expand Down Expand Up @@ -250,6 +254,8 @@
<item name="emoji_category_symbol">@drawable/emoji_category_symbol_dark</item>
<item name="emoji_category_emoticons">@drawable/emoji_category_emoticons_dark</item>

<item name="quick_camera_icon">@drawable/quick_camera_dark</item>

<item name="menu_new_conversation_icon">@drawable/ic_add_white_24dp</item>
<item name="menu_group_icon">@drawable/ic_group_white_24dp</item>
<item name="menu_search_icon">@drawable/ic_search_white_24dp</item>
Expand Down
Loading

0 comments on commit c4a37e3

Please sign in to comment.