Skip to content

Commit

Permalink
Clean up internals
Browse files Browse the repository at this point in the history
  • Loading branch information
markusfisch committed Jan 12, 2018
1 parent fc6d861 commit 684a0fb
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 26 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
tools:ignore="UnusedAttribute"
android:allowBackup="true"
android:fullBackupContent="true"
android:supportsRtl="true"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package de.markusfisch.android.pielauncher.content;

import de.markusfisch.android.pielauncher.graphics.PieMenu;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package de.markusfisch.android.pielauncher.content;
package de.markusfisch.android.pielauncher.graphics;

import java.util.ArrayList;

public class PieMenu {
private static final double TAU = Math.PI + Math.PI;
private static final double HALF_PI = Math.PI * .5f;

static class Icon {
double weight;
double size;
double cellSize;
int x;
int y;
protected static class Icon {
public double weight;
public double size;
public double cellSize;
public int x;
public int y;
}

final ArrayList<Icon> icons = new ArrayList<>();
protected final ArrayList<Icon> icons = new ArrayList<>();

int numberOfIcons = 0;
int selectedIcon = -1;
protected int numberOfIcons = 0;
protected int selectedIcon = -1;

private int centerX = -1;
private int centerY = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,10 @@ public class AppPieView extends SurfaceView {
public void run() {
while (running) {
Canvas canvas = surfaceHolder.lockCanvas();

if (canvas == null) {
continue;
}

synchronized (surfaceHolder) {
drawMenu(canvas);
}

drawMenu(canvas);
surfaceHolder.unlockCanvasAndPost(canvas);
}
}
Expand Down Expand Up @@ -68,6 +63,7 @@ public void surfaceChanged(
int format,
int width,
int height) {
stopThread();
initMenu(width, height);

running = true;
Expand All @@ -82,12 +78,20 @@ public void surfaceCreated(SurfaceHolder holder) {

@Override
public void surfaceDestroyed(SurfaceHolder holder) {
stopThread();
}

private void stopThread() {
if (thread == null) {
return;
}

running = false;

for (int retry = 100; retry-- > 0; ) {
try {
thread.join();
retry = 0;
break;
} catch (InterruptedException e) {
// try again
}
Expand Down Expand Up @@ -160,14 +164,6 @@ private void drawMenu(Canvas canvas) {
return;
}

/*View rootView = ((Activity) getContext())
.getWindow()
.getDecorView()
.getRootView();
rootView.setDrawingCacheEnabled(true);
Bitmap bitmap = Bitmap.createBitmap(rootView.getDrawingCache());
rootView.setDrawingCacheEnabled(false);*/

if (touchX != lastTouchX || touchY != lastTouchY) {
appMenu.calculate(touchX, touchY);

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buildscript {
ext.tools_version = '2.3.0'
ext.build_tools_version = '25.0.2'
ext.sdk_version = 25
ext.support_version = '25.2.0'
ext.support_version = '25.3.1'

repositories {
jcenter()
Expand Down

0 comments on commit 684a0fb

Please sign in to comment.