-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add: Remove button for deck picker background image #16091
base: main
Are you sure you want to change the base?
Add: Remove button for deck picker background image #16091
Conversation
This class helps to bind the layout for deck picker background
Implement the interface and the functions to handle image select and image remove functionalities
42ba730
to
929922d
Compare
I'd suggest best and simple way: |
@SanjaySargam I think the problem with this approach would be replacing the image. If there is already a bg image and user decides to change to new image, first they have to remove the prior image and then they would get the option to "Select image", which I think is an extra unnecessary step from user's pov. |
<PreferenceCategory android:title="@string/background_image_title" > | ||
<Preference | ||
<PreferenceCategory android:title="@string/background_image_title" | ||
app:allowDividerBelow="false"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you set this to false? Is there any specific reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After adding a custom layout for preferences, there was a divider below the title, and setting this to false
removes that divider. So there is only one divider after that preference category.
fun onImageRemoveClicked() | ||
} | ||
|
||
class PreferenceSelectBackgroundImage @JvmOverloads constructor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me. Can you move this to SettingsFragment
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krmanik I tried moving this to SettingsFragment
and encountered some issues.
So basically I had to update the reference in xml as follows :
<PreferenceCategory android:title="@string/background_image_title"
app:allowDividerBelow="false">
<view class="com.ichi2.anki.preferences.SettingsFragment$PreferenceSelectBackgroundImage"
android:defaultValue="0"
android:key="@string/pref_deck_picker_background_key"
android:shouldDisableView="true"/>
</PreferenceCategory>
which gives an error:
ACRA caught a InflateException for com.ichi2.anki.debug
android.view.InflateException: Binary XML file line #62: Error inflating class (not found)view
and on further searching I found:
https://stackoverflow.com/a/2100111/9062752
where it is mentioned in the comments -
" The only way round this I've found is to promote the static nested class to a full-blown class in its own file, which isn't ideal."
Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically |
Purpose / Description
Add: Remove button for deck picker background image
Fixes
Approach
Created a custom preference for adding the option to remove the image along with selecting the image.
Before
WhatsApp.Video.2024-04-04.at.11.53.17.AM.mp4
After
WhatsApp.Video.2024-04-04.at.11.53.25.AM.mp4
How Has This Been Tested?
Tested on:
Physical device - Pixel 6A (Android 13)
Emulator - Pixel 3a (Android 14)
Checklist
Please, go through these checks before submitting the PR.