Skip to content

Commit 058e9df

Browse files
feat: Add Import/Export and enhance UI for System Message Database
I've implemented a comprehensive set of new features and UI refinements for the system message database functionality based on your feedback. Key Changes: 1. **New Branch**: I've committed the work to a new branch named `db-import-export-v2`. 2. **"Database" Button (Main Screen)**: * I've added a thin black border to the button. 3. **First Pop-up (`DatabaseListPopup`) Refinements**: * **Layout**: I've adjusted the pop-up card styling to minimize the perceived border, aligning it with other dialogs. I've also added a fixed footer below the scrollable list. * **Row Count**: The pop-up now displays a fixed 15 rows in the scrollable list area. * **"New" Button**: I've moved the "New" button to the right side of its dedicated row. This row is dynamically positioned after the last data entry, or as the first row if the list is empty. It will shift if entries are deleted. * **Data Row Styling**: Titles in data rows are now styled to appear as rounded "buttons" with a black border, while retaining their alternating yellow background. * **Import/Export Footer**: * A fixed footer area now contains "Import" and "Export" buttons. * I've introduced a selection mode for export: * The "Export" button toggles selection mode (its text changes to "Share"). * A "Select All/None" checkbox appears in the footer. * Checkboxes appear on each data row for individual selection. * The "MoreVert" (delete) icon on rows is hidden during selection mode. 4. **Export Functionality**: * When you click "Share" (Export in selection mode): * Selected entries are serialized to a JSON string. * The JSON string is shared as a `.txt` file (e.g., "system_messages_export.txt") using the Android Share Intent and `FileProvider`. * This includes `FileProvider` setup in `AndroidManifest.xml` and `res/xml/file_paths.xml`. 5. **Import Functionality**: * The "Import" button launches the system file picker for you to select a text file (expected to be JSON). * The selected file is read and parsed as a list of system message entries. * For entries with titles that duplicate existing ones, a dialog prompts you to "Overwrite" the guide, "Skip" the specific entry, or "Skip All" further duplicates in the current import session. * New entries are added, and overwritten entries are updated. * The list refreshes after the import process. 6. **General**: * I've included error handling with Toast messages for file operations and parsing. * I've reviewed the code for logic and adherence to your requirements.
1 parent da910b1 commit 058e9df

4 files changed

Lines changed: 412 additions & 432 deletions

File tree

app/src/main/AndroidManifest.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@
5555
<!-- Added TrialTimerService declaration -->
5656
<service android:name=".TrialTimerService" />
5757

58+
<provider
59+
android:name="androidx.core.content.FileProvider"
60+
android:authorities="${applicationId}.provider"
61+
android:exported="false"
62+
android:grantUriPermissions="true">
63+
<meta-data
64+
android:name="android.support.FILE_PROVIDER_PATHS"
65+
android:resource="@xml/file_paths" />
66+
</provider>
5867
</application>
5968
</manifest>
6069

0 commit comments

Comments
 (0)