diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a3c70b47e..6d93681ba 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -437,10 +437,9 @@
android:excludeFromRecents="true"/>
directory_listing = new ArrayAdapter(DataManagementActivity.this, android.R.layout.simple_list_item_1, export_path.list());
+
+ builder.setSingleChoiceItems(directory_listing, 0, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ }
+ });
+
+ AlertDialog dialog = builder.create();
+ dialog.show();
+
+ }
+ });
+
int oldDBVisibility = hasOldActivityDatabase() ? View.VISIBLE : View.GONE;
TextView deleteOldActivityTitle = findViewById(R.id.mergeOldActivityDataTitle);
@@ -140,6 +174,9 @@ public class DbManagementActivity extends AbstractGBActivity {
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
}
+ private void showDirectoryContent() {
+ }
+
//would rather re-use method of SettingsActivity... but lifecycle...
private String getAutoExportLocationSummary() {
String autoExportLocation = GBApplication.getPrefs().getString(GBPrefs.AUTO_EXPORT_LOCATION, null);
@@ -213,7 +250,7 @@ public class DbManagementActivity extends AbstractGBActivity {
File myFile = new File(myPath, "Export_preference");
ImportExportSharedPreferences.importFromFile(sharedPrefs, myFile);
} catch (Exception ex) {
- GB.toast(DbManagementActivity.this, getString(R.string.dbmanagementactivity_error_importing_db, ex.getMessage()), Toast.LENGTH_LONG, GB.ERROR, ex);
+ GB.toast(DataManagementActivity.this, getString(R.string.dbmanagementactivity_error_importing_db, ex.getMessage()), Toast.LENGTH_LONG, GB.ERROR, ex);
}
try (DBHandler lockHandler = GBApplication.acquireDB()) {
@@ -236,15 +273,30 @@ public class DbManagementActivity extends AbstractGBActivity {
}
private void exportDB() {
- try (DBHandler dbHandler = GBApplication.acquireDB()) {
- exportShared();
- DBHelper helper = new DBHelper(this);
- File dir = FileUtils.getExternalFilesDir();
- File destFile = helper.exportDB(dbHandler, dir);
- GB.toast(this, getString(R.string.dbmanagementactivity_exported_to, destFile.getAbsolutePath()), Toast.LENGTH_LONG, GB.INFO);
- } catch (Exception ex) {
- GB.toast(this, getString(R.string.dbmanagementactivity_error_exporting_db, ex.getMessage()), Toast.LENGTH_LONG, GB.ERROR, ex);
- }
+ new AlertDialog.Builder(this)
+ .setCancelable(true)
+ .setTitle(R.string.dbmanagementactivity_export_data_title)
+ .setMessage(R.string.dbmanagementactivity_export_confirmation)
+ .setPositiveButton(R.string.activity_DB_ExportButton, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ try (DBHandler dbHandler = GBApplication.acquireDB()) {
+ exportShared();
+ DBHelper helper = new DBHelper(DataManagementActivity.this);
+ File dir = FileUtils.getExternalFilesDir();
+ File destFile = helper.exportDB(dbHandler, dir);
+ GB.toast(DataManagementActivity.this, getString(R.string.dbmanagementactivity_exported_to, destFile.getAbsolutePath()), Toast.LENGTH_LONG, GB.INFO);
+ } catch (Exception ex) {
+ GB.toast(DataManagementActivity.this, getString(R.string.dbmanagementactivity_error_exporting_db, ex.getMessage()), Toast.LENGTH_LONG, GB.ERROR, ex);
+ }
+ }
+ })
+ .setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ }
+ })
+ .show();
}
private void importDB() {
@@ -256,15 +308,15 @@ public class DbManagementActivity extends AbstractGBActivity {
@Override
public void onClick(DialogInterface dialog, int which) {
try (DBHandler dbHandler = GBApplication.acquireDB()) {
- DBHelper helper = new DBHelper(DbManagementActivity.this);
+ DBHelper helper = new DBHelper(DataManagementActivity.this);
File dir = FileUtils.getExternalFilesDir();
SQLiteOpenHelper sqLiteOpenHelper = dbHandler.getHelper();
File sourceFile = new File(dir, sqLiteOpenHelper.getDatabaseName());
helper.importDB(dbHandler, sourceFile);
helper.validateDB(sqLiteOpenHelper);
- GB.toast(DbManagementActivity.this, getString(R.string.dbmanagementactivity_import_successful), Toast.LENGTH_LONG, GB.INFO);
+ GB.toast(DataManagementActivity.this, getString(R.string.dbmanagementactivity_import_successful), Toast.LENGTH_LONG, GB.INFO);
} catch (Exception ex) {
- GB.toast(DbManagementActivity.this, getString(R.string.dbmanagementactivity_error_importing_db, ex.getMessage()), Toast.LENGTH_LONG, GB.ERROR, ex);
+ GB.toast(DataManagementActivity.this, getString(R.string.dbmanagementactivity_error_importing_db, ex.getMessage()), Toast.LENGTH_LONG, GB.ERROR, ex);
}
importShared();
}
@@ -285,10 +337,10 @@ public class DbManagementActivity extends AbstractGBActivity {
.setPositiveButton(R.string.Delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- if (GBApplication.deleteActivityDatabase(DbManagementActivity.this)) {
- GB.toast(DbManagementActivity.this, getString(R.string.dbmanagementactivity_database_successfully_deleted), Toast.LENGTH_SHORT, GB.INFO);
+ if (GBApplication.deleteActivityDatabase(DataManagementActivity.this)) {
+ GB.toast(DataManagementActivity.this, getString(R.string.dbmanagementactivity_database_successfully_deleted), Toast.LENGTH_SHORT, GB.INFO);
} else {
- GB.toast(DbManagementActivity.this, getString(R.string.dbmanagementactivity_db_deletion_failed), Toast.LENGTH_SHORT, GB.INFO);
+ GB.toast(DataManagementActivity.this, getString(R.string.dbmanagementactivity_db_deletion_failed), Toast.LENGTH_SHORT, GB.INFO);
}
}
})
@@ -307,10 +359,10 @@ public class DbManagementActivity extends AbstractGBActivity {
new AlertDialog.Builder(this).setPositiveButton(R.string.Delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- if (GBApplication.deleteOldActivityDatabase(DbManagementActivity.this)) {
- GB.toast(DbManagementActivity.this, getString(R.string.dbmanagementactivity_old_activity_db_successfully_deleted), Toast.LENGTH_SHORT, GB.INFO);
+ if (GBApplication.deleteOldActivityDatabase(DataManagementActivity.this)) {
+ GB.toast(DataManagementActivity.this, getString(R.string.dbmanagementactivity_old_activity_db_successfully_deleted), Toast.LENGTH_SHORT, GB.INFO);
} else {
- GB.toast(DbManagementActivity.this, getString(R.string.dbmanagementactivity_old_activity_db_deletion_failed), Toast.LENGTH_SHORT, GB.INFO);
+ GB.toast(DataManagementActivity.this, getString(R.string.dbmanagementactivity_old_activity_db_deletion_failed), Toast.LENGTH_SHORT, GB.INFO);
}
}
});
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SettingsActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SettingsActivity.java
index 0bd8199e9..6094e5974 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SettingsActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SettingsActivity.java
@@ -418,7 +418,7 @@ public class SettingsActivity extends AbstractSettingsActivity {
/*
Either returns the file path of the selected document, or the display name, or an empty string
*/
- private String getAutoExportLocationSummary() {
+ public String getAutoExportLocationSummary() {
String autoExportLocation = GBApplication.getPrefs().getString(GBPrefs.AUTO_EXPORT_LOCATION, null);
if (autoExportLocation == null) {
return "";
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/WidgetConfigurationActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/WidgetConfigurationActivity.java
index 942dc9154..16d54f384 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/WidgetConfigurationActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/WidgetConfigurationActivity.java
@@ -19,6 +19,7 @@ import java.util.List;
import java.util.Map;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
+import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.Widget;
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
@@ -58,7 +59,7 @@ public class WidgetConfigurationActivity extends Activity {
}
AlertDialog.Builder builder = new AlertDialog.Builder(WidgetConfigurationActivity.this);
- builder.setTitle("Select device");
+ builder.setTitle(R.string.widget_settings_select_device_title);
allDevices = getAllDevices(getApplicationContext());
diff --git a/app/src/main/res/layout/activity_db_management.xml b/app/src/main/res/layout/activity_data_management.xml
similarity index 70%
rename from app/src/main/res/layout/activity_db_management.xml
rename to app/src/main/res/layout/activity_data_management.xml
index 67ffddee2..260360b44 100644
--- a/app/src/main/res/layout/activity_db_management.xml
+++ b/app/src/main/res/layout/activity_data_management.xml
@@ -10,30 +10,27 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
-
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingBottom="@dimen/activity_vertical_margin">
+
-
+ android:textColor="@color/accent"/>
-
+
+
+
+
+
+
+ android:id="@+id/showContentDataButton"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/activity_DB_ShowContentButton" />
-
+
diff --git a/app/src/main/res/menu/activity_controlcenterv2_main_drawer.xml b/app/src/main/res/menu/activity_controlcenterv2_main_drawer.xml
index 6c3ba2af3..768d5120f 100644
--- a/app/src/main/res/menu/activity_controlcenterv2_main_drawer.xml
+++ b/app/src/main/res/menu/activity_controlcenterv2_main_drawer.xml
@@ -10,7 +10,7 @@
-
- Daily target: active time in minutes
Store raw record in the database
Stores the data \"as is\", increasing the database usage to allow for later interpretation.
- Database management
- Database management
- The database operations use the following path on your device. \nThis path is accessible to other Android apps and your computer. \nExpect to find your exported database (or place the database you want to import) there:
+ Data management
+ Data management
+ The export/import operations use the following path to a directory on your device. This directory is accessible to other Android apps and your computer. The data includes:\n Export_preference - global settings\n Export_preference_MAC - device specific settings\n Gadgetbridge - device and activity database\n Gadgetbridge_date - database exported on a date\n *.gpx - GPS recordings\n *.log - log files\nExpect to find your exported files (or place the files you want to import) there:
Legacy database delete
Cannot access export path. Please contact the developers.
Exported to: %1$s
"Error exporting DB: %1$s"
"Error exporting preference: %1$s"
Import Data?
- Really overwrite the current database? All your current activity data (if any) will be lost.
+ ExportData?
+ Really overwrite the current data? All your current activity data (if any) and preferences will be overwritten.
+ Really export data? Previously exported activity data (if any) and preferences will be overwritten.
Imported.
"Error importing DB: %1$s"
"Error importing preference: %1$s"
@@ -677,12 +679,12 @@
Overwrite
Database autoexport location has been set to:
AutoExport
- Export DB
- Import DB
+ Export Data
+ Import Data
Run AutoExport Now
Exporting database…
Delete old DB
- Empty DB
+ Empty Database
Empty Database
Export and Import
Warning! By pushing this button you will wipe your database and start from scratch.
@@ -898,6 +900,7 @@
Save Configuration
Not connected, alarm not set.
+ Select device
Zzz
Add widget
Setting alarm for %1$02d:%2$02d
@@ -1104,4 +1107,6 @@
Operating Sounds
Fake continuous ringing
Automatically remove SMS notifications
+ Export/Import directory content
+ Show Export/Import directory content