-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
#13282: Fixes Android Studio Warnings under Kotlin Header #15704
Conversation
First PR! 🚀 We sincerely appreciate that you have taken the time to propose a change to AnkiDroid! Please have patience with us as we are all volunteers - we will get to this as soon as possible. |
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.
Thanks!
AnkiDroid/src/main/java/com/ichi2/libanki/backend/model/NoteUtil.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/dialogs/DeckSelectionDialog.kt
Outdated
Show resolved
Hide resolved
public object FlashCardsContract { | ||
public const val AUTHORITY: String = BuildConfig.AUTHORITY | ||
public const val READ_WRITE_PERMISSION: String = BuildConfig.READ_WRITE_PERMISSION | ||
object FlashCardsContract { |
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.
all our API files should require public
due to explicitApi
object FlashCardsContract { | ||
const val AUTHORITY: String = BuildConfig.AUTHORITY | ||
const val READ_WRITE_PERMISSION: String = BuildConfig.READ_WRITE_PERMISSION | ||
public object FlashCardsContract { |
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.
Thanks!
all the files in api
should be reverted
Thank you for your feedback and suggestions. I've made the necessary changes as requested. Please take another look when you have a chance. |
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.
Thanks! Last one I think
@@ -339,7 +346,7 @@ open class AnkiActivity : AppCompatActivity, SimpleMessageDialogListener { | |||
.setToolbarColor(toolbarColor) | |||
.setNavigationBarColor(navBarColor) | |||
.build() | |||
val builder = CustomTabsIntent.Builder(customTabActivityHelper.session) | |||
val builder = Builder(customTabActivityHelper.session) |
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.
This shouldn't be imported as we lose context for the containing type
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.
Would you recommend reverting the change or is there a preferred approach for handling this? @david-allison
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.
revert the change, remove the import if possible
@@ -189,7 +189,7 @@ public object FlashCardsContract { | |||
* -------------------------------------------------------------------------------------------------------------------- | |||
* ``` | |||
*/ | |||
public object Note { | |||
object Note { |
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.
changes to this class need reverting
@@ -24,7 +24,7 @@ import java.util.* | |||
* Representation of the contents of a note in AnkiDroid. | |||
*/ | |||
@Suppress("unused") | |||
public class NoteInfo { | |||
class NoteInfo { |
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.
changes to this class need reverting
Code Quality failing. try running |
Hi @neeldoshii thanks ,I think this happen because I commit (try to solve merge conflict in one of the import) directly from the github , Right now i am travelling ,there is few review(comments) i have to revert ,I will soon make a new PR 👍 |
Hi @awanishyadav967, we prefer rebase + force-push rather than making new PRs, we want to keep the code review history in one place No rush, and enjoy your travels! |
Thanks, @david-allison, for the input! I'll use rebase + force-push to maintain the code review history in one place. Appreciate the guidance, and I'll take care of it. |
Test cases failing.
|
Just to note: you can reproduce the local failures by rebasing onto
|
the fields need to be passed for the card to be previewed, but they weren't built in IO so they couldn't have their values taken
* Keep the widgets disabled until the application has storage access
If a screen is backgrounded, `requireActivity()` throws `IllegalStateException("Fragment " + this + " not attached to an activity.")` The request which caused this was `/_anki/congratsInfo` which occurred every minute This was returned to the screen and caused a messagebox to appear And one messagebox per minute eventually exceeded the system window limit Causing issue 15659: a crash with "window count is over max!!" To fix this, allow a null activity Fixes 15679
The current implementation using messages and handlers for async dialogs means that if the user tries to import before actually starting the app the import dialog ends up being shown in the introduction screen ending up in a crash. These changes prevent that by checking for this scenario and notifying the user that he must start the app at least once before any import can be done. The hasShownAppIntro() was moved to better structure the code(it's related to the introduction screen) and for ease of access in the screens that use it.
* Fix : Multiple instance of dialog shown * Simplified the layout, increased padding and touch target * Increased the top and bottom padding * Fix : My search uses divider and fixed padding
…t file" This reverts commit f5d1017.
Hi @neeldoshii ,The local test cases passed, but they're failing in CI. Any suggestions or insights into possible reasons for the this? |
Hi @awanishyadav967, you haven't done rebase properly see Coming to your point, #15709 we have added an explictAPi() method which make sure's all the API calls are set to public. Also you have conflicts in your PR now so you need to fix the conflicts too 😔. |
Hi @awanishyadav967, I noticed you closed the PR do you need any help? |
Hi @neeldoshii I think I created a mess here, I just want to create new pr ,I tried rebasing and reverting my changes but it does worked for me . |
Hi @david-allison @neeldoshii, |
Description
I addressed the issue #13282 by fixing Android Studio warnings under Kotlin ->redundant constructs header (The list of warnings can be obtained via: Code -> Inspect Code). The changes include removing redundant constructs such as unused imports and redundant quantifier names.
Fixes
Approach
I reviewed the code and identified areas with Android Studio warnings. I removed unnecessary constructs to improve code readability and maintainability.
How Has This Been Tested?
I tested these changes on Level 30 (Android 11).
Before
After
Checklist