]> hydra-www.ietfng.org Git - android-vcpass-oisafe/commitdiff
OI Safe: Allow web links to work without "http://" also in PassView (similar to PassE...
authorpeli0101 <peli0101@72b678ce-9140-0410-bee8-679b907dd61a>
Fri, 30 Jan 2009 09:01:50 +0000 (09:01 +0000)
committerpeli0101 <peli0101@72b678ce-9140-0410-bee8-679b907dd61a>
Fri, 30 Jan 2009 09:01:50 +0000 (09:01 +0000)
git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@1876 72b678ce-9140-0410-bee8-679b907dd61a

src/org/openintents/safe/PassView.java

index c345bb34c887f85d0ffc4543ec1054758c629913..21f618687932d8c00e9340c56c6b3d50a6ab9af8 100644 (file)
@@ -128,13 +128,21 @@ public class PassView extends Activity {
                                cb.setText(passwordText.getText().toString());
 
                                Intent i = new Intent(Intent.ACTION_VIEW);
-                               Uri u = Uri.parse(websiteText.getText().toString());
+                               String link = websiteText.getText().toString();
+                               Uri u = Uri.parse(link);
                                i.setData(u);
                                try {
                                        startActivity(i);
                                } catch (ActivityNotFoundException e) {
-                                       Toast.makeText(PassView.this, R.string.invalid_website,
-                                               Toast.LENGTH_SHORT).show();
+                                       // Let's try to catch the most common mistake: omitting http:
+                                       u = Uri.parse("http://" + link);
+                                       i.setData(u);
+                                       try {
+                                               startActivity(i);
+                                       } catch (ActivityNotFoundException e2) {
+                                               Toast.makeText(PassView.this, R.string.invalid_website,
+                                                       Toast.LENGTH_SHORT).show();
+                                       }
                                }
                        }
                });