More Fixes
This commit is contained in:
parent
de7dd71a94
commit
dd7a2fcd98
2 changed files with 18 additions and 34 deletions
|
@ -15,26 +15,31 @@ import android.os.PowerManager;
|
||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
import android.os.StatFs;
|
import android.os.StatFs;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class BInstallerActivity extends Activity {
|
public class BInstallerActivity extends Activity {
|
||||||
|
|
||||||
public static final String DOWNLOAD_ACTION = "btools.routingapp.download";
|
public static final String DOWNLOAD_ACTION = "btools.routingapp.download";
|
||||||
|
|
||||||
private static final int DIALOG_CONFIRM_DELETE_ID = 1;
|
private static final int DIALOG_CONFIRM_DELETE_ID = 1;
|
||||||
|
|
||||||
private BInstallerView mBInstallerView;
|
private BInstallerView mBInstallerView;
|
||||||
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<>();
|
|
||||||
|
static public long getAvailableSpace(String baseDir) {
|
||||||
|
StatFs stat = new StatFs(baseDir);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||||
|
return stat.getAvailableBlocksLong() * stat.getBlockSizeLong();
|
||||||
|
} else {
|
||||||
|
//noinspection deprecation
|
||||||
|
return (long) stat.getAvailableBlocks() * stat.getBlockSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the activity is first created.
|
* Called when the activity is first created.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
@ -91,7 +96,6 @@ public class BInstallerActivity extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
protected Dialog onCreateDialog(int id) {
|
protected Dialog onCreateDialog(int id) {
|
||||||
AlertDialog.Builder builder;
|
AlertDialog.Builder builder;
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
@ -114,19 +118,10 @@ public class BInstallerActivity extends Activity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void showConfirmDelete() {
|
public void showConfirmDelete() {
|
||||||
showDialog(DIALOG_CONFIRM_DELETE_ID);
|
showDialog(DIALOG_CONFIRM_DELETE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showNewDialog(int id) {
|
|
||||||
if (dialogIds.contains(id)) {
|
|
||||||
removeDialog(id);
|
|
||||||
}
|
|
||||||
dialogIds.add(id);
|
|
||||||
showDialog(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DownloadReceiver extends BroadcastReceiver {
|
public class DownloadReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -138,15 +133,4 @@ public class BInstallerActivity extends Activity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static public long getAvailableSpace(String baseDir) {
|
|
||||||
StatFs stat = new StatFs(baseDir);
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
|
||||||
return stat.getAvailableBlocksLong() * stat.getBlockSizeLong();
|
|
||||||
} else {
|
|
||||||
return stat.getAvailableBlocks() * stat.getBlockSize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,13 @@ public class BInstallerView extends View {
|
||||||
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;
|
||||||
public static boolean downloadCanceled = false;
|
public static boolean downloadCanceled = false;
|
||||||
|
private final int imgwOrig;
|
||||||
|
private final int imghOrig;
|
||||||
|
private final float scaleOrig;
|
||||||
|
private final int imgw;
|
||||||
|
private final int imgh;
|
||||||
|
private final float[] testVector = new float[2];
|
||||||
|
private final Matrix matText;
|
||||||
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();
|
||||||
|
@ -35,16 +42,10 @@ public class BInstallerView extends View {
|
||||||
int btnh = 40;
|
int btnh = 40;
|
||||||
int btnw = 160;
|
int btnw = 160;
|
||||||
float tx, ty;
|
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 lastDownX;
|
||||||
private float lastDownY;
|
private float lastDownY;
|
||||||
private Bitmap bmp;
|
private Bitmap bmp;
|
||||||
private float viewscale;
|
private float viewscale;
|
||||||
private final float[] testVector = new float[2];
|
|
||||||
private int[] tileStatus;
|
private int[] tileStatus;
|
||||||
private boolean tilesVisible = false;
|
private boolean tilesVisible = false;
|
||||||
private long availableSize;
|
private long availableSize;
|
||||||
|
@ -57,7 +58,6 @@ public class BInstallerView extends View {
|
||||||
private long rd5Tiles = 0;
|
private long rd5Tiles = 0;
|
||||||
private long delTiles = 0;
|
private long delTiles = 0;
|
||||||
private Matrix mat;
|
private Matrix mat;
|
||||||
private final Matrix matText;
|
|
||||||
|
|
||||||
public BInstallerView(Context context) {
|
public BInstallerView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
Loading…
Reference in a new issue