diff --git a/app/src/main/java/com/owncloud/android/ui/activity/SsoGrantPermissionActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/SsoGrantPermissionActivity.java index 1d6929ae68..af78931244 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/SsoGrantPermissionActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/SsoGrantPermissionActivity.java @@ -47,9 +47,14 @@ import com.owncloud.android.lib.common.OwnCloudAccount; import com.owncloud.android.lib.common.accounts.AccountUtils; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.utils.EncryptionUtils; +import com.owncloud.android.utils.theme.ViewThemeUtils; import java.util.UUID; +import javax.inject.Inject; + +import androidx.appcompat.app.AlertDialog; + import static com.nextcloud.android.sso.Constants.DELIMITER; import static com.nextcloud.android.sso.Constants.EXCEPTION_ACCOUNT_ACCESS_DECLINED; import static com.nextcloud.android.sso.Constants.EXCEPTION_ACCOUNT_NOT_FOUND; @@ -69,10 +74,17 @@ public class SsoGrantPermissionActivity extends BaseActivity { private String packageName; private Account account; + @Inject ViewThemeUtils.Factory themeUtilsFactory; + private ViewThemeUtils viewThemeUtils; + + private AlertDialog dialog; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + viewThemeUtils = themeUtilsFactory.withDefaultSchemes(); + DialogSsoGrantPermissionBinding binding = DialogSsoGrantPermissionBinding.inflate(getLayoutInflater()); ComponentName callingActivity = getCallingActivity(); @@ -102,7 +114,8 @@ public class SsoGrantPermissionActivity extends BaseActivity { .setPositiveButton(R.string.permission_allow, (dialog, which) -> grantPermission()) .setNegativeButton(R.string.permission_deny, (dialog, which) -> exitFailed()); - builder.show(); + dialog = builder.create(); + dialog.show(); Log_OC.v(TAG, "TOKEN-REQUEST: Calling Package: " + packageName); Log_OC.v(TAG, "TOKEN-REQUEST: App Name: " + appName); @@ -113,6 +126,13 @@ public class SsoGrantPermissionActivity extends BaseActivity { } } + @Override + protected void onStart() { + super.onStart(); + viewThemeUtils.platform.colorTextButtons(dialog.getButton(AlertDialog.BUTTON_POSITIVE), + dialog.getButton(AlertDialog.BUTTON_NEGATIVE)); + } + private SpannableStringBuilder makeSpecialPartsBold(String text, String... toBeStyledText) { SpannableStringBuilder ssb = new SpannableStringBuilder(text); for (String textBlock : toBeStyledText) { diff --git a/app/src/main/java/com/owncloud/android/utils/theme/ViewThemeUtils.kt b/app/src/main/java/com/owncloud/android/utils/theme/ViewThemeUtils.kt index 38da91860b..8bb94cf4cb 100644 --- a/app/src/main/java/com/owncloud/android/utils/theme/ViewThemeUtils.kt +++ b/app/src/main/java/com/owncloud/android/utils/theme/ViewThemeUtils.kt @@ -52,4 +52,17 @@ class ViewThemeUtils @Inject constructor( @JvmField val files = FilesSpecificViewThemeUtils(schemes, colorUtil, platform, androidx) + + class Factory @Inject constructor( + private val schemesProvider: MaterialSchemesProvider, + private val colorUtil: ColorUtil + ) { + fun withSchemes(schemes: MaterialSchemes): ViewThemeUtils { + return ViewThemeUtils(schemes, colorUtil) + } + + fun withDefaultSchemes(): ViewThemeUtils { + return withSchemes(schemesProvider.getDefaultMaterialSchemes()) + } + } }