Android Studio automatic cleanup
This commit is contained in:
parent
553f064ce0
commit
89ef74f95b
2 changed files with 65 additions and 89 deletions
|
@ -28,20 +28,7 @@ public class BInstallerActivity extends Activity {
|
||||||
private PowerManager mPowerManager;
|
private PowerManager mPowerManager;
|
||||||
private WakeLock mWakeLock;
|
private WakeLock mWakeLock;
|
||||||
private DownloadReceiver myReceiver;
|
private DownloadReceiver myReceiver;
|
||||||
|
private final Set<Integer> dialogIds = new HashSet<Integer>();
|
||||||
|
|
||||||
public class DownloadReceiver extends BroadcastReceiver {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
if (intent.hasExtra("txt")) {
|
|
||||||
String txt = intent.getStringExtra("txt");
|
|
||||||
boolean ready = intent.getBooleanExtra("ready", false);
|
|
||||||
mBInstallerView.setState(txt, ready);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the activity is first created.
|
* Called when the activity is first created.
|
||||||
|
@ -132,8 +119,6 @@ public class BInstallerActivity extends Activity {
|
||||||
showDialog(DIALOG_CONFIRM_DELETE_ID);
|
showDialog(DIALOG_CONFIRM_DELETE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<Integer> dialogIds = new HashSet<Integer>();
|
|
||||||
|
|
||||||
private void showNewDialog(int id) {
|
private void showNewDialog(int id) {
|
||||||
if (dialogIds.contains(Integer.valueOf(id))) {
|
if (dialogIds.contains(Integer.valueOf(id))) {
|
||||||
removeDialog(id);
|
removeDialog(id);
|
||||||
|
@ -142,6 +127,18 @@ public class BInstallerActivity extends Activity {
|
||||||
showDialog(id);
|
showDialog(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class DownloadReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
if (intent.hasExtra("txt")) {
|
||||||
|
String txt = intent.getStringExtra("txt");
|
||||||
|
boolean ready = intent.getBooleanExtra("ready", false);
|
||||||
|
mBInstallerView.setState(txt, ready);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static public long getAvailableSpace(String baseDir) {
|
static public long getAvailableSpace(String baseDir) {
|
||||||
StatFs stat = new StatFs(baseDir);
|
StatFs stat = new StatFs(baseDir);
|
||||||
|
|
|
@ -28,50 +28,63 @@ public class BInstallerView extends View {
|
||||||
private static final int MASK_DELETED_RD5 = 2;
|
private static final int MASK_DELETED_RD5 = 2;
|
||||||
private static final int MASK_INSTALLED_RD5 = 4;
|
private static final int MASK_INSTALLED_RD5 = 4;
|
||||||
private static final int MASK_CURRENT_RD5 = 8;
|
private static final int MASK_CURRENT_RD5 = 8;
|
||||||
|
|
||||||
private int imgwOrig;
|
|
||||||
private int imghOrig;
|
|
||||||
private float scaleOrig;
|
|
||||||
|
|
||||||
private int imgw;
|
|
||||||
private int imgh;
|
|
||||||
|
|
||||||
private float lastDownX;
|
|
||||||
private float lastDownY;
|
|
||||||
|
|
||||||
private Bitmap bmp;
|
|
||||||
|
|
||||||
private float viewscale;
|
|
||||||
|
|
||||||
private float[] testVector = new float[2];
|
|
||||||
|
|
||||||
private int[] tileStatus;
|
|
||||||
|
|
||||||
private boolean tilesVisible = false;
|
|
||||||
|
|
||||||
private long availableSize;
|
|
||||||
private File baseDir;
|
|
||||||
private File segmentDir;
|
|
||||||
|
|
||||||
private boolean isDownloading = false;
|
|
||||||
public static boolean downloadCanceled = false;
|
public static boolean downloadCanceled = false;
|
||||||
|
|
||||||
private long currentDownloadSize;
|
|
||||||
private String currentDownloadFile = "";
|
|
||||||
private volatile String currentDownloadOperation = "";
|
|
||||||
private String downloadAction = "";
|
|
||||||
private volatile String newDownloadAction = "";
|
|
||||||
|
|
||||||
private long totalSize = 0;
|
|
||||||
private long rd5Tiles = 0;
|
|
||||||
private long delTiles = 0;
|
|
||||||
|
|
||||||
Paint pnt_1 = new Paint();
|
Paint pnt_1 = new Paint();
|
||||||
Paint pnt_2 = new Paint();
|
Paint pnt_2 = new Paint();
|
||||||
Paint paint = new Paint();
|
Paint paint = new Paint();
|
||||||
|
|
||||||
Activity mActivity;
|
Activity mActivity;
|
||||||
|
int btnh = 40;
|
||||||
|
int btnw = 160;
|
||||||
|
float tx, ty;
|
||||||
|
private final int imgwOrig;
|
||||||
|
private final int imghOrig;
|
||||||
|
private final float scaleOrig;
|
||||||
|
private final int imgw;
|
||||||
|
private final int imgh;
|
||||||
|
private float lastDownX;
|
||||||
|
private float lastDownY;
|
||||||
|
private Bitmap bmp;
|
||||||
|
private float viewscale;
|
||||||
|
private final float[] testVector = new float[2];
|
||||||
|
private int[] tileStatus;
|
||||||
|
private boolean tilesVisible = false;
|
||||||
|
private long availableSize;
|
||||||
|
private File baseDir;
|
||||||
|
private File segmentDir;
|
||||||
|
private boolean isDownloading = false;
|
||||||
|
private long currentDownloadSize;
|
||||||
|
private final String currentDownloadFile = "";
|
||||||
|
private volatile String currentDownloadOperation = "";
|
||||||
|
private String downloadAction = "";
|
||||||
|
private final String newDownloadAction = "";
|
||||||
|
private long totalSize = 0;
|
||||||
|
private long rd5Tiles = 0;
|
||||||
|
private long delTiles = 0;
|
||||||
|
private Matrix mat;
|
||||||
|
private final Matrix matText;
|
||||||
|
|
||||||
|
public BInstallerView(Context context) {
|
||||||
|
super(context);
|
||||||
|
mActivity = (Activity) context;
|
||||||
|
|
||||||
|
DisplayMetrics metrics = new DisplayMetrics();
|
||||||
|
((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||||
|
imgwOrig = metrics.widthPixels;
|
||||||
|
imghOrig = metrics.heightPixels;
|
||||||
|
int im = imgwOrig > imghOrig ? imgwOrig : imghOrig;
|
||||||
|
|
||||||
|
scaleOrig = im / 480.f;
|
||||||
|
|
||||||
|
matText = new Matrix();
|
||||||
|
matText.preScale(scaleOrig, scaleOrig);
|
||||||
|
|
||||||
|
imgw = (int) (imgwOrig / scaleOrig);
|
||||||
|
imgh = (int) (imghOrig / scaleOrig);
|
||||||
|
|
||||||
|
totalSize = 0;
|
||||||
|
rd5Tiles = 0;
|
||||||
|
delTiles = 0;
|
||||||
|
}
|
||||||
|
|
||||||
protected String baseNameForTile(int tileIndex) {
|
protected String baseNameForTile(int tileIndex) {
|
||||||
int lon = (tileIndex % 72) * 5 - 180;
|
int lon = (tileIndex % 72) * 5 - 180;
|
||||||
|
@ -100,7 +113,6 @@ public class BInstallerView extends View {
|
||||||
return (ilon + 180) / 5 + 72 * ((ilat + 90) / 5);
|
return (ilon + 180) / 5 + 72 * ((ilat + 90) / 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isDownloadCanceled() {
|
public boolean isDownloadCanceled() {
|
||||||
return downloadCanceled;
|
return downloadCanceled;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +179,6 @@ public class BInstallerView extends View {
|
||||||
deleteRawTracks(); // invalidate raw-tracks after data update
|
deleteRawTracks(); // invalidate raw-tracks after data update
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void downloadDone(boolean success) {
|
public void downloadDone(boolean success) {
|
||||||
isDownloading = false;
|
isDownloading = false;
|
||||||
if (success) {
|
if (success) {
|
||||||
|
@ -234,7 +245,7 @@ public class BInstallerView extends View {
|
||||||
|
|
||||||
availableSize = -1;
|
availableSize = -1;
|
||||||
try {
|
try {
|
||||||
availableSize = (long) ((BInstallerActivity) getContext()).getAvailableSpace(baseDir.getAbsolutePath());
|
availableSize = ((BInstallerActivity) getContext()).getAvailableSpace(baseDir.getAbsolutePath());
|
||||||
//StatFs stat = new StatFs(baseDir.getAbsolutePath ());
|
//StatFs stat = new StatFs(baseDir.getAbsolutePath ());
|
||||||
//availableSize = (long)stat.getAvailableBlocksLong()*stat.getBlockSizeLong();
|
//availableSize = (long)stat.getAvailableBlocksLong()*stat.getBlockSizeLong();
|
||||||
} catch (Exception e) { /* ignore */ }
|
} catch (Exception e) { /* ignore */ }
|
||||||
|
@ -256,9 +267,6 @@ public class BInstallerView extends View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Matrix mat;
|
|
||||||
private Matrix matText;
|
|
||||||
|
|
||||||
public void startInstaller() {
|
public void startInstaller() {
|
||||||
|
|
||||||
baseDir = ConfigHelper.getBaseDir(getContext());
|
baseDir = ConfigHelper.getBaseDir(getContext());
|
||||||
|
@ -285,29 +293,6 @@ public class BInstallerView extends View {
|
||||||
tilesVisible = false;
|
tilesVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BInstallerView(Context context) {
|
|
||||||
super(context);
|
|
||||||
mActivity = (Activity) context;
|
|
||||||
|
|
||||||
DisplayMetrics metrics = new DisplayMetrics();
|
|
||||||
((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
|
||||||
imgwOrig = metrics.widthPixels;
|
|
||||||
imghOrig = metrics.heightPixels;
|
|
||||||
int im = imgwOrig > imghOrig ? imgwOrig : imghOrig;
|
|
||||||
|
|
||||||
scaleOrig = im / 480.f;
|
|
||||||
|
|
||||||
matText = new Matrix();
|
|
||||||
matText.preScale(scaleOrig, scaleOrig);
|
|
||||||
|
|
||||||
imgw = (int) (imgwOrig / scaleOrig);
|
|
||||||
imgh = (int) (imghOrig / scaleOrig);
|
|
||||||
|
|
||||||
totalSize = 0;
|
|
||||||
rd5Tiles = 0;
|
|
||||||
delTiles = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||||
super.onSizeChanged(w, h, oldw, oldh);
|
super.onSizeChanged(w, h, oldw, oldh);
|
||||||
|
@ -411,12 +396,6 @@ public class BInstallerView extends View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int btnh = 40;
|
|
||||||
int btnw = 160;
|
|
||||||
|
|
||||||
|
|
||||||
float tx, ty;
|
|
||||||
|
|
||||||
private void drawSelectedTiles(Canvas canvas, Paint pnt, float fw, float fh, int status, int mask, boolean doCount, boolean cntDel, boolean doDraw) {
|
private void drawSelectedTiles(Canvas canvas, Paint pnt, float fw, float fh, int status, int mask, boolean doCount, boolean cntDel, boolean doDraw) {
|
||||||
for (int ix = 0; ix < 72; ix++)
|
for (int ix = 0; ix < 72; ix++)
|
||||||
for (int iy = 0; iy < 36; iy++) {
|
for (int iy = 0; iy < 36; iy++) {
|
||||||
|
|
Loading…
Reference in a new issue