Compare commits

..

14 Commits

Author SHA1 Message Date
17ab043a4b 0.9.18
i2p.i2p tag: i2p-0.9.18
2015-03-04 12:13:45 +00:00
32b2b0ce75 Updated TODO with Silent Store checklist (useful reference) 2015-03-04 12:12:44 +00:00
b77e2ebbe5 Updated translations 2015-03-04 01:11:48 +00:00
9eeab68cdb String translation fix 2015-03-04 01:11:44 +00:00
96257015a9 Language cleanups 2015-03-03 23:37:56 +00:00
d7f6e3688c UDP and NTCP ports, part 4 2015-03-03 22:50:26 +00:00
5ef434e29f Updated translations 2015-03-03 13:23:16 +00:00
852d695dac UDP and NTCP ports, part 3 2015-03-03 13:21:32 +00:00
96cb8ab410 Bugfix 2015-03-03 00:19:36 +00:00
cd158cca84 Updated translations 2015-03-02 22:57:37 +00:00
b71a0a27d3 Fixed help Activity back and up nav 2015-03-02 22:57:03 +00:00
64268c7af8 Activity title fixes 2015-03-02 21:45:13 +00:00
95749f032e I2PTunnel -> Tunnels / Hidden Services Manager; string tweaks 2015-03-02 21:29:34 +00:00
0ac1ae56b0 Dropped unnecessary part of tunnels guide 2015-03-02 21:17:43 +00:00
59 changed files with 551 additions and 458 deletions

44
TODO
View File

@ -51,6 +51,50 @@
- Think about pan/zoom - Think about pan/zoom
- How to persist data across restarts? - How to persist data across restarts?
# Silent Store approval checks to confirm/implement
- Known Vulnerabilities
- Apps will be tested to ensure that they are not susceptible to known
publicly disclosed vulnerabilities. For example:
- Heartbleed
- Poodle
- MasterKey
- Common Path Traversal attacks
- Common SQL Injection attacks
- Network Security Protocols
- All Apps that require transmission of data from the App to a system that
does not exist on the device must use, at a minimum, TLS1.1 standards.
However, Blackphone would prefer the usage of TLS1.2.
- Apps must not use algorithms for cryptographic purposes that are considered
obsolete or outdated i.e. MD5, SHA1, RC4, DES, or any encryption algorithm
that is weaker than AES128.
- Transport Layer Protection
- All network communication should be encrypted
- Not vulnerable to SSl Strip
- Data Leakage
- No storage of sensitive data outside of application sandbox
- Files should not be created with MODE_WORLD_READABLE or MODE_WORLD_WRITABLE
- Copy & Paste will be evaluated on a case by case basis
- App logs should not contain sensitive information
- Authentication and Authorization
- Validate that authentication credentials are not stored on the device
- Must use an approved password-based key derivation function ie. PBKDF2, scrypt
- Data-at-rest Encryption
- Must use at a minimum AES128 with modes CCM or GCM
- Should not store the encryption key on the file system
- Permission Checks
- The App must function with all permissions disabled
- Apps must not hard crash if a permission is disabled
- Apps should ask users to enable permissions that are disabled if needed to
function properly and explain why the permission is necessary
- Privacy Policy
- Apps must have a privacy policy that details how customer data is used,
stored, shared, etc...
- Apps must be configured with the customer opted out by default
- App logs should not contain PII
- Error Handling
- Apps should follow best-practices for error handling and logging
# Long-term # Long-term
- Remote router support - Remote router support

View File

@ -5,8 +5,8 @@ android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION) compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig { defaultConfig {
versionCode 4745225 versionCode 4745226
versionName '0.9.17.1' versionName '0.9.18'
minSdkVersion 9 minSdkVersion 9
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
} }

View File

@ -45,7 +45,7 @@
<activity <activity
android:name=".NewsActivity" android:name=".NewsActivity"
android:configChanges="orientation|keyboardHidden" android:configChanges="orientation|keyboardHidden"
android:label="I2P News" android:label="@string/label_news"
android:parentActivityName=".MainActivity"> android:parentActivityName=".MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
@ -53,7 +53,7 @@
</activity> </activity>
<activity <activity
android:name="net.i2p.android.help.HelpActivity" android:name="net.i2p.android.help.HelpActivity"
android:label="Help" android:label="@string/menu_help"
android:parentActivityName=".MainActivity"> android:parentActivityName=".MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
@ -61,7 +61,7 @@
</activity> </activity>
<activity <activity
android:name="net.i2p.android.help.BrowserConfigActivity" android:name="net.i2p.android.help.BrowserConfigActivity"
android:label="Browser Configuration" android:label="@string/label_browser_configuration"
android:parentActivityName=".MainActivity"> android:parentActivityName=".MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
@ -69,7 +69,7 @@
</activity> </activity>
<activity <activity
android:name=".LicenseActivity" android:name=".LicenseActivity"
android:label="I2P License Information" android:label="@string/label_licenses"
android:parentActivityName="net.i2p.android.help.HelpActivity"> android:parentActivityName="net.i2p.android.help.HelpActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
@ -94,7 +94,7 @@
</activity> </activity>
<activity <activity
android:name=".SettingsActivity" android:name=".SettingsActivity"
android:label="I2P Settings" android:label="@string/menu_settings"
android:parentActivityName=".MainActivity"> android:parentActivityName=".MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
@ -111,7 +111,7 @@
</activity> </activity>
<activity <activity
android:name=".addressbook.AddressbookActivity" android:name=".addressbook.AddressbookActivity"
android:label="Addressbook" android:label="@string/label_addressbook"
android:launchMode="singleTop"> android:launchMode="singleTop">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH" /> <action android:name="android.intent.action.SEARCH" />
@ -135,7 +135,7 @@
</activity> </activity>
<activity <activity
android:name="net.i2p.android.i2ptunnel.TunnelListActivity" android:name="net.i2p.android.i2ptunnel.TunnelListActivity"
android:label="I2PTunnel" android:label="@string/label_i2ptunnel"
android:launchMode="singleTop" android:launchMode="singleTop"
android:parentActivityName=".MainActivity"> android:parentActivityName=".MainActivity">
<meta-data <meta-data
@ -148,7 +148,7 @@
android:parentActivityName="net.i2p.android.i2ptunnel.TunnelListActivity"> android:parentActivityName="net.i2p.android.i2ptunnel.TunnelListActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value="net.i2p.android.router.i2ptunnel.TunnelListActivity" /> android:value="net.i2p.android.i2ptunnel.TunnelListActivity" />
</activity> </activity>
<activity <activity
android:name="net.i2p.android.i2ptunnel.TunnelWizardActivity" android:name="net.i2p.android.i2ptunnel.TunnelWizardActivity"

View File

@ -3,6 +3,7 @@ package net.i2p.android.help;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
public class Browser implements Comparable<Browser> { public class Browser implements Comparable<Browser> {
public final String packageName; public final String packageName;
@ -55,7 +56,7 @@ public class Browser implements Comparable<Browser> {
} }
@Override @Override
public int compareTo(Browser browser) { public int compareTo(@NonNull Browser browser) {
// Sort order: supported -> unknown -> unsupported // Sort order: supported -> unknown -> unsupported
int a = getOrder(this); int a = getOrder(this);
int b = getOrder(browser); int b = getOrder(browser);

View File

@ -102,12 +102,12 @@ public class BrowserListFragment extends Fragment implements
@Override @Override
public List<Browser> loadInBackground() { public List<Browser> loadInBackground() {
List<Browser> browsers = new ArrayList<Browser>(); List<Browser> browsers = new ArrayList<>();
Map<String, String> recommendedMap = new HashMap<String, String>(); Map<String, String> recommendedMap = new HashMap<>();
for (int i = 0; i < recommended.size(); i++) { for (int i = 0; i < recommended.size(); i++) {
recommendedMap.put(recommended.get(i), recommendedLabels.get(i)); recommendedMap.put(recommended.get(i), recommendedLabels.get(i));
} }
Map<String, String> supportedMap = new HashMap<String, String>(); Map<String, String> supportedMap = new HashMap<>();
for (int i = 0; i < supported.size(); i++) { for (int i = 0; i < supported.size(); i++) {
supportedMap.put(supported.get(i), supportedLabels.get(i)); supportedMap.put(supported.get(i), supportedLabels.get(i));
} }

View File

@ -2,6 +2,8 @@ package net.i2p.android.help;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.support.v4.app.TaskStackBuilder;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
@ -24,6 +26,7 @@ public class HelpActivity extends ActionBarActivity implements
* device. * device.
*/ */
private boolean mTwoPane; private boolean mTwoPane;
private int mCategory;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -49,9 +52,10 @@ public class HelpActivity extends ActionBarActivity implements
.commit(); .commit();
} }
int category = getIntent().getIntExtra(CATEGORY, -1); mCategory = getIntent().getIntExtra(CATEGORY, -1);
if (category >= 0) if (mCategory >= 0) {
showCategory(category); showCategory(mCategory);
}
} }
@Override @Override
@ -64,7 +68,24 @@ public class HelpActivity extends ActionBarActivity implements
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case android.R.id.home: case android.R.id.home:
onBackPressed(); if (mCategory >= 0) {
onBackPressed();
} else {
Intent upIntent = NavUtils.getParentActivityIntent(this);
if (NavUtils.shouldUpRecreateTask(this, upIntent)) {
// This activity is NOT part of this app's task, so create a new task
// when navigating up, with a synthesized back stack.
TaskStackBuilder.create(this)
// Add all of this activity's parents to the back stack
.addNextIntentWithParentStack(upIntent)
// Navigate up to the closest parent
.startActivities();
} else {
// This activity is part of this app's task, so simply
// navigate up to the logical parent activity.
NavUtils.navigateUpTo(this, upIntent);
}
}
return true; return true;
case R.id.menu_help_licenses: case R.id.menu_help_licenses:
Intent lic = new Intent(HelpActivity.this, LicenseActivity.class); Intent lic = new Intent(HelpActivity.this, LicenseActivity.class);
@ -84,6 +105,13 @@ public class HelpActivity extends ActionBarActivity implements
} }
} }
@Override
public void onBackPressed() {
super.onBackPressed();
if (mCategory >= 0)
mCategory = -1;
}
// HelpListFragment.OnEntrySelectedListener // HelpListFragment.OnEntrySelectedListener
@Override @Override
@ -91,8 +119,10 @@ public class HelpActivity extends ActionBarActivity implements
if (entry == CAT_CONFIGURE_BROWSER) { if (entry == CAT_CONFIGURE_BROWSER) {
Intent i = new Intent(this, BrowserConfigActivity.class); Intent i = new Intent(this, BrowserConfigActivity.class);
startActivity(i); startActivity(i);
} else } else {
mCategory = entry;
showCategory(entry); showCategory(entry);
}
} }
private void showCategory(int category) { private void showCategory(int category) {

View File

@ -1,8 +1,9 @@
package net.i2p.android.i2ptunnel; package net.i2p.android.i2ptunnel;
import android.os.Bundle;
import net.i2p.android.router.I2PActivityBase; import net.i2p.android.router.I2PActivityBase;
import net.i2p.android.router.R; import net.i2p.android.router.R;
import android.os.Bundle;
public class TunnelDetailActivity extends I2PActivityBase implements public class TunnelDetailActivity extends I2PActivityBase implements
TunnelDetailFragment.OnTunnelDeletedListener { TunnelDetailFragment.OnTunnelDeletedListener {
@ -11,6 +12,8 @@ public class TunnelDetailActivity extends I2PActivityBase implements
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
mDrawerToggle.setDrawerIndicatorEnabled(false); mDrawerToggle.setDrawerIndicatorEnabled(false);
getSupportActionBar().setDisplayShowTitleEnabled(false);
if (savedInstanceState == null) { if (savedInstanceState == null) {
int tunnelId = getIntent().getIntExtra(TunnelDetailFragment.TUNNEL_ID, 0); int tunnelId = getIntent().getIntExtra(TunnelDetailFragment.TUNNEL_ID, 0);
TunnelDetailFragment detailFrag = TunnelDetailFragment.newInstance(tunnelId); TunnelDetailFragment detailFrag = TunnelDetailFragment.newInstance(tunnelId);

View File

@ -1,15 +1,11 @@
package net.i2p.android.i2ptunnel; package net.i2p.android.i2ptunnel;
import java.util.List;
import net.i2p.android.i2ptunnel.util.TunnelUtil;
import net.i2p.android.router.R;
import net.i2p.i2ptunnel.TunnelControllerGroup;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -22,6 +18,12 @@ import android.widget.CheckBox;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import net.i2p.android.i2ptunnel.util.TunnelUtil;
import net.i2p.android.router.R;
import net.i2p.i2ptunnel.TunnelControllerGroup;
import java.util.List;
public class TunnelDetailFragment extends Fragment { public class TunnelDetailFragment extends Fragment {
public static final String TUNNEL_ID = "tunnel_id"; public static final String TUNNEL_ID = "tunnel_id";
@ -165,6 +167,7 @@ public class TunnelDetailFragment extends Fragment {
return true; return true;
case R.id.action_delete_tunnel: case R.id.action_delete_tunnel:
DialogFragment dg = new DialogFragment() { DialogFragment dg = new DialogFragment() {
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity()) return new AlertDialog.Builder(getActivity())

View File

@ -1,15 +1,15 @@
package net.i2p.android.i2ptunnel; package net.i2p.android.i2ptunnel;
import java.util.ArrayList;
import java.util.List;
import net.i2p.i2ptunnel.TunnelController;
import net.i2p.i2ptunnel.TunnelControllerGroup;
import android.content.Context; import android.content.Context;
import android.os.Handler; import android.os.Handler;
import android.support.v4.content.AsyncTaskLoader; import android.support.v4.content.AsyncTaskLoader;
import net.i2p.i2ptunnel.TunnelController;
import net.i2p.i2ptunnel.TunnelControllerGroup;
import java.util.ArrayList;
import java.util.List;
public class TunnelEntryLoader extends AsyncTaskLoader<List<TunnelEntry>> { public class TunnelEntryLoader extends AsyncTaskLoader<List<TunnelEntry>> {
private TunnelControllerGroup mGroup; private TunnelControllerGroup mGroup;
private boolean mClientTunnels; private boolean mClientTunnels;
@ -26,7 +26,7 @@ public class TunnelEntryLoader extends AsyncTaskLoader<List<TunnelEntry>> {
@Override @Override
public List<TunnelEntry> loadInBackground() { public List<TunnelEntry> loadInBackground() {
List<TunnelEntry> ret = new ArrayList<TunnelEntry>(); List<TunnelEntry> ret = new ArrayList<>();
List<TunnelController> controllers = mGroup.getControllers(); List<TunnelController> controllers = mGroup.getControllers();
for (int i = 0; i < controllers.size(); i++) { for (int i = 0; i < controllers.size(); i++) {
TunnelEntry tunnel = new TunnelEntry(getContext(), controllers.get(i), i); TunnelEntry tunnel = new TunnelEntry(getContext(), controllers.get(i), i);

View File

@ -1,16 +1,18 @@
package net.i2p.android.i2ptunnel; package net.i2p.android.i2ptunnel;
import net.i2p.android.router.R;
import net.i2p.android.wizard.model.AbstractWizardModel;
import net.i2p.android.wizard.ui.AbstractWizardActivity;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import net.i2p.android.router.R;
import net.i2p.android.wizard.model.AbstractWizardModel;
import net.i2p.android.wizard.ui.AbstractWizardActivity;
public class TunnelWizardActivity extends AbstractWizardActivity { public class TunnelWizardActivity extends AbstractWizardActivity {
@Override @Override
protected AbstractWizardModel onCreateModel() { protected AbstractWizardModel onCreateModel() {
@ -20,6 +22,7 @@ public class TunnelWizardActivity extends AbstractWizardActivity {
@Override @Override
protected DialogFragment onGetFinishWizardDialog() { protected DialogFragment onGetFinishWizardDialog() {
return new DialogFragment() { return new DialogFragment() {
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity()) return new AlertDialog.Builder(getActivity())

View File

@ -1,11 +1,5 @@
package net.i2p.android.i2ptunnel.util; package net.i2p.android.i2ptunnel.util;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
@ -17,6 +11,12 @@ import net.i2p.i2ptunnel.TunnelControllerGroup;
import net.i2p.util.FileUtil; import net.i2p.util.FileUtil;
import net.i2p.util.SecureFile; import net.i2p.util.SecureFile;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
public abstract class TunnelUtil { public abstract class TunnelUtil {
public static TunnelController getController(TunnelControllerGroup tcg, int tunnel) { public static TunnelController getController(TunnelControllerGroup tcg, int tunnel) {
if (tunnel < 0) return null; if (tunnel < 0) return null;
@ -36,7 +36,7 @@ public abstract class TunnelUtil {
TunnelController cur = getController(tcg, tunnelId); TunnelController cur = getController(tcg, tunnelId);
if (config == null) { if (config == null) {
List<String> ret = new ArrayList<String>(); List<String> ret = new ArrayList<>();
ret.add("Invalid params"); ret.add("Invalid params");
return ret; return ret;
} }
@ -101,7 +101,7 @@ public abstract class TunnelUtil {
List<String> msgs; List<String> msgs;
TunnelController cur = getController(tcg, tunnelId); TunnelController cur = getController(tcg, tunnelId);
if (cur == null) { if (cur == null) {
msgs = new ArrayList<String>(); msgs = new ArrayList<>();
msgs.add("Invalid tunnel number"); msgs.add("Invalid tunnel number");
return msgs; return msgs;
} }
@ -192,32 +192,34 @@ public abstract class TunnelUtil {
public static String getTypeName(String type, Context context) { public static String getTypeName(String type, Context context) {
Resources res = context.getResources(); Resources res = context.getResources();
if ("client".equals(type)) switch (type) {
return res.getString(R.string.i2ptunnel_type_client); case "client":
else if ("httpclient".equals(type)) return res.getString(R.string.i2ptunnel_type_client);
return res.getString(R.string.i2ptunnel_type_httpclient); case "httpclient":
else if ("ircclient".equals(type)) return res.getString(R.string.i2ptunnel_type_httpclient);
return res.getString(R.string.i2ptunnel_type_ircclient); case "ircclient":
else if ("server".equals(type)) return res.getString(R.string.i2ptunnel_type_ircclient);
return res.getString(R.string.i2ptunnel_type_server); case "server":
else if ("httpserver".equals(type)) return res.getString(R.string.i2ptunnel_type_server);
return res.getString(R.string.i2ptunnel_type_httpserver); case "httpserver":
else if ("sockstunnel".equals(type)) return res.getString(R.string.i2ptunnel_type_httpserver);
return res.getString(R.string.i2ptunnel_type_sockstunnel); case "sockstunnel":
else if ("socksirctunnel".equals(type)) return res.getString(R.string.i2ptunnel_type_sockstunnel);
return res.getString(R.string.i2ptunnel_type_socksirctunnel); case "socksirctunnel":
else if ("connectclient".equals(type)) return res.getString(R.string.i2ptunnel_type_socksirctunnel);
return res.getString(R.string.i2ptunnel_type_connectclient); case "connectclient":
else if ("ircserver".equals(type)) return res.getString(R.string.i2ptunnel_type_connectclient);
return res.getString(R.string.i2ptunnel_type_ircserver); case "ircserver":
else if ("streamrclient".equals(type)) return res.getString(R.string.i2ptunnel_type_ircserver);
return res.getString(R.string.i2ptunnel_type_streamrclient); case "streamrclient":
else if ("streamrserver".equals(type)) return res.getString(R.string.i2ptunnel_type_streamrclient);
return res.getString(R.string.i2ptunnel_type_streamrserver); case "streamrserver":
else if ("httpbidirserver".equals(type)) return res.getString(R.string.i2ptunnel_type_streamrserver);
return res.getString(R.string.i2ptunnel_type_httpbidirserver); case "httpbidirserver":
else return res.getString(R.string.i2ptunnel_type_httpbidirserver);
return type; default:
return type;
}
} }
public static boolean isClient(String type) { public static boolean isClient(String type) {

View File

@ -126,7 +126,7 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
mDrawerList.setChoiceMode(ListView.CHOICE_MODE_SINGLE); mDrawerList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
// Set the adapter for the list view // Set the adapter for the list view
mDrawerList.setAdapter(new ArrayAdapter<String>(this, mDrawerList.setAdapter(new ArrayAdapter<>(this,
R.layout.listitem_navdrawer, activityTitles)); R.layout.listitem_navdrawer, activityTitles));
// Set the list's click listener // Set the list's click listener
mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); mDrawerList.setOnItemClickListener(new DrawerItemClickListener());

View File

@ -124,8 +124,7 @@ class InitActivities {
File certificates = new File(myDir, "certificates"); File certificates = new File(myDir, "certificates");
File[] allcertificates = certificates.listFiles(); File[] allcertificates = certificates.listFiles();
if ( allcertificates != null) { if ( allcertificates != null) {
for (int i = 0; i < allcertificates.length; i++) { for (File f : allcertificates) {
File f = allcertificates[i];
Util.d("Deleting old certificate file/dir " + f); Util.d("Deleting old certificate file/dir " + f);
FileUtil.rmdir(f, false); FileUtil.rmdir(f, false);
} }

View File

@ -1,6 +1,5 @@
package net.i2p.android.router; package net.i2p.android.router;
import net.i2p.android.router.R;
import android.os.Bundle; import android.os.Bundle;
public class LicenseActivity extends I2PActivityBase { public class LicenseActivity extends I2PActivityBase {

View File

@ -5,7 +5,7 @@ import android.support.v4.app.ListFragment;
import android.view.View; import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ListView; import android.widget.ListView;
import net.i2p.android.router.R;
import net.i2p.android.router.dialog.TextResourceDialog; import net.i2p.android.router.dialog.TextResourceDialog;
public class LicenseFragment extends ListFragment { public class LicenseFragment extends ListFragment {
@ -28,7 +28,7 @@ public class LicenseFragment extends ListFragment {
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, names)); setListAdapter(new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, names));
} }
@Override @Override

View File

@ -1,6 +1,5 @@
package net.i2p.android.router; package net.i2p.android.router;
import net.i2p.android.router.R;
import android.os.Bundle; import android.os.Bundle;
public class NewsActivity extends I2PActivityBase { public class NewsActivity extends I2PActivityBase {

View File

@ -2,12 +2,15 @@ package net.i2p.android.router;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory; import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -17,7 +20,7 @@ import android.widget.Toast;
import net.i2p.I2PAppContext; import net.i2p.I2PAppContext;
import net.i2p.android.router.service.StatSummarizer; import net.i2p.android.router.service.StatSummarizer;
import net.i2p.android.router.util.IntEditTextPreference; import net.i2p.android.router.util.PortPreference;
import net.i2p.android.router.util.Util; import net.i2p.android.router.util.Util;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
import net.i2p.stat.FrequencyStat; import net.i2p.stat.FrequencyStat;
@ -48,26 +51,61 @@ public class SettingsActivity extends PreferenceActivity {
String action = getIntent().getAction(); String action = getIntent().getAction();
if (action != null) { if (action != null) {
if (ACTION_PREFS_NET.equals(action)) { switch (action) {
addPreferencesFromResource(R.xml.settings_net); case ACTION_PREFS_NET:
} else if (ACTION_PREFS_GRAPHS.equals(action)){ addPreferencesFromResource(R.xml.settings_net);
addPreferencesFromResource(R.xml.settings_graphs); break;
setupGraphSettings(this, getPreferenceScreen(), Util.getRouterContext()); case ACTION_PREFS_GRAPHS:
} else if (ACTION_PREFS_LOGGING.equals(action)) { addPreferencesFromResource(R.xml.settings_graphs);
addPreferencesFromResource(R.xml.settings_logging); setupGraphSettings(this, getPreferenceScreen(), Util.getRouterContext());
setupLoggingSettings(this, getPreferenceScreen(), Util.getRouterContext()); break;
} else if (ACTION_PREFS_ADVANCED.equals(action)) { case ACTION_PREFS_LOGGING:
addPreferencesFromResource(R.xml.settings_advanced); addPreferencesFromResource(R.xml.settings_logging);
setupAdvancedSettings(this, getPreferenceScreen(), Util.getRouterContext()); setupLoggingSettings(this, getPreferenceScreen(), Util.getRouterContext());
break;
case ACTION_PREFS_ADVANCED:
addPreferencesFromResource(R.xml.settings_advanced);
setupAdvancedSettings(this, getPreferenceScreen());
break;
}
} else {
// Load any properties that the router might have changed on us.
setupPreferences(this, Util.getRouterContext());
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
// Load the legacy preferences headers
addPreferencesFromResource(R.xml.settings_headers_legacy);
} }
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
// Load the legacy preferences headers
addPreferencesFromResource(R.xml.settings_headers_legacy);
} }
mToolbar.setTitle(getTitle()); mToolbar.setTitle(getTitle());
} }
protected static void setupPreferences(Context context, RouterContext ctx) {
if (ctx != null) {
final String udpPortKey = context.getString(R.string.PROP_UDP_INTERNAL_PORT);
final String ntcpPortKey = context.getString(R.string.PROP_I2NP_NTCP_PORT);
final String ntcpAutoPortKey = context.getString(R.string.PROP_I2NP_NTCP_AUTO_PORT);
int udpPort = ctx.getProperty(udpPortKey, -1);
int ntcpPort = ctx.getProperty(ntcpPortKey, -1);
boolean ntcpAutoPort = ctx.getBooleanPropertyDefaultTrue(ntcpAutoPortKey);
if (ntcpPort < 0 && ntcpAutoPort)
ntcpPort = udpPort;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (prefs.getInt(udpPortKey, -1) != udpPort ||
prefs.getInt(ntcpPortKey, -1) != ntcpPort) {
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(udpPortKey, udpPort);
editor.putInt(ntcpPortKey, ntcpPort);
// commit() instead of apply() because this needs to happen
// before SettingsActivity loads its Preferences.
editor.commit();
}
}
}
protected static void setupGraphSettings(Context context, PreferenceScreen ps, RouterContext ctx) { protected static void setupGraphSettings(Context context, PreferenceScreen ps, RouterContext ctx) {
if (ctx == null) { if (ctx == null) {
PreferenceCategory noRouter = new PreferenceCategory(context); PreferenceCategory noRouter = new PreferenceCategory(context);
@ -156,22 +194,63 @@ public class SettingsActivity extends PreferenceActivity {
} }
} }
protected static void setupAdvancedSettings(Context context, PreferenceScreen ps, RouterContext ctx) { protected static void setupAdvancedSettings(final Context context, PreferenceScreen ps) {
if (ctx != null) { final String udpEnableKey = context.getString(R.string.PROP_ENABLE_UDP);
final String udpPortKey = context.getString(R.string.PROP_UDP_INTERNAL_PORT); final String ntcpEnableKey = context.getString(R.string.PROP_ENABLE_NTCP);
final String ntcpPortKey = context.getString(R.string.PROP_I2NP_NTCP_PORT); final String udpPortKey = context.getString(R.string.PROP_UDP_INTERNAL_PORT);
final String ntcpPortKey = context.getString(R.string.PROP_I2NP_NTCP_PORT);
final String ntcpAutoPortKey = context.getString(R.string.PROP_I2NP_NTCP_AUTO_PORT);
IntEditTextPreference udpPort = (IntEditTextPreference) ps.findPreference(udpPortKey); final CheckBoxPreference udpEnable = (CheckBoxPreference) ps.findPreference(udpEnableKey);
IntEditTextPreference ntcpPort = (IntEditTextPreference) ps.findPreference(ntcpPortKey); final CheckBoxPreference ntcpEnable = (CheckBoxPreference) ps.findPreference(ntcpEnableKey);
final PortPreference udpPort = (PortPreference) ps.findPreference(udpPortKey);
final PortPreference ntcpPort = (PortPreference) ps.findPreference(ntcpPortKey);
final CheckBoxPreference ntcpAutoPort = (CheckBoxPreference) ps.findPreference(ntcpAutoPortKey);
String udpCurrentPort = ctx.getProperty(udpPortKey, "0"); udpEnable.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
udpPort.setText(udpCurrentPort); @Override
String ntcpCurrentPort = ctx.getProperty(ntcpPortKey); public boolean onPreferenceChange(Preference preference, Object newValue) {
if (ntcpCurrentPort != null && ntcpCurrentPort.length() > 0) final Boolean checked = (Boolean) newValue;
ntcpPort.setText(ntcpCurrentPort); if (checked || ntcpEnable.isChecked())
else return true;
ntcpPort.setText(udpCurrentPort); else {
} Toast.makeText(context, R.string.settings_need_transport_enabled, Toast.LENGTH_LONG).show();
return false;
}
}
});
ntcpEnable.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final Boolean checked = (Boolean) newValue;
if (checked || udpEnable.isChecked())
return true;
else {
Toast.makeText(context, R.string.settings_need_transport_enabled, Toast.LENGTH_LONG).show();
return false;
}
}
});
udpPort.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (ntcpAutoPort.isChecked())
ntcpPort.setText((String) newValue);
return true;
}
});
ntcpAutoPort.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final Boolean checked = (Boolean) newValue;
if (checked)
ntcpPort.setText(udpPort.getText());
return true;
}
});
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @TargetApi(Build.VERSION_CODES.HONEYCOMB)
@ -264,17 +343,22 @@ public class SettingsActivity extends PreferenceActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
String settings = getArguments().getString("settings"); String settings = getArguments().getString("settings");
if ("net".equals(settings)) { switch (settings) {
addPreferencesFromResource(R.xml.settings_net); case "net":
} else if ("graphs".equals(settings)) { addPreferencesFromResource(R.xml.settings_net);
addPreferencesFromResource(R.xml.settings_graphs); break;
setupGraphSettings(getActivity(), getPreferenceScreen(), Util.getRouterContext()); case "graphs":
} else if ("logging".equals(settings)) { addPreferencesFromResource(R.xml.settings_graphs);
addPreferencesFromResource(R.xml.settings_logging); setupGraphSettings(getActivity(), getPreferenceScreen(), Util.getRouterContext());
setupLoggingSettings(getActivity(), getPreferenceScreen(), Util.getRouterContext()); break;
} else if ("advanced".equals(settings)) { case "logging":
addPreferencesFromResource(R.xml.settings_advanced); addPreferencesFromResource(R.xml.settings_logging);
setupAdvancedSettings(getActivity(), getPreferenceScreen(), Util.getRouterContext()); setupLoggingSettings(getActivity(), getPreferenceScreen(), Util.getRouterContext());
break;
case "advanced":
addPreferencesFromResource(R.xml.settings_advanced);
setupAdvancedSettings(getActivity(), getPreferenceScreen());
break;
} }
} }
} }

View File

@ -40,8 +40,8 @@ public class AddressEntryLoader extends AsyncTaskLoader<List<AddressEntry>> {
NamingService ns = NamingServiceUtil.getNamingService(routerContext, mBook); NamingService ns = NamingServiceUtil.getNamingService(routerContext, mBook);
Util.d("NamingService: " + ns.getName()); Util.d("NamingService: " + ns.getName());
// After router shutdown we get nothing... why? // After router shutdown we get nothing... why?
List<AddressEntry> ret = new ArrayList<AddressEntry>(); List<AddressEntry> ret = new ArrayList<>();
Map<String, Destination> names = new TreeMap<String, Destination>(); Map<String, Destination> names = new TreeMap<>();
Properties searchProps = new Properties(); Properties searchProps = new Properties();
// Needed for HostsTxtNamingService // Needed for HostsTxtNamingService

View File

@ -6,6 +6,7 @@ import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import net.i2p.android.wizard.model.AbstractWizardModel; import net.i2p.android.wizard.model.AbstractWizardModel;
import net.i2p.android.wizard.ui.AbstractWizardActivity; import net.i2p.android.wizard.ui.AbstractWizardActivity;
@ -19,6 +20,7 @@ public class AddressbookAddWizardActivity extends AbstractWizardActivity {
@Override @Override
protected DialogFragment onGetFinishWizardDialog() { protected DialogFragment onGetFinishWizardDialog() {
return new DialogFragment() { return new DialogFragment() {
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity()) return new AlertDialog.Builder(getActivity())

View File

@ -1,21 +1,24 @@
package net.i2p.android.router.dialog; package net.i2p.android.router.dialog;
import net.i2p.android.router.LicenseActivity;
import net.i2p.android.router.R;
import net.i2p.android.router.util.I2Patterns;
import net.i2p.android.router.util.Util;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.text.util.Linkify; import android.text.util.Linkify;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import net.i2p.android.router.LicenseActivity;
import net.i2p.android.router.R;
import net.i2p.android.router.util.I2Patterns;
import net.i2p.android.router.util.Util;
public class AboutDialog extends DialogFragment { public class AboutDialog extends DialogFragment {
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle SavedInstanceState) { public Dialog onCreateDialog(Bundle SavedInstanceState) {
LayoutInflater li = LayoutInflater.from(getActivity()); LayoutInflater li = LayoutInflater.from(getActivity());

View File

@ -5,18 +5,14 @@ import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.text.util.Linkify;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import net.i2p.android.help.BrowserConfigActivity; import net.i2p.android.help.BrowserConfigActivity;
import net.i2p.android.help.HelpActivity;
import net.i2p.android.router.R; import net.i2p.android.router.R;
import net.i2p.android.router.util.I2Patterns;
public class ConfigureBrowserDialog extends DialogFragment { public class ConfigureBrowserDialog extends DialogFragment {
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder b = new AlertDialog.Builder(getActivity()); AlertDialog.Builder b = new AlertDialog.Builder(getActivity());

View File

@ -1,18 +1,20 @@
package net.i2p.android.router.dialog; package net.i2p.android.router.dialog;
import net.i2p.android.router.R;
import net.i2p.android.router.util.I2Patterns;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.text.util.Linkify; import android.text.util.Linkify;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import net.i2p.android.router.R;
import net.i2p.android.router.util.I2Patterns;
public class FirstStartDialog extends DialogFragment { public class FirstStartDialog extends DialogFragment {
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater li = LayoutInflater.from(getActivity()); LayoutInflater li = LayoutInflater.from(getActivity());

View File

@ -54,10 +54,8 @@ public class TextResourceDialog extends DialogFragment {
while ( (read = in.read(buf)) != -1) while ( (read = in.read(buf)) != -1)
out.write(buf, 0, read); out.write(buf, 0, read);
} catch (IOException ioe) { } catch (IOException | Resources.NotFoundException re) {
System.err.println("resource error " + ioe); System.err.println("resource error " + re);
} catch (Resources.NotFoundException nfe) {
System.err.println("resource error " + nfe);
} finally { } finally {
if (in != null) try { in.close(); } catch (IOException ioe) {} if (in != null) try { in.close(); } catch (IOException ioe) {}
} }

View File

@ -1,24 +1,27 @@
package net.i2p.android.router.dialog; package net.i2p.android.router.dialog;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import net.i2p.android.router.I2PActivityBase; import net.i2p.android.router.I2PActivityBase;
import net.i2p.android.router.MainFragment; import net.i2p.android.router.MainFragment;
import net.i2p.android.router.R; import net.i2p.android.router.R;
import net.i2p.android.router.util.Util; import net.i2p.android.router.util.Util;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
public class VersionDialog extends DialogFragment { public class VersionDialog extends DialogFragment {
public static final String DIALOG_TYPE = "dialog_type"; public static final String DIALOG_TYPE = "dialog_type";
public static final int DIALOG_NEW_INSTALL = 0; public static final int DIALOG_NEW_INSTALL = 0;
public static final int DIALOG_NEW_VERSION = 1; public static final int DIALOG_NEW_VERSION = 1;
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle SavedInstanceState) { public Dialog onCreateDialog(Bundle SavedInstanceState) {
final String currentVersion = Util.getOurVersion(getActivity()); final String currentVersion = Util.getOurVersion(getActivity());
Dialog rv = null; Dialog rv;
AlertDialog.Builder b = new AlertDialog.Builder(getActivity()); AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
int id = getArguments().getInt(DIALOG_TYPE); int id = getArguments().getInt(DIALOG_TYPE);
switch(id) { switch(id) {
@ -53,6 +56,7 @@ public class VersionDialog extends DialogFragment {
break; break;
case DIALOG_NEW_VERSION: case DIALOG_NEW_VERSION:
default:
b.setMessage(getResources().getString(R.string.welcome_new_version) + b.setMessage(getResources().getString(R.string.welcome_new_version) +
" " + currentVersion) " " + currentVersion)
.setCancelable(true) .setCancelable(true)

View File

@ -15,11 +15,12 @@ import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import net.i2p.I2PAppContext; import net.i2p.I2PAppContext;
import net.i2p.android.router.R; import net.i2p.android.router.R;
import java.util.ArrayList;
import java.util.List;
public class LogFragment extends ListFragment implements public class LogFragment extends ListFragment implements
LoaderManager.LoaderCallbacks<List<String>> { LoaderManager.LoaderCallbacks<List<String>> {
public static final String LOG_LEVEL = "log_level"; public static final String LOG_LEVEL = "log_level";
@ -33,7 +34,7 @@ public class LogFragment extends ListFragment implements
private static final int LEVEL_ALL = 2; private static final int LEVEL_ALL = 2;
OnEntrySelectedListener mEntrySelectedCallback; OnEntrySelectedListener mEntrySelectedCallback;
private final List<String> mLogEntries = new ArrayList<String>(); private final List<String> mLogEntries = new ArrayList<>();
private LogAdapter mAdapter; private LogAdapter mAdapter;
private TextView mHeaderView; private TextView mHeaderView;
private String mLogLevel; private String mLogLevel;

View File

@ -1,18 +1,19 @@
package net.i2p.android.router.netdb; package net.i2p.android.router.netdb;
import android.content.Context;
import android.support.v4.content.AsyncTaskLoader;
import net.i2p.data.Destination;
import net.i2p.data.LeaseSet;
import net.i2p.data.router.RouterInfo;
import net.i2p.router.RouterContext;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import net.i2p.data.Destination;
import net.i2p.data.LeaseSet;
import net.i2p.data.router.RouterInfo;
import net.i2p.router.RouterContext;
import android.content.Context;
import android.support.v4.content.AsyncTaskLoader;
public class NetDbEntryLoader extends AsyncTaskLoader<List<NetDbEntry>> { public class NetDbEntryLoader extends AsyncTaskLoader<List<NetDbEntry>> {
private RouterContext mRContext; private RouterContext mRContext;
private boolean mRouters; private boolean mRouters;
@ -44,17 +45,17 @@ public class NetDbEntryLoader extends AsyncTaskLoader<List<NetDbEntry>> {
@Override @Override
public List<NetDbEntry> loadInBackground() { public List<NetDbEntry> loadInBackground() {
List<NetDbEntry> ret = new ArrayList<NetDbEntry>(); List<NetDbEntry> ret = new ArrayList<>();
if (mRContext.netDb().isInitialized()) { if (mRContext.netDb().isInitialized()) {
if (mRouters) { if (mRouters) {
Set<RouterInfo> routers = new TreeSet<RouterInfo>(new RouterInfoComparator()); Set<RouterInfo> routers = new TreeSet<>(new RouterInfoComparator());
routers.addAll(mRContext.netDb().getRouters()); routers.addAll(mRContext.netDb().getRouters());
for (RouterInfo ri : routers) { for (RouterInfo ri : routers) {
NetDbEntry entry = NetDbEntry.fromRouterInfo(mRContext, ri); NetDbEntry entry = NetDbEntry.fromRouterInfo(mRContext, ri);
ret.add(entry); ret.add(entry);
} }
} else { } else {
Set<LeaseSet> leases = new TreeSet<LeaseSet>(new LeaseSetComparator()); Set<LeaseSet> leases = new TreeSet<>(new LeaseSetComparator());
leases.addAll(mRContext.netDb().getLeases()); leases.addAll(mRContext.netDb().getLeases());
for (LeaseSet ls : leases) { for (LeaseSet ls : leases) {
NetDbEntry entry = NetDbEntry.fromLeaseSet(mRContext, ls); NetDbEntry entry = NetDbEntry.fromLeaseSet(mRContext, ls);

View File

@ -1,18 +1,19 @@
package net.i2p.android.router.netdb; package net.i2p.android.router.netdb;
import java.util.ArrayList; import android.content.Context;
import java.util.Comparator; import android.support.v4.content.AsyncTaskLoader;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import net.i2p.data.Hash; import net.i2p.data.Hash;
import net.i2p.data.router.RouterAddress; import net.i2p.data.router.RouterAddress;
import net.i2p.data.router.RouterInfo; import net.i2p.data.router.RouterInfo;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
import net.i2p.util.ObjectCounter; import net.i2p.util.ObjectCounter;
import android.content.Context;
import android.support.v4.content.AsyncTaskLoader; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
public class NetDbStatsLoader extends AsyncTaskLoader<List<ObjectCounter<String>>> { public class NetDbStatsLoader extends AsyncTaskLoader<List<ObjectCounter<String>>> {
private RouterContext mRContext; private RouterContext mRContext;
@ -31,16 +32,16 @@ public class NetDbStatsLoader extends AsyncTaskLoader<List<ObjectCounter<String>
@Override @Override
public List<ObjectCounter<String>> loadInBackground() { public List<ObjectCounter<String>> loadInBackground() {
List<ObjectCounter<String>> ret = new ArrayList<ObjectCounter<String>>(); List<ObjectCounter<String>> ret = new ArrayList<>();
ObjectCounter<String> versions = new ObjectCounter<String>(); ObjectCounter<String> versions = new ObjectCounter<>();
ObjectCounter<String> countries = new ObjectCounter<String>(); ObjectCounter<String> countries = new ObjectCounter<>();
ObjectCounter<String> transports = new ObjectCounter<String>(); ObjectCounter<String> transports = new ObjectCounter<>();
if (mRContext != null && mRContext.netDb() != null && mRContext.netDb().isInitialized()) { if (mRContext != null && mRContext.netDb() != null && mRContext.netDb().isInitialized()) {
Hash us = mRContext.routerHash(); Hash us = mRContext.routerHash();
Set<RouterInfo> routers = new TreeSet<RouterInfo>(new RouterInfoComparator()); Set<RouterInfo> routers = new TreeSet<>(new RouterInfoComparator());
routers.addAll(mRContext.netDb().getRouters()); routers.addAll(mRContext.netDb().getRouters());
for (RouterInfo ri : routers) { for (RouterInfo ri : routers) {
Hash key = ri.getHash(); Hash key = ri.getHash();

View File

@ -1,12 +1,5 @@
package net.i2p.android.router.netdb; package net.i2p.android.router.netdb;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.i2p.android.router.R;
import net.i2p.util.ObjectCounter;
import net.i2p.util.VersionComparator;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -16,6 +9,14 @@ import android.widget.TableLayout;
import android.widget.TableRow; import android.widget.TableRow;
import android.widget.TextView; import android.widget.TextView;
import net.i2p.android.router.R;
import net.i2p.util.ObjectCounter;
import net.i2p.util.VersionComparator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class NetDbSummaryTableFragment extends Fragment { public class NetDbSummaryTableFragment extends Fragment {
private static final String CATEGORY = "category"; private static final String CATEGORY = "category";
private static final String COUNTS = "counts"; private static final String COUNTS = "counts";
@ -44,7 +45,7 @@ public class NetDbSummaryTableFragment extends Fragment {
mTable = (TableLayout) v.findViewById(R.id.table); mTable = (TableLayout) v.findViewById(R.id.table);
List<String> objects = new ArrayList<String>(mCounts.objects()); List<String> objects = new ArrayList<>(mCounts.objects());
if (!objects.isEmpty()) { if (!objects.isEmpty()) {
createTableTitle(); createTableTitle();

View File

@ -6,6 +6,12 @@ import android.content.SharedPreferences;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import net.i2p.android.apps.EepGetFetcher;
import net.i2p.android.router.BuildConfig;
import net.i2p.android.router.util.AppCache;
import net.i2p.android.router.util.Util;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
@ -13,10 +19,6 @@ import java.io.OutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.i2p.android.apps.EepGetFetcher;
import net.i2p.android.router.BuildConfig;
import net.i2p.android.router.util.AppCache;
import net.i2p.android.router.util.Util;
/** /**
* Usage: content://net.i2p.android.router/NONCE/ENCODED-SCHEME/ENCODED-AUTHORITY/ENCODED_PATH + QUERY_MARKER + ENCODED-QUERY * Usage: content://net.i2p.android.router/NONCE/ENCODED-SCHEME/ENCODED-AUTHORITY/ENCODED_PATH + QUERY_MARKER + ENCODED-QUERY
@ -141,7 +143,7 @@ public class CacheProvider extends ContentProvider {
* *
* @param uri must contain a scheme, authority and path with nonce etc. as defined above * @param uri must contain a scheme, authority and path with nonce etc. as defined above
* @return non-null * @return non-null
* @throws FNFE on error * @throws java.io.FileNotFoundException on error
*/ */
public static Uri getI2PUri(Uri uri) throws FileNotFoundException { public static Uri getI2PUri(Uri uri) throws FileNotFoundException {
String resPath = uri.getEncodedPath(); String resPath = uri.getEncodedPath();
@ -243,8 +245,7 @@ public class CacheProvider extends ContentProvider {
if (file.length() > 0) { if (file.length() > 0) {
// this call will insert it back to us (don't set as current base) // this call will insert it back to us (don't set as current base)
Uri content = cache.addCacheFile(uri, false); Uri content = cache.addCacheFile(uri, false);
ParcelFileDescriptor parcel = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
return parcel;
} else { } else {
Util.d("CacheProvider Sucess but no data " + uri); Util.d("CacheProvider Sucess but no data " + uri);
} }
@ -276,7 +277,7 @@ public class CacheProvider extends ContentProvider {
put(uri, fileURI); put(uri, fileURI);
} }
Boolean setAsCurrentBase = values.getAsBoolean(CURRENT_BASE); Boolean setAsCurrentBase = values.getAsBoolean(CURRENT_BASE);
if (setAsCurrentBase != null && setAsCurrentBase.booleanValue()) { if (setAsCurrentBase != null && setAsCurrentBase) {
Util.d("CacheProvider set current base " + uri); Util.d("CacheProvider set current base " + uri);
setCurrentBase(uri); setCurrentBase(uri);
} }
@ -303,7 +304,7 @@ public class CacheProvider extends ContentProvider {
private void cleanup() { private void cleanup() {
String pfx = CONTENT_URI.toString(); String pfx = CONTENT_URI.toString();
List<String> toDelete = new ArrayList<String>(); List<String> toDelete = new ArrayList<>();
Map<String, ?> map = _sharedPrefs.getAll(); Map<String, ?> map = _sharedPrefs.getAll();
for (Map.Entry<String, ?> e : map.entrySet()) { for (Map.Entry<String, ?> e : map.entrySet()) {
String path = (String) e.getValue(); String path = (String) e.getValue();

View File

@ -1,10 +1,12 @@
package net.i2p.android.router.service; package net.i2p.android.router.service;
import android.content.Context; import android.content.Context;
import java.io.File;
import net.i2p.android.router.util.Util; import net.i2p.android.router.util.Util;
import net.i2p.util.FileUtil; import net.i2p.util.FileUtil;
import java.io.File;
class Init { class Init {
private final Context ctx; private final Context ctx;
@ -32,8 +34,7 @@ class Init {
File tmp = new File(myDir, "tmp"); File tmp = new File(myDir, "tmp");
File[] files = tmp.listFiles(); File[] files = tmp.listFiles();
if (files != null) { if (files != null) {
for (int i = 0; i < files.length; i++) { for (File f : files) {
File f = files[i];
Util.d("Deleting old file/dir " + f); Util.d("Deleting old file/dir " + f);
FileUtil.rmdir(f, false); FileUtil.rmdir(f, false);
} }

View File

@ -9,15 +9,6 @@ import android.os.Message;
import android.os.RemoteCallbackList; import android.os.RemoteCallbackList;
import android.os.RemoteException; import android.os.RemoteException;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.DecimalFormat;
import java.util.List;
import java.util.Properties;
import java.util.Random;
import net.i2p.android.router.R; import net.i2p.android.router.R;
import net.i2p.android.router.receiver.I2PReceiver; import net.i2p.android.router.receiver.I2PReceiver;
import net.i2p.android.router.util.Connectivity; import net.i2p.android.router.util.Connectivity;
@ -28,7 +19,8 @@ import net.i2p.router.Job;
import net.i2p.router.Router; import net.i2p.router.Router;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
import net.i2p.router.RouterLaunch; import net.i2p.router.RouterLaunch;
import net.i2p.util.OrderedProperties;
import java.text.DecimalFormat;
/** /**
* Runs the router * Runs the router
@ -59,7 +51,7 @@ public class RouterService extends Service {
* that it can be accessed more efficiently from inner classes. * that it can be accessed more efficiently from inner classes.
*/ */
final RemoteCallbackList<IRouterStateCallback> mStateCallbacks final RemoteCallbackList<IRouterStateCallback> mStateCallbacks
= new RemoteCallbackList<IRouterStateCallback>(); = new RemoteCallbackList<>();
@Override @Override
public void onCreate() { public void onCreate() {
@ -176,147 +168,7 @@ public class RouterService extends Service {
//NativeBigInteger.main(null); //NativeBigInteger.main(null);
//Util.d(MARKER + this + " JBigI speed test finished, launching router"); //Util.d(MARKER + this + " JBigI speed test finished, launching router");
// Launch the router!
// Before we launch, fix up any settings that need to be fixed here.
// This should be done in the core, but as of this writing it isn't!
// Step one. Load the propertites.
Properties props = new OrderedProperties();
Properties oldprops = new OrderedProperties();
String wrapName = _myDir + "/router.config";
try {
InputStream fin = new FileInputStream(new File(wrapName));
DataHelper.loadProps(props, fin);
} catch(IOException ioe) {
// shouldn't happen...
}
oldprops.putAll(props);
// Step two, check for any port settings, and copy for those that are missing.
int UDPinbound;
int UDPinlocal;
int TCPinbound;
int TCPinlocal;
UDPinbound = Integer.parseInt(props.getProperty("i2np.udp.port", "-1"));
UDPinlocal = Integer.parseInt(props.getProperty("i2np.udp.internalPort", "-1"));
TCPinbound = Integer.parseInt(props.getProperty("i2np.ntcp.port", "-1"));
TCPinlocal = Integer.parseInt(props.getProperty("i2np.ntcp.internalPort", "-1"));
boolean hasUDPinbound = UDPinbound != -1;
boolean hasUDPinlocal = UDPinlocal != -1;
boolean hasTCPinbound = TCPinbound != -1;
boolean hasTCPinlocal = TCPinlocal != -1;
// check and clear values based on these:
boolean udp = Boolean.parseBoolean(props.getProperty("i2np.udp.enable", "false"));
boolean tcp = Boolean.parseBoolean(props.getProperty("i2np.ntcp.enable", "false"));
// Fix if both are false.
if(!(udp || tcp)) {
// If both are not on, turn them both on.
props.setProperty("i2np.udp.enable", "true");
props.setProperty("i2np.ntcp.enable", "true");
}
// Fix if we have local but no inbound
if(!hasUDPinbound && hasUDPinlocal) {
// if we got a local port and no external port, set it
hasUDPinbound = true;
UDPinbound = UDPinlocal;
}
if(!hasTCPinbound && hasTCPinlocal) {
// if we got a local port and no external port, set it
hasTCPinbound = true;
TCPinbound = TCPinlocal;
}
boolean anyUDP = hasUDPinbound || hasUDPinlocal;
boolean anyTCP = hasTCPinbound || hasTCPinlocal;
boolean anyport = anyUDP || anyTCP;
if(!anyport) {
// generate one for UDPinbound, and fall thru.
// FIX ME: Possibly not the best but should be OK.
Random generator = new Random(System.currentTimeMillis());
UDPinbound = generator.nextInt(55500) + 10000;
anyUDP = true;
}
// Copy missing port numbers
if(anyUDP && !anyTCP) {
TCPinbound = UDPinbound;
TCPinlocal = UDPinlocal;
}
if(anyTCP && !anyUDP) {
UDPinbound = TCPinbound;
UDPinlocal = TCPinlocal;
}
// reset for a retest.
hasUDPinbound = UDPinbound != -1;
hasUDPinlocal = UDPinlocal != -1;
hasTCPinbound = TCPinbound != -1;
hasTCPinlocal = TCPinlocal != -1;
anyUDP = hasUDPinbound || hasUDPinlocal;
anyTCP = hasTCPinbound || hasTCPinlocal;
boolean checkAnyUDP = anyUDP && udp;
boolean checkAnyTCP = anyTCP && tcp;
// Enable things that need to be enabled.
// Disable anything that needs to be disabled.
if(!checkAnyUDP && !checkAnyTCP) {
// enable the one(s) with values.
if(anyUDP) {
udp = true;
}
if(anyTCP) {
tcp = true;
}
}
if(!udp) {
props.setProperty("i2np.udp.enable", "false");
props.remove("i2np.udp.port");
props.remove("i2np.udp.internalPort");
} else {
props.setProperty("i2np.udp.enable", "true");
if(hasUDPinbound) {
props.setProperty("i2np.udp.port", Integer.toString(UDPinbound));
} else {
props.remove("i2np.udp.port");
}
if(hasUDPinlocal) {
props.setProperty("i2np.udp.internalPort", Integer.toString(UDPinlocal));
} else {
props.remove("i2np.udp.internalPort");
}
}
if(!tcp) {
props.setProperty("i2np.ntcp.enable", "false");
props.remove("i2np.ntcp.port");
props.remove("i2np.ntcp.internalPort");
} else {
props.setProperty("i2np.ntcp.enable", "true");
if(hasTCPinbound) {
props.setProperty("i2np.ntcp.port", Integer.toString(TCPinbound));
} else {
props.remove("i2np.ntcp.port");
}
if(hasTCPinlocal) {
props.setProperty("i2np.ntcp.internalPort", Integer.toString(TCPinlocal));
} else {
props.remove("i2np.ntcp.internalPort");
}
}
// WHEW! Now test for any changes.
if(!props.equals(oldprops)) {
// save fixed properties.
try {
DataHelper.storeProps(props, new File(wrapName));
} catch(IOException ioe) {
// shouldn't happen...
}
}
// _NOW_ launch the router!
RouterLaunch.main(null); RouterLaunch.main(null);
synchronized(_stateLock) { synchronized(_stateLock) {
if(_state != State.STARTING) { if(_state != State.STARTING) {
@ -457,7 +309,7 @@ public class RouterService extends Service {
// ******** following methods may be accessed from Activities and Receivers ************ // ******** following methods may be accessed from Activities and Receivers ************
/** /**
* @returns null if router is not running * @return null if router is not running
*/ */
public RouterContext getRouterContext() { public RouterContext getRouterContext() {
RouterContext rv = _context; RouterContext rv = _context;

View File

@ -1,15 +1,15 @@
package net.i2p.android.router.service; package net.i2p.android.router.service;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.concurrent.CopyOnWriteArrayList;
import net.i2p.android.router.util.Util; import net.i2p.android.router.util.Util;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
import net.i2p.stat.Rate; import net.i2p.stat.Rate;
import net.i2p.stat.RateStat; import net.i2p.stat.RateStat;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.concurrent.CopyOnWriteArrayList;
public class StatSummarizer implements Runnable { public class StatSummarizer implements Runnable {
private final RouterContext _context; private final RouterContext _context;
private final List<SummaryListener> _listeners; private final List<SummaryListener> _listeners;
@ -20,7 +20,7 @@ public class StatSummarizer implements Runnable {
public StatSummarizer() { public StatSummarizer() {
_context = Util.getRouterContext(); _context = Util.getRouterContext();
_listeners = new CopyOnWriteArrayList<SummaryListener>(); _listeners = new CopyOnWriteArrayList<>();
_instance = this; _instance = this;
if (_context != null) if (_context != null)
_context.addShutdownTask(new Shutdown()); _context.addShutdownTask(new Shutdown());
@ -109,7 +109,7 @@ public class StatSummarizer implements Runnable {
*/ */
List<Rate> parseSpecs(String specs) { List<Rate> parseSpecs(String specs) {
StringTokenizer tok = new StringTokenizer(specs, ","); StringTokenizer tok = new StringTokenizer(specs, ",");
List<Rate> rv = new ArrayList<Rate>(); List<Rate> rv = new ArrayList<>();
while (tok.hasMoreTokens()) { while (tok.hasMoreTokens()) {
String spec = tok.nextToken(); String spec = tok.nextToken();
int split = spec.lastIndexOf('.'); int split = spec.lastIndexOf('.');
@ -117,7 +117,7 @@ public class StatSummarizer implements Runnable {
continue; continue;
String name = spec.substring(0, split); String name = spec.substring(0, split);
String per = spec.substring(split+1); String per = spec.substring(split+1);
long period = -1; long period;
try { try {
period = Long.parseLong(per); period = Long.parseLong(per);
RateStat rs = _context.statManager().getRate(name); RateStat rs = _context.statManager().getRate(name);

View File

@ -6,6 +6,7 @@ import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
@ -40,7 +41,7 @@ public class RateGraphActivity extends I2PActivityBase {
if (StatSummarizer.instance() != null) { if (StatSummarizer.instance() != null) {
// Get the rates currently being graphed // Get the rates currently being graphed
List<SummaryListener> listeners = StatSummarizer.instance().getListeners(); List<SummaryListener> listeners = StatSummarizer.instance().getListeners();
TreeSet<SummaryListener> ordered = new TreeSet<SummaryListener>(new AlphaComparator()); TreeSet<SummaryListener> ordered = new TreeSet<>(new AlphaComparator());
ordered.addAll(listeners); ordered.addAll(listeners);
if (ordered.size() > 0) { if (ordered.size() > 0) {
@ -58,7 +59,7 @@ public class RateGraphActivity extends I2PActivityBase {
mSpinner = (Spinner) findViewById(R.id.main_spinner); mSpinner = (Spinner) findViewById(R.id.main_spinner);
mSpinner.setVisibility(View.VISIBLE); mSpinner.setVisibility(View.VISIBLE);
mSpinner.setAdapter(new ArrayAdapter<String>(this, mSpinner.setAdapter(new ArrayAdapter<>(this,
android.R.layout.simple_spinner_dropdown_item, mRates)); android.R.layout.simple_spinner_dropdown_item, mRates));
mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@ -79,6 +80,7 @@ public class RateGraphActivity extends I2PActivityBase {
selectRate(0); selectRate(0);
} else { } else {
DialogFragment df = new DialogFragment() { DialogFragment df = new DialogFragment() {
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
@ -112,6 +114,7 @@ public class RateGraphActivity extends I2PActivityBase {
} }
} else { } else {
DialogFragment df = new DialogFragment() { DialogFragment df = new DialogFragment() {
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

View File

@ -1,11 +1,13 @@
package net.i2p.android.router.stats; package net.i2p.android.router.stats;
import java.text.DecimalFormat; import android.graphics.Color;
import java.text.FieldPosition; import android.os.Bundle;
import java.text.Format; import android.os.Handler;
import java.text.ParsePosition; import android.support.annotation.NonNull;
import java.util.Observable; import android.view.LayoutInflater;
import java.util.Observer; import android.view.View;
import android.view.ViewGroup;
import com.androidplot.Plot; import com.androidplot.Plot;
import com.androidplot.xy.BoundaryMode; import com.androidplot.xy.BoundaryMode;
import com.androidplot.xy.LineAndPointFormatter; import com.androidplot.xy.LineAndPointFormatter;
@ -18,12 +20,13 @@ import net.i2p.android.router.R;
import net.i2p.android.router.service.StatSummarizer; import net.i2p.android.router.service.StatSummarizer;
import net.i2p.android.router.service.SummaryListener; import net.i2p.android.router.service.SummaryListener;
import net.i2p.android.router.util.Util; import net.i2p.android.router.util.Util;
import android.graphics.Color;
import android.os.Bundle; import java.text.DecimalFormat;
import android.os.Handler; import java.text.FieldPosition;
import android.view.LayoutInflater; import java.text.Format;
import android.view.View; import java.text.ParsePosition;
import android.view.ViewGroup; import java.util.Observable;
import java.util.Observer;
public class RateGraphFragment extends I2PFragmentBase { public class RateGraphFragment extends I2PFragmentBase {
// redraws a plot whenever an update is received: // redraws a plot whenever an update is received:
@ -131,8 +134,8 @@ public class RateGraphFragment extends I2PFragmentBase {
_ratePlot.setRangeValueFormat(new Format() { _ratePlot.setRangeValueFormat(new Format() {
@Override @Override
public StringBuffer format(Object obj, StringBuffer toAppendTo, public StringBuffer format(Object obj, @NonNull StringBuffer toAppendTo,
FieldPosition pos) { @NonNull FieldPosition pos) {
double val = ((Number) obj).doubleValue(); double val = ((Number) obj).doubleValue();
if (val >= 10 * 1000 * 1000) if (val >= 10 * 1000 * 1000)
return new DecimalFormat("0 M").format(val / (1000 * 1000), toAppendTo, pos); return new DecimalFormat("0 M").format(val / (1000 * 1000), toAppendTo, pos);
@ -147,7 +150,7 @@ public class RateGraphFragment extends I2PFragmentBase {
} }
@Override @Override
public Object parseObject(String source, ParsePosition pos) { public Object parseObject(String source, @NonNull ParsePosition pos) {
return null; return null;
} }

View File

@ -4,6 +4,9 @@ import android.content.ContentResolver;
import android.content.ContentValues; import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.net.Uri; import android.net.Uri;
import net.i2p.android.router.provider.CacheProvider;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
@ -14,7 +17,6 @@ import java.util.Comparator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.i2p.android.router.provider.CacheProvider;
/** /**
* A least recently used cache with a max number of entries * A least recently used cache with a max number of entries
@ -32,7 +34,7 @@ public class AppCache {
/** the LRU cache */ /** the LRU cache */
private final Map<Integer, Object> _cache; private final Map<Integer, Object> _cache;
private static final Integer DUMMY = Integer.valueOf(0); private static final Integer DUMMY = 0;
private static final String DIR_NAME = "appCache"; private static final String DIR_NAME = "appCache";
/** fragment into this many subdirectories */ /** fragment into this many subdirectories */
private static final int NUM_DIRS = 32; private static final int NUM_DIRS = 32;
@ -89,7 +91,7 @@ public class AppCache {
public Uri addCacheFile(Uri key, boolean setAsCurrentBase) { public Uri addCacheFile(Uri key, boolean setAsCurrentBase) {
int hash = toHash(key); int hash = toHash(key);
synchronized(_cache) { synchronized(_cache) {
_cache.put(Integer.valueOf(hash), DUMMY); _cache.put(hash, DUMMY);
} }
// file:/// uri // file:/// uri
//return Uri.fromFile(toFile(hash)).toString(); //return Uri.fromFile(toFile(hash)).toString();
@ -104,7 +106,7 @@ public class AppCache {
public void removeCacheFile(Uri key) { public void removeCacheFile(Uri key) {
int hash = toHash(key); int hash = toHash(key);
synchronized(_cache) { synchronized(_cache) {
_cache.remove(Integer.valueOf(hash)); _cache.remove(hash);
} }
deleteContent(key); deleteContent(key);
} }
@ -121,7 +123,7 @@ public class AppCache {
// poke the LRU // poke the LRU
Object present; Object present;
synchronized(_cache) { synchronized(_cache) {
present = _cache.get(Integer.valueOf(hash)); present = _cache.get(hash);
} }
if (present != null) if (present != null)
setAsCurrentBase(key); setAsCurrentBase(key);
@ -173,17 +175,16 @@ public class AppCache {
File[] files = dir.listFiles(); File[] files = dir.listFiles();
if (files == null) if (files == null)
return 0; return 0;
for (int i = 0; i < files.length; i++) { for (File f : files) {
File f = files[i]; if (f.isDirectory()) {
if (f.isDirectory()) { rv += enumerate(f, fileList);
rv += enumerate(f, fileList); } else {
} else { long len = f.length();
long len = f.length(); if (len > 0) {
if (len > 0) { fileList.add(f);
fileList.add(f); rv += len;
rv += len;
} else { } else {
f.delete(); f.delete();
} }
} }
} }
@ -195,7 +196,7 @@ public class AppCache {
try { try {
int hash = toHash(f); int hash = toHash(f);
synchronized(_cache) { synchronized(_cache) {
_cache.put(Integer.valueOf(hash), DUMMY); _cache.put(hash, DUMMY);
} }
} catch (IllegalArgumentException iae) { } catch (IllegalArgumentException iae) {
Util.d("Huh bad file?" + iae); Util.d("Huh bad file?" + iae);
@ -294,7 +295,7 @@ public class AppCache {
@Override @Override
public Object put(Integer key, Object value) { public Object put(Integer key, Object value) {
Object rv = super.put(key, value); Object rv = super.put(key, value);
File f = toFile(key.intValue()); File f = toFile(key);
if (f.exists()) { if (f.exists()) {
_totalSize += f.length(); _totalSize += f.length();
} }
@ -306,7 +307,7 @@ public class AppCache {
public Object remove(Object key) { public Object remove(Object key) {
Object rv = super.remove(key); Object rv = super.remove(key);
if ( /* rv != null && */ key instanceof Integer) { if ( /* rv != null && */ key instanceof Integer) {
File f = toFile(((Integer)key).intValue()); File f = toFile((Integer) key);
if (f.exists()) { if (f.exists()) {
_totalSize -= f.length(); _totalSize -= f.length();
f.delete(); f.delete();

View File

@ -1,9 +1,5 @@
package net.i2p.android.router.util; package net.i2p.android.router.util;
import java.net.IDN;
import java.util.List;
import java.util.Locale;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
@ -18,6 +14,10 @@ import net.i2p.data.DataFormatException;
import net.i2p.data.Destination; import net.i2p.data.Destination;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
import java.net.IDN;
import java.util.List;
import java.util.Locale;
public class NamingServiceUtil { public class NamingServiceUtil {
private static final String DEFAULT_NS = "BlockfileNamingService"; private static final String DEFAULT_NS = "BlockfileNamingService";
@ -106,7 +106,7 @@ public class NamingServiceUtil {
* Ref: java.net.IDN and RFC 3940 * Ref: java.net.IDN and RFC 3940
* @param host will be converted to lower case * @param host will be converted to lower case
* @return name converted to lower case and punycoded if necessary * @return name converted to lower case and punycoded if necessary
* @throws IAE on various errors or if IDN is needed but not available * @throws java.lang.IllegalArgumentException on various errors or if IDN is needed but not available
* @since 0.8.7 * @since 0.8.7
*/ */
@SuppressLint("NewApi") @SuppressLint("NewApi")

View File

@ -131,13 +131,13 @@ public abstract class Util implements I2PConstants {
final static String PROP_I2NP_NTCP_AUTO_PORT = "i2np.ntcp.autoport"; final static String PROP_I2NP_NTCP_AUTO_PORT = "i2np.ntcp.autoport";
public static List<Properties> getPropertiesFromPreferences(Context context) { public static List<Properties> getPropertiesFromPreferences(Context context) {
List<Properties> pList = new ArrayList<Properties>(); List<Properties> pList = new ArrayList<>();
// Copy prefs // Copy prefs
Properties routerProps = new OrderedProperties(); Properties routerProps = new OrderedProperties();
// List to store stats for graphing // List to store stats for graphing
List<String> statSummaries = new ArrayList<String>(); List<String> statSummaries = new ArrayList<>();
// Properties to remove // Properties to remove
Properties toRemove = new OrderedProperties(); Properties toRemove = new OrderedProperties();
@ -147,27 +147,25 @@ public abstract class Util implements I2PConstants {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
Map<String, ?> all = preferences.getAll(); Map<String, ?> all = preferences.getAll();
Iterator<String> iterator = all.keySet().iterator();
// get values from the Map and make them strings. // get values from the Map and make them strings.
// This loop avoids needing to convert each one, or even know it's type, or if it exists yet. // This loop avoids needing to convert each one, or even know it's type, or if it exists yet.
while (iterator.hasNext()) { for (String x : all.keySet()) {
String x = iterator.next(); if (x.startsWith("stat.summaries.")) {
if ( x.startsWith("stat.summaries.")) {
String stat = x.substring("stat.summaries.".length()); String stat = x.substring("stat.summaries.".length());
String checked = all.get(x).toString(); String checked = all.get(x).toString();
if (checked.equals("true")) { if (checked.equals("true")) {
statSummaries.add(stat); statSummaries.add(stat);
} }
} else if ( x.startsWith("logger.")) { } else if (x.startsWith("logger.")) {
logSettings.put(x, all.get(x).toString()); logSettings.put(x, all.get(x).toString());
} else if ( } else if (
x.equals("router.hiddenMode") || x.equals("router.hiddenMode") ||
x.equals("i2cp.disableInterface")) { x.equals("i2cp.disableInterface")) {
// special exception, we must invert the bool for these properties only. // special exception, we must invert the bool for these properties only.
String string = all.get(x).toString(); String string = all.get(x).toString();
String inverted = Boolean.toString(!Boolean.parseBoolean(string)); String inverted = Boolean.toString(!Boolean.parseBoolean(string));
routerProps.setProperty(x, inverted); routerProps.setProperty(x, inverted);
} else if ( !x.startsWith(ANDROID_PREF_PREFIX)) { // Skip over UI-related I2P Android settings } else if (!x.startsWith(ANDROID_PREF_PREFIX)) { // Skip over UI-related I2P Android settings
String string = all.get(x).toString(); String string = all.get(x).toString();
routerProps.setProperty(x, string); routerProps.setProperty(x, string);
} }
@ -185,11 +183,9 @@ public abstract class Util implements I2PConstants {
// See net.i2p.router.web.ConfigNetHandler.saveChanges() // See net.i2p.router.web.ConfigNetHandler.saveChanges()
int udpPort = Integer.parseInt(routerProps.getProperty(UDPTransport.PROP_INTERNAL_PORT, "-1")); int udpPort = Integer.parseInt(routerProps.getProperty(UDPTransport.PROP_INTERNAL_PORT, "-1"));
System.out.println("UDP port: " + udpPort);
if (udpPort <= 0) if (udpPort <= 0)
routerProps.remove(UDPTransport.PROP_INTERNAL_PORT); routerProps.remove(UDPTransport.PROP_INTERNAL_PORT);
int ntcpPort = Integer.parseInt(routerProps.getProperty(PROP_I2NP_NTCP_PORT, "-1")); int ntcpPort = Integer.parseInt(routerProps.getProperty(PROP_I2NP_NTCP_PORT, "-1"));
System.out.println("NTCP port: " + ntcpPort);
boolean ntcpAutoPort = Boolean.parseBoolean( boolean ntcpAutoPort = Boolean.parseBoolean(
routerProps.getProperty(PROP_I2NP_NTCP_AUTO_PORT, "true")); routerProps.getProperty(PROP_I2NP_NTCP_AUTO_PORT, "true"));
if (ntcpPort <= 0 || ntcpAutoPort) { if (ntcpPort <= 0 || ntcpAutoPort) {
@ -205,11 +201,11 @@ public abstract class Util implements I2PConstants {
} }
// propName -> defaultValue // propName -> defaultValue
private static HashMap<String, Boolean> booleanOptionsRequiringRestart = new HashMap<String, Boolean>(); private static HashMap<String, Boolean> booleanOptionsRequiringRestart = new HashMap<>();
private static HashMap<String, String> stringOptionsRequiringRestart = new HashMap<String, String>(); private static HashMap<String, String> stringOptionsRequiringRestart = new HashMap<>();
static { static {
HashMap<String, Boolean> boolToAdd = new HashMap<String, Boolean>(); HashMap<String, Boolean> boolToAdd = new HashMap<>();
HashMap<String, String> strToAdd = new HashMap<String, String>(); HashMap<String, String> strToAdd = new HashMap<>();
boolToAdd.put(TransportManager.PROP_ENABLE_UPNP, true); boolToAdd.put(TransportManager.PROP_ENABLE_UPNP, true);
boolToAdd.put(TransportManager.PROP_ENABLE_NTCP, true); boolToAdd.put(TransportManager.PROP_ENABLE_NTCP, true);

View File

@ -1,9 +1,9 @@
<html> <html>
<head></head> <head></head>
<body> <body>
<h2>What is I2PTunnel?</h2> <h2>What are tunnels?</h2>
<p>Tunnels are the heart of I2P. All data inside the I2P network is sent through tunnels that hide the location of users. If an app has native I2P support, it will create its own tunnels.</p> <p>Tunnels are the heart of I2P. All data inside the I2P network is sent through tunnels that hide the location of users. If an app has native I2P support, it will create its own tunnels.</p>
<p>I2PTunnel lets you create your own tunnels manually. This is useful for when you want to use an app that doesn't have native I2P support, like:</p> <p>The Hidden Services Manager lets you create your own tunnels manually. This is useful for when you want to use an app that doesn't have native I2P support, like:</p>
<ul> <ul>
<li>A browser.</li> <li>A browser.</li>
<li>An IRC client.</li> <li>An IRC client.</li>
@ -11,14 +11,7 @@
</ul> </ul>
<h2>Using clients with pre-configured tunnels</h2> <h2>Using clients with pre-configured tunnels</h2>
<p>The app starts an HTTP proxy at localhost port 4444 and IRC client tunnels at localhost ports 6668 - 6672. The IRC clients are "shared clients" on the same tunnels. Once you see the tunnel icon turn green on the main console (several minutes after startup), you should be able to connect.</p> <p>The app starts an HTTP proxy tunnel at localhost port 4444 and IRC client tunnels at localhost ports 6668 - 6672. The IRC clients are "shared clients" on the same tunnels. Once you see the tunnel icon turn green on the main console (several minutes after startup), you should be able to connect.</p>
<p>The IRC proxy is tested with the "Android IRC Free" app. The IRC proxy destinations are:</p>
<ol>
<li>Port 6668: IRC2P - irc.postman.i2p, irc.freshcoffee.i2p, and irc.echelon.i2p</li>
<li>Port 6669: irc.welterde.i2p</li>
<li>Port 6670: irc.killyourtv.i2p</li>
</ol>
<h2>What does the clock icon on a yellow background mean?</h2> <h2>What does the clock icon on a yellow background mean?</h2>
<p>When a tunnel's indicator is yellow with a clock icon, the tunnel is in standby mode. This means that I2P has not built the tunnel yet, but will do so automatically when you start using it. This helps to minimize resource use and conserve battery life.</p> <p>When a tunnel's indicator is yellow with a clock icon, the tunnel is in standby mode. This means that I2P has not built the tunnel yet, but will do so automatically when you start using it. This helps to minimize resource use and conserve battery life.</p>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">Tunnel</string> <string name="label_tunnels">Tunnel</string>
<string name="label_status">Status</string> <string name="label_status">Status</string>
<string name="label_addressbook">Adressbuch</string> <string name="label_addressbook">Adressbuch</string>
<string name="label_i2ptunnel">I2PTunnel</string>
<string name="label_i2ptunnel_client">Kliententunnel</string> <string name="label_i2ptunnel_client">Kliententunnel</string>
<string name="label_i2ptunnel_server">Servertunnel</string> <string name="label_i2ptunnel_server">Servertunnel</string>
<string name="label_logs">Statusberichte</string> <string name="label_logs">Statusberichte</string>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">Túneles</string> <string name="label_tunnels">Túneles</string>
<string name="label_status">Estado</string> <string name="label_status">Estado</string>
<string name="label_addressbook">Libreta de direcciones</string> <string name="label_addressbook">Libreta de direcciones</string>
<string name="label_i2ptunnel">I2PTunnel</string>
<string name="label_i2ptunnel_client">Túneles de cliente</string> <string name="label_i2ptunnel_client">Túneles de cliente</string>
<string name="label_i2ptunnel_server">Túneles de servidor</string> <string name="label_i2ptunnel_server">Túneles de servidor</string>
<string name="label_logs">Registros</string> <string name="label_logs">Registros</string>

View File

@ -7,7 +7,6 @@
<string name="label_tunnels">Tunnelit</string> <string name="label_tunnels">Tunnelit</string>
<string name="label_status">Tila</string> <string name="label_status">Tila</string>
<string name="label_addressbook">Osoitekirja</string> <string name="label_addressbook">Osoitekirja</string>
<string name="label_i2ptunnel">I2PTunnel</string>
<string name="label_i2ptunnel_client">Asiakastunnelit</string> <string name="label_i2ptunnel_client">Asiakastunnelit</string>
<string name="label_i2ptunnel_server">Palvelintunnelit</string> <string name="label_i2ptunnel_server">Palvelintunnelit</string>
<string name="label_logs">Lokitiedostot</string> <string name="label_logs">Lokitiedostot</string>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">Tunnels</string> <string name="label_tunnels">Tunnels</string>
<string name="label_status">Statut</string> <string name="label_status">Statut</string>
<string name="label_addressbook">Carnet d\'adresses</string> <string name="label_addressbook">Carnet d\'adresses</string>
<string name="label_i2ptunnel">I2PTunnel</string>
<string name="label_i2ptunnel_client">Tunnels client</string> <string name="label_i2ptunnel_client">Tunnels client</string>
<string name="label_i2ptunnel_server">Tunnels serveur</string> <string name="label_i2ptunnel_server">Tunnels serveur</string>
<string name="label_logs">Logs</string> <string name="label_logs">Logs</string>
@ -69,6 +68,8 @@
<string name="settings_enable">Activer</string> <string name="settings_enable">Activer</string>
<string name="settings_desc_subscriptions">URLs d\'abonnement</string> <string name="settings_desc_subscriptions">URLs d\'abonnement</string>
<string name="settings_label_bandwidth_net">Bande passante et réseau</string> <string name="settings_label_bandwidth_net">Bande passante et réseau</string>
<string name="settings_label_startOnBoot">Démarrer I2P lors du boot</string>
<string name="settings_desc_startOnBoot">Se connecter automatiquement à I2P lorsque votre dispositif Android démarre</string>
<string name="settings_label_bandwidth">Bande passante</string> <string name="settings_label_bandwidth">Bande passante</string>
<string name="settings_label_bw_inbound">Vitesse entrante</string> <string name="settings_label_bw_inbound">Vitesse entrante</string>
<string name="settings_desc_bw_inbound">Vitesse entrante maximum</string> <string name="settings_desc_bw_inbound">Vitesse entrante maximum</string>
@ -191,4 +192,5 @@
<string name="error_logs_copied_to_clipboard">Les historiques des erreurs ont été copiés dans le presse-papier</string> <string name="error_logs_copied_to_clipboard">Les historiques des erreurs ont été copiés dans le presse-papier</string>
<string name="logs_copied_to_clipboard">Les historiques ont été copiés dans le presse-papier</string> <string name="logs_copied_to_clipboard">Les historiques ont été copiés dans le presse-papier</string>
<string name="label_browser_configuration">Configuration du navigateur</string> <string name="label_browser_configuration">Configuration du navigateur</string>
<string name="unset">Démettre</string>
</resources> </resources>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">Saluran</string> <string name="label_tunnels">Saluran</string>
<string name="label_status">Status</string> <string name="label_status">Status</string>
<string name="label_addressbook">Buku alamat</string> <string name="label_addressbook">Buku alamat</string>
<string name="label_i2ptunnel">I2PTunnel</string>
<string name="label_i2ptunnel_client">Saluran klien</string> <string name="label_i2ptunnel_client">Saluran klien</string>
<string name="label_i2ptunnel_server">Saluran server</string> <string name="label_i2ptunnel_server">Saluran server</string>
<string name="label_logs">Log</string> <string name="label_logs">Log</string>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">Tunnel</string> <string name="label_tunnels">Tunnel</string>
<string name="label_status">Stato</string> <string name="label_status">Stato</string>
<string name="label_addressbook">Rubrica</string> <string name="label_addressbook">Rubrica</string>
<string name="label_i2ptunnel">I2PTunnel</string>
<string name="label_i2ptunnel_client">I tunnel del client</string> <string name="label_i2ptunnel_client">I tunnel del client</string>
<string name="label_i2ptunnel_server">I tunnel del server</string> <string name="label_i2ptunnel_server">I tunnel del server</string>
<string name="label_logs">Logs</string> <string name="label_logs">Logs</string>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">トンネル</string> <string name="label_tunnels">トンネル</string>
<string name="label_status">ステータス</string> <string name="label_status">ステータス</string>
<string name="label_addressbook">アドレス帳</string> <string name="label_addressbook">アドレス帳</string>
<string name="label_i2ptunnel">I2P トンネル</string>
<string name="label_i2ptunnel_client">クライアントトンネル</string> <string name="label_i2ptunnel_client">クライアントトンネル</string>
<string name="label_i2ptunnel_server">サーバートンネル</string> <string name="label_i2ptunnel_server">サーバートンネル</string>
<string name="label_logs">ログ</string> <string name="label_logs">ログ</string>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">터널들</string> <string name="label_tunnels">터널들</string>
<string name="label_status">상태</string> <string name="label_status">상태</string>
<string name="label_addressbook">주소록</string> <string name="label_addressbook">주소록</string>
<string name="label_i2ptunnel">I2P터널</string>
<string name="label_i2ptunnel_client">클라이언트 터널들</string> <string name="label_i2ptunnel_client">클라이언트 터널들</string>
<string name="label_i2ptunnel_server">서버 터널들</string> <string name="label_i2ptunnel_server">서버 터널들</string>
<string name="label_logs">로그</string> <string name="label_logs">로그</string>
@ -69,6 +68,8 @@
<string name="settings_enable">활성화</string> <string name="settings_enable">활성화</string>
<string name="settings_desc_subscriptions">구독 URL들</string> <string name="settings_desc_subscriptions">구독 URL들</string>
<string name="settings_label_bandwidth_net">대역폭과 네트워크</string> <string name="settings_label_bandwidth_net">대역폭과 네트워크</string>
<string name="settings_label_startOnBoot">부트시 I2P 실행</string>
<string name="settings_desc_startOnBoot">안드로이드 기기가 시작될 때 I2P에 자동으로 연결</string>
<string name="settings_label_bandwidth">대역폭</string> <string name="settings_label_bandwidth">대역폭</string>
<string name="settings_label_bw_inbound">수신 속도</string> <string name="settings_label_bw_inbound">수신 속도</string>
<string name="settings_desc_bw_inbound">최대 수신 속도</string> <string name="settings_desc_bw_inbound">최대 수신 속도</string>
@ -141,6 +142,8 @@
<string name="i2ptunnel_type_streamrclient">Streamr 클라이언트</string> <string name="i2ptunnel_type_streamrclient">Streamr 클라이언트</string>
<string name="i2ptunnel_type_streamrserver">Streamr 서버</string> <string name="i2ptunnel_type_streamrserver">Streamr 서버</string>
<string name="i2ptunnel_type_httpbidirserver">HTTP bidir</string> <string name="i2ptunnel_type_httpbidirserver">HTTP bidir</string>
<string name="install_recommended_app">권장 앱을 설치할까요?</string>
<string name="app_needed_for_this_tunnel_type">이 터널을 이용하기 위해서는 앱을 설치해야 합니다. 권장 앱을 설치할까요?</string>
<string name="i2ptunnel_not_initialized">터널이 아직 시작되지 않았습니다. 2분 후에 다시 로드하세요.</string> <string name="i2ptunnel_not_initialized">터널이 아직 시작되지 않았습니다. 2분 후에 다시 로드하세요.</string>
<string name="i2ptunnel_new_tunnel">새 터널</string> <string name="i2ptunnel_new_tunnel">새 터널</string>
<string name="i2ptunnel_msg_config_saved">설정 변경 저장됨</string> <string name="i2ptunnel_msg_config_saved">설정 변경 저장됨</string>
@ -189,4 +192,5 @@
<string name="error_logs_copied_to_clipboard">클립보드에 오류 로그 복사됨</string> <string name="error_logs_copied_to_clipboard">클립보드에 오류 로그 복사됨</string>
<string name="logs_copied_to_clipboard">클립보드에 로그 복사됨</string> <string name="logs_copied_to_clipboard">클립보드에 로그 복사됨</string>
<string name="label_browser_configuration">브라우저 설정</string> <string name="label_browser_configuration">브라우저 설정</string>
<string name="unset">미설정</string>
</resources> </resources>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">Tunneler</string> <string name="label_tunnels">Tunneler</string>
<string name="label_status">Status</string> <string name="label_status">Status</string>
<string name="label_addressbook">Adressebok</string> <string name="label_addressbook">Adressebok</string>
<string name="label_i2ptunnel">I2P-Tunnel</string>
<string name="label_i2ptunnel_client">Klient-tunneler</string> <string name="label_i2ptunnel_client">Klient-tunneler</string>
<string name="label_i2ptunnel_server">Tjener-tunneler</string> <string name="label_i2ptunnel_server">Tjener-tunneler</string>
<string name="label_logs">Logger</string> <string name="label_logs">Logger</string>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">Tunnels</string> <string name="label_tunnels">Tunnels</string>
<string name="label_status">Status</string> <string name="label_status">Status</string>
<string name="label_addressbook">Adresboek</string> <string name="label_addressbook">Adresboek</string>
<string name="label_i2ptunnel">I2PTunnel</string>
<string name="label_i2ptunnel_client">Cliënt tunnels</string> <string name="label_i2ptunnel_client">Cliënt tunnels</string>
<string name="label_i2ptunnel_server">Server tunnels</string> <string name="label_i2ptunnel_server">Server tunnels</string>
<string name="label_logs">Logboeken</string> <string name="label_logs">Logboeken</string>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">Tunele</string> <string name="label_tunnels">Tunele</string>
<string name="label_status">Status</string> <string name="label_status">Status</string>
<string name="label_addressbook">Książka adresowa</string> <string name="label_addressbook">Książka adresowa</string>
<string name="label_i2ptunnel">Tunel I2P</string>
<string name="label_i2ptunnel_client">Tunele klienta</string> <string name="label_i2ptunnel_client">Tunele klienta</string>
<string name="label_i2ptunnel_server">Tunele serwerów</string> <string name="label_i2ptunnel_server">Tunele serwerów</string>
<string name="label_logs">Logi</string> <string name="label_logs">Logi</string>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">Tuneis</string> <string name="label_tunnels">Tuneis</string>
<string name="label_status">Estado</string> <string name="label_status">Estado</string>
<string name="label_addressbook">Livro de endereços</string> <string name="label_addressbook">Livro de endereços</string>
<string name="label_i2ptunnel">TunelI2P</string>
<string name="label_i2ptunnel_client">Túneis clientes</string> <string name="label_i2ptunnel_client">Túneis clientes</string>
<string name="label_i2ptunnel_server">Túneis servidor</string> <string name="label_i2ptunnel_server">Túneis servidor</string>
<string name="label_logs">Registros</string> <string name="label_logs">Registros</string>

View File

@ -1,46 +1,72 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources> <resources>
<string name="app_name">I2P</string> <string name="app_name">I2P</string>
<string name="welcome_new_install">Bem-vindo ao I2P! Este aplicativo é um software ALPHA e não proporciona um forte anonimato. Por favor, leia as notas de lançamento e informações de licença.</string> <string name="desc_i2p_logo">Logótipo I2P</string>
<string name="welcome_new_install">Bem-vindo à I2P! Esta app é um programa ALPHA e não proporciona um anonimato forte. Por favor, leia as notas de lançamento e a informação da licença.</string>
<string name="welcome_new_version">Nova versão instalada. Por favor, leias as notas de lançamento. Versão:</string> <string name="welcome_new_version">Nova versão instalada. Por favor, leias as notas de lançamento. Versão:</string>
<string name="label_home">Início I2P</string> <string name="label_home">Controlos e Estado</string>
<string name="label_addressbook">Endereços</string> <string name="label_status">Estado</string>
<string name="label_logs">Registros</string> <string name="label_addressbook">Livro de Endereços</string>
<string name="label_error_logs">Registros de Erros</string> <string name="label_logs">Registos</string>
<string name="label_info_and_pages">Informação e páginas</string> <string name="label_error_logs">Registos de Erros</string>
<string name="label_welcome_page">Página de boas vindas</string> <string name="label_info_and_pages">Informação e Páginas</string>
<string name="label_welcome_page">Página de Boas-vindas</string>
<string name="label_news">Notícias</string> <string name="label_news">Notícias</string>
<string name="label_news_status">Últimas Notícias do I2P</string>
<string name="label_peers_status">Pares</string> <string name="label_peers_status">Pares</string>
<string name="label_release_notes">Notas da Versão</string> <string name="label_release_notes">Notas de Lançamento</string>
<string name="label_licenses">Licenças</string> <string name="label_licenses">Licenças</string>
<string name="label_nonanon_info">Informação não anônima</string> <string name="label_nonanon_info">Informação Não Anónima</string>
<string name="label_browse">Explorar</string>
<string name="label_graphs">Gráficos</string>
<string name="button_router_off">Pressionar longo para iniciar I2P</string>
<string name="button_router_on">I2P está em execução (pressionar longo para para)</string>
<!--Character to indicate a client tunnel. Usually first letter of the word "client".-->
<string name="char_client_tunnel">C</string>
<!--Character to indicate a server tunnel. Usually first letter of the word "server".-->
<string name="char_server_tunnel">S</string>
<string name="configure_browser_title">Configurar navegador?</string>
<string name="drawer_open">Abrir navegador</string>
<string name="drawer_close">Fechar navegador</string>
<string name="action_search">Procurar</string>
<string name="action_add">Adicionar</string> <string name="action_add">Adicionar</string>
<string name="action_router_start">Iniciar Roteador</string> <string name="action_edit">Editar</string>
<string name="action_router_stop">Parar Roteador</string> <string name="action_delete">Apagar</string>
<string name="action_router_start">Iniciar Router</string>
<string name="action_router_stop">Parar Router</string>
<string name="action_reload">Recarregar</string> <string name="action_reload">Recarregar</string>
<string name="action_refresh">Atualizar</string>
<string name="hint_search_addressbook">Procurar livro de endereços</string>
<string name="action_reload_subscriptions">Recarregar subscrições</string>
<string name="router_not_running">O router não está em execução.</string>
<string name="stats_not_ready">O gestor de estatísticas ainda não está pronto. Tente de novo mais tarde.</string>
<string name="configure_graphs">Configurar gráficos</string>
<string name="graphs_not_ready">Os gráficos não estão prontos, ou o router não está em execução. Tente de novo mais tarde.</string>
<string name="menu_settings">Configurações</string> <string name="menu_settings">Configurações</string>
<string name="settings_enable">Habilitar</string> <string name="settings_enable">Ativar</string>
<string name="settings_desc_subscriptions">Subscrição de URLs</string> <string name="settings_desc_subscriptions">URLs de Subscrição</string>
<string name="settings_label_bandwidth">Largura de banda e rede</string> <string name="settings_label_startOnBoot">Iniciar I2P no Arranque</string>
<string name="settings_label_bandwidth">Largura de Banda</string>
<string name="settings_label_bw_inbound">Velocidade de entrada</string> <string name="settings_label_bw_inbound">Velocidade de entrada</string>
<string name="settings_desc_bw_inbound">Máxima velocidade de entrada</string> <string name="settings_desc_bw_inbound">Velocidade de entrada máxima</string>
<string name="settings_label_bw_outbound">Velocidade de saída</string> <string name="settings_label_bw_outbound">Velocidade de saída</string>
<string name="settings_desc_bw_outbound">Máxima velocidade de saída</string> <string name="settings_desc_bw_outbound">Velocidade de saída máxima</string>
<string name="settings_label_hiddenMode">Participação</string> <string name="settings_label_hiddenMode">Participação</string>
<string name="settings_desc_hiddenMode">Desligar modo escondido</string> <string name="settings_desc_hiddenMode">Desative o modo de ocultar</string>
<string name="settings_label_maxPartTunnels">Nº máximo de túneis participantes</string> <string name="settings_label_maxPartTunnels">Nr. máximo de túneis participantes</string>
<string name="settings_desc_maxPartTunnels">Máximo de túneis para participar (padrão=20)</string> <string name="settings_desc_maxPartTunnels">Nr. máximo de túneis para participar (predefinição=20)</string>
<string name="settings_dialog_maxPartTunnels">Máximo de túneis para participar</string> <string name="settings_dialog_maxPartTunnels">Nr. máximo de túneis para participar em</string>
<string name="settings_label_sharePercent">Percentagem de compartilhamento</string> <string name="settings_label_sharePercent">Percentagem de Partilhar</string>
<string name="settings_desc_sharePercent">Percentagem de largura de banda para compartilhar (padrão=80)</string> <string name="settings_desc_sharePercent">Percentagem da largura de banda para partilhar (predefinição=80)</string>
<string name="settings_dialog_sharePercent">Percentagem de largura de banda compartilhada</string> <string name="settings_dialog_sharePercent">Percentagem da largura de banda para partilhar</string>
<string name="settings_desc_upnp">Abrir portas do firewall automaticamente</string> <string name="settings_desc_upnp">Abrir automaticamente as portas da firewall</string>
<string name="settings_label_logging">Registo de Eventos</string>
<string name="settings_label_default_log_level">Nível de registo predefinido</string>
<string name="settings_label_advanced">Avançado</string> <string name="settings_label_advanced">Avançado</string>
<string name="settings_label_showStats">Estatísticas do Router</string>
<string name="settings_label_transports">Transportes</string> <string name="settings_label_transports">Transportes</string>
<string name="settings_label_maxConns">Máx. nº de conexões</string> <string name="settings_label_maxConns">Nr. máx. de ligações</string>
<string name="settings_label_i2cp">Interface I2CP</string> <string name="settings_label_i2cp">Interface I2CP</string>
<string name="settings_desc_i2cp">Escutando na porta 7654</string> <string name="settings_desc_i2cp">Escutar na porta 7654</string>
<string name="settings_label_exploratory_pool">Poço exploratório</string> <string name="settings_label_exploratory_pool">Poço exploratório</string>
<string name="settings_desc_exploratory_pool">Parâmetros dos túneis</string> <string name="settings_desc_exploratory_pool">Parâmetros dos túneis</string>
<string name="settings_label_expl_inbound">Túneis de entrada</string> <string name="settings_label_expl_inbound">Túneis de entrada</string>
@ -48,9 +74,50 @@
<string name="settings_label_expl_length">Duração</string> <string name="settings_label_expl_length">Duração</string>
<string name="settings_desc_expl_length">Quantos saltos usar</string> <string name="settings_desc_expl_length">Quantos saltos usar</string>
<string name="settings_label_expl_lengthVariance">Variação de saltos</string> <string name="settings_label_expl_lengthVariance">Variação de saltos</string>
<string name="settings_summ_expl_lengthVariance">%s</string>
<string name="settings_desc_expl_lengthVariance">Quantos saltos adicionar aleatoriamente</string> <string name="settings_desc_expl_lengthVariance">Quantos saltos adicionar aleatoriamente</string>
<string name="settings_label_expl_quantity">Quantidade</string> <string name="settings_label_expl_quantity">Quantidade</string>
<string name="settings_desc_expl_quantity">Quantos túneis</string> <string name="settings_desc_expl_quantity">Quantos túneis</string>
<string name="settings_label_expl_backupQuantity">Quantidade tuneis de reserva</string> <string name="settings_label_expl_backupQuantity">Quantidade tuneis de reserva</string>
<string name="settings_desc_expl_backupQuantity">Quantos túneis de reserva</string> <string name="settings_desc_expl_backupQuantity">Quantos túneis de reserva</string>
<string name="menu_about">Sobre</string>
<string name="about_version">Versão:</string>
<string name="about_project">Página do Projeto:</string>
<string name="about_bugs">Erros e Suporte</string>
<string name="about_helpwanted">Preciso de Ajuda!</string>
<string name="menu_help">Ajuda</string>
<string name="general">Geral</string>
<string name="addressbook_add_wizard_k_name">Nome</string>
<string name="addressbook_add_wizard_k_destination">Destino</string>
<string name="addressbook_add_wizard_desc_name">O nome</string>
<string name="i2ptunnel_type_client">Cliente Padrão</string>
<string name="i2ptunnel_type_httpclient">Cliente HTTP</string>
<string name="i2ptunnel_type_ircclient">Cliente IRC</string>
<string name="i2ptunnel_type_server">Servidor Padrão</string>
<string name="i2ptunnel_type_httpserver">Servidor HTTP</string>
<string name="i2ptunnel_type_ircserver">Servidor IRC</string>
<string name="install_recommended_app">Instalar a app recomendada?</string>
<string name="i2ptunnel_wizard_k_client_server">Cliente ou Servidor</string>
<string name="i2ptunnel_wizard_k_name">Nome</string>
<string name="i2ptunnel_wizard_k_desc">Descrição</string>
<string name="i2ptunnel_wizard_k_dest">Destino</string>
<string name="i2ptunnel_wizard_k_target_host">Hospedeiro de Destino</string>
<string name="i2ptunnel_wizard_k_target_port">Porta de Destino</string>
<string name="i2ptunnel_wizard_k_auto_start">Iniciar Automático</string>
<string name="next">Seguinte</string>
<string name="prev">Anterior</string>
<string name="finish">Submeter</string>
<string name="review">Rever</string>
<string name="enabled">Ativado</string>
<string name="i2ptunnel_view_type">Tipo:</string>
<string name="i2ptunnel_view_desc">Descrição:</string>
<string name="i2ptunnel_view_target">Destino:</string>
<string name="i2ptunnel_view_access_point">Ponto de acesso:</string>
<string name="i2ptunnel_view_autostart">Iniciar-Automático</string>
<string name="copy_logs">Copiar registos</string>
<string name="i2p_android_error_logs">Registos de Erro I2P Android</string>
<string name="i2p_android_logs">Registos I2P Android</string>
<string name="error_logs_copied_to_clipboard">Registos de erro copiados para a área de transferência</string>
<string name="logs_copied_to_clipboard">Registos copiados para a área de transferência</string>
<string name="label_browser_configuration">Configuração do Navegador</string>
</resources> </resources>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">Tuneluri</string> <string name="label_tunnels">Tuneluri</string>
<string name="label_status">Stare</string> <string name="label_status">Stare</string>
<string name="label_addressbook">Agendă</string> <string name="label_addressbook">Agendă</string>
<string name="label_i2ptunnel">Tunel I2P</string>
<string name="label_i2ptunnel_client">Tuneluri clienti</string> <string name="label_i2ptunnel_client">Tuneluri clienti</string>
<string name="label_i2ptunnel_server">Tuneluri server</string> <string name="label_i2ptunnel_server">Tuneluri server</string>
<string name="label_logs">Jurnale</string> <string name="label_logs">Jurnale</string>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">Туннели</string> <string name="label_tunnels">Туннели</string>
<string name="label_status">Статус</string> <string name="label_status">Статус</string>
<string name="label_addressbook">Адресная книга</string> <string name="label_addressbook">Адресная книга</string>
<string name="label_i2ptunnel">I2PTunnel</string>
<string name="label_i2ptunnel_client">Туннели клиента</string> <string name="label_i2ptunnel_client">Туннели клиента</string>
<string name="label_i2ptunnel_server">Туннели сервера</string> <string name="label_i2ptunnel_server">Туннели сервера</string>
<string name="label_logs">Журналы</string> <string name="label_logs">Журналы</string>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">Tunely</string> <string name="label_tunnels">Tunely</string>
<string name="label_status">Stav</string> <string name="label_status">Stav</string>
<string name="label_addressbook">Adresár</string> <string name="label_addressbook">Adresár</string>
<string name="label_i2ptunnel">I2PTunnel</string>
<string name="label_i2ptunnel_client">Klientské tunely</string> <string name="label_i2ptunnel_client">Klientské tunely</string>
<string name="label_i2ptunnel_server">Serverové tunely</string> <string name="label_i2ptunnel_server">Serverové tunely</string>
<string name="label_logs">Logy</string> <string name="label_logs">Logy</string>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">Tunelet</string> <string name="label_tunnels">Tunelet</string>
<string name="label_status">Statusi</string> <string name="label_status">Statusi</string>
<string name="label_addressbook">Libri i adresave. </string> <string name="label_addressbook">Libri i adresave. </string>
<string name="label_i2ptunnel">Tuneli i I2P\'së</string>
<string name="label_i2ptunnel_client">Tunelet e klientëve</string> <string name="label_i2ptunnel_client">Tunelet e klientëve</string>
<string name="label_i2ptunnel_server">Tunelet e Serverave. </string> <string name="label_i2ptunnel_server">Tunelet e Serverave. </string>
<string name="label_logs">Logot</string> <string name="label_logs">Logot</string>

View File

@ -7,7 +7,6 @@
<string name="label_tunnels">Тунелі</string> <string name="label_tunnels">Тунелі</string>
<string name="label_status">Статус</string> <string name="label_status">Статус</string>
<string name="label_addressbook">Адресна книга</string> <string name="label_addressbook">Адресна книга</string>
<string name="label_i2ptunnel">I2PTunnel</string>
<string name="label_i2ptunnel_client">Клієнтські тунелі</string> <string name="label_i2ptunnel_client">Клієнтські тунелі</string>
<string name="label_i2ptunnel_server">Серверні тунелі</string> <string name="label_i2ptunnel_server">Серверні тунелі</string>
<string name="label_logs">Журнали</string> <string name="label_logs">Журнали</string>

View File

@ -8,7 +8,6 @@
<string name="label_tunnels">隧道</string> <string name="label_tunnels">隧道</string>
<string name="label_status">状态</string> <string name="label_status">状态</string>
<string name="label_addressbook">地址簿</string> <string name="label_addressbook">地址簿</string>
<string name="label_i2ptunnel">I2PTunnel</string>
<string name="label_i2ptunnel_client">客户隧道</string> <string name="label_i2ptunnel_client">客户隧道</string>
<string name="label_i2ptunnel_server">服务隧道</string> <string name="label_i2ptunnel_server">服务隧道</string>
<string name="label_logs">日志</string> <string name="label_logs">日志</string>

View File

@ -10,7 +10,7 @@
<string name="label_tunnels">Tunnels</string> <string name="label_tunnels">Tunnels</string>
<string name="label_status">Status</string> <string name="label_status">Status</string>
<string name="label_addressbook">Addressbook</string> <string name="label_addressbook">Addressbook</string>
<string name="label_i2ptunnel">I2PTunnel</string> <string name="label_i2ptunnel" translatable="false">@string/label_tunnels</string>
<string name="label_i2ptunnel_client">Client tunnels</string> <string name="label_i2ptunnel_client">Client tunnels</string>
<string name="label_i2ptunnel_server">Server tunnels</string> <string name="label_i2ptunnel_server">Server tunnels</string>
<string name="label_logs">Logs</string> <string name="label_logs">Logs</string>
@ -126,6 +126,7 @@
<string name="settings_summ_expl_backupQuantity">%s tunnels</string> <string name="settings_summ_expl_backupQuantity">%s tunnels</string>
<string name="settings_desc_expl_backupQuantity">How many tunnel backups</string> <string name="settings_desc_expl_backupQuantity">How many tunnel backups</string>
<string name="settings_need_transport_enabled">You must have at least one transport enabled</string>
<string name="settings_router_restart_required">Please restart I2P to apply the changes</string> <string name="settings_router_restart_required">Please restart I2P to apply the changes</string>
<string name="menu_about">About</string> <string name="menu_about">About</string>

View File

@ -0,0 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<string name="yes">Sim</string>
<string name="no">Não</string>
<string name="install_i2p_android">Instalar I2P Android?</string>
<string name="you_must_have_i2p_android">Deverá ter instalado e em execução a I2P Android. Deseja instalá-la?</string>
<string name="start_i2p_android">Iniciar I2P Android?</string>
<string name="would_you_like_to_start_i2p_android">Parece que a I2P Android não está em execução. Deseja iniciá-la?</string>
</resources>