Android Open Source - Twitter-Android Browser






From Project

Back to project page Twitter-Android.

License

The source code is released under:

Apache License

If you think the Android project Twitter-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package info.mahmoudhossam.twitter.Activities;
/*  w  w  w.j  av  a 2 s  .co m*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import info.mahmoudhossam.twitter.R;

public class Browser extends Activity {

  private WebView webView;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.browser);
    webView = (WebView) findViewById(R.id.webView1);
    webView.getSettings().setJavaScriptEnabled(true);
    String Url = getIntent().getExtras().getString("url");
    webView.setWebViewClient(new WebBrowser());
    webView.loadUrl(Url);
  }

  private class WebBrowser extends WebViewClient {

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
      view.loadUrl(url);
      return true;
    }

    @Override
    public void onPageFinished(WebView view, String url) {
      super.onPageFinished(view, url);
      Intent data = new Intent("result");
      if(url.contains("verifier")){
        data.putExtra("url", url);
        setResult(RESULT_OK, data);
        finish();
      }
    }
    
  }

  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) {
      webView.goBack();
      return true;
    }
    return super.onKeyDown(keyCode, event);
  }

}




Java Source Code List

info.mahmoudhossam.twitter.MyEndlessAdapter.java
info.mahmoudhossam.twitter.TweetAdapter.java
info.mahmoudhossam.twitter.TwitterBackend.java
info.mahmoudhossam.twitter.Activities.Browser.java
info.mahmoudhossam.twitter.Activities.Login.java
info.mahmoudhossam.twitter.Activities.MainActivity.java
info.mahmoudhossam.twitter.Activities.PostStatus.java
info.mahmoudhossam.twitter.Activities.Tweet.java
info.mahmoudhossam.twitter.Fragments.HomeTweets.java
info.mahmoudhossam.twitter.Fragments.Mentions.java
info.mahmoudhossam.twitter.Fragments.TweetFragment.java
info.mahmoudhossam.twitter.Fragments.UserTweets.java