use cards views in about and publish avatar activity

Daniel Gultsch created

Change summary

build.gradle                                                    |   1 
src/main/java/eu/siacs/conversations/ui/widget/ScannerView.java |   8 
src/main/res/layout/activity_about.xml                          |  47 
src/main/res/layout/activity_publish_profile_picture.xml        | 113 +-
src/main/res/values-h360dp/dimens.xml                           |   4 
src/main/res/values-h640dp/dimens.xml                           |   4 
src/main/res/values/about.xml                                   |  63 +
src/main/res/values/colors.xml                                  |   7 
src/main/res/values/dimens.xml                                  |   3 
src/main/res/values/strings.xml                                 |  31 
10 files changed, 165 insertions(+), 116 deletions(-)

Detailed changes

build.gradle 🔗

@@ -49,7 +49,6 @@ dependencies {
     implementation 'com.google.zxing:core:3.3.0'
     implementation 'de.measite.minidns:minidns-hla:0.2.4'
     implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
-    implementation 'com.kyleduo.switchbutton:library:1.2.8'
     implementation 'org.whispersystems:signal-protocol-java:2.6.2'
     implementation 'com.makeramen:roundedimageview:2.3.0'
     implementation "com.wefika:flowlayout:0.4.1"

src/main/java/eu/siacs/conversations/ui/widget/ScannerView.java 🔗

@@ -60,10 +60,10 @@ public class ScannerView extends View {
         super(context, attrs);
 
         final Resources res = getResources();
-        maskColor = res.getColor(R.color.scan_mask);
-        maskResultColor = res.getColor(R.color.scan_result_view);
-        laserColor = res.getColor(R.color.scan_laser);
-        dotColor = res.getColor(R.color.scan_dot);
+        maskColor = res.getColor(R.color.black54);
+        maskResultColor = res.getColor(R.color.black87);
+        laserColor = res.getColor(R.color.red500);
+        dotColor = res.getColor(R.color.orange500);
         dotResultColor = res.getColor(R.color.scan_result_dots);
 
         maskPaint = new Paint();

src/main/res/layout/activity_about.xml 🔗

@@ -1,21 +1,32 @@
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    tools:context="eu.siacs.conversations.ui.AboutActivity"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:background="?attr/color_background_primary">
+            xmlns:tools="http://schemas.android.com/tools"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:background="?attr/color_background_secondary"
+            tools:context="eu.siacs.conversations.ui.AboutActivity">
 
-    <TextView
-        android:text="@string/pref_about_message"
-        android:autoLink="web"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:linksClickable="true"
-        android:layout_marginLeft="@dimen/activity_horizontal_margin"
-        android:layout_marginRight="@dimen/activity_horizontal_margin"
-        android:layout_marginTop="@dimen/activity_vertical_margin"
-        android:paddingBottom="@dimen/activity_vertical_margin"
-        android:textSize="?attr/TextSizeBody"
-        android:typeface="monospace"
-        android:fontFamily="monospace"/>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <android.support.v7.widget.CardView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="@dimen/activity_vertical_margin"
+            android:layout_marginLeft="@dimen/activity_horizontal_margin"
+            android:layout_marginRight="@dimen/activity_horizontal_margin"
+            android:layout_marginTop="@dimen/activity_vertical_margin">
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:autoLink="web"
+                android:fontFamily="monospace"
+                android:linksClickable="true"
+                android:padding="@dimen/card_padding_regular"
+                android:text="@string/pref_about_message"
+                android:textAppearance="@style/TextAppearance.AppCompat.Body1"
+                android:typeface="monospace"/>
+        </android.support.v7.widget.CardView>
+    </LinearLayout>
 </ScrollView>

src/main/res/layout/activity_publish_profile_picture.xml 🔗

@@ -1,42 +1,62 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:background="?attr/color_background_primary" >
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:background="?attr/color_background_primary">
 
-    <LinearLayout
-        android:id="@+id/account_image_wrapper"
-        android:layout_width="wrap_content"
+    <android.support.v7.widget.CardView
+        android:layout_width="fill_parent"
         android:layout_height="wrap_content"
-        android:layout_alignParentTop="true"
-        android:layout_centerHorizontal="true"
-        android:layout_marginBottom="8dp"
-        android:layout_marginTop="24dp"
-        android:background="@drawable/account_image_border" >
+        android:layout_marginBottom="@dimen/activity_vertical_margin"
+        android:layout_marginLeft="@dimen/activity_horizontal_margin"
+        android:layout_marginRight="@dimen/activity_horizontal_margin"
+        android:layout_marginTop="@dimen/activity_vertical_margin">
 
-        <ImageView
-            android:id="@+id/account_image"
-            android:layout_width="192dp"
-            android:layout_height="192dp" />
-    </LinearLayout>
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center_horizontal"
+            android:orientation="vertical">
 
-    <TextView
-        android:id="@+id/hint"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/account_image_wrapper"
-        android:layout_centerHorizontal="true"
-        android:text="@string/touch_to_choose_picture"
-        android:textColor="?attr/color_text_secondary" />
+            <FrameLayout
+                android:id="@+id/account_image_wrapper"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginBottom="8dp"
+                android:layout_marginTop="@dimen/publish_avatar_top_margin"
+                android:background="@drawable/account_image_border">
 
-    <TextView
-        android:id="@+id/secondary_hint"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/hint"
-        android:layout_centerHorizontal="true"
-        android:text="@string/or_long_press_for_default"
-        android:textColor="?attr/color_text_secondary" />
+                <ImageView
+                    android:id="@+id/account_image"
+                    android:layout_width="@dimen/publish_avatar_size"
+                    android:layout_height="@dimen/publish_avatar_size"/>
+            </FrameLayout>
+
+            <TextView
+                android:id="@+id/hint"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/touch_to_choose_picture"
+                android:textColor="?attr/color_text_secondary"/>
+
+            <TextView
+                android:id="@+id/secondary_hint"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/or_long_press_for_default"
+                android:textColor="?attr/color_text_secondary"/>
+
+            <TextView
+                android:id="@+id/hint_or_warning"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="8dp"
+                android:layout_marginBottom="8dp"
+                android:textColor="?attr/color_text_primary"
+                android:textSize="?attr/TextSizeBody"/>
+
+        </LinearLayout>
+    </android.support.v7.widget.CardView>
 
     <LinearLayout
         android:id="@+id/button_bar"
@@ -44,7 +64,7 @@
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
         android:layout_alignParentLeft="true"
-        android:layout_alignParentRight="true" >
+        android:layout_alignParentRight="true">
 
         <Button
             android:id="@+id/cancel_button"
@@ -53,14 +73,14 @@
             android:layout_height="wrap_content"
             android:layout_weight="1"
             android:text="@string/cancel"
-            android:textColor="?attr/color_text_primary" />
+            android:textColor="?attr/color_text_primary"/>
 
         <View
             android:layout_width="1dp"
             android:layout_height="fill_parent"
             android:layout_marginBottom="7dp"
             android:layout_marginTop="7dp"
-            android:background="?attr/divider" />
+            android:background="?attr/divider"/>
 
         <Button
             android:id="@+id/publish_button"
@@ -70,28 +90,7 @@
             android:layout_weight="1"
             android:enabled="false"
             android:text="@string/publish"
-            android:textColor="?attr/color_text_secondary" />
-    </LinearLayout>
-
-    <LinearLayout
-        android:layout_width="wrap_content"
-        android:layout_height="fill_parent"
-        android:layout_above="@+id/button_bar"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentRight="true"
-        android:layout_below="@+id/secondary_hint"
-        android:gravity="center_vertical"
-        android:orientation="vertical"
-        android:paddingLeft="8dp"
-        android:paddingRight="8dp" >
-        <TextView
-            android:id="@+id/hint_or_warning"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="8dp"
-            android:minLines="3"
-            android:textColor="?attr/color_text_primary"
-            android:textSize="?attr/TextSizeBody" />
+            android:textColor="?attr/color_text_secondary"/>
     </LinearLayout>
 
 </RelativeLayout>

src/main/res/values/about.xml 🔗

@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (c) 2018, Daniel Gultsch All rights reserved.
+  ~
+  ~ Redistribution and use in source and binary forms, with or without modification,
+  ~ are permitted provided that the following conditions are met:
+  ~
+  ~ 1. Redistributions of source code must retain the above copyright notice, this
+  ~ list of conditions and the following disclaimer.
+  ~
+  ~ 2. Redistributions in binary form must reproduce the above copyright notice,
+  ~ this list of conditions and the following disclaimer in the documentation and/or
+  ~ other materials provided with the distribution.
+  ~
+  ~ 3. Neither the name of the copyright holder nor the names of its contributors
+  ~ may be used to endorse or promote products derived from this software without
+  ~ specific prior written permission.
+  ~
+  ~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+  ~ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+  ~ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+  ~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+  ~ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+  ~ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  ~ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+  ~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  ~ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+  ~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  -->
+
+<resources>
+    <string name="pref_about_message" translatable="false">
+			Conversations • the very last word in instant messaging.
+			\n\nCopyright © 2014-2018 Daniel Gultsch
+			\n\nThis program is free software: you can redistribute it and/or modify
+			it under the terms of the GNU General Public License as published by
+			the Free Software Foundation, either version 3 of the License, or
+			(at your option) any later version.
+			\n\nThis program is distributed in the hope that it will be useful,
+			but WITHOUT ANY WARRANTY; without even the implied warranty of
+			MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+			GNU General Public License for more details.
+			\n\nYou should have received a copy of the GNU General Public License
+			along with this program. If not, see https://www.gnu.org/licenses
+			\n\nDownload the full source code at https://github.com/siacs/Conversations
+			\n\n\nLibraries
+			\n\nhttps://github.com/ypresto/android-transcoder\n(Apache License, Version 2.0)
+			\n\nhttps://www.bouncycastle.org\n(The MIT License (MIT))
+			\n\nhttps://www.gnu.org/software/libidn\n(Apache License, Version 2.0)
+			\n\nhttps://github.com/ge0rg/MemorizingTrustManager\n(The MIT License (MIT))
+			\n\nhttps://github.com/rtreffer/minidns\n(WTFPL)
+			\n\nhttps://github.com/open-keychain/openkeychain-api-lib\n(Apache License, Version 2.0)
+			\n\nhttps://developer.android.com/tools/support-library\n(Apache License, Version 2.0)
+			\n\nhttps://github.com/zxing/zxing\n(Apache License, Version 2.0)
+			\n\nhttps://github.com/google/material-design-icons\n(CC BY 4.0)
+			\n\nhttps://github.com/timroes/EnhancedListView\n(Apache License, Version 2.0)
+			\n\nhttps://github.com/leolin310148/ShortcutBadger\n(Apache License, Version 2.0)
+			\n\nhttps://github.com/WhisperSystems/libaxolotl-java\n(GPLv3)
+			\n\nhttps://github.com/vinc3m1/RoundedImageView\n(Apache License, Version 2.0)
+			\n\nhttps://github.com/jdamcd/android-crop\n(Apache License, Version 2.0)
+			\n\nhttps://github.com/zxing/zxing\n(Apache License, Version 2.0)
+	</string>
+</resources>

src/main/res/values/colors.xml 🔗

@@ -17,6 +17,7 @@
 	<color name="grey500">#ff9e9e9e</color>
 	<color name="grey800">#ff424242</color>
 	<color name="grey900">#ff282828</color>
+	<color name="red500">#fff44336</color>
 	<color name="red800">#ffc62828</color>
 	<color name="orange500">#ffff9800</color>
 	<color name="green500">#ff259b24</color>
@@ -25,9 +26,5 @@
 	<color name="unreadcountdark">#ff326130</color>
 
 	<!-- scanner -->
-	<color name="scan_mask">#60000000</color>
-	<color name="scan_laser">#cc0000</color>
-	<color name="scan_dot">#ff6600</color>
-	<color name="scan_result_view">#b0000000</color>
-	<color name="scan_result_dots">#c099cc00</color>
+	<color name="scan_result_dots">#c04CAF50</color>
 </resources>

src/main/res/values/dimens.xml 🔗

@@ -12,6 +12,9 @@
 	<dimen name="swipe_handle_size">32dp</dimen>
 	<dimen name="avatar_item_distance">16dp</dimen>
 
+	<dimen name="publish_avatar_top_margin">8dp</dimen>
+	<dimen name="publish_avatar_size">96dp</dimen>
+
 	<!-- scanner -->
 	<dimen name="scan_laser_width">4dp</dimen>
 	<dimen name="scan_dot_size">8dp</dimen>

src/main/res/values/strings.xml 🔗

@@ -282,37 +282,6 @@
 	<string name="pref_expert_options_summary">Please be careful with these</string>
 	<string name="title_activity_about">About Conversations</string>
 	<string name="pref_about_conversations_summary">Build and licensing information</string>
-	<string name="pref_about_message" translatable="false">
-			Conversations • the very last word in instant messaging.
-			\n\nCopyright © 2014-2018 Daniel Gultsch
-			\n\nThis program is free software: you can redistribute it and/or modify
-			it under the terms of the GNU General Public License as published by
-			the Free Software Foundation, either version 3 of the License, or
-			(at your option) any later version.
-			\n\nThis program is distributed in the hope that it will be useful,
-			but WITHOUT ANY WARRANTY; without even the implied warranty of
-			MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-			GNU General Public License for more details.
-			\n\nYou should have received a copy of the GNU General Public License
-			along with this program. If not, see https://www.gnu.org/licenses
-			\n\nDownload the full source code at https://github.com/siacs/Conversations
-			\n\n\nLibraries
-			\n\nhttps://www.bouncycastle.org\n(The MIT License (MIT))
-			\n\nhttps://www.gnu.org/software/libidn\n(Apache License, Version 2.0)
-			\n\nhttps://github.com/ge0rg/MemorizingTrustManager\n(The MIT License (MIT))
-			\n\nhttps://github.com/rtreffer/minidns\n(WTFPL)
-			\n\nhttps://github.com/open-keychain/openkeychain-api-lib\n(Apache License, Version 2.0)
-			\n\nhttps://github.com/jitsi/otr4j\n(LGPL-3.0)
-			\n\nhttps://developer.android.com/tools/support-library\n(Apache License, Version 2.0)
-			\n\nhttps://github.com/zxing/zxing\n(Apache License, Version 2.0)
-			\n\nhttps://github.com/google/material-design-icons\n(CC BY 4.0)
-			\n\nhttps://github.com/timroes/EnhancedListView\n(Apache License, Version 2.0)
-			\n\nhttps://github.com/leolin310148/ShortcutBadger\n(Apache License, Version 2.0)
-			\n\nhttps://github.com/kyleduo/SwitchButton\n(Apache License, Version 2.0)
-			\n\nhttps://github.com/WhisperSystems/libaxolotl-java\n(GPLv3)
-			\n\nhttps://github.com/vinc3m1/RoundedImageView\n(Apache License, Version 2.0)
-			\n\nhttps://github.com/jdamcd/android-crop\n(Apache License, Version 2.0)
-	</string>
 	<string name="title_pref_quiet_hours">Quiet Hours</string>
 	<string name="title_pref_quiet_hours_start_time">Start time</string>
 	<string name="title_pref_quiet_hours_end_time">End time</string>