diff --git a/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/about/AboutFragmentLicenseTab.java b/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/about/AboutFragmentLicenseTab.java index 4ce5d5dc..b5b984cd 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/about/AboutFragmentLicenseTab.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/about/AboutFragmentLicenseTab.java @@ -1,20 +1,27 @@ package it.niedermann.owncloud.notes.android.fragment.about; import android.content.Intent; +import android.content.res.ColorStateList; import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import androidx.annotation.ColorInt; import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; +import androidx.core.graphics.drawable.DrawableCompat; import it.niedermann.owncloud.notes.R; +import it.niedermann.owncloud.notes.branding.BrandedFragment; +import it.niedermann.owncloud.notes.branding.BrandingUtil; import it.niedermann.owncloud.notes.databinding.FragmentAboutLicenseTabBinding; +import it.niedermann.owncloud.notes.util.ColorUtil; import it.niedermann.owncloud.notes.util.SupportUtil; -public class AboutFragmentLicenseTab extends Fragment { +public class AboutFragmentLicenseTab extends BrandedFragment { + + private FragmentAboutLicenseTabBinding binding; private void openLicense() { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.url_license)))); @@ -22,9 +29,16 @@ public class AboutFragmentLicenseTab extends Fragment { @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - FragmentAboutLicenseTabBinding binding = FragmentAboutLicenseTabBinding.inflate(inflater, container, false); + binding = FragmentAboutLicenseTabBinding.inflate(inflater, container, false); binding.aboutAppLicenseButton.setOnClickListener((v) -> openLicense()); SupportUtil.setHtml(binding.aboutIconsDisclaimer, R.string.about_icons_disclaimer, getString(R.string.about_app_icon_author)); return binding.getRoot(); } + + @Override + public void applyBrand(int mainColor, int textColor) { + @ColorInt final int finalMainColor = BrandingUtil.getSecondaryForegroundColorDependingOnTheme(requireContext(), mainColor); + DrawableCompat.setTintList(binding.aboutAppLicenseButton.getBackground(), ColorStateList.valueOf(finalMainColor)); + binding.aboutAppLicenseButton.setTextColor(ColorUtil.getForegroundColorForBackgroundColor(finalMainColor)); + } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index 10444a88..8e6c0a2f 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -24,6 +24,7 @@ android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" + app:tabIndicatorColor="@color/defaultBrand" android:background="?attr/colorPrimary" /> diff --git a/app/src/main/res/layout/fragment_about_license_tab.xml b/app/src/main/res/layout/fragment_about_license_tab.xml index e65d6b9e..1d587793 100644 --- a/app/src/main/res/layout/fragment_about_license_tab.xml +++ b/app/src/main/res/layout/fragment_about_license_tab.xml @@ -1,5 +1,6 @@ @@ -27,7 +28,8 @@ style="@style/Widget.MaterialComponents.Button" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/about_app_license_button" /> + android:text="@string/about_app_license_button" + app:backgroundTint="@color/defaultBrand" />