Move deleting tiles to BInstallerActivity
This commit is contained in:
parent
da7569b0a0
commit
7b6fce1481
2 changed files with 37 additions and 33 deletions
|
|
@ -86,7 +86,6 @@ public class BInstallerView extends View {
|
|||
}
|
||||
|
||||
tileStatus = new int[72 * 36];
|
||||
scanExistingFiles();
|
||||
|
||||
float scaleX = imgwOrig / ((float) bmp.getWidth());
|
||||
float scaley = imghOrig / ((float) bmp.getHeight());
|
||||
|
|
@ -97,10 +96,6 @@ public class BInstallerView extends View {
|
|||
mat.postScale(viewscale, viewscale);
|
||||
}
|
||||
|
||||
private void scanExistingFiles() {
|
||||
|
||||
}
|
||||
|
||||
public void setAvailableSize(long availableSize) {
|
||||
this.availableSize = availableSize;
|
||||
}
|
||||
|
|
@ -119,6 +114,20 @@ public class BInstallerView extends View {
|
|||
invalidate();
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getSelectedTiles(int tileMask) {
|
||||
ArrayList<Integer> selectedTiles = new ArrayList<>();
|
||||
for (int ix = 0; ix < 72; ix++) {
|
||||
for (int iy = 0; iy < 36; iy++) {
|
||||
int tileIndex = gridPos2Tileindex(ix, iy);
|
||||
if ((tileStatus[tileIndex] & tileMask) != 0 && BInstallerSizes.getRd5Size(tileIndex) > 0) {
|
||||
selectedTiles.add(tileIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return selectedTiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnClickListener(OnClickListener listener) {
|
||||
mOnClickListener = listener;
|
||||
|
|
@ -137,11 +146,6 @@ public class BInstallerView extends View {
|
|||
}
|
||||
|
||||
public void toggleDownload() {
|
||||
if (delTiles > 0) {
|
||||
((BInstallerActivity) getContext()).showConfirmDelete();
|
||||
return;
|
||||
}
|
||||
|
||||
int min_size = Integer.MAX_VALUE;
|
||||
|
||||
ArrayList<Integer> downloadList = new ArrayList<>();
|
||||
|
|
@ -298,19 +302,6 @@ public class BInstallerView extends View {
|
|||
}
|
||||
}
|
||||
|
||||
public void deleteSelectedTiles() {
|
||||
for (int ix = 0; ix < 72; ix++) {
|
||||
for (int iy = 0; iy < 36; iy++) {
|
||||
int tidx = gridPos2Tileindex(ix, iy);
|
||||
if ((tileStatus[tidx] & MASK_DELETED_RD5) != 0) {
|
||||
new File(baseDir, "brouter/segments4/" + baseNameForTile(tidx) + ".rd5").delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
scanExistingFiles();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue