diff --git a/assets/index.template.html b/assets/index.template.html
index fe48db91f..fd77b404b 100644
--- a/assets/index.template.html
+++ b/assets/index.template.html
@@ -1,65 +1,114 @@
+ "http://www.w3.org/TR/html4/strict.dtd">
-
-
- {{REPO_URL}} local FDroid repo
-
-
-
-
-
+
+
+ F-Droid swap
+
+
+
-
- Kerplapp Bootstrap
-
- Find a Kerplapp Repo
- - Download F-Droid client
- - Install F-Droid client
- - Add Kerplapp Repo to F-Droid client
- - Kerplapp an App!
-
-
+ ol > li a {
+ font-family: "Roboto", Helvetica, sans-serif;
+ font-weight: bold;
+ color: #fff;
+ }
+
+ #download-from-web {
+ padding-left: 2em;
+ padding-right: 2em;
+ }
+
+
+
+
+
+
+
+ You're minutes away from having swap success!
+
+ -
+ Find a swap
+
+
+ -
+ Download F-Droid
+
+
+ -
+ Install F-Droid
+
+
+ -
+ Add the swap to F-Droid
+
+
+ -
+ Install the apps you want
+
+
+
+
+
+ Or, download apps from the web
+
+
+
diff --git a/assets/swap-icon.png b/assets/swap-icon.png
new file mode 100644
index 000000000..50a5852d8
Binary files /dev/null and b/assets/swap-icon.png differ
diff --git a/assets/swap-icon.svg b/assets/swap-icon.svg
new file mode 100644
index 000000000..adcd0b51c
--- /dev/null
+++ b/assets/swap-icon.svg
@@ -0,0 +1,48 @@
+
+
+
+
diff --git a/assets/swap-tick-done.png b/assets/swap-tick-done.png
new file mode 100644
index 000000000..c50f40947
Binary files /dev/null and b/assets/swap-tick-done.png differ
diff --git a/assets/swap-tick-not-done.png b/assets/swap-tick-not-done.png
new file mode 100644
index 000000000..ec8ca7e0d
Binary files /dev/null and b/assets/swap-tick-not-done.png differ
diff --git a/src/org/fdroid/fdroid/localrepo/LocalRepoManager.java b/src/org/fdroid/fdroid/localrepo/LocalRepoManager.java
index f0ff3fe42..5da82ef8e 100644
--- a/src/org/fdroid/fdroid/localrepo/LocalRepoManager.java
+++ b/src/org/fdroid/fdroid/localrepo/LocalRepoManager.java
@@ -28,6 +28,14 @@ import org.fdroid.fdroid.data.App;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
@@ -50,15 +58,6 @@ import java.util.Map.Entry;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
public class LocalRepoManager {
private static final String TAG = "LocalRepoManager";
@@ -74,6 +73,12 @@ public class LocalRepoManager {
private String ipAddressString = "UNSET";
private String uriString = "UNSET";
+ private static String[] WEB_ROOT_ASSET_FILES = {
+ "swap-icon.png",
+ "swap-tick-done.png",
+ "swap-tick-not-done.png"
+ };
+
private Map apps = new HashMap();
public final File xmlIndex;
@@ -159,30 +164,43 @@ public class LocalRepoManager {
}
in.close();
out.close();
+
+ for (String file : WEB_ROOT_ASSET_FILES) {
+ Utils.copy(assetManager.open(file), new FileOutputStream(new File(webRoot, file)));
+ }
+
// make symlinks/copies in each subdir of the repo to make sure that
// the user will always find the bootstrap page.
- File fdroidDirIndex = new File(fdroidDir, "index.html");
- fdroidDirIndex.delete();
- Utils.symlinkOrCopyFile(new File("../index.html"), fdroidDirIndex);
- File repoDirIndex = new File(repoDir, "index.html");
- repoDirIndex.delete();
- Utils.symlinkOrCopyFile(new File("../../index.html"), repoDirIndex);
+ symlinkIndexPageElsewhere("../", fdroidDir);
+ symlinkIndexPageElsewhere("../../", repoDir);
+
// add in /FDROID/REPO to support bad QR Scanner apps
File fdroidCAPS = new File(fdroidDir.getParentFile(), "FDROID");
fdroidCAPS.mkdir();
+
File repoCAPS = new File(fdroidCAPS, "REPO");
repoCAPS.mkdir();
- File fdroidCAPSIndex = new File(fdroidCAPS, "index.html");
- fdroidCAPSIndex.delete();
- Utils.symlinkOrCopyFile(new File("../index.html"), fdroidCAPSIndex);
- File repoCAPSIndex = new File(repoCAPS, "index.html");
- repoCAPSIndex.delete();
- Utils.symlinkOrCopyFile(new File("../../index.html"), repoCAPSIndex);
+
+ symlinkIndexPageElsewhere("../", fdroidCAPS);
+ symlinkIndexPageElsewhere("../../", repoCAPS);
+
} catch (IOException e) {
e.printStackTrace();
}
}
+ private void symlinkIndexPageElsewhere(String symlinkPrefix, File directory) {
+ File index = new File(directory, "index.html");
+ index.delete();
+ Utils.symlinkOrCopyFile(new File(symlinkPrefix + "index.html"), index);
+
+ for(String fileName : WEB_ROOT_ASSET_FILES) {
+ File file = new File(directory, fileName);
+ file.delete();
+ Utils.symlinkOrCopyFile(new File(symlinkPrefix + fileName), file);
+ }
+ }
+
private void deleteContents(File path) {
if (path.exists()) {
for (File file : path.listFiles()) {
@@ -225,7 +243,7 @@ public class LocalRepoManager {
public void addApp(Context context, String packageName) {
App app;
try {
- app = new App(context, pm, packageName);
+ app = new App(context.getApplicationContext(), pm, packageName);
if (!app.isValid())
return;
PackageInfo packageInfo = pm.getPackageInfo(packageName, PackageManager.GET_META_DATA);