Skip to content

Commit 8eb9890

Browse files
stefan-niedermannAndyScherzinger
authored andcommitted
feat(theming): Align theming closer to files app
Follow-Up to #1680 Signed-off-by: Stefan Niedermann <info@niedermann.it>
1 parent 1dbde30 commit 8eb9890

File tree

10 files changed

+33
-13
lines changed

10 files changed

+33
-13
lines changed

app/src/main/java/it/niedermann/owncloud/notes/branding/NotesViewThemeUtils.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import androidx.annotation.ColorInt;
1717
import androidx.annotation.IdRes;
1818
import androidx.annotation.NonNull;
19+
import androidx.appcompat.widget.SearchView;
1920
import androidx.appcompat.widget.Toolbar;
2021
import androidx.core.content.ContextCompat;
2122
import androidx.core.graphics.drawable.DrawableCompat;
@@ -171,4 +172,24 @@ public void themeSearchToolbar(@NonNull MaterialToolbar toolbar) {
171172
return toolbar;
172173
});
173174
}
175+
176+
/**
177+
* @deprecated Should be replaced with {@link com.google.android.material.search.SearchView}
178+
* @see com.nextcloud.android.common.ui.theme.utils.AndroidXViewThemeUtils#themeToolbarSearchView(SearchView)
179+
*/
180+
@Deprecated
181+
public void themeToolbarSearchView(@NonNull SearchView searchView) {
182+
withScheme(searchView, scheme -> {
183+
// hacky as no default way is provided
184+
final var editText = (SearchView.SearchAutoComplete) searchView.findViewById(androidx.appcompat.R.id.search_src_text);
185+
final var closeButton = (ImageView) searchView.findViewById(androidx.appcompat.R.id.search_close_btn);
186+
final var searchButton = (ImageView) searchView.findViewById(androidx.appcompat.R.id.search_button);
187+
editText.setHintTextColor(scheme.getOnSurfaceVariant());
188+
editText.setHighlightColor(scheme.getInverseOnSurface());
189+
editText.setTextColor(scheme.getOnSurface());
190+
closeButton.setColorFilter(scheme.getOnSurface());
191+
searchButton.setColorFilter(scheme.getOnSurface());
192+
return searchView;
193+
});
194+
}
174195
}

app/src/main/java/it/niedermann/owncloud/notes/main/MainActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,12 +594,13 @@ public void onIconClick(NavigationItem item) {
594594
@Override
595595
public void applyBrand(int color) {
596596
final var util = BrandingUtil.of(color, this);
597-
util.material.themeFAB(activityBinding.fabCreate);
598597
util.androidx.themeSwipeRefreshLayout(activityBinding.swiperefreshlayout);
599598
util.platform.colorCircularProgressBar(activityBinding.progressCircular, ColorRole.PRIMARY);
600599
util.platform.colorNavigationView(binding.navigationView);
600+
util.material.themeFAB(activityBinding.fabCreate);
601601
util.notes.themeSearchCardView(binding.activityNotesListView.searchBarWrapper);
602602
util.notes.themeSearchToolbar(binding.activityNotesListView.searchToolbar);
603+
util.notes.themeToolbarSearchView(binding.activityNotesListView.searchView);
603604

604605
binding.headerView.setBackgroundColor(color);
605606
@ColorInt final int headerTextColor = ColorUtil.INSTANCE.getForegroundColorForBackgroundColor(color);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
android:layout_width="match_parent"
1717
android:layout_height="wrap_content"
1818
app:navigationIcon="@drawable/ic_arrow_back_grey600_24dp"
19-
app:titleMarginStart="0dp"
2019
tools:title="@string/simple_about" />
2120

2221
<com.google.android.material.tabs.TabLayout

app/src/main/res/layout/activity_edit.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
android:layout_width="match_parent"
1212
android:layout_height="wrap_content"
1313
app:navigationIcon="@drawable/ic_arrow_back_grey600_24dp"
14-
app:titleMarginStart="0dp"
1514
tools:title="Edit Sample note" />
1615

1716
<androidx.fragment.app.FragmentContainerView

app/src/main/res/layout/activity_exception.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
android:layout_width="match_parent"
1212
android:layout_height="wrap_content"
1313
app:elevation="4dp"
14-
app:titleMarginStart="0dp"
1514
tools:title="@string/simple_exception" />
1615

1716
<TextView

app/src/main/res/layout/activity_formatting_help.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
android:layout_width="match_parent"
1212
android:layout_height="wrap_content"
1313
app:navigationIcon="@drawable/ic_arrow_back_grey600_24dp"
14-
app:title="@string/action_formatting_help"
15-
app:titleMarginStart="0dp" />
14+
app:title="@string/action_formatting_help" />
1615

1716
<ScrollView
1817
android:id="@+id/scrollView"

app/src/main/res/layout/activity_manage_accounts.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
android:layout_width="match_parent"
1212
android:layout_height="wrap_content"
1313
app:navigationIcon="@drawable/ic_arrow_back_grey600_24dp"
14-
app:title="@string/manage_accounts"
15-
app:titleMarginStart="0dp" />
14+
app:title="@string/manage_accounts" />
1615

1716
<androidx.recyclerview.widget.RecyclerView
1817
android:id="@+id/accounts"

app/src/main/res/layout/activity_notes_list_view.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@
3838
android:layout_width="match_parent"
3939
android:layout_height="wrap_content"
4040
android:orientation="horizontal"
41-
app:contentInsetStartWithNavigation="0dp"
42-
app:titleMarginStart="0dp">
41+
app:contentInsetStartWithNavigation="0dp">
4342

4443
<LinearLayout
4544
android:layout_width="match_parent"
@@ -86,11 +85,11 @@
8685

8786
<com.google.android.material.appbar.MaterialToolbar
8887
android:id="@+id/search_toolbar"
88+
style="@style/searchToolbarStyle"
8989
android:layout_width="match_parent"
9090
android:layout_height="match_parent"
9191
android:visibility="gone"
9292
app:navigationIcon="@drawable/ic_arrow_back_grey600_24dp"
93-
app:titleMarginStart="0dp"
9493
tools:title="@string/app_name">
9594

9695
<androidx.appcompat.widget.SearchView

app/src/main/res/layout/activity_preferences.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
android:layout_width="match_parent"
1111
android:layout_height="wrap_content"
1212
app:navigationIcon="@drawable/ic_arrow_back_grey600_24dp"
13-
app:title="@string/action_settings"
14-
app:titleMarginStart="0dp" />
13+
app:title="@string/action_settings" />
1514

1615
<androidx.fragment.app.FragmentContainerView
1716
android:id="@+id/fragment_container_view"

app/src/main/res/values/styles.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@
5151
<item name="android:paddingEnd">@dimen/spacer_activity_sides</item>
5252
</style>
5353

54+
<style name="searchToolbarStyle" parent="@style/Widget.Material3.Toolbar">
55+
<item name="android:paddingStart">@dimen/spacer_activity_sides</item>
56+
<item name="android:paddingEnd">@dimen/spacer_activity_sides</item>
57+
</style>
58+
5459
<style name="tabStyle" parent="Widget.Material3.TabLayout">
5560
<item name="backgroundColor">@android:color/transparent</item>
5661
<item name="itemBackground">@android:color/transparent</item>

0 commit comments

Comments
 (0)