Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 439cde22 authored by Shen Lin's avatar Shen Lin
Browse files

Optimize UI to support Dark theme

Style changes:
- Remove hard-coded background color for top search bar background
- Add a values-night folder to adopt night color scheme

Bug: 253348420
Test: Manual UI test in normal and dark mode

Change-Id: I136c7a31697ca1f8bb058947ed877684bfa75b4d
parent d94eb445
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2022 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
        android:color="?android:attr/colorControlHighlight">
    <item android:drawable="@color/search_bar_background"/>
</ripple>
+0 −2
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@
        android:id="@+id/search_bar_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/search_panel_background"
        android:elevation="4dp">
        <androidx.cardview.widget.CardView
            android:id="@+id/search_bar"
@@ -33,7 +32,6 @@
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/search_bar_margin"
            app:cardCornerRadius="2dp"
            app:cardBackgroundColor="?android:attr/colorBackground"
            app:cardElevation="2dp">
            <Toolbar
                android:id="@+id/search_toolbar"
+23 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2017 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<resources
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">

    <color name="search_bar_background">?androidprv:attr/colorSurfaceVariant</color>

</resources>
+1 −1
Original line number Diff line number Diff line
@@ -18,5 +18,5 @@
<resources>
    <color name="launcher_background_color">#ff008577</color>

    <color name="search_panel_background">#f2f2f2</color>
    <color name="search_bar_background">?android:attr/colorBackground</color>
</resources>
+4 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.VisibleForTesting;
import androidx.cardview.widget.CardView;
import androidx.loader.content.Loader;
import androidx.loader.app.LoaderManager;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -149,6 +150,9 @@ public class SearchFragment extends Fragment implements SearchView.OnQueryTextLi

        mNoResultsView = view.findViewById(R.id.no_results_layout);

        final CardView cardView = view.findViewById(R.id.search_bar);
        cardView.setBackgroundResource(R.drawable.search_bar_selected_background);

        final Toolbar toolbar = view.findViewById(R.id.search_toolbar);
        activity.setActionBar(toolbar);
        activity.getActionBar().setDisplayHomeAsUpEnabled(true);