0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 20:03:05 +02:00
Commit Graph

16062 Commits

Author SHA1 Message Date
Brayan Oliveira
8ebc1ac25f Embed the preferences search bar on the toolbar
So the user can search preferences from any screen

Changes' description:
- Move the search bar configuration from HeaderFragment.kt to the preferences activity
   - a change made to it was disabling the search history, as it was poor
- Remove the previous SearchPreference bar
- Embed the searchBar by creating a new menu (preferences.xml) and a new SearchView (PreferencesSearchView)
2022-08-15 14:54:36 +03:00
Brayan Oliveira
a08496e826 Test if getFragmentFromXmlRes() lead to the correct fragments
And add a utility method to access private/protected java fields with reflection
2022-08-15 14:54:36 +03:00
Brayan Oliveira
4ddc356a69 Add a search bar to the settings screen
It's necessary for all "PreferenceScreen" to have keys, so they are being added to the screens which hadn't a key

search:ignore is an attribute that allows to skip a preference indexing on a XML file. It is added to subscreens' preferences to avoid duplication of the results of the screens themselves and the preferences that open them

Added as well to "Day" and "Night" preferences to avoid duplication of their entries and "Theme" preference's entries
2022-08-15 14:54:36 +03:00
Brayan Oliveira
ab5bfc3ef4 Move addAllControlPreferencesToCategory to ControlPreference.kt
The method should be a responsibility of the screen's class, not of the individual preference's class
2022-08-15 14:54:36 +03:00
Brayan Oliveira
2201b53f2a Rename AdaptionUtil.isRestrictedLearningDevice
And add a javadoc to explain what it does.

Currently it is only used to hide some preferences which aren't usable on "Xiaomi AI teacher" devices.
2022-08-15 14:54:36 +03:00
AnkiDroid Translations
8a1ef83ed8 Updated strings from Crowdin 2022-08-14 20:01:06 -05:00
Mike Hardy
f830827f06 test: LeakCanary channels are auto-created / okay to have 2022-08-14 07:49:33 -05:00
Arthur Milchior
2e82380e2e NF: uses NoteId instead of Long
It's used upstream. It was defined in notes.py, but since Notes.java may not get
converted, consts is the most relevant place to put it.

Those ones were found by searching for "nodeId: Long", "NoteId: Long" and "nid:
Long".
2022-08-14 13:43:31 +01:00
Arthur Milchior
886773c691 refactor: Convert DB to Kotlin
com.ichi2.libanki.DB
2022-08-14 13:39:54 +01:00
Arthur Milchior
2cdeca6d0b refactor: Rename DB.java to .kt
com.ichi2.libanki.DB
2022-08-14 13:39:54 +01:00
Brayan Oliveira
3f946efe18 NF: refactor androidX custom preferences
- rename "formattedSummary" to "summaryFormat"
- simplify SeekBarPreferenceCompat and NumberRangePreferenceCompat constructors and declare styleable attributes for "useSimpleSummaryProvider" and "summaryFormat" so they can be previewed on Android Studio's layout viewer
2022-08-14 08:22:44 +03:00
Brayan Oliveira
3b6b2106a5 Move preferences headers' summary configuration to the XMLs
with the bonus that now the summaries can be previewed on Android Studio layout viewer

note: buildCategorySummary was renamed to buildHeaderSummary
2022-08-14 08:22:44 +03:00
Arthur Milchior
e701342531 NF: export without scheduling: remove all system tags
This is obviously what was expected to be done. Instead of removing the tags
from the same note over and over again.
2022-08-13 15:51:26 +01:00
Arthur Milchior
df5917f483 NF: converting Long to DeckId
Those one were found with searcing for "eckId: Long"
2022-08-13 15:46:18 +01:00
Brayan Oliveira
aa8df7c032 Make possible to commit hunks again on Kotlin
Replaced the old runKtlint() code with the one generated by `./gradlew addKtlintFormatGitPreCommitHook`

for reference, see https://github.com/JLLeitschuh/ktlint-gradle#additional-helper-tasks, and for the implementation, https://github.com/JLLeitschuh/ktlint-gradle/blob/master/plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/GitHook.kt
2022-08-13 15:45:00 +01:00
Arthur Milchior
71072fbb94 NF: replace or remove is 2022-08-13 11:26:46 +01:00
Arthur Milchior
0549a18716 NF: Card's data move to lateinit 2022-08-13 11:12:30 +01:00
Arthur Milchior
f554994f7f NF: remove unused import
This will ensure linter works again
2022-08-12 20:52:00 -05:00
dorrin-sot
f1bc5ca1b4 onOptionsItemSelected action_list_my_searches savedFilters cleanup 2022-08-12 23:18:17 +02:00
dorrin-sot
4aad6192b4 lastDeckId cleanup 2022-08-12 23:18:17 +02:00
dorrin-sot
a02ad3d711 onCollectionLoaded mOrder cleanup 2022-08-12 23:18:17 +02:00
dorrin-sot
0b6becba80 selectedCardIds for cleanup 2022-08-12 23:18:17 +02:00
Brayan Oliveira
951e5e5f56 Remove "setFormattedSummary" methods
It's best to keep the summary configuration only in the XMLs as much as possible
2022-08-12 14:47:25 +03:00
Brayan Oliveira
c5ddb35abc Migrate "Reviewing" summaries configuration to the XML 2022-08-12 14:47:25 +03:00
Brayan Oliveira
6a06f49941 Migrate "Advanced Statistics" summaries configuration to the XML
and use simple summary value on "Compute first n days, simulate remainder"
2022-08-12 14:47:25 +03:00
Brayan Oliveira
98f4299f2f Migrate "Accessibility" summaries configuration to the XML 2022-08-12 14:47:25 +03:00
Brayan Oliveira
55eeafa39f Make possible to set preferences formatted preferences on the XMLs 2022-08-12 14:47:25 +03:00
Brayan Oliveira
1f2c6e1b6a NF: Exchange .beginTransaction for .commit
It automatically commits on the end of the code block, similar to what `.edit{}` does with sharedPreferences
2022-08-12 11:10:07 +03:00
Mike Hardy
75293efc0c Bumped version to 2.16alpha77 2022-08-11 19:08:26 +00:00
AnkiDroid Translations
6b7d7e1696 Updated strings from Crowdin 2022-08-11 14:06:07 -05:00
Brayan Oliveira
1c87ec046c
[GSoC] Add Use new backend (persistent) preference (#11977)
* Add `Use the new backend` (persistent) preference
And remove the old temporary "Use V16 backend" preference
* Add a stronger warning before changing to the new backend
2022-08-11 11:45:18 -05:00
AnkiDroid Translations
7283426dec Updated strings from Crowdin 2022-08-11 11:44:25 -05:00
Raymond Zeng
f83ce04675
[Kotlin Cleanup] LaTeX (#11980)
* Cleanup of LaTeX.kt

* Modified tests to use string literals, new hashes, functions to public

* Renamed functions to be more accurate, params/output to String, comment style
2022-08-10 12:12:40 +03:00
Advitiay Anand
3752358577 Replace use of String.format with a template expression 2022-08-10 09:16:00 +03:00
Brayan Oliveira
bd2996a02d NF: Remove StringUtil.strip()
Useless now that Kotlin's .trim() can be used
2022-08-09 19:39:54 +03:00
lukstbit
2de8bf54f8 Move the main testutils package to the unit test source set 2022-08-09 11:19:48 +01:00
oyeraghib
2958df96e6 Migrate [ActivityList] to Kotlin 2022-08-08 10:22:08 +03:00
oyeraghib
90c40303fa Rename .java to .kt 2022-08-08 10:22:08 +03:00
Arthur Milchior
1fa8cde108
View animation (#11961)
* NF: Slide in as enum

* NF: factorize setInterpolator in viewAnimationSlide

* NF: Fade as enum

* NF: fade as expression

* NF: factorize translateAnimation
2022-08-08 08:39:22 +03:00
Brayan Oliveira
afbbfd2357
[GSoC] Reorganize some preferences + refactors (#11934)
* Move HTML/Js debug to DevOptions

* Move `Card browser` and `Anki card` context menu to General

note that I changed their order: now, Anki card comes first and Card browser comes second
reason: Anki Card is enabled by default, so it's better to be seen first

* Move `Card browser font scaling` to Accessibility

To keep it together with the other "UI size" settings

* Removed check on GeneralSettingsFragment

If user had a restricted learning device, the app would crash as the preferences with keys of "widgetBlink" and "widgetVibrate" are not on the General category anymore.

These preferences were moved to NotificationsSettingsFragment on d302bcf and are handled there.

* Move `Press back twice to go back/exit` to General

* Remove `Upgrade to V2 scheduler` preference

142f789a7b forces requires/prompts to use the V2 scheduler when the user tries to study, so this preference is no longer necessary

* Remove `Perfomance` subcategory on Advanced

It had only `Backups` under it

* Reorganize `General` settings

New structure:
- Language
- Error reporting mode
- Share feature usage
- Paste Images as PNG
# Studying
- Deck for new cards
- Press back twice to leave
# System-wide
- Anki Card Menu
- Card Browser Menu

* Improve preferences_general.xml preview on Android Studio

Add preview title and summary for "Anki Card Menu" and "Card Browser Menu"

* Simplify `buildCategorySummary` calls

Add a helper method that converts the resIds to strings to reduce boilerplate

* Build `General`, `Appearance` and `Advanced` summaries programatically

And remove the old summary strings, as they aren't necessary anymore

* Extract `SettingsFragment.requirePreference()` to `PreferencesFragmentCompat.requirePreference()`

Utility method that was previously defined only on `SettingsFragment`. Now it can include other classes that inherit from `PreferencesFragmentCompat` as well, e.g. `HeaderFragment`.

As `SettingsFragment` inherits from `PreferencesFragmentCompat` too, its functionality isn't changed

* NF: Remove unchecked cast warning on `requirePreference`

Done by reifying the type and inlining the function

* Replace findPreference with requirePreference on HeaderFragment

* cleanup on HeaderFragment.kt

- simplify Advanced category configuration
- uniformize comments

* Add a comment specifying that dev options strings may not be translated

* Create a `Statistics` subcategory on Advanced preferences

Contains "Advanced statistics" and "Default deck when opening statistics"

And add "Statistics" to the Advanced category summary

* Move preferences not related to plugins out of the plugins subcategory

Moved preferences: "Text to speech", "Reset languages", "Chess notation support", "Double scrolling" and "eReader"

removeUnnecessaryAdvancedPrefs() had to be adapted, as "Double scrolling" and "eReader" aren't on the "Plugins" category anymore
2022-08-07 17:45:36 +02:00
dorrin-sot
a4f553c5d3 made comment javadoc
Co-authored-by: Brayan Oliveira <69634269+BrayanDSO@users.noreply.github.com>
2022-08-07 12:32:09 +03:00
dorrin-sot
dde749b70c Fix DeckPicker#searchDecksIcon flash 2022-08-07 12:32:09 +03:00
Bennett
b7a104b3ed use when in navigationdraweractivity.kt 2022-08-07 11:47:16 +03:00
Arthur Milchior
f5254a82e5 NF: ensure replacements of preempted operations are done first 2022-08-07 02:14:32 +05:30
gradle-update-robot
bbeaf6dc92 Update Gradle Wrapper from 7.5 to 7.5.1.
Signed-off-by: gradle-update-robot <gradle-update-robot@regolo.cc>
2022-08-05 19:15:45 -05:00
Arthur Milchior
e1cc3a1cf3 NF: Ensure searchTerm is non null
I believe it could improve #11469 to have this done first
2022-08-05 18:02:45 +03:00
Arthur Milchior
16b108e1e0 Add a comment stating not to rename/remove credits
Indeed, it will be hard linked in #11803 and changing the name would break the link
2022-08-04 13:13:40 +03:00
Arthur Milchior
a85ff162de NF: make currentSearchTerm local 2022-08-04 01:15:31 +01:00
Arthur Milchior
d38434ce70 NF: Create typealias DeckId
Upstream, it is created in Decks. However, `Decks` is still in java and may
never been ported to Kotlin, so Const seems a good compromise for it.
2022-08-04 01:14:28 +01:00
Arthur Milchior
598153bb5b NF: uses Apply on mLatestInstance
This deal with null check and ensure we use the same instance during the whole
process.
2022-08-01 18:02:50 -05:00