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.
NMC-2258: Snackbar theme customized.
NMC-2047: Customized floating action button.
- Loading branch information
1 parent
9f7370f
commit d4c2b01
Showing
12 changed files
with
244 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.nmc.android.utils | ||
|
||
import android.content.Context | ||
import android.content.res.ColorStateList | ||
import android.graphics.Color | ||
import com.google.android.material.floatingactionbutton.FloatingActionButton | ||
import com.owncloud.android.R | ||
|
||
object FabThemeUtils { | ||
@JvmStatic | ||
fun colorFloatingActionButton( | ||
context: Context, | ||
button: FloatingActionButton | ||
) { | ||
val primaryColor = context.resources.getColor(R.color.primary, null) | ||
val disableColor = context.resources.getColor(R.color.grey_0, null) | ||
|
||
val bgStates = arrayOf( | ||
intArrayOf(android.R.attr.state_enabled), | ||
intArrayOf(-android.R.attr.state_enabled), | ||
) | ||
val bgColors = intArrayOf( | ||
primaryColor, | ||
disableColor | ||
) | ||
|
||
button.backgroundTintList = ColorStateList(bgStates, bgColors) | ||
|
||
val imageStates = arrayOf( | ||
intArrayOf(android.R.attr.state_enabled), | ||
intArrayOf(-android.R.attr.state_enabled), | ||
) | ||
val imageColors = intArrayOf( | ||
Color.WHITE, | ||
disableColor | ||
) | ||
|
||
button.imageTintList = ColorStateList(imageStates, imageColors) | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<style name="SnackBarBackgroundStyle" parent="Widget.Material3.Snackbar"> | ||
<item name="android:backgroundTint">@color/snackbar_bg_color</item> | ||
<item name="backgroundTint">@color/snackbar_bg_color</item> | ||
</style> | ||
|
||
<style name="SnackBarActionButtonStyle" parent="Widget.Material3.Button.TextButton.Snackbar"> | ||
<item name="android:textColor">@color/white</item> | ||
</style> | ||
|
||
<style name="SnackBarTextViewStyle" parent="Widget.Material3.Snackbar.TextView"> | ||
<item name="android:textColor">@color/snackbar_txt_color</item> | ||
</style> | ||
</resources> |
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