mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 01:55:50 +01:00
Add test button, @stringify strings, add headers
This commit is contained in:
parent
4780c26dd8
commit
503fe854eb
@ -19,6 +19,7 @@ package nodomain.freeyourgadget.gadgetbridge.activities;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.os.Bundle;
|
||||
@ -42,10 +43,13 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.PeriodicExporter;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GBPrefs;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.ImportExportSharedPreferences;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||
|
||||
|
||||
public class DbManagementActivity extends AbstractGBActivity {
|
||||
@ -97,6 +101,32 @@ public class DbManagementActivity extends AbstractGBActivity {
|
||||
}
|
||||
});
|
||||
|
||||
Prefs prefs = GBApplication.getPrefs();
|
||||
boolean autoExportEnabled = prefs.getBoolean(GBPrefs.AUTO_EXPORT_ENABLED, false);
|
||||
Integer autoExportInterval = prefs.getInt(GBPrefs.AUTO_EXPORT_INTERVAL, 0);
|
||||
String autoExportLocation = prefs.getString(GBPrefs.AUTO_EXPORT_LOCATION, "");
|
||||
|
||||
int testExportVisibility = (autoExportInterval > 0 && autoExportEnabled) ? View.VISIBLE : View.GONE;
|
||||
|
||||
TextView autoExportLocation_label = findViewById(R.id.autoExportLocation_label);
|
||||
autoExportLocation_label.setVisibility(testExportVisibility);
|
||||
|
||||
TextView autoExportLocation_intro = findViewById(R.id.autoExportLocation_intro);
|
||||
autoExportLocation_intro.setVisibility(testExportVisibility);
|
||||
|
||||
TextView autoExportLocationview = findViewById(R.id.autoExportLocationview);
|
||||
autoExportLocationview.setVisibility(testExportVisibility);
|
||||
autoExportLocationview.setText(autoExportLocation);
|
||||
|
||||
Button testExportDBButton = findViewById(R.id.testExportDBButton);
|
||||
testExportDBButton.setVisibility(testExportVisibility);
|
||||
testExportDBButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
sendBroadcast(new Intent(getApplicationContext(), PeriodicExporter.class));
|
||||
}
|
||||
});
|
||||
|
||||
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:grid="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -9,8 +10,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.gridlayout.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:grid="http://schemas.android.com/apk/res-auto"
|
||||
<androidx.gridlayout.widget.GridLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
@ -20,17 +20,27 @@
|
||||
grid:alignmentMode="alignBounds"
|
||||
grid:columnCount="2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/exportImportLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_db_management_exportimport_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/accent"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_columnWeight="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/exportDBButton"
|
||||
android:text="Export DB"
|
||||
android:text="@string/activity_DB_ExportButton"
|
||||
grid:layout_column="0"
|
||||
grid:layout_gravity="center" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/importDBButton"
|
||||
android:text="Import DB"
|
||||
grid:layout_gravity="center"
|
||||
grid:layout_column="1" />
|
||||
android:text="@string/activity_DB_import_button"
|
||||
grid:layout_column="1"
|
||||
grid:layout_gravity="center" />
|
||||
|
||||
|
||||
<TextView
|
||||
@ -51,11 +61,47 @@
|
||||
grid:layout_columnWeight="1" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/autoExportLocation_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/activity_db_management_autoexport_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/accent"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_columnWeight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/autoExportLocation_intro"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_db_management_autoexport_explanation"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_columnWeight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/autoExportLocationview"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_columnWeight="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/testExportDBButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_DB_test_export_button"
|
||||
grid:layout_column="0"
|
||||
grid:layout_gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mergeOldActivityDataTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/activity_db_management_merge_old_title"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/accent"
|
||||
@ -68,14 +114,24 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Delete old DB" />
|
||||
android:text="@string/activity_DB_delete_legacy_button" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/emptyActivityDataTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/activity_db_management_empty_DB"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/accent"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_columnWeight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/emptyDBText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:text="Warning! By pushing this button you will wipe your database and start from scratch."
|
||||
android:text="@string/activity_db_management_empty_db_warning"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_columnWeight="1" />
|
||||
@ -84,7 +140,7 @@
|
||||
android:id="@+id/emptyDBButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Empty DB" />
|
||||
android:text="@string/activity_DB_empty_button" />
|
||||
|
||||
</androidx.gridlayout.widget.GridLayout>
|
||||
|
||||
|
@ -565,6 +565,17 @@
|
||||
<string name="dbmanagementactivity_old_activity_db_successfully_deleted">Old activity data deleted.</string>
|
||||
<string name="dbmanagementactivity_old_activity_db_deletion_failed">Old Activity database deletion failed.</string>
|
||||
<string name="dbmanagementactivity_overwrite">Overwrite</string>
|
||||
<string name="activity_db_management_autoexport_explanation">Database autoexport location has been set to:</string>
|
||||
<string name="activity_db_management_autoexport_label">AutoExport</string>
|
||||
<string name="activity_DB_ExportButton">Export DB</string>
|
||||
<string name="activity_DB_import_button">Import DB</string>
|
||||
<string name="activity_DB_test_export_button">Test AutoExport Now</string>
|
||||
<string name="activity_DB_delete_legacy_button">Delete old DB</string>
|
||||
<string name="activity_DB_empty_button">Empty DB</string>
|
||||
<string name="activity_db_management_empty_DB">Empty Database</string>
|
||||
<string name="activity_db_management_exportimport_label">Export and Import</string>
|
||||
<string name="activity_db_management_empty_db_warning">Warning! By pushing this button you will wipe your database and start from scratch.</string>
|
||||
|
||||
<string name="Cancel">Cancel</string>
|
||||
<string name="Delete">Delete</string>
|
||||
<string name="ok">OK</string>
|
||||
@ -730,5 +741,4 @@
|
||||
<string name="icon_placeholder" translatable="false">Icon</string>
|
||||
<string name="widget_alarm_target_hours">%d hours</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user