1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2024-09-19 23:19:09 -05:00

CustomTabs fix (#56)

This commit is contained in:
Rafał Borcz 2018-03-04 20:27:44 +01:00 committed by Mikołaj Pich
parent 30bb01e9c3
commit e187493e01
2 changed files with 6 additions and 8 deletions

View File

@ -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

View File

@ -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) {