I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 7424e5b7 authored by str4d's avatar str4d
Browse files

Browser configuration guides for embedded, Orweb, unknown and unsupported

parent 5175c937
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ public class BrowserAdapter extends RecyclerView.Adapter<BrowserAdapter.ViewHold
}
public static interface OnBrowserSelectedListener {
public void onBrowserSelected(String packageName, boolean known, boolean supported);
public void onBrowserSelected(Browser browser);
}
public BrowserAdapter(Context ctx, OnBrowserSelectedListener listener) {
......@@ -55,8 +55,7 @@ public class BrowserAdapter extends RecyclerView.Adapter<BrowserAdapter.ViewHold
int viewType) {
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.listitem_browser, parent, false);
ViewHolder vh = new ViewHolder(v);
return vh;
return new ViewHolder(v);
}
// Replace the contents of a view (invoked by the layout manager)
......@@ -76,7 +75,7 @@ public class BrowserAdapter extends RecyclerView.Adapter<BrowserAdapter.ViewHold
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mListener.onBrowserSelected(browser.packageName, browser.isKnown, browser.isSupported);
mListener.onBrowserSelected(browser);
}
});
}
......
......@@ -9,7 +9,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.AsyncTaskLoader;
import android.support.v4.content.Loader;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
......
......@@ -15,7 +15,6 @@ import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.Toast;
import net.i2p.android.router.LicenseActivity;
import net.i2p.android.router.R;
......@@ -23,6 +22,8 @@ import net.i2p.android.router.dialog.TextResourceDialog;
import org.sufficientlysecure.htmltextview.HtmlTextView;
import java.lang.reflect.Field;
public class HelpActivity extends ActionBarActivity implements
BrowserAdapter.OnBrowserSelectedListener {
public static final String CATEGORY = "help_category";
......@@ -147,21 +148,21 @@ public class HelpActivity extends ActionBarActivity implements
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_help_licenses:
Intent lic = new Intent(HelpActivity.this, LicenseActivity.class);
startActivity(lic);
return true;
case R.id.menu_help_release_notes:
TextResourceDialog dialog = new TextResourceDialog();
Bundle args = new Bundle();
args.putString(TextResourceDialog.TEXT_DIALOG_TITLE,
getResources().getString(R.string.label_release_notes));
args.putInt(TextResourceDialog.TEXT_RESOURCE_ID, R.raw.releasenotes_txt);
dialog.setArguments(args);
dialog.show(getSupportFragmentManager(), "release_notes");
return true;
default:
return super.onOptionsItemSelected(item);
case R.id.menu_help_licenses:
Intent lic = new Intent(HelpActivity.this, LicenseActivity.class);
startActivity(lic);
return true;
case R.id.menu_help_release_notes:
TextResourceDialog dialog = new TextResourceDialog();
Bundle args = new Bundle();
args.putString(TextResourceDialog.TEXT_DIALOG_TITLE,
getResources().getString(R.string.label_release_notes));
args.putInt(TextResourceDialog.TEXT_RESOURCE_ID, R.raw.releasenotes_txt);
dialog.setArguments(args);
dialog.show(getSupportFragmentManager(), "release_notes");
return true;
default:
return super.onOptionsItemSelected(item);
}
}
......@@ -174,8 +175,38 @@ public class HelpActivity extends ActionBarActivity implements
// BrowserAdapter.OnBrowserSelected
@Override
public void onBrowserSelected(String packageName, boolean known, boolean supported) {
// TODO Implement
Toast.makeText(this, packageName, Toast.LENGTH_SHORT).show();
public void onBrowserSelected(Browser browser) {
int file;
if (browser.isKnown) {
if (browser.isSupported) {
// Check for embedded browser
if (browser.packageName.startsWith("net.i2p.android"))
file = R.raw.help_embedded_browser;
else {
// Load the configuration guide for this browser
try {
String name = "help_" + browser.packageName.replace('.', '_');
Class res = R.raw.class;
Field field = res.getField(name);
file = field.getInt(null);
} catch (Exception e) {
file = R.raw.help_unknown_browser;
}
}
} else
file = R.raw.help_unsupported_browser;
} else
file = R.raw.help_unknown_browser;
HelpHtmlFragment configFrag = HelpHtmlFragment.newInstance(file);
if (mTwoPane) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.detail_fragment, configFrag)
.commit();
} else {
getSupportFragmentManager().beginTransaction()
.replace(R.id.main_fragment, configFrag)
.addToBackStack("config" + browser.packageName)
.commit();
}
}
}
<html>
<head></head>
<body>
<h2>Pre-configured HTTP proxy</h2>
<p>The app starts an HTTP proxy at localhost port 4444. To use it, configure your browser's HTTP proxy setting to use localhost:4444.</p>
<p>The HTTP proxy is tested with the "Orweb" app. It should also work with Firefox 4 Mobile and the ProxyMob Firefox plugin, if you have at least 512 MB of RAM.</p>
<h2>Embedded web browser</h2>
<p>An embedded web browser is provided for convenience that will open .i2p addresses. However, it is not recommended for general use; users should download the Orweb browser, or Firefox Mobile and the ProxyMob Firefox plugin.</p>
<p>An embedded web browser is provided for convenience that will open .i2p addresses. However, it is not recommended for general use.</p>
<p>The browser does not use the outproxy for regular web sites. Javascript is disabled.</p>
<p>The following problems with eepsites are probably not fixable except on Android 3.0 (Honeycomb - i.e. tablets) and higher due to API limitations. The workaround is to use Firefox Mobile 4 and the ProxMob plugin (see below).</p>
......
<html>
<head></head>
<body>
<h2>How to configure Orweb:</h2>
<ol>
<li>Open Orweb's settings menu.</li>
<li>Change the "Proxy Port" to 4444.</li>
<li>Exit Orweb using the back button, then open it again.</li>
</ol>
</body>
</html>
\ No newline at end of file
......@@ -7,5 +7,10 @@
<h2>How do I use it?</h2>
<p>If you want to view I2P sites, see the "Browser configuration" help category.</p>
<p>With this app installed, other apps that are designed for I2P will use it automatically.</p>
<h2>Pre-configured HTTP proxy</h2>
<p>The app starts an HTTP proxy at localhost port 4444. To use it, configure your browser's HTTP proxy setting to use localhost:4444.</p>
<p>The HTTP proxy is tested with the "Orweb" app. It should also work with Firefox 4 Mobile and the ProxyMob Firefox plugin, if you have at least 512 MB of RAM.</p>
<p>See the "Browser configuration" help page for more info.</p>
</body>
</html>
\ No newline at end of file
<html>
<head></head>
<body>
<h2>This browser is unknown</h2>
<p>We have not tested this browser with I2P, so we don't know anything about it.</p>
<p>But if this browser supports proxies, it will work with I2P.</p>
<p>Configure this browser's HTTP proxy setting to use <code>localhost:4444</code>.</p>
</body>
</html>
\ No newline at end of file
<html>
<head></head>
<body>
<h2>Sorry, this browser is unsupported</h2>
<p>This browser does not support HTTP proxies, so it can't be used with I2P.</p>
</body>
</html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment