unsplash / unsplash-photopicker-android

📱An Android photo picker to search and download photos from Unsplash.
MIT License
336 stars 62 forks source link

How to set a custom theme? #7

Closed Vitor238 closed 4 years ago

Vitor238 commented 4 years ago

Describe the bug The toolbar text is not readable using my custom theme (Theme.AppCompat.DayNight.NoActionBar).

To Reproduce Steps to reproduce the behavior: 1.Set a custom theme. The text or toolbar must use a light color

  1. Open the unsplash screen and the theme will be applied
  2. Text and icons will not be very readable

Expected behavior Better readability

Screenshots <img src="https://user-images.githubusercontent.com/29716879/80992576-1ae41e80-8e10-11ea-8204-44006fc4f88b.png" alt="Captura de tela 1" width="270"> <img src="https://user-images.githubusercontent.com/29716879/80992581-1c154b80-8e10-11ea-8ff2-bb4d3cea35ee.png" alt="Captura de tela 2" width="270" hspace="20">

Smartphone (please complete the following information):

Additional context Is it possible to add a custom theme to this screen?

Vitor238 commented 4 years ago

To solve the problem I changed the colors of my theme as described here to avoid override the original unsplash colors.

I also added this in both themes:

        <item name="android:textColorHint">@android:color/darker_gray</item>
        <item name="android:textColorPrimary">@android:color/black</item>
pierre225 commented 2 years ago

Here is what I had to do: In your androidManifest

<activity
            tools:replace="theme"
            android:theme="@style/UnsplashActivity"
            android:name="com.unsplash.pickerandroid.photopicker.presentation.UnsplashPickerActivity" />

In your style

<style name="UnsplashActivity" parent="AppTheme.NoActionBar">
        <item name="backgroundTint"> <your_color> </item>
        <item name="android:statusBarColor">@color/status_bar_color</item>
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:windowTranslucentStatus">false</item>
        <item name="android:fitsSystemWindows">true</item>
 </style>
Hope that helps ;)