-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Widget that opens a group #397
Comments
Can I try to work on it ? |
Yeah, sure! Go for it :) |
For this issue, do you want me to display a group of coupons on the main page instead of each separate coupon on the main page as it is now? |
The idea is that instead of creating a widget on your home screen that opens the chosen card, it open Catima's main screen with your chosen group. I think that is what you meant too, so yes :) |
any tips for this issues? :( |
Let's do things one step at a time. Step 1: Make sure you can find the widget to create a shortcut video_2021-09-21_23-51-52.mp4Step 2: Make a copy of CardShortcutConfigure.java to a logical name (something like GroupShortcutConfigure.java) Step 3: Copy the widget stuff in AndroidManifest.xml but change .CardShortcutConfigure.java to .GroupShortcutConfigure.java Step 4: Test if you now have 2 widgets Step 5: Modify GroupShortcutConfigure.java until you no longer have a list of cards, but a list of groups Step 6: Modify GroupShortcutConfigure.java to create an Intent pointing at MainActivity instead of LoyaltyCardViewActivity and put the group somewhere in the intent extra data (like CardShortcutConfigure creates one which puts the loyaltyCard id in the bundle, see https://github.com/TheLastProject/Catima/blob/fa33cdaca4397f22651f9b64bdba77a907d2f3df/app/src/main/java/protect/card_locker/ShortcutHelper.java#L122-L130) Step 7: Create an extractIntentFields on MainActivity like LoyaltyCardViewActivity has one: https://github.com/TheLastProject/Catima/blob/fa33cdaca4397f22651f9b64bdba77a907d2f3df/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java#L185-L190 and make it read however you named the field for the group name and display that group It sounds really big and complex like this, but for the most part it is standard Android widget handling, there is not really any Catima "secret sauce" over it (which, I admit, can be a bit confusing if you've never worked with Android widgets before, but basically, a widget just starts an activity with an intent, the same way launchers start apps or apps switch between screens). |
Thank you so much for your help. I will work on it |
Hey @theyup12, I haven't heard from you on this for a while. If you still want to work on this, please tell me. Otherwise I will free this up for someone else to work on. |
I'm currently trying to work on this :) |
As an id for the group should the group._id string be used or the hashCode? |
I would recommend using |
Ah yes your right, that's what I did anyway. But as these ids are just strings and I don't know if they are unique, my fear was to introduce conflicts ^^ Are group._id unique? What is the group._id of the "All" tab? |
Yeah, The "All" tab has no group ID, it's not a real group. Guess you could use like null or something for all |
Ok because I was wondering what to put here:
|
I managed to progress pretty far, but I have a bug now: when I have the app opened on the All tab, then leave the app open in the background and then tap on the widget, the all tab opens up instead of the group I chose. Do you have an idea of where in the code this error comes from? |
Please make a PR, mark it as "Draft" with the note of that issue and I will take a look at your code when I have time :) |
All right, I still need to make some tweaks, but will make the draft PR probably in a few hours :) |
I'm finally done with the work and it is now a real PR! |
A widget that opens the MainActivity with a specific group selected would be pretty awesome.
So, for example, I use Groups to make a group of "Coupons". I would like to be able to create a widget to not just open a specific card but open Catima with the Coupons group selected.
This would requiring adding an
extractIntentFields
to MainActivity (like LoyaltyCardViewActivity has) which supports entering a requested group and an extra Shortcut activity in the manifest: https://github.com/TheLastProject/Catima/blob/110b3bcef3aa5e63531c706934ef0674dd0d51cf/app/src/main/AndroidManifest.xml#L92-L100The text was updated successfully, but these errors were encountered: