mirror of
https://github.com/markusfisch/PieLauncher.git
synced 2026-03-13 09:01:30 +08:00
Add option for pie in the upper half of the screen
When enabled use a separate pie menu for the upper (or left, for landscape configurations) half of the screen.
This commit is contained in:
@@ -191,6 +191,11 @@ public class PreferencesActivity extends Activity {
|
||||
PreferencesActivity::getAnimateInOutOptions,
|
||||
() -> prefs.animateInOut(),
|
||||
(value) -> prefs.setAnimateInOut(value));
|
||||
initPreference(R.id.split_pie_enabled,
|
||||
R.string.split_pie_menu,
|
||||
PreferencesActivity::getSplitPieEnabledOptions,
|
||||
() -> prefs.splitPieEnabled(),
|
||||
(value) -> prefs.setSplitPieEnabled(value));
|
||||
initPreference(R.id.home_button_opens_drawer,
|
||||
R.string.home_button_opens_drawer,
|
||||
PreferencesActivity::getHomeButtonOpensDrawerOptions,
|
||||
@@ -477,6 +482,13 @@ public class PreferencesActivity extends Activity {
|
||||
return map;
|
||||
}
|
||||
|
||||
private static Map<Boolean, Integer> getSplitPieEnabledOptions() {
|
||||
Map<Boolean, Integer> map = new LinkedHashMap<>();
|
||||
map.put(Boolean.TRUE, R.string.split_pie_yes);
|
||||
map.put(Boolean.FALSE, R.string.split_pie_no);
|
||||
return map;
|
||||
}
|
||||
|
||||
private static Map<Boolean, Integer> getHomeButtonOpensDrawerOptions() {
|
||||
Map<Boolean, Integer> map = new LinkedHashMap<>();
|
||||
map.put(Boolean.TRUE, R.string.home_button_opens_drawer_yes);
|
||||
|
||||
@@ -47,7 +47,13 @@ import de.markusfisch.android.pielauncher.io.HiddenApps;
|
||||
import de.markusfisch.android.pielauncher.io.Menu;
|
||||
import de.markusfisch.android.pielauncher.preference.Preferences;
|
||||
|
||||
public class Apps extends CanvasPieMenu<Apps.AppIcon> {
|
||||
public class Apps {
|
||||
public interface UpdateListener {
|
||||
void onUpdate();
|
||||
|
||||
void onShowAllAppsOnResume();
|
||||
}
|
||||
|
||||
public static class AppIcon extends CanvasPieMenu.CanvasIcon {
|
||||
public final Rect hitRect = new Rect();
|
||||
public final String label;
|
||||
@@ -66,15 +72,13 @@ public class Apps extends CanvasPieMenu<Apps.AppIcon> {
|
||||
}
|
||||
}
|
||||
|
||||
public interface UpdateListener {
|
||||
void onUpdate();
|
||||
|
||||
void onShowAllAppsOnResume();
|
||||
}
|
||||
|
||||
public static final String PIE_MENU_MAIN = "menu";
|
||||
public static final String PIE_MENU_ALT = "menu_alt";
|
||||
public static final boolean HAS_LAUNCHER_APP =
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
|
||||
|
||||
public final CanvasPieMenu<Apps.AppIcon> pieMain = new CanvasPieMenu<>();
|
||||
public final CanvasPieMenu<Apps.AppIcon> pieAlt = new CanvasPieMenu<>();
|
||||
public final HiddenApps hiddenApps = new HiddenApps();
|
||||
|
||||
private final Handler handler = new Handler(Looper.getMainLooper());
|
||||
@@ -170,7 +174,8 @@ public class Apps extends CanvasPieMenu<Apps.AppIcon> {
|
||||
}
|
||||
|
||||
public void store(Context context) {
|
||||
Menu.store(context, icons);
|
||||
Menu.store(context, PIE_MENU_MAIN, pieMain.icons);
|
||||
Menu.store(context, PIE_MENU_ALT, pieAlt.icons);
|
||||
hiddenApps.store(context);
|
||||
}
|
||||
|
||||
@@ -209,7 +214,7 @@ public class Apps extends CanvasPieMenu<Apps.AppIcon> {
|
||||
}
|
||||
}
|
||||
if (prefs.excludePie()) {
|
||||
list.removeAll(new HashSet<>(icons));
|
||||
list.removeAll(new HashSet<>(pieMain.icons));
|
||||
}
|
||||
} else {
|
||||
int item = prefs.getSearchParameter();
|
||||
@@ -265,7 +270,10 @@ public class Apps extends CanvasPieMenu<Apps.AppIcon> {
|
||||
hiddenApps.removeAndStore(appContext, packageName);
|
||||
handler.post(() -> {
|
||||
removePackageFromApps(apps, packageName, userHandle);
|
||||
removePackageFromPieMenu(packageName, userHandle);
|
||||
removePackageFromPieMenu(pieMain.icons, packageName,
|
||||
userHandle);
|
||||
removePackageFromPieMenu(pieAlt.icons, packageName,
|
||||
userHandle);
|
||||
propagateUpdate();
|
||||
});
|
||||
});
|
||||
@@ -316,11 +324,15 @@ public class Apps extends CanvasPieMenu<Apps.AppIcon> {
|
||||
List<AppIcon> newIcons = createMenu(context, newApps,
|
||||
PieLauncherApp.getPrefs(context).openListWith() ==
|
||||
Preferences.OPEN_LIST_WITH_ICON);
|
||||
List<AppIcon> newIconsAlt = Menu.restore(context,
|
||||
PIE_MENU_ALT, newApps);
|
||||
handler.post(() -> {
|
||||
apps.clear();
|
||||
apps.putAll(newApps);
|
||||
icons.clear();
|
||||
icons.addAll(newIcons);
|
||||
pieMain.icons.clear();
|
||||
pieMain.icons.addAll(newIcons);
|
||||
pieAlt.icons.clear();
|
||||
pieAlt.icons.addAll(newIconsAlt);
|
||||
indexing = false;
|
||||
propagateUpdate();
|
||||
});
|
||||
@@ -451,7 +463,7 @@ public class Apps extends CanvasPieMenu<Apps.AppIcon> {
|
||||
AppIcon drawerIcon = useDrawerIcon
|
||||
? addDrawerIcon(context, allApps)
|
||||
: null;
|
||||
ArrayList<AppIcon> menu = Menu.restore(context, allApps);
|
||||
ArrayList<AppIcon> menu = Menu.restore(context, PIE_MENU_MAIN, allApps);
|
||||
if (menu.isEmpty()) {
|
||||
createInitialMenu(menu, allApps, context.getPackageManager());
|
||||
}
|
||||
@@ -594,8 +606,8 @@ public class Apps extends CanvasPieMenu<Apps.AppIcon> {
|
||||
}
|
||||
}
|
||||
|
||||
private void removePackageFromPieMenu(String packageName,
|
||||
UserHandle userHandle) {
|
||||
private void removePackageFromPieMenu(List<AppIcon> icons,
|
||||
String packageName, UserHandle userHandle) {
|
||||
Iterator<AppIcon> it = icons.iterator();
|
||||
while (it.hasNext()) {
|
||||
AppIcon appIcon = it.next();
|
||||
|
||||
@@ -24,6 +24,24 @@ public class CanvasPieMenu<T extends CanvasPieMenu.CanvasIcon> extends PieMenu<T
|
||||
this.bitmap = bitmap;
|
||||
}
|
||||
|
||||
public void setStartPosition(int x, int y) {
|
||||
smoothedX = x;
|
||||
smoothedY = y;
|
||||
}
|
||||
|
||||
public void draw(Canvas canvas, double iconSize, int centerX,
|
||||
int centerY) {
|
||||
int s = (int) iconSize >> 1;
|
||||
if (s < 1) {
|
||||
return;
|
||||
}
|
||||
int left = centerX - s;
|
||||
int top = centerY - s;
|
||||
s <<= 1;
|
||||
rect.set(left, top, left + s, top + s);
|
||||
canvas.drawBitmap(bitmap, null, rect, paint);
|
||||
}
|
||||
|
||||
void draw(Canvas canvas) {
|
||||
draw(canvas, size, x, y);
|
||||
}
|
||||
@@ -41,19 +59,6 @@ public class CanvasPieMenu<T extends CanvasPieMenu.CanvasIcon> extends PieMenu<T
|
||||
draw(canvas, smoothedSize, smoothedX, smoothedY);
|
||||
}
|
||||
|
||||
public void draw(Canvas canvas, double iconSize, int centerX,
|
||||
int centerY) {
|
||||
int s = (int) iconSize >> 1;
|
||||
if (s < 1) {
|
||||
return;
|
||||
}
|
||||
int left = centerX - s;
|
||||
int top = centerY - s;
|
||||
s <<= 1;
|
||||
rect.set(left, top, left + s, top + s);
|
||||
canvas.drawBitmap(bitmap, null, rect, paint);
|
||||
}
|
||||
|
||||
private void initSmoothing() {
|
||||
smoothedSize = size;
|
||||
smoothedX = x;
|
||||
|
||||
@@ -16,14 +16,13 @@ import de.markusfisch.android.pielauncher.content.Apps;
|
||||
import de.markusfisch.android.pielauncher.content.LauncherItemKey;
|
||||
|
||||
public class Menu {
|
||||
private static final String MENU_FILE = "menu";
|
||||
|
||||
public static ArrayList<Apps.AppIcon> restore(Context context,
|
||||
String fileName,
|
||||
Map<LauncherItemKey, Apps.AppIcon> allApps) {
|
||||
ArrayList<Apps.AppIcon> icons = new ArrayList<>();
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
||||
context.openFileInput(MENU_FILE)));
|
||||
context.openFileInput(fileName)));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
Apps.AppIcon icon = allApps.get(
|
||||
@@ -41,10 +40,12 @@ public class Menu {
|
||||
return icons;
|
||||
}
|
||||
|
||||
public static void store(Context context, List<Apps.AppIcon> icons) {
|
||||
public static void store(Context context,
|
||||
String fileName,
|
||||
List<Apps.AppIcon> icons) {
|
||||
try {
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
|
||||
context.openFileOutput(MENU_FILE, Context.MODE_PRIVATE)));
|
||||
context.openFileOutput(fileName, Context.MODE_PRIVATE)));
|
||||
for (Apps.AppIcon icon : icons) {
|
||||
writer.write(LauncherItemKey.flattenToString(
|
||||
context,
|
||||
|
||||
@@ -71,6 +71,7 @@ public class Preferences {
|
||||
private static final String USE_LIGHT_DIALOGS = "use_light_dialogs";
|
||||
private static final String FORCE_RELAUNCH = "force_relaunch";
|
||||
private static final String SHOW_DRAWER_ON_HOME = "show_drawer_on_home";
|
||||
private static final String SPLIT_PIE_ENABLED = "split_pie_enabled";
|
||||
|
||||
private final SharedPreferences preferences;
|
||||
private final SystemSettings systemSettings;
|
||||
@@ -100,6 +101,7 @@ public class Preferences {
|
||||
private boolean useLightDialogs = false;
|
||||
private boolean forceRelaunch = true;
|
||||
private boolean showDrawerOnHome = true;
|
||||
private boolean splitPieEnabled = false;
|
||||
|
||||
public Preferences(Context context) {
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
@@ -150,6 +152,8 @@ public class Preferences {
|
||||
forceRelaunch = preferences.getBoolean(FORCE_RELAUNCH, forceRelaunch);
|
||||
showDrawerOnHome = preferences.getBoolean(SHOW_DRAWER_ON_HOME,
|
||||
showDrawerOnHome);
|
||||
splitPieEnabled = preferences.getBoolean(SPLIT_PIE_ENABLED,
|
||||
splitPieEnabled);
|
||||
}
|
||||
|
||||
public boolean skipSetup() {
|
||||
@@ -385,6 +389,15 @@ public class Preferences {
|
||||
put(SHOW_DRAWER_ON_HOME, showDrawerOnHome).apply();
|
||||
}
|
||||
|
||||
public boolean splitPieEnabled() {
|
||||
return splitPieEnabled;
|
||||
}
|
||||
|
||||
public void setSplitPieEnabled(boolean splitPieEnabled) {
|
||||
this.splitPieEnabled = splitPieEnabled;
|
||||
put(SPLIT_PIE_ENABLED, splitPieEnabled).apply();
|
||||
}
|
||||
|
||||
public float getAnimationDuration() {
|
||||
return 200f * systemSettings.getAnimatorDurationScale();
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@ public class AppPieView extends View {
|
||||
private static final int MODE_LIST = 1;
|
||||
private static final int MODE_EDIT = 2;
|
||||
|
||||
private final CanvasPieMenu<Apps.AppIcon> pieMenu = PieLauncherApp.apps;
|
||||
private final Fade fadePie = new Fade();
|
||||
private final Fade fadeList = new Fade();
|
||||
private final Fade fadeEdit = new Fade();
|
||||
@@ -126,6 +125,11 @@ public class AppPieView extends View {
|
||||
private final float textOffset;
|
||||
private final float touchSlopSq;
|
||||
|
||||
private CanvasPieMenu<Apps.AppIcon> lowerPieMenu =
|
||||
PieLauncherApp.apps.pieMain;
|
||||
private CanvasPieMenu<Apps.AppIcon> upperPieMenu =
|
||||
PieLauncherApp.apps.pieAlt;
|
||||
private CanvasPieMenu<Apps.AppIcon> pieMenu = lowerPieMenu;
|
||||
private Window window;
|
||||
private RenderNode pieRenderNode;
|
||||
private RenderNode listRenderNode;
|
||||
@@ -171,6 +175,7 @@ public class AppPieView extends View {
|
||||
private Bitmap iconChangeTwist;
|
||||
private Bitmap iconChangeIconScale;
|
||||
private Bitmap iconChangeRadius;
|
||||
private Bitmap iconSplitPie;
|
||||
private boolean neverDropped = false;
|
||||
private boolean appListIsFiltered = false;
|
||||
|
||||
@@ -481,7 +486,13 @@ public class AppPieView extends View {
|
||||
if (inDeadZone()) {
|
||||
return false;
|
||||
}
|
||||
if (eventTime - lastActionUp > 200L) {
|
||||
if (prefs.splitPieEnabled()) {
|
||||
selectMenu(touch.x, touch.y);
|
||||
// Always update to make the touch
|
||||
// immediate.
|
||||
setCenter(touch.x, touch.y);
|
||||
} else if (eventTime - lastActionUp > 200L) {
|
||||
// But not when there's just one pie.
|
||||
setCenter(touch.x, touch.y);
|
||||
}
|
||||
fadePie.fadeIn(eventTime);
|
||||
@@ -890,6 +901,7 @@ public class AppPieView extends View {
|
||||
updateChangeTwistIcon();
|
||||
updateChangeIconScaleIcon();
|
||||
updateChangeRadiusIcon();
|
||||
updateSplitPieIcon();
|
||||
|
||||
int pieBottom = viewMax / 2 + maxRadius;
|
||||
controlsPadding = (viewMax - pieBottom) / 2;
|
||||
@@ -905,15 +917,51 @@ public class AppPieView extends View {
|
||||
}
|
||||
|
||||
private void layoutEditorControls(boolean portrait) {
|
||||
Bitmap[] icons = new Bitmap[]{iconAdd, iconPreferences, iconDone};
|
||||
Rect[] rects = new Rect[]{iconStartRect, iconCenterRect, iconEndRect};
|
||||
int max = distributeIconButtons(
|
||||
new Bitmap[]{
|
||||
iconAdd,
|
||||
iconPreferences,
|
||||
iconDone
|
||||
},
|
||||
new Rect[]{
|
||||
iconStartRect,
|
||||
iconCenterRect,
|
||||
iconEndRect
|
||||
},
|
||||
-controlsPadding,
|
||||
portrait);
|
||||
|
||||
distributeIconButtons(
|
||||
new Bitmap[]{
|
||||
iconChangeTwist,
|
||||
iconChangeIconScale,
|
||||
iconChangeRadius,
|
||||
},
|
||||
new Rect[]{
|
||||
iconChangeTwistRect,
|
||||
iconChangeIconScaleRect,
|
||||
iconChangeRadiusRect
|
||||
},
|
||||
controlsPadding,
|
||||
portrait);
|
||||
|
||||
// Calculate size of circular action buttons.
|
||||
actionSize = Math.min(iconSize, max / 2 - spaceBetween);
|
||||
actionSizeSq = actionSize * actionSize;
|
||||
}
|
||||
|
||||
private int distributeIconButtons(
|
||||
Bitmap[] icons,
|
||||
Rect[] rects,
|
||||
int base,
|
||||
boolean portrait) {
|
||||
int length = icons.length;
|
||||
int totalWidth = 0;
|
||||
int totalHeight = 0;
|
||||
int largestWidth = 0;
|
||||
int largestHeight = 0;
|
||||
|
||||
// Initialize rects and calculate totals.
|
||||
// Initialize rects and calculate totals for both layout directions.
|
||||
for (int i = 0; i < length; ++i) {
|
||||
Bitmap icon = icons[i];
|
||||
int w = icon.getWidth();
|
||||
@@ -929,18 +977,20 @@ public class AppPieView extends View {
|
||||
int spaces = length + 1;
|
||||
int max;
|
||||
if (portrait) {
|
||||
// Horizontally.
|
||||
int step = Math.round((float) (viewWidth - totalWidth) / spaces);
|
||||
max = largestWidth + step;
|
||||
int x = step;
|
||||
int y = viewHeight - controlsPadding - largestHeight / 2;
|
||||
int y = (base > 0 ? base : viewHeight + base) - largestHeight / 2;
|
||||
for (Rect rect : rects) {
|
||||
rect.offset(x, y);
|
||||
x += step + rect.width();
|
||||
}
|
||||
} else {
|
||||
// Vertically.
|
||||
int step = Math.round((float) (viewHeight - totalHeight) / spaces);
|
||||
max = largestHeight + step;
|
||||
int x = viewWidth - controlsPadding - largestWidth / 2;
|
||||
int x = (base > 0 ? base : viewWidth + base) - largestWidth / 2;
|
||||
int y = step;
|
||||
for (Rect rect : rects) {
|
||||
rect.offset(x, y);
|
||||
@@ -948,31 +998,7 @@ public class AppPieView extends View {
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate top button rectangles.
|
||||
iconChangeTwistRect.set(iconStartRect);
|
||||
iconChangeIconScaleRect.set(iconCenterRect);
|
||||
iconChangeRadiusRect.set(iconEndRect);
|
||||
if (portrait) {
|
||||
int axis = viewHeight >> 1;
|
||||
iconChangeTwistRect.top = mirror(iconStartRect.bottom, axis);
|
||||
iconChangeTwistRect.bottom = mirror(iconStartRect.top, axis);
|
||||
iconChangeIconScaleRect.top = mirror(iconCenterRect.bottom, axis);
|
||||
iconChangeIconScaleRect.bottom = mirror(iconCenterRect.top, axis);
|
||||
iconChangeRadiusRect.top = mirror(iconEndRect.bottom, axis);
|
||||
iconChangeRadiusRect.bottom = mirror(iconEndRect.top, axis);
|
||||
} else {
|
||||
int axis = viewWidth >> 1;
|
||||
iconChangeTwistRect.left = mirror(iconStartRect.right, axis);
|
||||
iconChangeTwistRect.right = mirror(iconStartRect.left, axis);
|
||||
iconChangeIconScaleRect.left = mirror(iconCenterRect.right, axis);
|
||||
iconChangeIconScaleRect.right = mirror(iconCenterRect.left, axis);
|
||||
iconChangeRadiusRect.left = mirror(iconEndRect.right, axis);
|
||||
iconChangeRadiusRect.right = mirror(iconEndRect.left, axis);
|
||||
}
|
||||
|
||||
// Calculate size of circular action buttons.
|
||||
actionSize = Math.min(iconSize, max / 2 - spaceBetween);
|
||||
actionSizeSq = actionSize * actionSize;
|
||||
return max;
|
||||
}
|
||||
|
||||
private void showIconOptions(Context context, Apps.AppIcon icon) {
|
||||
@@ -1025,6 +1051,7 @@ public class AppPieView extends View {
|
||||
}
|
||||
|
||||
private void editIcon(Apps.AppIcon icon) {
|
||||
updateSplitPieIcon();
|
||||
backup.clear();
|
||||
backup.addAll(pieMenu.icons);
|
||||
pieMenu.icons.remove(icon);
|
||||
@@ -1145,9 +1172,10 @@ public class AppPieView extends View {
|
||||
}
|
||||
|
||||
private boolean performEditAction(Context context) {
|
||||
if (grabbedIcon == null && contains(iconChangeTwistRect, touch)) {
|
||||
twist = getTwistSegment(twist + Apps.HALF_PI) *
|
||||
(float) Apps.HALF_PI;
|
||||
if (grabbedIcon == null &&
|
||||
contains(iconChangeTwistRect, touch)) {
|
||||
twist = getTwistSegment(twist + PieMenu.HALF_PI) *
|
||||
(float) PieMenu.HALF_PI;
|
||||
updateChangeTwistIcon();
|
||||
return true;
|
||||
} else if (grabbedIcon == null &&
|
||||
@@ -1172,7 +1200,16 @@ public class AppPieView extends View {
|
||||
return true;
|
||||
} else if (contains(iconCenterRect, touch)) {
|
||||
if (grabbedIcon == null) {
|
||||
PreferencesActivity.start(context);
|
||||
if (prefs.splitPieEnabled()) {
|
||||
pieMenu = pieMenu == lowerPieMenu
|
||||
? upperPieMenu
|
||||
: lowerPieMenu;
|
||||
centerIcons(pieMenu.icons);
|
||||
updateSplitPieIcon();
|
||||
invalidate();
|
||||
} else {
|
||||
PreferencesActivity.start(context);
|
||||
}
|
||||
} else {
|
||||
rollback();
|
||||
if (neverDropped) {
|
||||
@@ -1214,6 +1251,14 @@ public class AppPieView extends View {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void centerIcons(ArrayList<Apps.AppIcon> icons) {
|
||||
int centerX = viewWidth >> 1;
|
||||
int centerY = viewHeight >> 1;
|
||||
for (Apps.AppIcon ic : icons) {
|
||||
ic.setStartPosition(centerX, centerY);
|
||||
}
|
||||
}
|
||||
|
||||
private void launchApp(Context context, Apps.AppIcon appIcon) {
|
||||
launchingIcon = appIcon;
|
||||
PieLauncherApp.apps.launchApp(context, appIcon);
|
||||
@@ -1245,7 +1290,7 @@ public class AppPieView extends View {
|
||||
if (size == 0) {
|
||||
return true;
|
||||
}
|
||||
Apps.Icon icon = a.get(0);
|
||||
PieMenu.Icon icon = a.get(0);
|
||||
int i;
|
||||
for (i = 0; i < size; ++i) {
|
||||
if (b.get(i) == icon) {
|
||||
@@ -1282,7 +1327,7 @@ public class AppPieView extends View {
|
||||
}
|
||||
|
||||
private static int getTwistSegment(double rad) {
|
||||
rad = (rad + Apps.TAU) % Apps.TAU;
|
||||
rad = (rad + PieMenu.TAU) % PieMenu.TAU;
|
||||
if (rad > 5.497 || rad < .785) {
|
||||
return 0;
|
||||
} else if (rad < 2.356) {
|
||||
@@ -1343,7 +1388,18 @@ public class AppPieView extends View {
|
||||
return 2;
|
||||
}
|
||||
|
||||
private void changeIcon(Context context, Apps.Icon icon) {
|
||||
private void updateSplitPieIcon() {
|
||||
iconSplitPie = Converter.getBitmapFromDrawable(getResources(),
|
||||
getDrawableForSplitPie());
|
||||
}
|
||||
|
||||
private int getDrawableForSplitPie() {
|
||||
return pieMenu == upperPieMenu
|
||||
? R.drawable.ic_screen_upper
|
||||
: R.drawable.ic_screen_lower;
|
||||
}
|
||||
|
||||
private void changeIcon(Context context, PieMenu.Icon icon) {
|
||||
Apps.AppIcon appIcon = (Apps.AppIcon) icon;
|
||||
PickIconActivity.start(context, appIcon.componentName);
|
||||
}
|
||||
@@ -1354,6 +1410,14 @@ public class AppPieView extends View {
|
||||
}
|
||||
}
|
||||
|
||||
private void selectMenu(int x, int y) {
|
||||
pieMenu = (viewWidth > viewHeight
|
||||
? x < viewWidth >> 1
|
||||
: y < viewHeight >> 1)
|
||||
? upperPieMenu
|
||||
: lowerPieMenu;
|
||||
}
|
||||
|
||||
private void setCenter(int x, int y) {
|
||||
pieMenu.set(
|
||||
clamp(x, radius, viewWidth - radius),
|
||||
@@ -1563,7 +1627,9 @@ public class AppPieView extends View {
|
||||
drawAction(canvas, iconChangeIconScale, iconChangeIconScaleRect);
|
||||
drawAction(canvas, iconChangeRadius, iconChangeRadiusRect);
|
||||
drawAction(canvas, iconAdd, iconStartRect);
|
||||
drawAction(canvas, iconPreferences, iconCenterRect);
|
||||
drawAction(canvas, prefs.splitPieEnabled()
|
||||
? iconSplitPie
|
||||
: iconPreferences, iconCenterRect);
|
||||
drawAction(canvas, iconDone, iconEndRect);
|
||||
}
|
||||
|
||||
@@ -1583,8 +1649,8 @@ public class AppPieView extends View {
|
||||
|
||||
private void calculateEditablePie(int centerX, int centerY) {
|
||||
int endIndex = ungrabbedIcons.size();
|
||||
double step = Apps.TAU / (endIndex + 1);
|
||||
double angle = Apps.getPositiveAngle(Math.atan2(
|
||||
double step = PieMenu.TAU / (endIndex + 1);
|
||||
double angle = PieMenu.getPositiveAngle(Math.atan2(
|
||||
touch.y - centerY,
|
||||
touch.x - centerX) - twist + step * .5);
|
||||
int insertAt = Math.min(endIndex, (int) Math.floor(angle / step));
|
||||
@@ -1779,10 +1845,6 @@ public class AppPieView extends View {
|
||||
return Math.max(min, Math.min(max, value));
|
||||
}
|
||||
|
||||
private static int mirror(int v, int axis) {
|
||||
return axis - (v - axis);
|
||||
}
|
||||
|
||||
private static int getSelectedAppFromTrailingSpace(String s) {
|
||||
int l = s == null ? 0 : s.length();
|
||||
if (l < 1) {
|
||||
|
||||
15
app/src/main/res/drawable/ic_screen_lower.xml
Normal file
15
app/src/main/res/drawable/ic_screen_lower.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#00ffffff"
|
||||
android:pathData="M7,4h10a2,2 0 0 1 2,2v12a2,2 0 0 1 -2,2h-10a2,2 0 0 1 -2,-2v-12a2,2 0 0 1 2,-2z"
|
||||
android:strokeColor="#ffffffff"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.5" />
|
||||
<path
|
||||
android:fillColor="#ffffffff"
|
||||
android:pathData="M8,12h8v5h-8z" />
|
||||
</vector>
|
||||
15
app/src/main/res/drawable/ic_screen_upper.xml
Normal file
15
app/src/main/res/drawable/ic_screen_upper.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#00ffffff"
|
||||
android:pathData="M7,4h10a2,2 0 0 1 2,2v12a2,2 0 0 1 -2,2h-10a2,2 0 0 1 -2,-2v-12a2,2 0 0 1 2,-2z"
|
||||
android:strokeColor="#ffffffff"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.5" />
|
||||
<path
|
||||
android:fillColor="#ffffffff"
|
||||
android:pathData="M8,7h8v5h-8z" />
|
||||
</vector>
|
||||
@@ -64,9 +64,13 @@
|
||||
android:id="@+id/immersive_mode"
|
||||
android:text="@string/immersive_mode_disabled" />
|
||||
<de.markusfisch.android.pielauncher.widget.PreferenceView
|
||||
style="@style/Preference"
|
||||
style="@style/PreferenceWithSeparator"
|
||||
android:id="@+id/animate_in_out"
|
||||
android:text="@string/animate_in_out_yes" />
|
||||
<de.markusfisch.android.pielauncher.widget.PreferenceView
|
||||
style="@style/Preference"
|
||||
android:id="@+id/split_pie_enabled"
|
||||
android:text="@string/split_pie_menu" />
|
||||
<TextView
|
||||
style="@style/CategoryHeader"
|
||||
android:text="@string/category_app_drawer" />
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<string name="background_blur_radius_medium">Etwas</string>
|
||||
<string name="background_blur_radius_heavy">Stark</string>
|
||||
<string name="background_blur_radius_none">Nein (Standard)</string>
|
||||
<string name="blur_menu">Menü verwischen</string>
|
||||
<string name="blur_menu">Menu verwischen</string>
|
||||
<string name="blur_menu_yes">Ja (Standard)</string>
|
||||
<string name="blur_menu_no">Nein</string>
|
||||
<string name="dead_zone">Berührungen ignorieren</string>
|
||||
@@ -78,6 +78,9 @@
|
||||
<string name="exclude_pie">Symbole des Startbildschirms ausblenden</string>
|
||||
<string name="exclude_pie_yes">Ja</string>
|
||||
<string name="exclude_pie_no">Nein (Standard)</string>
|
||||
<string name="split_pie_menu">Ein Menu für oben und unten</string>
|
||||
<string name="split_pie_yes">Ja</string>
|
||||
<string name="split_pie_no">Nein (Standard)</string>
|
||||
<string name="icon_press">Langes Drücken</string>
|
||||
<string name="icon_press_default">Fügt App zum Menu hinzu (Standard)</string>
|
||||
<string name="icon_press_longer">Erfordert längeres Drücken</string>
|
||||
|
||||
@@ -78,6 +78,9 @@
|
||||
<string name="exclude_pie">Masquer les icônes de l\'écran d\'accueil</string>
|
||||
<string name="exclude_pie_yes">Oui</string>
|
||||
<string name="exclude_pie_no">Non (par défaut)</string>
|
||||
<string name="split_pie_menu">Menus Pie séparés en haut/en bas</string>
|
||||
<string name="split_pie_yes">Oui</string>
|
||||
<string name="split_pie_no">Non (par défaut)</string>
|
||||
<string name="icon_press">Appui long</string>
|
||||
<string name="icon_press_default">Lancer l\'app dans le menu (par défaut)</string>
|
||||
<string name="icon_press_longer">Nécessite une pression prolongée</string>
|
||||
|
||||
@@ -78,6 +78,9 @@
|
||||
<string name="exclude_pie">Pictogrammen op het beginscherm verbergen</string>
|
||||
<string name="exclude_pie_yes">Ja</string>
|
||||
<string name="exclude_pie_no">Nee (standaard)</string>
|
||||
<string name="split_pie_menu">Aparte bovenste/onderste Pie-menu\'s</string>
|
||||
<string name="split_pie_yes">Ja</string>
|
||||
<string name="split_pie_no">Nee (standaard)</string>
|
||||
<string name="icon_press">Lang drukken</string>
|
||||
<string name="icon_press_default">Voegt app toe aan het Pie menu (standaard)</string>
|
||||
<string name="icon_press_longer">Vereist lang drukken</string>
|
||||
|
||||
@@ -82,6 +82,9 @@
|
||||
<string name="exclude_pie">Esconder ícones iniciais da gaveta de aplicativos</string>
|
||||
<string name="exclude_pie_yes">Sim</string>
|
||||
<string name="exclude_pie_no">Não (Padrão)</string>
|
||||
<string name="split_pie_menu">Menus Pie separados em cima/embaixo</string>
|
||||
<string name="split_pie_yes">Sim</string>
|
||||
<string name="split_pie_no">Não (Padrão)</string>
|
||||
<string name="icon_press">Toque longo</string>
|
||||
<string name="icon_press_default">Adiciona aplicativo ao menu Pie (Padrão)</string>
|
||||
<string name="icon_press_longer">Requer toque prolongado</string>
|
||||
|
||||
@@ -78,6 +78,9 @@
|
||||
<string name="exclude_pie">Скрыть значки на главном экране</string>
|
||||
<string name="exclude_pie_yes">Да</string>
|
||||
<string name="exclude_pie_no">Нет (Стандартно)</string>
|
||||
<string name="split_pie_menu">Отдельные круговые меню сверху/снизу</string>
|
||||
<string name="split_pie_yes">Да</string>
|
||||
<string name="split_pie_no">Нет (Стандартно)</string>
|
||||
<string name="icon_press">Длительное нажатие</string>
|
||||
<string name="icon_press_default">Добавляет приложение в меню (Стандартно)</string>
|
||||
<string name="icon_press_longer">Добавляет приложение в меню (С задержкой)</string>
|
||||
|
||||
@@ -78,6 +78,9 @@
|
||||
<string name="exclude_pie">Dölj ikoner på startskärmen</string>
|
||||
<string name="exclude_pie_yes">Ja</string>
|
||||
<string name="exclude_pie_no">Nej (standard)</string>
|
||||
<string name="split_pie_menu">Separata cirkelmenyer upptill/nedtill</string>
|
||||
<string name="split_pie_yes">Ja</string>
|
||||
<string name="split_pie_no">Nej (standard)</string>
|
||||
<string name="icon_press">Långtryckning</string>
|
||||
<string name="icon_press_default">Lägg till app i cirkelmenyn (standard)</string>
|
||||
<string name="icon_press_longer">Kräver långvarig tryckning</string>
|
||||
|
||||
@@ -78,6 +78,9 @@
|
||||
<string name="exclude_pie">Приховати іконки на головному екрані</string>
|
||||
<string name="exclude_pie_yes">Так</string>
|
||||
<string name="exclude_pie_no">Ні (за замовчуванням)</string>
|
||||
<string name="split_pie_menu">Окремі кругові меню зверху/знизу</string>
|
||||
<string name="split_pie_yes">Так</string>
|
||||
<string name="split_pie_no">Ні (за замовчуванням)</string>
|
||||
<string name="icon_press">Тривале натискання</string>
|
||||
<string name="icon_press_default">Додає додаток до меню (за замовчуванням)</string>
|
||||
<string name="icon_press_longer">Вимагає тривалого натискання</string>
|
||||
|
||||
@@ -78,6 +78,9 @@
|
||||
<string name="exclude_pie">隐藏主屏幕上的图标</string>
|
||||
<string name="exclude_pie_yes">是</string>
|
||||
<string name="exclude_pie_no">没有 (默认)</string>
|
||||
<string name="split_pie_menu">上下独立饼状菜单</string>
|
||||
<string name="split_pie_yes">是</string>
|
||||
<string name="split_pie_no">没有 (默认)</string>
|
||||
<string name="icon_press">长按</string>
|
||||
<string name="icon_press_default">在菜单中添加应用程序 (默认)</string>
|
||||
<string name="icon_press_longer">需要长时间按压</string>
|
||||
|
||||
@@ -82,6 +82,9 @@
|
||||
<string name="exclude_pie">Hide home icons from app drawer</string>
|
||||
<string name="exclude_pie_yes">Yes</string>
|
||||
<string name="exclude_pie_no">No (Default)</string>
|
||||
<string name="split_pie_menu">Separate top/bottom pie menus</string>
|
||||
<string name="split_pie_yes">Yes</string>
|
||||
<string name="split_pie_no">No (Default)</string>
|
||||
<string name="icon_press">Long press</string>
|
||||
<string name="icon_press_default">Adds app to the pie menu (Default)</string>
|
||||
<string name="icon_press_longer">Requires prolonged pressing</string>
|
||||
|
||||
Reference in New Issue
Block a user