@Override
  @SuppressLint("SetJavaScriptEnabled")
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    Dank.dependencyInjector().inject(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    ButterKnife.bind(this);
    findAndSetupToolbar();
    toolbar.setBackground(null);
    toolbar.setTitle(R.string.login);
    contentViewGroup.setClipToOutline(true);
    // Setup WebView.
    CookieManager.getInstance().removeAllCookies(null);
    webView.setWebChromeClient(new WebChromeClient() {
      @Override
      public void onProgressChanged(WebView view, int newProgress) {
        if (!loggedIn) {
          boolean shouldShowProgress = newProgress < 75;
          setProgressVisible(shouldShowProgress);
        }
      }
    });
    webView.setWebViewClient(new WebViewClient() {
      @Override
      public void onPageStarted(WebView view, String url, Bitmap favicon) {
        if (url.contains("code=")) {
          // We've detected the redirect URL.
          webView.stopLoading();
          loggedIn = true;
          handleOnPermissionGranted(url);
        } else if (url.contains("error=")) {
          Toast.makeText(LoginActivity.this, R.string.login_error_oauth_permission_rejected, Toast.LENGTH_LONG).show();
          webView.stopLoading();
          setResult(RESULT_CANCELED);
          finish();
        }
      }
    });
    // Bug workaround: WebView crashes when dropdown is shown on
    // a Nougat emulator. Haven't tested on other devices.
    webView.clearFormData();
    webView.getSettings().setSaveFormData(false);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setDomStorageEnabled(true);
    userLoginHelper = reddit.get().login().loginHelper();
    webView.loadUrl(userLoginHelper.authorizationUrl());
  }
@Override
  @SuppressLint("SetJavaScriptEnabled")
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    Dank.dependencyInjector().inject(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    ButterKnife.bind(this);
    findAndSetupToolbar();
    toolbar.setBackground(null);
    toolbar.setTitle(R.string.login);
    contentViewGroup.setClipToOutline(true);
   
    CookieManager.getInstance().removeAllCookies(null);
    webView.setWebChromeClient(new WebChromeClient() {
      @Override
      public void onProgressChanged(WebView view, int newProgress) {
        if (!loggedIn) {
          boolean shouldShowProgress = newProgress < 75;
          setProgressVisible(shouldShowProgress);
        }
      }
    });
    webView.setWebViewClient(new WebViewClient() {
      @Override
      public void onPageStarted(WebView view, String url, Bitmap favicon) {
        if (url.contains("code=")) {
         
          webView.stopLoading();
          loggedIn = true;
          handleOnPermissionGranted(url);
        } else if (url.contains("error=")) {
          Toast.makeText(LoginActivity.this, R.string.login_error_oauth_permission_rejected, Toast.LENGTH_LONG).show();
          webView.stopLoading();
          setResult(RESULT_CANCELED);
          finish();
        }
      }
    });
   
   
    webView.clearFormData();
    webView.getSettings().setSaveFormData(false);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setDomStorageEnabled(true);
    userLoginHelper = reddit.get().login().loginHelper();
    webView.loadUrl(userLoginHelper.authorizationUrl());
  }
@override @suppresslint("setjavascriptenabled") protected void oncreate(@nullable bundle savedinstancestate) { dank.dependencyinjector().inject(this); super.oncreate(savedinstancestate); setcontentview(r.layout.activity_login); butterknife.bind(this); findandsetuptoolbar(); toolbar.setbackground(null); toolbar.settitle(r.string.login); contentviewgroup.setcliptooutline(true); cookiemanager.getinstance().removeallcookies(null); webview.setwebchromeclient(new webchromeclient() { @override public void onprogresschanged(webview view, int newprogress) { if (!loggedin) { boolean shouldshowprogress = newprogress < 75; setprogressvisible(shouldshowprogress); } } }); webview.setwebviewclient(new webviewclient() { @override public void onpagestarted(webview view, string url, bitmap favicon) { if (url.contains("code=")) { webview.stoploading(); loggedin = true; handleonpermissiongranted(url); } else if (url.contains("error=")) { toast.maketext(loginactivity.this, r.string.login_error_oauth_permission_rejected, toast.length_long).show(); webview.stoploading(); setresult(result_canceled); finish(); } } }); webview.clearformdata(); webview.getsettings().setsaveformdata(false); webview.getsettings().setjavascriptenabled(true); webview.getsettings().setdomstorageenabled(true); userloginhelper = reddit.get().login().loginhelper(); webview.loadurl(userloginhelper.authorizationurl()); }