Rearange BRouterActivity/BRouterView
This commit is contained in:
parent
c67374a268
commit
11f104afe9
2 changed files with 29 additions and 49 deletions
|
@ -48,10 +48,27 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat
|
|||
private static final int DIALOG_SHOW_REPEAT_TIMEOUT_HELP_ID = 16;
|
||||
private static final int DIALOG_SHOW_API23_HELP_ID = 17;
|
||||
|
||||
|
||||
private BRouterView mBRouterView;
|
||||
private PowerManager mPowerManager;
|
||||
private WakeLock mWakeLock;
|
||||
private String[] availableProfiles;
|
||||
private String selectedProfile = null;
|
||||
private List<File> availableBasedirs;
|
||||
private String[] basedirOptions;
|
||||
private int selectedBasedir;
|
||||
private String[] availableWaypoints;
|
||||
private String[] routingModes;
|
||||
private boolean[] routingModesChecked;
|
||||
private String defaultbasedir = null;
|
||||
private String message = null;
|
||||
private String[] availableVias;
|
||||
private Set<String> selectedVias;
|
||||
private List<OsmNodeNamed> nogoList;
|
||||
private String maptoolDirCandidate;
|
||||
private Set<Integer> dialogIds = new HashSet<Integer>();
|
||||
private String errorMessage;
|
||||
private String title;
|
||||
private int wpCount;
|
||||
|
||||
/**
|
||||
* Called when the activity is first created.
|
||||
|
@ -359,28 +376,6 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat
|
|||
return checked;
|
||||
}
|
||||
|
||||
private String[] availableProfiles;
|
||||
private String selectedProfile = null;
|
||||
|
||||
private List<File> availableBasedirs;
|
||||
private String[] basedirOptions;
|
||||
private int selectedBasedir;
|
||||
|
||||
private String[] availableWaypoints;
|
||||
|
||||
private String[] routingModes;
|
||||
private boolean[] routingModesChecked;
|
||||
|
||||
private String defaultbasedir = null;
|
||||
private String message = null;
|
||||
|
||||
private String[] availableVias;
|
||||
private Set<String> selectedVias;
|
||||
|
||||
private List<OsmNodeNamed> nogoList;
|
||||
|
||||
private String maptoolDirCandidate;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void selectProfile(String[] items) {
|
||||
availableProfiles = items;
|
||||
|
@ -486,8 +481,6 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat
|
|||
showDialog(DIALOG_NOGOSELECT_ID);
|
||||
}
|
||||
|
||||
private Set<Integer> dialogIds = new HashSet<Integer>();
|
||||
|
||||
private void showNewDialog(int id) {
|
||||
if (dialogIds.contains(Integer.valueOf(id))) {
|
||||
removeDialog(id);
|
||||
|
@ -496,10 +489,6 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat
|
|||
showDialog(id);
|
||||
}
|
||||
|
||||
private String errorMessage;
|
||||
private String title;
|
||||
private int wpCount;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void showErrorMessage(String msg) {
|
||||
errorMessage = msg;
|
||||
|
|
|
@ -47,10 +47,11 @@ import btools.router.RoutingHelper;
|
|||
import btools.util.CheapRuler;
|
||||
|
||||
public class BRouterView extends View {
|
||||
|
||||
public boolean canAccessSdCard;
|
||||
RoutingEngine cr;
|
||||
private int imgw;
|
||||
private int imgh;
|
||||
|
||||
private int centerLon;
|
||||
private int centerLat;
|
||||
private double scaleLon; // ilon -> pixel
|
||||
|
@ -60,7 +61,6 @@ public class BRouterView extends View {
|
|||
private List<OsmNodeNamed> nogoList;
|
||||
private List<OsmNodeNamed> nogoVetoList;
|
||||
private OsmTrack rawTrack;
|
||||
|
||||
private File retryBaseDir;
|
||||
private File modesDir;
|
||||
private File tracksDir;
|
||||
|
@ -73,32 +73,26 @@ public class BRouterView extends View {
|
|||
private boolean waitingForMigration = false;
|
||||
private String rawTrackPath;
|
||||
private String oldMigrationPath;
|
||||
|
||||
private boolean needsViaSelection;
|
||||
private boolean needsNogoSelection;
|
||||
private boolean needsWaypointSelection;
|
||||
|
||||
private WpDatabaseScanner dataBaseScanner;
|
||||
|
||||
private long lastDataTime = System.currentTimeMillis();
|
||||
|
||||
private CoordinateReader cor;
|
||||
|
||||
private int[] imgPixels;
|
||||
|
||||
private int memoryClass;
|
||||
|
||||
public boolean canAccessSdCard;
|
||||
|
||||
public void stopRouting() {
|
||||
if (cr != null) cr.terminate();
|
||||
}
|
||||
private long lastTs = System.currentTimeMillis();
|
||||
private long startTime = 0L;
|
||||
|
||||
public BRouterView(Context context, int memoryClass) {
|
||||
super(context);
|
||||
this.memoryClass = memoryClass;
|
||||
}
|
||||
|
||||
public void stopRouting() {
|
||||
if (cr != null) cr.terminate();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
try {
|
||||
// get base dir from private file
|
||||
|
@ -114,7 +108,7 @@ public class BRouterView extends View {
|
|||
|
||||
// don't ask twice
|
||||
String version = "v" + getContext().getString(R.string.app_version);
|
||||
File vFile = new File(brd, "profiles2/"+version );
|
||||
File vFile = new File(brd, "profiles2/" + version);
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q
|
||||
&& vFile.exists()) {
|
||||
startSetup(baseDir, false);
|
||||
|
@ -568,7 +562,7 @@ public class BRouterView extends View {
|
|||
// for profile remote, use ref-track logic same as service interface
|
||||
rc.rawTrackPath = rawTrackPath;
|
||||
|
||||
cr = new RoutingEngine(tracksDir.getAbsolutePath()+"/brouter", null, segmentDir, wpList, rc);
|
||||
cr = new RoutingEngine(tracksDir.getAbsolutePath() + "/brouter", null, segmentDir, wpList, rc);
|
||||
cr.start();
|
||||
invalidate();
|
||||
|
||||
|
@ -703,9 +697,6 @@ public class BRouterView extends View {
|
|||
lastDataTime += 4000; // give time for the toast before exiting
|
||||
}
|
||||
|
||||
private long lastTs = System.currentTimeMillis();
|
||||
private long startTime = 0L;
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue