diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 2363507be1a62a22e037d3ba57537c65e06fb3d7..229ff16c2f50c196f2469ec87da10805f1e70800 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -16,7 +16,7 @@ android:label="@string/app_name" android:icon="@drawable/ic_launcher_itoopie" /> <activity android:name=".activity.MainActivity" - android:label="@string/app_name" + android:label="I2P Main Page" android:icon="@drawable/ic_launcher_itoopie" android.theme="@android:style/Theme.NoTitleBar" android:launchMode="singleTask" > @@ -26,19 +26,23 @@ </intent-filter> </activity> <activity android:name=".activity.NewsActivity" - android:label="@string/app_name" + android:label="I2P News" android.theme="@android:style/Theme.NoTitleBar" > </activity> <activity android:name=".activity.TextResourceActivity" - android:label="@string/app_name" + android:label="I2P Information" android.theme="@android:style/Theme.NoTitleBar" > </activity> <activity android:name=".activity.LicenseActivity" - android:label="@string/app_name" + android:label="Licenses" android.theme="@android:style/Theme.NoTitleBar" > </activity> <activity android:name=".activity.WebActivity" - android:label="@string/app_name" + android:label="Web Browser" + android.theme="@android:style/Theme.NoTitleBar" > + </activity> + <activity android:name=".activity.SettingsActivity" + android:label="Settings" android.theme="@android:style/Theme.NoTitleBar" > </activity> </application> diff --git a/res/layout/main.xml b/res/layout/main.xml index eb19eff235d80d7495870d9516d80a4169fe7471..b16744faab4f048268e449ab1a9783ddc5f8f522 100644 --- a/res/layout/main.xml +++ b/res/layout/main.xml @@ -24,19 +24,19 @@ android:id="@+id/website_button" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Web Site" + android:text="Web Site\n(non-anon)" /> <Button android:id="@+id/faq_button" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="FAQ" + android:text="FAQ\n(non-anon)" /> <Button android:id="@+id/welcome_button" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Welcome" + android:text="Welcome\nPage" /> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" diff --git a/res/menu/menu1.xml b/res/menu/menu1.xml new file mode 100755 index 0000000000000000000000000000000000000000..9ef1eb1af5a84052370d839cc1c5e341c51e4597 --- /dev/null +++ b/res/menu/menu1.xml @@ -0,0 +1,17 @@ +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:title="Preferences" + android:titleCondensed="Settings" + android:id="@+id/menu_settings" + android:icon="@android:drawable/ic_menu_preferences" > + </item> + <item android:title="Start Router" + android:id="@+id/menu_start" + android:titleCondensed="Start" + android:icon="@drawable/ic_menu_play_clip" > + </item> + <item android:title="Stop Router" + android:id="@+id/menu_stop" + android:titleCondensed="Stop" + android:icon="@android:drawable/ic_menu_close_clear_cancel" > + </item> +</menu> diff --git a/res/raw/releasenotes_txt b/res/raw/releasenotes_txt index f15307819c0eb24b5364b43e978b32eda68a26f3..c20d3834f15874555304ec4dfb017362d118eb9a 100644 --- a/res/raw/releasenotes_txt +++ b/res/raw/releasenotes_txt @@ -2,7 +2,7 @@ WARNING - This is ALPHA SOFTWARE. It may crash your phone. Do not rely upon it for strong anonymity. Tunnels may be as short as one hop. -Minimum Android OS is 2.1 (SDK 7). The app is only tested on the Motorola Droid. It uses a lot of RAM. You need at least 256 MB of RAM. 512 should be much better. +Minimum Android OS is 2.2 (API 8). The app is only tested on the Motorola Droid. It uses a lot of RAM. You need at least 256 MB of RAM. 512 should be much better. The app may use a lot of RAM even after the router has stopped and there is no icon in the notification bar. Go to Settings -> Applications -> Running Services and stop the I2P service if necessary. Or Settings -> Applications -> Manage Applications -> Running -> I2P and force stop. @@ -35,6 +35,7 @@ For eepsites, there are several other things to note: - No way to type in addresses - No addressbook app yet, so you only have what is in the standard hosts.txt - Eepsites are not found in the cache when hitting the back button + - Fetches are aborted when you rotate the screen Using clients with the router diff --git a/res/xml/settings1.xml b/res/xml/settings1.xml new file mode 100644 index 0000000000000000000000000000000000000000..d83230f0d3c6db651de3f2f0a47ac97310e9f494 --- /dev/null +++ b/res/xml/settings1.xml @@ -0,0 +1,6 @@ +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + android:key="settings1"> + <CheckBoxPreference + android:key="test" android:title="Check it or not"/> +</PreferenceScreen> diff --git a/scripts/setversion.sh b/scripts/setversion.sh index cb60fb3f4f1423192f35d924c74db9fcd65b746b..51b5ff7bdf623b90d7e2562677c17f1352487617 100755 --- a/scripts/setversion.sh +++ b/scripts/setversion.sh @@ -26,7 +26,7 @@ SDK=`grep 'android:minSdkVersion' $MANIFEST | \ cut -d '"' -f 2` # don't let build number get too long -VERSIONSTRING="${CORE}-${ROUTERBUILD}_b$(($ANDROIDBUILD % 256))-SDK$SDK" +VERSIONSTRING="${CORE}-${ROUTERBUILD}_b$(($ANDROIDBUILD % 512))-API$SDK" # # Android version code is an integer. diff --git a/src/net/i2p/android/router/activity/I2PActivityBase.java b/src/net/i2p/android/router/activity/I2PActivityBase.java index 0fd14f02b3f5b72ed489ebb44afc8fc874ec4fac..38e014cb983813c25aa44e1886e1c6d0a29d0b18 100644 --- a/src/net/i2p/android/router/activity/I2PActivityBase.java +++ b/src/net/i2p/android/router/activity/I2PActivityBase.java @@ -6,7 +6,11 @@ import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import net.i2p.android.router.R; import net.i2p.android.router.binder.RouterBinder; import net.i2p.android.router.service.RouterService; import net.i2p.router.CommSystemFacade; @@ -98,6 +102,35 @@ public abstract class I2PActivityBase extends Activity { super.onDestroy(); } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.menu1, menu); + return true; + } + + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + // add/hide items here + return super.onPrepareOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.menu_settings: + Intent intent = new Intent(I2PActivityBase.this, SettingsActivity.class); + startActivityForResult(intent, 0); + return true; + case R.id.menu_start: + case R.id.menu_stop: + default: + return super.onOptionsItemSelected(item); + } + } + + ////// Service stuff + protected boolean bindRouter() { Intent intent = new Intent(); intent.setClassName(this, "net.i2p.android.router.service.RouterService"); @@ -130,6 +163,8 @@ public abstract class I2PActivityBase extends Activity { } } + ////// Router stuff + protected RouterContext getRouterContext() { if (_routerService == null || !_isBound) return null; diff --git a/src/net/i2p/android/router/activity/I2PWebViewClient.java b/src/net/i2p/android/router/activity/I2PWebViewClient.java index 8a5c870b3f1053d9d640cf0b978d7cf9c8057d9a..69d613555c3f627f71dea4d264eacb66c6019f5c 100644 --- a/src/net/i2p/android/router/activity/I2PWebViewClient.java +++ b/src/net/i2p/android/router/activity/I2PWebViewClient.java @@ -127,7 +127,12 @@ class I2PWebViewClient extends WebViewClient { protected Integer doInBackground(String... urls) { publishProgress(Integer.valueOf(-1)); - _view.loadUrl(urls[0]); + try { + _view.loadUrl(urls[0]); + } catch (Exception e) { + // CalledFromWrongThreadException + cancel(false); + } return Integer.valueOf(0); } @@ -181,7 +186,12 @@ class I2PWebViewClient extends WebViewClient { System.err.println("Fetch cancelled for " + url); return Integer.valueOf(0); } - _view.loadDataWithBaseURL(url, d, t, e, url); + try { + _view.loadDataWithBaseURL(url, d, t, e, url); + } catch (Exception exc) { + // CalledFromWrongThreadException + cancel(false); + } return Integer.valueOf(0); } diff --git a/src/net/i2p/android/router/activity/NewsActivity.java b/src/net/i2p/android/router/activity/NewsActivity.java index 9b2c9a1c2471594a05ebe4c036c684a4cb28164f..e48d9e90ef189fe3c9b77e438a498f72f3413ab6 100644 --- a/src/net/i2p/android/router/activity/NewsActivity.java +++ b/src/net/i2p/android/router/activity/NewsActivity.java @@ -38,6 +38,8 @@ public class NewsActivity extends I2PActivityBase { setContentView(R.layout.news); WebView wv = (WebView) findViewById(R.id.news_webview); wv.getSettings().setLoadsImagesAutomatically(false); + // http://stackoverflow.com/questions/2369310/webview-double-tap-zoom-not-working-on-a-motorola-droid-a855 + wv.getSettings().setUseWideViewPort(true); _wvClient = new I2PWebViewClient(); wv.setWebViewClient(_wvClient); wv.getSettings().setBuiltInZoomControls(true); diff --git a/src/net/i2p/android/router/activity/SettingsActivity.java b/src/net/i2p/android/router/activity/SettingsActivity.java new file mode 100644 index 0000000000000000000000000000000000000000..a7aca9e589b825541f00c3fc48d01c422ac253af --- /dev/null +++ b/src/net/i2p/android/router/activity/SettingsActivity.java @@ -0,0 +1,15 @@ +package net.i2p.android.router.activity; + +import android.os.Bundle; +import android.preference.PreferenceActivity; + +import net.i2p.android.router.R; + +public class SettingsActivity extends PreferenceActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.settings1); + } +} diff --git a/src/net/i2p/android/router/activity/WebActivity.java b/src/net/i2p/android/router/activity/WebActivity.java index 88d7845c4611f5c166e4f31c83b20b412fb413c1..8d263f373eedc322bc9ea7e9220619f28a6d13e6 100644 --- a/src/net/i2p/android/router/activity/WebActivity.java +++ b/src/net/i2p/android/router/activity/WebActivity.java @@ -36,6 +36,8 @@ public class WebActivity extends I2PActivityBase { _wvClient = new I2PWebViewClient(); wv.setWebViewClient(_wvClient); wv.getSettings().setBuiltInZoomControls(true); + // http://stackoverflow.com/questions/2369310/webview-double-tap-zoom-not-working-on-a-motorola-droid-a855 + wv.getSettings().setUseWideViewPort(true); Intent intent = getIntent(); Uri uri = intent.getData(); if (uri != null) { diff --git a/src/net/i2p/android/router/service/Init.java b/src/net/i2p/android/router/service/Init.java index c99341add470c4db7e20d426c50e5ace1962c8f2..9f0c4fac9a48a47c1da9f618188b4a71e59b21b4 100644 --- a/src/net/i2p/android/router/service/Init.java +++ b/src/net/i2p/android/router/service/Init.java @@ -19,8 +19,9 @@ import net.i2p.data.DataHelper; import net.i2p.router.Router; import net.i2p.router.RouterContext; import net.i2p.router.RouterLaunch; -import net.i2p.util.OrderedProperties; +import net.i2p.util.FileUtil; import net.i2p.util.NativeBigInteger; +import net.i2p.util.OrderedProperties; class Init { @@ -93,7 +94,7 @@ class Init { copyResourceToFile(R.raw.blocklist_txt, "blocklist.txt"); } - (new File(myDir, "wrapper.log")).delete(); + deleteOldFiles(); // Set up the locations so Router and WorkingDir can find them System.setProperty("i2p.dir.base", myDir); @@ -200,4 +201,17 @@ class Init { } return newVersion; } + + private void deleteOldFiles() { + (new File(myDir, "wrapper.log")).delete(); + File tmp = new File(myDir, "tmp"); + File[] files = tmp.listFiles(); + if (files != null) { + for (int i = 0; i < files.length; i++) { + File f = files[i]; + System.err.println("Deleting old file/dir " + f); + FileUtil.rmdir(f, false); + } + } + } }