Explorar o código

optimize lock-screen layout/colors

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger %!s(int64=4) %!d(string=hai) anos
pai
achega
1ab96016ac

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

@@ -34,12 +34,14 @@ 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;
 
@@ -64,20 +66,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 +170,8 @@ public class LockedController extends BaseController {
             }
         }
     }
+
+    public AppBarLayoutType getAppBarLayoutType() {
+        return AppBarLayoutType.EMPTY;
+    }
 }

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

@@ -18,36 +18,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/white"
+        android:textSize="22sp" />
+
+</LinearLayout>

+ 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>