Skip to content

Commit

Permalink
Implemention of Deck Picker Widget !Add Deck Picker Widget to display…
Browse files Browse the repository at this point in the history
… deck statistics

This commit introduces the Deck Picker Widget, which displays a list of decks along with the number of cards that are new, in learning, and due for review. It is a display-only widget.

Features:
- Displays deck names and statistics (new, learning, and review counts).
- Updates every minute using a recurring alarm.
- Retrieves selected decks from shared preferences.
- Handles widget updates and deletions appropriately.
- Can be reconfigured by holding the widget.

Note:
-The reviewer need to switch enabled to true in order to test the
widget, also which can be accomplished by removing the
android:enabled="false".

This widget provides users with a quick overview of their decks without needing to open the app.
  • Loading branch information
xenonnn4w committed Aug 14, 2024
1 parent de309bb commit 972f83d
Show file tree
Hide file tree
Showing 16 changed files with 1,623 additions and 1 deletion.
26 changes: 26 additions & 0 deletions AnkiDroid/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,32 @@
/>
</receiver>

<!-- A widget that displays a few decks's name and number of cards to review on the Android home screen.
The way to add it depends on the phone. It usually consists in a long press on the screen, followed by finding a "widget" button"-->
<receiver
android:name="com.ichi2.widget.DeckPickerWidget"
android:exported="false"
android:enabled="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>

<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_provider_deck_picker" />
</receiver>

<!-- Configuration view for the DeckPickerWidget above.
It is opened when adding a new deck picker widget and
by configuration button which appears when the widget is hold or resized.-->
<activity
android:name="com.ichi2.widget.DeckPickerWidgetConfig"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>

<receiver android:name="com.ichi2.widget.WidgetPermissionReceiver"
android:exported="true">
<intent-filter>
Expand Down
397 changes: 397 additions & 0 deletions AnkiDroid/src/main/java/com/ichi2/widget/DeckPickerWidget.kt

Large diffs are not rendered by default.

Loading

0 comments on commit 972f83d

Please sign in to comment.