Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable-3.30] Toolbar, NavigationView & Sort filter button theming customizations #285

Open
wants to merge 1 commit into
base: stable-3.30
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,10 @@
<activity
android:name=".ui.activity.SettingsActivity"
android:exported="false"
android:theme="@style/PreferenceTheme" />
android:theme="@style/Theme.ownCloud" />
<activity
android:name=".ui.preview.PreviewImageActivity"
android:exported="false"
android:theme="@style/Theme.ownCloud.Overlay" />
android:exported="false" />
<activity
android:name=".ui.preview.PreviewMediaActivity"
android:configChanges="orientation|screenLayout|screenSize|keyboardHidden"
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/java/com/nmc/android/utils/DrawableThemeUtils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.nmc.android.utils

import android.graphics.drawable.Drawable
import androidx.annotation.ColorInt
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat
import androidx.core.graphics.drawable.DrawableCompat

object DrawableThemeUtils {
@JvmStatic
fun tintDrawable(drawable: Drawable, @ColorInt color: Int): Drawable {
val wrap: Drawable = DrawableCompat.wrap(drawable)
wrap.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
color, BlendModeCompat.SRC_ATOP
)
return wrap
}
}
27 changes: 27 additions & 0 deletions app/src/main/java/com/nmc/android/utils/ToolbarThemeUtils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.nmc.android.utils

import android.content.Context
import android.graphics.Typeface
import android.text.Spannable
import android.text.style.StyleSpan
import androidx.appcompat.app.ActionBar
import com.owncloud.android.R
import com.owncloud.android.utils.StringUtils

object ToolbarThemeUtils {
@JvmStatic
fun setColoredTitle(context: Context, actionBar: ActionBar?, title: String) {
if (actionBar != null) {
val text: Spannable = StringUtils.getColorSpan(title, context.resources.getColor(R.color.fontAppbar, null))

//bold the magenta from MagentaCLOUD title
if (title.contains(context.resources.getString(R.string.app_name))) {
val textToBold = context.resources.getString(R.string.splashScreenBold)
val indexStart = title.indexOf(textToBold)
val indexEnd = indexStart + textToBold.length
text.setSpan(StyleSpan(Typeface.BOLD), indexStart, indexEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
}
actionBar.title = text
}
}
}
Loading