diff options
-rw-r--r-- | src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java b/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java index 9b9418a..847189c 100644 --- a/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java +++ b/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java @@ -25,6 +25,7 @@ import android.content.pm.PackageManager; import android.widget.Toast; import com.cyanogenmod.trebuchet.R; +import com.cyanogenmod.trebuchet.preference.PreferencesProvider; import java.util.ArrayList; import java.util.HashSet; @@ -136,7 +137,10 @@ public class InstallShortcutReceiver extends BroadcastReceiver { // Try adding to the workspace screens incrementally, starting at the default or center // screen and alternating between +1, -1, +2, -2, etc. (using ~ ceil(i/2f)*(-1)^(i-1)) - final int screen = Launcher.DEFAULT_SCREEN; + final int screenCount = PreferencesProvider.Interface.Homescreen.getNumberHomescreens(context); + final int screenDefault = PreferencesProvider.Interface.Homescreen.getDefaultHomescreen(context, screenCount / 2); + final int screen = (screenDefault >= screenCount) ? screenCount / 2 : screenDefault; + for (int i = 0; i < (2 * Launcher.MAX_SCREEN_COUNT) + 1 && !found; ++i) { int si = screen + (int) ((i / 2f) + 0.5f) * ((i % 2 == 1) ? 1 : -1); if (0 <= si && si < Launcher.MAX_SCREEN_COUNT) { |