Skip to content

Commit f806bfd

Browse files
committed
Customized theme of toolbar and action mode.
NMC-2138: Sort filter toolbar button customized. NMC-2035: Customized navigation view theme with drawer options.
1 parent e3e0264 commit f806bfd

38 files changed

Lines changed: 646 additions & 391 deletions

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,10 @@
344344
<activity
345345
android:name=".ui.activity.SettingsActivity"
346346
android:exported="false"
347-
android:theme="@style/PreferenceTheme" />
347+
android:theme="@style/Theme.ownCloud" />
348348
<activity
349349
android:name=".ui.preview.PreviewImageActivity"
350-
android:exported="false"
351-
android:theme="@style/Theme.ownCloud.Overlay" />
350+
android:exported="false" />
352351
<activity
353352
android:name=".ui.preview.PreviewMediaActivity"
354353
android:configChanges="orientation|screenLayout|screenSize|keyboardHidden"

app/src/main/java/com/nextcloud/utils/extensions/DrawerActivityExtensions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fun DrawerActivity.getMenuItemIdFromTitle(): Int? {
3535
getString(R.string.drawer_item_shared) -> R.id.nav_shared
3636
getString(R.string.drawer_item_groupfolders) -> R.id.nav_groupfolders
3737
getString(R.string.drawer_item_on_device) -> R.id.nav_on_device
38-
getString(R.string.drawer_item_recently_modified) -> R.id.nav_recently_modified
38+
getString(R.string.drawer_item_recent_files) -> R.id.nav_recently_modified
3939
getString(R.string.drawer_item_assistant) -> R.id.nav_assistant
4040
getString(R.string.drawer_item_uploads_list) -> R.id.nav_uploads
4141
getString(R.string.drawer_item_trashbin) -> R.id.nav_trashbin
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.nmc.android.utils
2+
3+
import android.graphics.drawable.Drawable
4+
import androidx.annotation.ColorInt
5+
import androidx.core.graphics.BlendModeColorFilterCompat
6+
import androidx.core.graphics.BlendModeCompat
7+
import androidx.core.graphics.drawable.DrawableCompat
8+
9+
object DrawableThemeUtils {
10+
@JvmStatic
11+
fun tintDrawable(drawable: Drawable, @ColorInt color: Int): Drawable {
12+
val wrap: Drawable = DrawableCompat.wrap(drawable)
13+
wrap.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
14+
color, BlendModeCompat.SRC_ATOP
15+
)
16+
return wrap
17+
}
18+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.nmc.android.utils
2+
3+
import android.content.Context
4+
import android.graphics.Typeface
5+
import android.text.Spannable
6+
import android.text.style.StyleSpan
7+
import androidx.appcompat.app.ActionBar
8+
import com.owncloud.android.R
9+
import com.owncloud.android.utils.StringUtils
10+
11+
object ToolbarThemeUtils {
12+
@JvmStatic
13+
fun setColoredTitle(context: Context, actionBar: ActionBar?, title: String) {
14+
if (actionBar != null) {
15+
val text: Spannable = StringUtils.getColorSpan(title, context.resources.getColor(R.color.fontAppbar, null))
16+
17+
//bold the magenta from MagentaCLOUD title
18+
if (title.contains(context.resources.getString(R.string.app_name))) {
19+
val textToBold = context.resources.getString(R.string.splashScreenBold)
20+
val indexStart = title.indexOf(textToBold)
21+
val indexEnd = indexStart + textToBold.length
22+
text.setSpan(StyleSpan(Typeface.BOLD), indexStart, indexEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
23+
}
24+
actionBar.title = text
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)