mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Tango: set third person camera by default, scan media file on SD-card when saving database (fixed issue of database just saved not seen with MTP when connected by USB)
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<!-- BEGIN_INCLUDE(manifest) -->
|
<!-- BEGIN_INCLUDE(manifest) -->
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.introlab.rtabmap"
|
package="com.introlab.rtabmap"
|
||||||
android:versionCode="70"
|
android:versionCode="71"
|
||||||
android:versionName="@RTABMAP_VERSION@">
|
android:versionName="@RTABMAP_VERSION@">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ Scene::Scene() :
|
|||||||
{
|
{
|
||||||
gesture_camera_ = new tango_gl::GestureCamera();
|
gesture_camera_ = new tango_gl::GestureCamera();
|
||||||
gesture_camera_->SetCameraType(
|
gesture_camera_->SetCameraType(
|
||||||
tango_gl::GestureCamera::kFirstPerson);
|
tango_gl::GestureCamera::kThirdPersonFollow);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scene::~Scene() {
|
Scene::~Scene() {
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
|||||||
private boolean mHudVisible = true;
|
private boolean mHudVisible = true;
|
||||||
private int mSavedRenderingType = 0;
|
private int mSavedRenderingType = 0;
|
||||||
private boolean mMenuOpened = false;
|
private boolean mMenuOpened = false;
|
||||||
|
private long mSavedStamp = 0;
|
||||||
|
|
||||||
// UI states
|
// UI states
|
||||||
private static enum State {
|
private static enum State {
|
||||||
@@ -534,6 +535,8 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
|||||||
};
|
};
|
||||||
|
|
||||||
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
|
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
|
||||||
|
|
||||||
|
setCamera(1);
|
||||||
|
|
||||||
DISABLE_LOG = !( 0 != ( getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE ) );
|
DISABLE_LOG = !( 0 != ( getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE ) );
|
||||||
}
|
}
|
||||||
@@ -2223,6 +2226,19 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
|||||||
File from = new File(mWorkingDirectory, files[position]);
|
File from = new File(mWorkingDirectory, files[position]);
|
||||||
File to = new File(mWorkingDirectory, fileName + ".db");
|
File to = new File(mWorkingDirectory, fileName + ".db");
|
||||||
from.renameTo(to);
|
from.renameTo(to);
|
||||||
|
|
||||||
|
long stamp = System.currentTimeMillis();
|
||||||
|
if(stamp-mSavedStamp < 10000)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Thread.sleep(10000 - (stamp-mSavedStamp));
|
||||||
|
}
|
||||||
|
catch(InterruptedException e){}
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshSystemMediaScanDataBase(getActivity(), files[position]);
|
||||||
|
refreshSystemMediaScanDataBase(getActivity(), to.getAbsolutePath());
|
||||||
|
|
||||||
ad.dismiss();
|
ad.dismiss();
|
||||||
resetNoTouchTimer(true);
|
resetNoTouchTimer(true);
|
||||||
}
|
}
|
||||||
@@ -2245,6 +2261,7 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
|||||||
case DialogInterface.BUTTON_POSITIVE:
|
case DialogInterface.BUTTON_POSITIVE:
|
||||||
Log.e(TAG, String.format("Yes delete %s!", files[position]));
|
Log.e(TAG, String.format("Yes delete %s!", files[position]));
|
||||||
(new File(mWorkingDirectory+files[position])).delete();
|
(new File(mWorkingDirectory+files[position])).delete();
|
||||||
|
refreshSystemMediaScanDataBase(getActivity(), mWorkingDirectory+files[position]);
|
||||||
ad.dismiss();
|
ad.dismiss();
|
||||||
resetNoTouchTimer(true);
|
resetNoTouchTimer(true);
|
||||||
break;
|
break;
|
||||||
@@ -2461,6 +2478,18 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
|||||||
exportThread.start();
|
exportThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param context : it is the reference where this method get called
|
||||||
|
@param docPath : absolute path of file for which broadcast will be send to refresh media database
|
||||||
|
@see https://stackoverflow.com/a/36051318/6163336
|
||||||
|
**/
|
||||||
|
public static void refreshSystemMediaScanDataBase(Context context, String docPath){
|
||||||
|
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
||||||
|
Uri contentUri = Uri.fromFile(new File(docPath));
|
||||||
|
mediaScanIntent.setData(contentUri);
|
||||||
|
context.sendBroadcast(mediaScanIntent);
|
||||||
|
}
|
||||||
|
|
||||||
private void saveDatabase(String fileName)
|
private void saveDatabase(String fileName)
|
||||||
{
|
{
|
||||||
final String newDatabasePath = mWorkingDirectory + fileName + ".db";
|
final String newDatabasePath = mWorkingDirectory + fileName + ".db";
|
||||||
@@ -2489,6 +2518,8 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
refreshSystemMediaScanDataBase(getActivity(), newDatabasePath);
|
||||||
|
mSavedStamp = System.currentTimeMillis();
|
||||||
msg = String.format("Database saved to \"%s\".", newDatabasePathHuman);
|
msg = String.format("Database saved to \"%s\".", newDatabasePathHuman);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user