Browse Source

Merge pull request #1147 from nextcloud/biometricsUpdate

Optimize lock-screen layout/colors
Andy Scherzinger 4 years ago
parent
commit
8e208165f0

+ 5 - 4
app/build.gradle

@@ -126,6 +126,7 @@ android {
 }
 
 ext {
+    coilKtVersion = "0.9.1"
     daggerVersion = "2.34.1"
     powermockVersion = "2.0.9"
     workVersion = "2.3.0"
@@ -223,9 +224,9 @@ dependencies {
     implementation 'com.github.mario.fresco:animated-gif:111'
     implementation 'com.github.mario.fresco:imagepipeline-okhttp3:111'
     implementation  group: 'joda-time', name: 'joda-time', version: '2.10.3'
-    implementation 'io.coil-kt:coil:0.9.1'
-    implementation("io.coil-kt:coil-gif:0.9.1")
-    implementation("io.coil-kt:coil-svg:0.9.1")
+    implementation "io.coil-kt:coil:${coilKtVersion}"
+    implementation("io.coil-kt:coil-gif:${coilKtVersion}")
+    implementation("io.coil-kt:coil-svg:${coilKtVersion}")
     implementation 'com.github.natario1:Autocomplete:v1.1.0'
 
     implementation 'com.github.cotechde.hwsecurity:hwsecurity-fido:2.4.5'
@@ -255,7 +256,7 @@ dependencies {
     implementation 'com.elyeproj.libraries:loaderviewlibrary:2.0.0'
 
     testImplementation 'junit:junit:4.13'
-    testImplementation 'org.mockito:mockito-core:3.0.0'
+    testImplementation 'org.mockito:mockito-core:3.8.0'
     testImplementation "org.powermock:powermock-core:${powermockVersion}"
     testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}"
     testImplementation "org.powermock:powermock-api-mockito2:${powermockVersion}"

+ 16 - 4
app/src/main/java/com/nextcloud/talk/controllers/LockedController.java

@@ -2,6 +2,8 @@
  * Nextcloud Talk application
  *
  * @author Mario Danic
+ * @author Andy Scherzinger
+ * Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
  * Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
  *
  * This program is free software: you can redistribute it and/or modify
@@ -34,15 +36,19 @@ import android.view.ViewGroup;
 import androidx.annotation.NonNull;
 import androidx.annotation.RequiresApi;
 import androidx.biometric.BiometricPrompt;
+import androidx.core.content.res.ResourcesCompat;
 import androidx.fragment.app.FragmentActivity;
 import autodagger.AutoInjector;
 import butterknife.OnClick;
 import com.nextcloud.talk.R;
 import com.nextcloud.talk.application.NextcloudTalkApplication;
 import com.nextcloud.talk.controllers.base.BaseController;
+import com.nextcloud.talk.utils.DisplayUtils;
 import com.nextcloud.talk.utils.SecurityUtils;
 import com.nextcloud.talk.utils.preferences.AppPreferences;
 
+import org.jetbrains.annotations.NotNull;
+
 import javax.inject.Inject;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
@@ -55,6 +61,7 @@ public class LockedController extends BaseController {
     @Inject
     AppPreferences appPreferences;
 
+    @NotNull
     @Override
     protected View inflateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) {
         return inflater.inflate(R.layout.controller_locked, container, false);
@@ -64,20 +71,21 @@ public class LockedController extends BaseController {
     protected void onViewBound(@NonNull View view) {
         super.onViewBound(view);
         NextcloudTalkApplication.Companion.getSharedApplication().getComponentApplication().inject(this);
-        if (getActionBar() != null) {
-            getActionBar().hide();
-        }
     }
 
     @RequiresApi(api = Build.VERSION_CODES.M)
     @Override
     protected void onAttach(@NonNull View view) {
         super.onAttach(view);
+        if (getActivity() != null && getResources() != null) {
+            DisplayUtils.applyColorToStatusBar(getActivity(), ResourcesCompat.getColor(getResources(), R.color.colorPrimary, null));
+            DisplayUtils.applyColorToNavigationBar(getActivity().getWindow(), ResourcesCompat.getColor(getResources(), R.color.colorPrimary, null));
+        }
         checkIfWeAreSecure();
     }
 
     @RequiresApi(api = Build.VERSION_CODES.M)
-    @OnClick(R.id.unlockTextView)
+    @OnClick(R.id.unlockContainer)
     void unlock() {
         checkIfWeAreSecure();
     }
@@ -167,4 +175,8 @@ public class LockedController extends BaseController {
             }
         }
     }
+
+    public AppBarLayoutType getAppBarLayoutType() {
+        return AppBarLayoutType.EMPTY;
+    }
 }

+ 34 - 22
app/src/main/res/layout/controller_locked.xml

@@ -2,6 +2,8 @@
   ~ Nextcloud Talk application
   ~
   ~ @author Mario Danic
+  ~ @author Andy Scherzinger
+  ~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
   ~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
   ~
   ~ This program is free software: you can redistribute it and/or modify
@@ -18,36 +20,46 @@
   ~ along with this program.  If not, see <http://www.gnu.org/licenses/>.
   -->
 
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/unlockContainer"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@drawable/ic_launcher_background"
+    android:layout_centerInParent="true"
+    android:background="@color/colorPrimary"
+    android:gravity="center"
     android:orientation="vertical">
 
-    <ImageView
-        android:id="@+id/appLogo"
-        android:layout_width="92dp"
-        android:layout_height="92dp"
-        android:layout_centerInParent="true"
-        android:scaleType="center"
-        android:src="@drawable/ic_launcher_foreground" />
+    <FrameLayout
+        android:id="@+id/appLogoContainer"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_horizontal">
+
+        <ImageView
+            android:id="@+id/appLogo"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:contentDescription="@string/nc_app_name"
+            android:src="@drawable/ic_logo" />
 
-    <ImageView
-        android:layout_width="24dp"
-        android:layout_height="24dp"
-        android:layout_alignTop="@id/appLogo"
-        android:layout_alignEnd="@id/appLogo"
-        android:src="@drawable/ic_lock_white_24px" />
+        <ImageView
+            android:layout_width="32dp"
+            android:layout_height="32dp"
+            android:layout_gravity="center"
+            android:src="@drawable/ic_lock_white_24px" />
+
+    </FrameLayout>
 
     <TextView
         android:id="@+id/unlockTextView"
-        android:layout_width="wrap_content"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_below="@id/appLogo"
-        android:layout_centerHorizontal="true"
-        android:layout_marginTop="@dimen/margin_between_elements"
-        android:padding="16dp"
+        android:layout_gravity="center_horizontal"
+        android:paddingTop="16dp"
+        android:paddingBottom="56dp"
         android:text="@string/nc_locked"
         android:textAlignment="center"
-        android:textColor="@color/fg_inverse" />
-</RelativeLayout>
+        android:textColor="@color/textColorOnPrimaryBackground"
+        android:textSize="22sp" />
+
+</LinearLayout>

+ 1 - 0
app/src/main/res/layout/item_message_quote.xml

@@ -45,6 +45,7 @@
         android:layout_marginEnd="8dp"
         android:layout_toEndOf="@id/quoteColoredView"
         android:ellipsize="end"
+        android:textColor="@color/textColorMaxContrast"
         android:textSize="12sp"
         tools:text="Jane Doe" />
 

+ 0 - 1
app/src/main/res/values-night/colors.xml

@@ -52,7 +52,6 @@
     <color name="controller_chat_separator">#484848</color>
 
     <!-- Chat window incoming message text & informational -->
-    <color name="nc_grey">@android:color/holo_purple</color>
     <color name="bg_bottom_sheet">#121212</color>
     <color name="bg_message_list_incoming_bubble">#484848</color>
     <color name="bg_message_list_incoming_bubble_deleted">#66484848</color>

+ 1 - 1
scripts/analysis/lint-results.txt

@@ -1,2 +1,2 @@
 DO NOT TOUCH; GENERATED BY DRONE
-      <span class="mdl-layout-title">Lint Report: 3 errors and 117 warnings</span>
+      <span class="mdl-layout-title">Lint Report: 3 errors and 116 warnings</span>