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.
- Loading branch information
1 parent
5915c25
commit 09b63b1
Showing
38 changed files
with
370 additions
and
356 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
app/src/main/java/com/nmc/android/utils/DialogThemeUtils.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,30 @@ | ||
package com.nmc.android.utils | ||
|
||
import android.content.Context | ||
import android.content.res.ColorStateList | ||
import android.os.Build | ||
import com.google.android.material.dialog.MaterialAlertDialogBuilder | ||
import com.google.android.material.shape.MaterialShapeDrawable | ||
import com.owncloud.android.R | ||
|
||
object DialogThemeUtils { | ||
fun colorMaterialAlertDialogBackground(context: Context, dialogBuilder: MaterialAlertDialogBuilder) { | ||
val materialShapeDrawable = MaterialShapeDrawable( | ||
context, | ||
null, | ||
R.attr.alertDialogStyle, | ||
R.style.MaterialAlertDialog_MaterialComponents | ||
) | ||
materialShapeDrawable.initializeElevationOverlay(context) | ||
materialShapeDrawable.fillColor = | ||
ColorStateList.valueOf(context.resources.getColor(R.color.alert_bg_color, null)) | ||
|
||
// dialogCornerRadius first appeared in Android Pie | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { | ||
val radius: Float = | ||
context.resources.getDimension(com.nextcloud.android.common.ui.R.dimen.dialogBorderRadius) | ||
materialShapeDrawable.setCornerSize(radius) | ||
} | ||
dialogBuilder.background = materialShapeDrawable | ||
} | ||
} |
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.