forked from nextcloud/android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Customized theme of toolbar and action mode.
- Loading branch information
1 parent
f59caa7
commit fc2bb76
Showing
19 changed files
with
342 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
app/src/main/java/com/nmc/android/utils/DrawableThemeUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
27
app/src/main/java/com/nmc/android/utils/ToolbarThemeUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.