From e187493e01ffd70e2dde64f1364c3e3866d7ec7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Sun, 4 Mar 2018 20:27:44 +0100 Subject: [PATCH] CustomTabs fix (#56) --- .../java/io/github/wulkanowy/ui/login/LoginActivity.java | 6 ++---- .../main/java/io/github/wulkanowy/utils/CommonUtils.java | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/ui/login/LoginActivity.java b/app/src/main/java/io/github/wulkanowy/ui/login/LoginActivity.java index 26d1c146..95c5548b 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/login/LoginActivity.java +++ b/app/src/main/java/io/github/wulkanowy/ui/login/LoginActivity.java @@ -97,14 +97,12 @@ public class LoginActivity extends BaseActivity implements LoginContract.View { @OnClick(R.id.login_activity_create_text) void onCreateAccountButtonClick() { - CommonUtils.openInternalBrowserViewer(getApplicationContext(), - AppConstant.VULCAN_CREATE_ACCOUNT_URL); + CommonUtils.openInternalBrowserViewer(this, AppConstant.VULCAN_CREATE_ACCOUNT_URL); } @OnClick(R.id.login_activity_forgot_text) void onForgotPasswordButtonClick() { - CommonUtils.openInternalBrowserViewer(getApplicationContext(), - AppConstant.VULCAN_FORGOT_PASS_URL); + CommonUtils.openInternalBrowserViewer(this, AppConstant.VULCAN_FORGOT_PASS_URL); } @Override diff --git a/app/src/main/java/io/github/wulkanowy/utils/CommonUtils.java b/app/src/main/java/io/github/wulkanowy/utils/CommonUtils.java index 9680817e..8ec73faf 100644 --- a/app/src/main/java/io/github/wulkanowy/utils/CommonUtils.java +++ b/app/src/main/java/io/github/wulkanowy/utils/CommonUtils.java @@ -1,6 +1,6 @@ package io.github.wulkanowy.utils; -import android.content.Context; +import android.app.Activity; import android.net.Uri; import android.support.customtabs.CustomTabsIntent; @@ -12,11 +12,11 @@ public final class CommonUtils { throw new IllegalStateException("Utility class"); } - public static void openInternalBrowserViewer(Context context, String url) { + public static void openInternalBrowserViewer(Activity activity, String url) { CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); - builder.setToolbarColor(context.getResources().getColor(R.color.colorPrimary)); + builder.setToolbarColor(activity.getResources().getColor(R.color.colorPrimary)); CustomTabsIntent customTabsIntent = builder.build(); - customTabsIntent.launchUrl(context, Uri.parse(url)); + customTabsIntent.launchUrl(activity, Uri.parse(url)); } public static int colorHexToColorName(String hexColor) {