diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1cb4e6e47..3aa91b7ef 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -167,10 +167,10 @@
Local Repo
Local FDroid Repos
Discovering local FDroid repos…
- Your local FDroid repo is accessible.
+ F-Droid is ready to swap
waiting for IP address…
Setup Local Repo
- Touch to setup your local repo.
+ Touch to view details and allow others to swap your apps.
Touch to turn on your local repo.
Touch to turn off your local repo.
Updating…
diff --git a/src/org/fdroid/fdroid/localrepo/LocalRepoService.java b/src/org/fdroid/fdroid/localrepo/LocalRepoService.java
index d05826b83..6b9152d08 100644
--- a/src/org/fdroid/fdroid/localrepo/LocalRepoService.java
+++ b/src/org/fdroid/fdroid/localrepo/LocalRepoService.java
@@ -2,27 +2,38 @@
package org.fdroid.fdroid.localrepo;
import android.annotation.SuppressLint;
-import android.app.*;
-import android.content.*;
-import android.os.*;
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.app.Service;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.AsyncTask;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Looper;
+import android.os.Message;
+import android.os.Messenger;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
-
-import org.fdroid.fdroid.*;
+import org.fdroid.fdroid.FDroidApp;
+import org.fdroid.fdroid.Preferences;
import org.fdroid.fdroid.Preferences.ChangeListener;
+import org.fdroid.fdroid.R;
import org.fdroid.fdroid.net.LocalHTTPD;
import org.fdroid.fdroid.net.WifiStateChangeService;
-import org.fdroid.fdroid.views.LocalRepoActivity;
+import org.fdroid.fdroid.views.swap.SwapActivity;
+import javax.jmdns.JmDNS;
+import javax.jmdns.ServiceInfo;
import java.io.IOException;
import java.net.BindException;
import java.util.HashMap;
import java.util.Random;
-import javax.jmdns.JmDNS;
-import javax.jmdns.ServiceInfo;
-
public class LocalRepoService extends Service {
private static final String TAG = "LocalRepoService";
@@ -109,14 +120,14 @@ public class LocalRepoService extends Service {
public void onCreate() {
notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
// launch LocalRepoActivity if the user selects this notification
- Intent intent = new Intent(this, LocalRepoActivity.class);
+ Intent intent = new Intent(this, SwapActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent,
PendingIntent.FLAG_CANCEL_CURRENT);
notification = new NotificationCompat.Builder(this)
.setContentTitle(getText(R.string.local_repo_running))
.setContentText(getText(R.string.touch_to_configure_local_repo))
- .setSmallIcon(android.R.drawable.ic_dialog_info)
+ .setSmallIcon(R.drawable.ic_swap)
.setContentIntent(contentIntent)
.build();
startForeground(NOTIFICATION, notification);
diff --git a/src/org/fdroid/fdroid/views/swap/SwapActivity.java b/src/org/fdroid/fdroid/views/swap/SwapActivity.java
index 430e9e84e..3359db011 100644
--- a/src/org/fdroid/fdroid/views/swap/SwapActivity.java
+++ b/src/org/fdroid/fdroid/views/swap/SwapActivity.java
@@ -30,7 +30,6 @@ public class SwapActivity extends ActionBarActivity implements SwapProcessManage
private static final String STATE_NFC = "nfc";
private static final String STATE_WIFI_QR = "wifiQr";
- private Menu menu;
private String nextMenuItemLabel;
private Timer shutdownLocalRepoTimer;
private UpdateAsyncTask updateSwappableAppsTask = null;
@@ -69,7 +68,6 @@ public class SwapActivity extends ActionBarActivity implements SwapProcessManage
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
- this.menu = menu;
getMenuInflater().inflate(R.menu.swap_next, menu);
MenuItem nextMenuItem = menu.findItem(R.id.action_next);
nextMenuItem.setVisible(false);
@@ -123,12 +121,18 @@ public class SwapActivity extends ActionBarActivity implements SwapProcessManage
if (savedInstanceState == null) {
- getSupportFragmentManager()
- .beginTransaction()
- .replace(android.R.id.content, new StartSwapFragment(), STATE_START_SWAP)
- .addToBackStack(STATE_START_SWAP)
- .commit();
- hideNextButton();
+ if (FDroidApp.isLocalRepoServiceRunnig()) {
+ onWifiQr();
+ } else {
+
+ getSupportFragmentManager()
+ .beginTransaction()
+ .replace(android.R.id.content, new StartSwapFragment(), STATE_START_SWAP)
+ .addToBackStack(STATE_START_SWAP)
+ .commit();
+ hideNextButton();
+
+ }
}