Compare commits
13 Commits
android-2.
...
i2p-androi
Author | SHA1 | Date | |
---|---|---|---|
ddb651a602 | |||
a8ad1d8d47 | |||
912602bfc0 | |||
24e3358ffa | |||
fcc51c429d | |||
de0ee87db3 | |||
2102d55315 | |||
2f900ebe2d | |||
5c03981a61 | |||
c68f0ff23a | |||
b01f44ae1f | |||
05aeb0cf37 | |||
fd8d596064 |
10
CHANGELOG
10
CHANGELOG
@ -1,3 +1,13 @@
|
||||
2.2.0
|
||||
* Add blocklist feed support
|
||||
* Fix translations on stats page
|
||||
* Various bugfixes
|
||||
|
||||
2.1.0-1
|
||||
* adds support for adding base32 addresses to the local addressbook
|
||||
* adds support for destinations with ports in the string to i2ptunnel
|
||||
* adds support for remote applications launching I2P, via MR#3 from @RyeMantis
|
||||
|
||||
2.1.0
|
||||
* Upgrades router to version 2.1.0
|
||||
* Adds jcenter repository back to app/ target, removes jcenter from other targets
|
||||
|
@ -8,7 +8,7 @@ repositories {
|
||||
android {
|
||||
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION as String)
|
||||
defaultConfig {
|
||||
versionCode 4745274
|
||||
versionCode 4745277
|
||||
versionName "$I2P_ANDROID_VERSION"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION as String)
|
||||
|
@ -44,6 +44,14 @@
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".receiver.RemoteStartReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="net.i2p.android.router.receiver.START_I2P" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<activity
|
||||
android:name="net.i2p.android.I2PActivity"
|
||||
|
@ -88,7 +88,7 @@ class InitActivities {
|
||||
|
||||
File abDir = new File(myDir, "addressbook");
|
||||
abDir.mkdir();
|
||||
copyResourceToFile(R.raw.subscriptions_txt, "addressbook/subscriptions.txt");
|
||||
copyResourceToFileIfAbsent(R.raw.subscriptions_txt, "addressbook/subscriptions.txt");
|
||||
mergeResourceToFile(R.raw.addressbook_config_txt, "addressbook/config.txt", null);
|
||||
|
||||
File docsDir = new File(myDir, "docs");
|
||||
|
@ -1,5 +1,13 @@
|
||||
package net.i2p.android.apps;
|
||||
|
||||
import static net.i2p.app.ClientAppState.INITIALIZED;
|
||||
import static net.i2p.app.ClientAppState.RUNNING;
|
||||
import static net.i2p.app.ClientAppState.STARTING;
|
||||
import static net.i2p.app.ClientAppState.STOPPED;
|
||||
import static net.i2p.app.ClientAppState.STOPPING;
|
||||
import static net.i2p.app.ClientAppState.UNINITIALIZED;
|
||||
import static net.i2p.update.UpdateType.BLOCKLIST;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import net.i2p.android.router.NewsActivity;
|
||||
@ -8,20 +16,26 @@ import net.i2p.android.router.util.Notifications;
|
||||
import net.i2p.app.ClientApp;
|
||||
import net.i2p.app.ClientAppManager;
|
||||
import net.i2p.app.ClientAppState;
|
||||
import static net.i2p.app.ClientAppState.*;
|
||||
import net.i2p.crypto.SU3File;
|
||||
import net.i2p.data.Base64;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.data.Hash;
|
||||
import net.i2p.router.Banlist;
|
||||
import net.i2p.router.Blocklist;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.news.BlocklistEntries;
|
||||
import net.i2p.router.news.NewsEntry;
|
||||
import net.i2p.router.news.NewsMetadata;
|
||||
import net.i2p.router.news.NewsXMLParser;
|
||||
import net.i2p.util.Addresses;
|
||||
import net.i2p.util.EepGet;
|
||||
import net.i2p.util.FileUtil;
|
||||
import net.i2p.util.I2PAppThread;
|
||||
import net.i2p.util.Log;
|
||||
import net.i2p.util.ReusableGZIPInputStream;
|
||||
import net.i2p.util.SecureFileOutputStream;
|
||||
import net.i2p.util.RFC822Date;
|
||||
import net.i2p.util.ReusableGZIPInputStream;
|
||||
import net.i2p.util.SecureFile;
|
||||
import net.i2p.util.SecureFileOutputStream;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
@ -32,6 +46,7 @@ import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -58,6 +73,10 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener, ClientApp {
|
||||
private volatile ClientAppState _state = UNINITIALIZED;
|
||||
public static final String APP_NAME = "NewsFetcher";
|
||||
|
||||
static final String PROP_BLOCKLIST_TIME = "router.blocklistVersion";
|
||||
private static final String BLOCKLIST_DIR = "docs/feed/blocklist";
|
||||
private static final String BLOCKLIST_FILE = "blocklist.txt";
|
||||
|
||||
/**
|
||||
* As of 0.9.41, returns a new one every time. Only call once.
|
||||
*/
|
||||
@ -333,6 +352,11 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener, ClientApp {
|
||||
xml.delete();
|
||||
NewsMetadata data = parser.getMetadata();
|
||||
List<NewsEntry> entries = parser.getEntries();
|
||||
BlocklistEntries ble = parser.getBlocklistEntries();
|
||||
if (ble != null && ble.isVerified())
|
||||
processBlocklistEntries(ble);
|
||||
else
|
||||
_log.info("No blocklist entries found in news feed");
|
||||
String sudVersion = su3.getVersionString();
|
||||
String signingKeyName = su3.getSignerString();
|
||||
File to3 = new File(_context.getTempDir(), "tmp3-" + _context.random().nextInt() + ".xml");
|
||||
@ -343,6 +367,104 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener, ClientApp {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process blocklist entries
|
||||
*
|
||||
* @since 0.9.57
|
||||
*/
|
||||
private void processBlocklistEntries(BlocklistEntries ble) {
|
||||
long oldTime = _context.getProperty(PROP_BLOCKLIST_TIME, 0L);
|
||||
if (ble.updated <= oldTime) {
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Not processing blocklist " + DataHelper.formatDate(ble.updated) +
|
||||
", already have " + DataHelper.formatDate(oldTime));
|
||||
return;
|
||||
}
|
||||
Blocklist bl = _context.blocklist();
|
||||
Banlist ban = _context.banlist();
|
||||
String reason = "Blocklist feed " + DataHelper.formatDate(ble.updated);
|
||||
int banned = 0;
|
||||
for (Iterator<String> iter = ble.entries.iterator(); iter.hasNext(); ) {
|
||||
String s = iter.next();
|
||||
if (s.length() == 44) {
|
||||
byte[] b = Base64.decode(s);
|
||||
if (b == null || b.length != Hash.HASH_LENGTH) {
|
||||
iter.remove();
|
||||
continue;
|
||||
}
|
||||
Hash h = Hash.create(b);
|
||||
if (!ban.isBanlistedForever(h)) {
|
||||
ban.banlistRouterForever(h, reason);
|
||||
_context.commSystem().forceDisconnect(h);
|
||||
}
|
||||
} else {
|
||||
byte[] ip = Addresses.getIP(s);
|
||||
if (ip == null) {
|
||||
iter.remove();
|
||||
continue;
|
||||
}
|
||||
if (!bl.isBlocklisted(ip))
|
||||
bl.add(ip);
|
||||
}
|
||||
if (++banned >= BlocklistEntries.MAX_ENTRIES) {
|
||||
// prevent somebody from destroying the whole network
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (String s : ble.removes) {
|
||||
if (s.length() == 44) {
|
||||
byte[] b = Base64.decode(s);
|
||||
if (b == null || b.length != Hash.HASH_LENGTH)
|
||||
continue;
|
||||
Hash h = Hash.create(b);
|
||||
if (ban.isBanlistedForever(h))
|
||||
ban.unbanlistRouter(h);
|
||||
} else {
|
||||
byte[] ip = Addresses.getIP(s);
|
||||
if (ip == null)
|
||||
continue;
|
||||
if (bl.isBlocklisted(ip))
|
||||
bl.remove(ip);
|
||||
}
|
||||
}
|
||||
// Save the blocks. We do not save the unblocks.
|
||||
File f = new SecureFile(_context.getConfigDir(), BLOCKLIST_DIR);
|
||||
f.mkdirs();
|
||||
f = new File(f, BLOCKLIST_FILE);
|
||||
boolean fail = false;
|
||||
BufferedWriter out = null;
|
||||
try {
|
||||
out = new BufferedWriter(new OutputStreamWriter(new SecureFileOutputStream(f), "UTF-8"));
|
||||
out.write("# ");
|
||||
out.write(ble.supdated);
|
||||
out.newLine();
|
||||
banned = 0;
|
||||
for (String s : ble.entries) {
|
||||
s = s.replace(':', ';'); // IPv6
|
||||
out.write(reason);
|
||||
out.write(':');
|
||||
out.write(s);
|
||||
out.newLine();
|
||||
if (++banned >= BlocklistEntries.MAX_ENTRIES)
|
||||
break;
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
_log.error("Error writing blocklist", ioe);
|
||||
fail = true;
|
||||
} finally {
|
||||
if (out != null) try {
|
||||
out.close();
|
||||
} catch (IOException ioe) {}
|
||||
}
|
||||
if (!fail) {
|
||||
f.setLastModified(ble.updated);
|
||||
String upd = Long.toString(ble.updated);
|
||||
_context.router().saveConfig(PROP_BLOCKLIST_TIME, upd);
|
||||
}
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Processed " + ble.entries.size() + " blocks and " + ble.removes.size() + " unblocks from news feed");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gunzip the file
|
||||
*
|
||||
|
@ -406,20 +406,21 @@ public class MainFragment extends I2PFragmentBase {
|
||||
//ctx.commSystem().getReachabilityStatus();
|
||||
|
||||
String status =
|
||||
"Exploratory Tunnels in/out: " + inEx + " / " + outEx
|
||||
+ "\nClient Tunnels in/out: " + inCl + " / " + outCl;
|
||||
getString(R.string.notification_status_expl, inEx, outEx) + '\n' +
|
||||
getString(R.string.notification_status_client, inCl, outCl);
|
||||
|
||||
|
||||
// Need to see if we have the participation option set to on.
|
||||
// I thought there was a router method for that? I guess not! WHY NOT?
|
||||
// It would be easier if we had a number to test status.
|
||||
String participate = "\nParticipation: " + tunnelStatus + " (" + part + ")";
|
||||
String participate = '\n' + getString(R.string.settings_label_hiddenMode) + ": " + tunnelStatus + " (" + part + ")";
|
||||
|
||||
String details =
|
||||
"\nMemory: " + DataHelper.formatSize(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())
|
||||
+ "B / " + DataHelper.formatSize(Runtime.getRuntime().maxMemory()) + 'B'
|
||||
+ "\nJob Lag: " + jobLag
|
||||
+ "\nMsg Delay: " + msgDelay;
|
||||
'\n' + getString(R.string.stats_memory) + ": " +
|
||||
DataHelper.formatSize(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) +
|
||||
"B / " + DataHelper.formatSize(Runtime.getRuntime().maxMemory()) + 'B' +
|
||||
'\n' + getString(R.string.stats_lag) + ": " + jobLag +
|
||||
'\n' + getString(R.string.stats_delay) + ": " + msgDelay;
|
||||
|
||||
_savedStatus = status + participate + details;
|
||||
vAdvStatusText.setText(_savedStatus);
|
||||
@ -661,7 +662,7 @@ public class MainFragment extends I2PFragmentBase {
|
||||
// even if an error occurs. http://trac.i2p2.i2p/ticket/2783
|
||||
intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
|
||||
intent.setData(Uri.parse("package:" + packageName));
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
try {
|
||||
mContext.startActivity(intent);
|
||||
} catch (ActivityNotFoundException activityNotFound) {
|
||||
|
@ -4,7 +4,7 @@ import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import net.i2p.android.router.R;
|
||||
import net.i2p.android.wizard.model.AbstractWizardModel;
|
||||
import net.i2p.android.wizard.model.I2PB64DestinationPage;
|
||||
import net.i2p.android.wizard.model.I2PDestinationPage;
|
||||
import net.i2p.android.wizard.model.PageList;
|
||||
import net.i2p.android.wizard.model.SingleTextFieldPage;
|
||||
|
||||
@ -22,7 +22,7 @@ public class AddressbookAddWizardModel extends AbstractWizardModel {
|
||||
.setDescription(res.getString(R.string.addressbook_add_wizard_desc_name))
|
||||
.setRequired(true),
|
||||
|
||||
new I2PB64DestinationPage(this, res.getString(R.string.addressbook_add_wizard_k_destination))
|
||||
new I2PDestinationPage(this, res.getString(R.string.i2ptunnel_wizard_k_dest))
|
||||
.setDescription(res.getString(R.string.addressbook_add_wizard_desc_destination))
|
||||
.setRequired(true)
|
||||
);
|
||||
|
@ -0,0 +1,23 @@
|
||||
package net.i2p.android.router.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.i2p.android.router.service.RouterService;
|
||||
import net.i2p.android.router.util.Util;
|
||||
|
||||
public class RemoteStartReceiver extends BroadcastReceiver {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if(Util.getRouterContext() == null){
|
||||
Intent rsIntent = new Intent(context, RouterService.class);
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O){
|
||||
context.startForegroundService(rsIntent);
|
||||
} else {
|
||||
context.startService(rsIntent);
|
||||
}
|
||||
Toast.makeText(context, "Starting I2P Router", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
@ -46,16 +46,36 @@ public class NamingServiceUtil {
|
||||
String displayHost = host.equals(hostName) ? hostName :
|
||||
hostName + " (" + host + ')';
|
||||
|
||||
String destB64 = data.getBundle(kDest).getString(Page.SIMPLE_DATA_KEY);
|
||||
Destination dest = new Destination();
|
||||
try {
|
||||
dest.fromBase64(destB64);
|
||||
} catch (DataFormatException e) {} // Already validated
|
||||
|
||||
String dest = data.getBundle(kDest).getString(Page.SIMPLE_DATA_KEY).split(":")[0];
|
||||
Destination destination = new Destination();
|
||||
if (dest.endsWith(".b32.i2p")) {
|
||||
NamingService dns = NamingServiceUtil.getNamingService(Util.getRouterContext(),"");
|
||||
destination = dns.lookup(dest);
|
||||
int i = 0;
|
||||
while (destination == null) {
|
||||
dns = NamingServiceUtil.getNamingService(Util.getRouterContext(),"");
|
||||
destination = dns.lookup(dest);
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
i++;
|
||||
if (i > 500){
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
destination.fromBase64(dest);
|
||||
} catch (DataFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
// Check if already in addressbook
|
||||
Destination oldDest = ns.lookup(host);
|
||||
if (oldDest != null) {
|
||||
if (destB64.equals(oldDest.toBase64()))
|
||||
if (destination.toBase64().equals(oldDest.toBase64()))
|
||||
Toast.makeText(ctx,
|
||||
"Host name " + displayHost + " is already in address book, unchanged.",
|
||||
Toast.LENGTH_LONG).show();
|
||||
@ -65,7 +85,7 @@ public class NamingServiceUtil {
|
||||
Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
// Put the new host name
|
||||
success = ns.put(host, dest);
|
||||
success = ns.put(host, destination);
|
||||
if (!success)
|
||||
Toast.makeText(ctx,
|
||||
"Failed to add Destination " + displayHost + " to naming service " + ns.getName(),
|
||||
|
@ -1,47 +0,0 @@
|
||||
package net.i2p.android.wizard.model;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
import net.i2p.android.wizard.ui.I2PB64DestinationFragment;
|
||||
import net.i2p.data.DataFormatException;
|
||||
import net.i2p.data.Destination;
|
||||
|
||||
/**
|
||||
* A page asking for an I2P Destination.
|
||||
* This must be the B64 representation of a Destination.
|
||||
*/
|
||||
public class I2PB64DestinationPage extends SingleTextFieldPage {
|
||||
private String mFeedback;
|
||||
|
||||
public I2PB64DestinationPage(ModelCallbacks callbacks, String title) {
|
||||
super(callbacks, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment createFragment() {
|
||||
return I2PB64DestinationFragment.create(getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
String data = mData.getString(SIMPLE_DATA_KEY);
|
||||
try {
|
||||
new Destination().fromBase64(data);
|
||||
} catch (DataFormatException dfe) {
|
||||
mFeedback = "Invalid B64";
|
||||
return false;
|
||||
}
|
||||
mFeedback = "";
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showFeedback() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeedback() {
|
||||
return mFeedback;
|
||||
}
|
||||
}
|
@ -4,9 +4,12 @@ import java.util.Locale;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.android.wizard.ui.I2PDestinationFragment;
|
||||
import net.i2p.client.naming.NamingService;
|
||||
import net.i2p.data.DataFormatException;
|
||||
import net.i2p.data.Destination;
|
||||
import net.i2p.client.naming.DummyNamingService;
|
||||
|
||||
/**
|
||||
* A page asking for an I2P Destination.
|
||||
@ -27,12 +30,18 @@ public class I2PDestinationPage extends SingleTextFieldPage {
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
String data = mData.getString(SIMPLE_DATA_KEY);
|
||||
String data = mData.getString(SIMPLE_DATA_KEY).split(":")[0];
|
||||
if (data.toLowerCase(Locale.US).endsWith(".b32.i2p")) { /* B32 */
|
||||
if (data.length() == BASE32_HASH_LENGTH + 8 || data.length() >= BASE32_HASH_LENGTH + 12) {
|
||||
if (data.length() == BASE32_HASH_LENGTH){
|
||||
mFeedback = "";
|
||||
return true;
|
||||
}
|
||||
if (data.length() >= BASE32_HASH_LENGTH + 8) {
|
||||
if (data.length() <= BASE32_HASH_LENGTH + 12) {
|
||||
mFeedback = "";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
mFeedback = "Invalid B32";
|
||||
return false;
|
||||
} else if (data.endsWith(".i2p")) { /* Domain */
|
||||
|
@ -1,208 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 str4d
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.i2p.android.wizard.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.i2p.android.router.R;
|
||||
import net.i2p.android.router.util.Util;
|
||||
import net.i2p.android.wizard.model.Page;
|
||||
import net.i2p.android.wizard.model.SingleTextFieldPage;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class I2PB64DestinationFragment extends Fragment {
|
||||
static final int REQUEST_DESTINATION_FILE = 1;
|
||||
|
||||
private static final String ARG_KEY = "key";
|
||||
|
||||
private PageFragmentCallbacks mCallbacks;
|
||||
private SingleTextFieldPage mPage;
|
||||
protected TextView mFieldView;
|
||||
private TextView mFeedbackView;
|
||||
|
||||
public static I2PB64DestinationFragment create(String key) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_KEY, key);
|
||||
|
||||
I2PB64DestinationFragment fragment = new I2PB64DestinationFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
public I2PB64DestinationFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Bundle args = getArguments();
|
||||
String mKey = args.getString(ARG_KEY);
|
||||
mPage = (SingleTextFieldPage) mCallbacks.onGetPage(mKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_wizard_page_single_text_field_picker, container, false);
|
||||
((TextView) rootView.findViewById(android.R.id.title)).setText(mPage.getTitle());
|
||||
((TextView) rootView.findViewById(R.id.wizard_text_field_desc)).setText(mPage.getDesc());
|
||||
|
||||
Button b = (Button) rootView.findViewById(R.id.wizard_text_field_pick);
|
||||
b.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
public void onClick(View view) {
|
||||
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
i.setType("text/plain");
|
||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
try {
|
||||
startActivityForResult(
|
||||
Intent.createChooser(i,"Select B64 file"),
|
||||
REQUEST_DESTINATION_FILE);
|
||||
} catch (android.content.ActivityNotFoundException ex) {
|
||||
Toast.makeText(getActivity(), "Please install a File Manager.",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mFieldView = ((TextView) rootView.findViewById(R.id.wizard_text_field));
|
||||
mFieldView.setHint(mPage.getTitle());
|
||||
if (mPage.getData().getString(Page.SIMPLE_DATA_KEY) != null)
|
||||
mFieldView.setText(mPage.getData().getString(Page.SIMPLE_DATA_KEY));
|
||||
else if (mPage.getDefault() != null) {
|
||||
mFieldView.setText(mPage.getDefault());
|
||||
mPage.getData().putString(Page.SIMPLE_DATA_KEY, mPage.getDefault());
|
||||
}
|
||||
|
||||
mFeedbackView = (TextView) rootView.findViewById(R.id.wizard_text_field_feedback);
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
|
||||
if (!(activity instanceof PageFragmentCallbacks)) {
|
||||
throw new ClassCastException("Activity must implement PageFragmentCallbacks");
|
||||
}
|
||||
|
||||
mCallbacks = (PageFragmentCallbacks) activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
mCallbacks = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
mFieldView.addTextChangedListener(new TextWatcher() {
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1,
|
||||
int i2) {
|
||||
}
|
||||
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
}
|
||||
|
||||
public void afterTextChanged(Editable editable) {
|
||||
mPage.getData().putString(Page.SIMPLE_DATA_KEY,
|
||||
(editable != null) ? editable.toString() : null);
|
||||
mPage.notifyDataChanged();
|
||||
if (mPage.showFeedback()) {
|
||||
mFeedbackView.setText(mPage.getFeedback());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMenuVisibility(boolean menuVisible) {
|
||||
super.setMenuVisibility(menuVisible);
|
||||
|
||||
// In a future update to the support library, this should override setUserVisibleHint
|
||||
// instead of setMenuVisibility.
|
||||
if (mFieldView != null) {
|
||||
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(
|
||||
Context.INPUT_METHOD_SERVICE);
|
||||
if (!menuVisible) {
|
||||
imm.hideSoftInputFromWindow(getView().getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == REQUEST_DESTINATION_FILE) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
Uri result = data.getData();
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
ParcelFileDescriptor pfd = getActivity().getContentResolver().openFileDescriptor(result, "r");
|
||||
br = new BufferedReader(
|
||||
new InputStreamReader(
|
||||
new ParcelFileDescriptor.AutoCloseInputStream(pfd)));
|
||||
try {
|
||||
mFieldView.setText(br.readLine());
|
||||
} catch (IOException ioe) {
|
||||
Util.e("Failed to read B64 file", ioe);
|
||||
Toast.makeText(getActivity(), "Failed to read B64 file.",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
Util.e("Could not find B64 file", fnfe);
|
||||
Toast.makeText(getActivity(), "Could not find B64 file.",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
} catch (SecurityException se) {
|
||||
Util.e("Could not open B64 file", se);
|
||||
Toast.makeText(getActivity(), "Could not open B64 file.",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
} finally {
|
||||
if (br != null)
|
||||
try {
|
||||
br.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -115,6 +115,11 @@
|
||||
<string name="notification_status_peers">Pares: %1$d activos, %2$d conocidos</string>
|
||||
<string name="notification_status_expl">Túneles exploratorios: %1$d/%2$d</string>
|
||||
<string name="notification_status_client">Túneles de cliente: %1$d/%2$d</string>
|
||||
<string name="stats_memory">Memoria usada/max</string>
|
||||
<string name="stats_lag">Demora de tareas</string>
|
||||
<string name="stats_delay">Demora de mensajes</string>
|
||||
<string name="copied_base32_system_notification_title">Base32 copiado al portapapeles</string>
|
||||
<string name="copied_base32_system_notification_body">La dirección de su túnel I2P se ha copiado en el portapapeles.</string>
|
||||
<string name="menu_settings">Configuración</string>
|
||||
<string name="settings_enable">Activar</string>
|
||||
<string name="settings_desc_subscriptions">URLs de suscripción</string>
|
||||
@ -147,6 +152,13 @@
|
||||
<string name="settings_label_transports">Transportes</string>
|
||||
<string name="settings_label_maxConns">Conexiones máximas</string>
|
||||
<string name="settings_label_i2cp">Interfaz de I2CP</string>
|
||||
<string name="settings_desc_i2cp">Permitir que las aplicaciones de terceros creen túneles usando I2CP (requiere el reinicio del enrutador)</string>
|
||||
<string name="settings_label_sam">Interfaz SAM</string>
|
||||
<string name="settings_desc_sam">Permitir que las aplicaciones de terceros creen túneles usando SAM (requiere el reinicio del enrutador)</string>
|
||||
<string name="settings_confirm_sam">Una aplicación está intentando establecer una conexión SAM.</string>
|
||||
<string name="settings_confirm_sam_id">Nombre de conexión/ID:</string>
|
||||
<string name="settings_confirm_allow_sam">Toca para permitir</string>
|
||||
<string name="settings_confirm_deny_sam">Ignorar para negar</string>
|
||||
<string name="settings_label_exploratory_pool">Grupo exploratorio</string>
|
||||
<string name="settings_desc_exploratory_pool">Parámetros de túneles</string>
|
||||
<string name="settings_label_expl_inbound">Túneles de entrada</string>
|
||||
@ -171,6 +183,7 @@
|
||||
<string name="about_bugs">Fallos y soporte:</string>
|
||||
<string name="about_helpwanted">¡Buscamos ayuda!</string>
|
||||
<string name="about_volunteer">¿Quiere ayudar a hacer mejor la aplicación? Ofrézcase voluntario en el foro de Android:</string>
|
||||
<string name="about_gitlab">¿Quiere sugerir una función o corregir un error? haga una solicitud de fusión en Android Gitlab:</string>
|
||||
<string name="menu_help">Ayuda</string>
|
||||
<string name="general">General</string>
|
||||
<string name="label_router">Direcciones públicas</string>
|
||||
@ -231,6 +244,7 @@
|
||||
<string name="enabled">Habilitado</string>
|
||||
<string name="i2ptunnel_wizard_desc_name">El nombre del túnel, para su identificación en la lista de túneles.</string>
|
||||
<string name="i2ptunnel_wizard_desc_desc">Una descripción del túnel. Esto es opcional y puramente informativo.</string>
|
||||
<string name="i2ptunnel_wizard_desc_dest">Especifique aquí la dirección .i2p o destino (hostname.i2p, b32 o b64) del túnel.</string>
|
||||
<string name="i2ptunnel_wizard_desc_outproxies">Si sabe de cualquier proxy de salida para este tipo de túnel (bien HTTP o SOCKS), introdúzcalo. Separe los proxys con comas.</string>
|
||||
<string name="i2ptunnel_wizard_desc_target_host">Esta es la IP sobre la que su servicio está ejecutándose, como este normalmente está en la misma máquina, se autorellena con 127.0.0.1</string>
|
||||
<string name="i2ptunnel_wizard_desc_target_port">Este es el puerto sobre el que el servicio está aceptando conexiones.</string>
|
||||
@ -357,4 +371,5 @@
|
||||
<string name="label_browser_configuration">Configuración del navegador</string>
|
||||
<string name="no_market_app">No se encontró la aplicación en Android market, por favor, instálela manualmente</string>
|
||||
<string name="unset">No configurado</string>
|
||||
<string name="running_background">I2P se ejecuta en segundo plano</string>
|
||||
</resources>
|
||||
|
@ -121,7 +121,7 @@
|
||||
<string name="settings_desc_subscriptions">URL を登録</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_desc_startOnBoot">Android端末の起動時に、自動でI2Pに接続</string>
|
||||
<string name="settings_label_bandwidth">帯域幅</string>
|
||||
<string name="settings_label_bw_inbound">受信速度</string>
|
||||
<string name="settings_desc_bw_inbound">最大受信速度</string>
|
||||
|
@ -197,4 +197,5 @@
|
||||
<string name="other">Ďalší</string>
|
||||
<string name="custom_options">Vlastné nastavenia</string>
|
||||
<string name="all">Všetko</string>
|
||||
<string name="no_messages">Žiadne správy</string>
|
||||
</resources>
|
||||
|
@ -31,6 +31,7 @@
|
||||
<string name="action_delete">Fshije</string>
|
||||
<string name="action_reload">Ringarkoje</string>
|
||||
<string name="action_refresh">Rifreskoje</string>
|
||||
<string name="statistics">Statistika</string>
|
||||
<string name="country">Vendi</string>
|
||||
<string name="version">Version</string>
|
||||
<string name="count">Numër</string>
|
||||
|
@ -150,6 +150,10 @@
|
||||
<string name="notification_status_expl">Exploratory tunnels: %1$d/%2$d</string>
|
||||
<string name="notification_status_client">Client tunnels: %1$d/%2$d</string>
|
||||
|
||||
<string name="stats_memory">Memory used/max</string>
|
||||
<string name="stats_lag">Job Lag</string>
|
||||
<string name="stats_delay">Message Delay</string>
|
||||
|
||||
<string name="copied_base32_system_notification_title">Base32 copied to clipboard</string>
|
||||
<string name="copied_base32_system_notification_body">The address of your I2P tunnel has been copied to the clipboard.</string>
|
||||
|
||||
|
@ -17,7 +17,7 @@ POM_DEVELOPER_EMAIL=hankhill19580@gmail.com
|
||||
ANDROID_BUILD_TARGET_SDK_VERSION=33
|
||||
ANDROID_BUILD_SDK_VERSION=33
|
||||
|
||||
I2P_VERSION=2.1.0
|
||||
I2P_ANDROID_VERSION=2.1.0
|
||||
I2P_VERSION=2.2.0
|
||||
I2P_ANDROID_VERSION=2.2.0
|
||||
android.disableAutomaticComponentCreation=true
|
||||
android.useAndroidX=true
|
@ -1,9 +0,0 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<resources>
|
||||
<string name="yes">Sí</string>
|
||||
<string name="no">No</string>
|
||||
<string name="install_i2p_android">¿Instalar I2P Android?</string>
|
||||
<string name="you_must_have_i2p_android">Ha de tener I2P Android instalado y ejecutándose. ¿Le gustaría instalarlo?</string>
|
||||
<string name="start_i2p_android">¿Iniciar I2P Android?</string>
|
||||
<string name="would_you_like_to_start_i2p_android">Parece que I2P Android no se está ejecutando. ¿Desea ejecutarlo?</string>
|
||||
</resources>
|
Reference in New Issue
Block a user