166 Commits
main ... beta

Author SHA1 Message Date
985c2fb730 Updates Android Gradle Plugin to 7.0.1. 2025-07-06 20:05:13 -07:00
0dc96a8c45 Removes unneeded logging. 2025-07-06 20:05:13 -07:00
10bca503e5 Adds support for virtual file urls. 2025-07-06 20:05:13 -07:00
1d335e9a37 Updates to build on arm macs. 2025-07-06 20:05:13 -07:00
fbf119fb8a Updates manifest to clear warnings and errors for targeting os 12. 2025-07-06 20:05:13 -07:00
3d6adaad2c Updates dependencies to latest versions. 2025-07-06 20:05:13 -07:00
c3a972571a Upgrades Android Gradle plugin to 7.0.0. 2025-07-06 20:05:13 -07:00
4e45a547f4 Moves gradle dependency versions out of variables. 2025-07-06 20:05:13 -07:00
792628d4a4 Adds proguard config. 2025-07-06 20:05:13 -07:00
b6b669a0db Disables release build minification and obfuscation. 2025-07-06 20:05:12 -07:00
540a0474da Disables minification of release builds. 2025-07-06 20:05:12 -07:00
49734d5eef Fixed release flipper stub.
Updates dependency versions.
2025-07-06 20:05:12 -07:00
b2c3728e9a Upgrades android gradle plugin to 4.2.2. 2025-07-06 20:05:12 -07:00
39cab7f799 Removes dead code and cleans up annotations Nullable/NonNull annotations. 2025-07-06 20:05:12 -07:00
Tom Hicks
1e007a3553 Makes dashboard views use dimension and string resources. 2025-07-06 20:05:12 -07:00
Tom Hicks
1a487f950d Adds functional dashboard based on recycler view that picks the number of columns based on screen width. 2025-07-06 20:05:12 -07:00
Tom Hicks
ea13e38402 Adds dashboard mockup. 2025-07-06 20:05:12 -07:00
Tom Hicks
8e2372085d Adds views for dashboard. 2025-07-06 20:05:10 -07:00
Tom Hicks
129d910126 Makes radio buttons suck less.
Styles the advantage picker and proficiency picker.
Makes the saving throws screen nicer.
2025-07-06 20:05:09 -07:00
Tom Hicks
1a23e5e35a Fixes missing descriptions on imported traits. 2025-07-06 20:05:09 -07:00
Tom Hicks
660cf633da Fixes lists to use similar sized items. 2025-07-06 20:05:09 -07:00
Tom Hicks
1e7a7c68aa Fixes screen titles. 2025-07-06 20:05:08 -07:00
Tom Hicks
070fda0989 Makes monster importing a fragment in the main activity.
Makes the edit action work when editing an imported monster.
2025-07-06 20:05:08 -07:00
Tom Hicks
af05c41b75 Adds import monster activity. 2025-07-06 20:05:08 -07:00
Tom Hicks
efa4c2a299 Refactors monster helper methods into a separate class. 2025-07-06 20:05:07 -07:00
Tom Hicks
2f5918b7a2 Adds other traits to the monster detail fragment.
Cleans up the monster detail fragment to work like the other fragments.
2025-07-06 20:05:07 -07:00
Tom Hicks
cb6f7122ed Refactors monster detail to use a view holder and partially corrects Regional Actions to Regional Effects. 2025-07-06 20:05:07 -07:00
Tom Hicks
7cfc6d4f65 Removes unused methods from EditMonsterViewModel. 2025-07-06 20:05:07 -07:00
Tom Hicks
cdae6a8b39 Adds OnMoveCallback to the SwipeToDeleteCallback class.
Makes traits orderable.
2025-07-06 20:05:07 -07:00
Tom Hicks
9d46d1420e Removes todo. 2025-07-06 20:05:07 -07:00
Tom Hicks
6d43b0635c View cleanup.
Makes more numeric fields Steppers.
Sets titles for fragments.
Sets focus on the first EditText on most edit pages.
Makes Checkbox be a SwitchCompat
Fixes monster list item view.
2025-07-06 20:05:07 -07:00
Tom Hicks
4c138ee499 Fix Stepper initial values. 2025-07-06 20:05:07 -07:00
Tom Hicks
0fcfa7e782 Adds ScrollViews to the editors that were missing them. 2025-07-06 20:05:07 -07:00
Tom Hicks
791cf4164c Fixes search.
It now works the same as iOS. It case insensitive matches the entire search text in any of name, size, type, subtype, or alignment.
2025-07-06 20:05:07 -07:00
Tom Hicks
fb12deaa3e Fixes removing languages. 2025-07-06 20:05:07 -07:00
Tom Hicks
6e597462ef Adds some TODOs. 2025-07-06 20:05:07 -07:00
Tom Hicks
12ffc5b15f Fixes the size of the edit languages header. 2025-07-06 20:05:07 -07:00
Tom Hicks
9c81bd4905 Fixes selection bug in AbilityScorePicker. 2025-07-06 20:05:07 -07:00
Tom Hicks
f1cbc60857 Renames EditTraitListFragment to EditTraitsFragment to match the other list fragments. 2025-07-06 20:05:07 -07:00
Tom Hicks
a2798ddc82 Replaces condition immunities, damage immunities, damage resistances, damage vulnerabilities, and senses with a unified list of strings editor. 2025-07-06 20:05:06 -07:00
Tom Hicks
ecf2b01723 Auto formatted all files. 2025-07-06 20:05:05 -07:00
Tom Hicks
18d6f2a31e Adds editing support for other traits using some shared fragments. 2025-07-06 20:05:05 -07:00
Tom Hicks
7cbcf8d07c Adds ability editor. 2025-07-06 20:05:04 -07:00
Tom Hicks
dc487d238a Fixes name of "Add Damage Type" string. 2025-07-06 20:05:03 -07:00
Tom Hicks
b8c702f665 Code style cleanup.
Replaces Fragment with MCFragment.
2025-07-06 20:05:03 -07:00
Tom Hicks
259b59f519 Adds equals override to Trait objects.
Fixes trait comparisons.
2025-07-06 20:05:03 -07:00
Tom Hicks
5289bac908 Adds ability to edit languages. 2025-07-06 20:05:03 -07:00
Tom Hicks
34e11d97e5 Makes use of class compareTo methods when sorting skills and languages.
Fixes dirty state of skills when modifying them.
2025-07-06 20:05:03 -07:00
Tom Hicks
ca6684a093 Replaces manual view != null assertions with requireView. 2025-07-06 20:05:03 -07:00
Tom Hicks
6e48a6f455 Adds equals override for Language objects.
Makes languages sort group by can speaks.
2025-07-06 20:05:03 -07:00
b8af70406f Add damage resistances and damage vulnerabilities to the monster editor. 2025-07-06 20:05:03 -07:00
7eae6f820e Adds damage resistances to monster editor. 2025-07-06 20:05:03 -07:00
2076d53b11 ViewModel refactoring. 2025-07-06 20:05:03 -07:00
e20602cc3d Adds editing of condition immunities. 2025-07-06 20:05:03 -07:00
04dc066191 Adds getters and setters to EditMonsterViewModel for Languages, Abilities, Actions, Reactions, Lair Actions, Legendary Actions, and Regional Actions. 2025-07-06 20:05:03 -07:00
72b3df429f Adds getters and setters for string array properties of EditMonsterViewModel. 2025-07-06 20:05:03 -07:00
8d94afeb55 Adds edit sense fragment. 2025-07-06 20:05:03 -07:00
8bae59ed29 Edit skill cleanup. 2025-07-06 20:05:03 -07:00
c401b7919e Adds Edit Senses fragment. 2025-07-06 20:05:03 -07:00
9983ba10cb Removes unused code from edit skills. 2025-07-06 20:05:03 -07:00
171bc7436e Replaces usages of Fragment with MCFragment. 2025-07-06 20:05:03 -07:00
04a30aa766 Adds senses to EditMonsterViewModel. 2025-07-06 20:05:03 -07:00
2356726e3f Fixes default values for array/set properties of monsters in db.
Removes individual senses properties and replaces with a Set<String>.
2025-07-06 20:05:03 -07:00
6151ad889c Updates TODO in EditMonsterViewModel. 2025-07-06 20:05:03 -07:00
1f15d73573 Adds edit skill fragment to edit individual skills. 2025-07-06 20:05:03 -07:00
40589f171d Adds stubbed out method to navigate to the edit skill fragment.
Adds a click handler to the edit skills recycler view adapter.
Makes tapping a skill in the edit skills view navigate to the editor for that skill.
Makes adding a new skill immediately edit the skill.
2025-07-06 20:05:02 -07:00
a58c851240 Makes addNewSkill return the new skill.
Adds replaceSkill to replace an existing skill in the skills array.
2025-07-06 20:05:02 -07:00
2c6b514538 Adds an equals method to skills. 2025-07-06 20:05:02 -07:00
f6a8b83343 Makes AdvantagePicker work if you set the id of the advantage picker to advantage. 2025-07-06 20:05:02 -07:00
eb3fa5108f Adds ability score picker. 2025-07-06 20:05:02 -07:00
922db42322 Lint cleanup. 2025-07-06 20:05:01 -07:00
71177b92f9 Removes debug logging. 2025-07-06 20:05:01 -07:00
34e68443ae Disables annoying lint rule. 2025-07-06 20:05:01 -07:00
857733ec9c Adds ability to remove a skill. 2025-07-06 20:05:00 -07:00
7e78ad8b7d Keeps skills on the edit skills screen sorted. 2025-07-06 20:05:00 -07:00
430fa61be1 Fixes bug where adding a new skill wouldn't show up until leaving and returning to the edit skills screen. 2025-07-06 20:05:00 -07:00
70e05cbb21 Adds item dividers to the Library and Edit Skills screens.
Makes the two layouts consistent with each other.
2025-07-06 20:05:00 -07:00
b67073622f Makes Add Skill button a FloatingActionButton. 2025-07-06 20:05:00 -07:00
c90579903d Adds "New Skill" button. 2025-07-06 20:05:00 -07:00
1a02eab07a Adds edit skills view. 2025-07-06 20:05:00 -07:00
00463c8092 Adds edit challenge rating screen. 2025-07-06 20:05:00 -07:00
153c49fe7b Adds remaining monster properties to the edit monster view model. 2025-07-06 20:04:59 -07:00
8178ec6fd7 Adds better change tracking to know if a monster needs to be saved. 2025-07-06 20:04:59 -07:00
2e7e40554d Adds saving throws editor. 2025-07-06 20:04:58 -07:00
989440de83 Adds AdvantagePicker and ProficiencyPicker components. 2025-07-06 20:04:57 -07:00
3c4adacc17 Adds a Stepper control and uses it for the steppers in the editor. 2025-07-06 20:04:57 -07:00
c28e1cb8c5 Adds screen to edit ability scores. 2025-07-06 20:04:56 -07:00
48dab535e9 Adds missed change tracking to EditMonsterViewModel. 2025-07-06 20:04:55 -07:00
ff26cb64b7 Adds Edit Speed screen to the monster editor. 2025-07-06 20:04:55 -07:00
28f0787020 Adds Edit Armor screen to edit a monster's armor stats. 2025-07-06 20:04:55 -07:00
71da064423 Adds hit dice and has custom HP toggle to the edit basic info screen. 2025-07-06 20:04:54 -07:00
23bcdc237d Adds confirmation when going up from the edit monster screen to save, cancel, or discard changes. 2025-07-06 20:04:54 -07:00
b56a662c9e Adds setTitle helper method to MCFragment. 2025-07-06 20:04:53 -07:00
dcce64f91a Adds edit basic info screen with most string fields.
Cleans up fonts/margins on edit screens.
Makes the EditMonsterViewModel shared between edit monster fragments.
2025-07-06 20:04:53 -07:00
595ee0c6fb Adds TextChangedListener helper class to make working with text inputs less verbose. 2025-07-06 20:04:52 -07:00
d52102d430 Makes EditMonsterFragment load the monster based with the id passed in and show it's name in the title. 2025-07-06 20:04:52 -07:00
6a4abdd547 Fixes passing the monster id when navigating to the edit monster screen. 2025-07-06 20:04:52 -07:00
bd3741af2d Extracts library strings to resources. 2025-07-06 20:04:52 -07:00
e254adfdce Changes to code format settings. 2025-07-06 20:04:52 -07:00
9c973ef348 Adds helper method to MCFragment to get the AppCompatActivity for the fragment. 2025-07-06 20:04:52 -07:00
dc9a0827d4 Adds edit monster view holder and placeholder for basic info tap handler. 2025-07-06 20:04:52 -07:00
b27274928e Adds top level items to the edit monster view. 2025-07-06 20:04:52 -07:00
6bb1e419c8 Replaces EditMonsterFragment with a basic ConstraintLayout. 2025-07-06 20:04:52 -07:00
3cda90eedd Adds shared preferences flipper plugin. 2025-07-06 20:04:51 -07:00
98a7dc5eeb Migrates from jcenter to maven central because of the jcenter shutdown. 2025-07-06 20:04:51 -07:00
e384e29570 Upgrades Android Gradle Plugin to 4.2.1 and Gradle to 6.7.1 2025-07-06 20:04:51 -07:00
7aa6419ece Adds Edit Monster placeholder fragment. 2025-07-06 20:04:51 -07:00
6b953e320d Adds edit button to monster detail view. 2025-07-06 20:04:50 -07:00
9f56f0283a Fixes the width of items in the library view. 2025-07-06 20:04:50 -07:00
b5f92afae9 Project file updates. 2025-07-06 20:04:50 -07:00
f58243ef6b Library refactoring. 2025-07-06 20:04:50 -07:00
886778ee78 Makes the swipe to delete callback more generic. 2025-07-06 20:04:50 -07:00
0a85324734 Fixes a bunch of lint errors and enables Flipper navigation logging. 2025-07-06 20:04:49 -07:00
b374dbfe71 Replaces fragment tag with FragmentContainerView. 2025-07-06 20:04:48 -07:00
21af6e20ba Renames MonsterFragment to MonsterDetailFragment to better explain its use. 2025-07-06 20:04:48 -07:00
dc9066daca Make AppCenter only included in debug builds.
Moves Flipper initialization to the same place as AppCenter.
2025-07-06 20:04:47 -07:00
e8e19d5371 Removes release build dependencies on Flipper and SoLoader. 2025-07-06 20:04:47 -07:00
c5242b5206 ViewModel cleanup
Removes unused view models.
Fixes warnings int MonsterViewModel.
2025-07-06 20:04:47 -07:00
ac2e37e494 Cleans up compiler warnings. 2025-07-06 20:04:47 -07:00
c5d857435d Removes unused type converter. 2025-07-06 20:04:47 -07:00
a1fab9d399 Adds functional search using sqlite full text search syntax. 2025-07-06 20:04:46 -07:00
e02e4ec399 Adds Flipper support to debug DB issues. 2025-07-06 20:04:46 -07:00
8706240fb4 Adds DevContent class with dev resources. Specifically an example monster.
Adds a task.
2025-07-06 20:04:46 -07:00
e17c492baf Adds swipe to delete monsters on the library screen. 2025-07-06 20:04:45 -07:00
2df11701e6 Adds floating action button to the library screen to create new monsters.
Adds a snackbar on successful muonster creation to view the new monster.
2025-07-06 20:04:44 -07:00
c6c0e4f758 Makes clicking a monster on the library screen show that monster in the detail screen. 2025-07-06 20:04:44 -07:00
8c233a3bc7 Adds list of monsters to Library screen. 2025-07-06 20:04:44 -07:00
e98b72ad7d Adds MCFragment and makes it the base fragment class. 2025-07-06 20:04:44 -07:00
1fb8dc3a86 Adds MonsterRepository to manage access to the RoomDB store. 2025-07-06 20:04:44 -07:00
8b52b0c3e5 Removes dev navigation on search button clicks. 2025-07-06 20:04:43 -07:00
ee065d7b39 Fixes back button in detail views. 2025-07-06 20:04:43 -07:00
59b319c27d Adds default values to Monster constructor. 2025-07-06 20:04:43 -07:00
cdcb7a60d4 Adds logger. 2025-07-06 20:04:43 -07:00
79106ec9f3 Adds application class. 2025-07-06 20:04:42 -07:00
bb4cbbb98b Upgrades android gradle plugin. 2025-07-06 20:04:41 -07:00
84b0fee261 Migrates Monster class to be storable in roomdb. 2025-07-06 20:04:41 -07:00
0c3ab6dc39 Creates initial app database class and adds minimal DTO support for monsters. 2025-07-06 20:04:37 -07:00
a694205c74 Fixes monster hp calculation so the first hit die is averaged like the others. Characters rolled as players will need to use custom HP. 2025-07-06 20:04:36 -07:00
793987c3fb Adds RoomDB and rxjava3 dependencies. 2025-07-06 20:04:36 -07:00
7d5f9c89a9 Updates build sdk. 2025-07-06 20:04:22 -07:00
6da0bfe70a Code reformat 2025-07-06 20:04:22 -07:00
a44893bca8 Adds actions to monster cards. 2025-07-06 20:04:22 -07:00
67375292a5 Adds abilities to monster cards.
Adds CommonMark dependency and CommonMarkHelper to render it to html.
2025-07-06 20:04:22 -07:00
145c827417 Adds challenge rating to monster cards. 2025-07-06 20:01:01 -07:00
8ff1cb8779 Adds languages to monster cards. 2025-07-06 20:00:59 -07:00
706b58fd2c Adds senses to monster cards. 2025-07-06 20:00:58 -07:00
15973a79f0 Adds condition immunities to monster cards. 2025-07-06 20:00:58 -07:00
94edc44044 Adds damage types to monster cards.
Adds oxfordJoin to StringHelper.
2025-07-06 20:00:58 -07:00
5396b7b014 Adds skills to monster cards. 2025-07-06 20:00:57 -07:00
e0cc8560d1 Adds saving throws to monster card. 2025-07-06 20:00:55 -07:00
c627bb0873 Adds ability scores to monster card. 2025-07-06 20:00:55 -07:00
6d8ec92012 Adds speeds to monster card. 2025-07-06 20:00:55 -07:00
212358e41d Adds hit points to monster card. 2025-07-06 20:00:55 -07:00
5fca394f0e Adds very basic readme. 2025-07-06 20:00:55 -07:00
6c914fb947 Adds armor class and section divider to monster cards. 2025-07-06 20:00:55 -07:00
5a283b8dae Adds monster meta (size, type, subtype/tag, and alignment) to monster cards. 2025-07-06 20:00:54 -07:00
407987e410 Adds monster name to monster cards. 2025-07-06 20:00:50 -07:00
27a1dd7580 Fixes build.gradle to generate safeargs directions for navigation. 2025-07-06 20:00:24 -07:00
775fbf3d9b Fixes deprecation warnings about ViewModelProviders.of(...). 2025-07-06 20:00:24 -07:00
2a75de4bce Adds Monster fragment to view a monster's card.
Adds query box and search button to search fragment.
Makes the search button show a monster card.
2025-07-06 20:00:23 -07:00
72502b3d03 Enables obfuscation and minification for release builds. 2025-07-06 20:00:18 -07:00
2b8a178c05 Adds top level navigation and placeholder fragments. 2025-07-06 20:00:16 -07:00
ab306289bd Sets better color scheme. 2025-07-06 19:59:12 -07:00
74b0c6695f Adds AppCenter config. 2025-07-06 19:58:55 -07:00
44d90ff5ea Adds INTERNET permission to manifest. 2025-07-06 19:58:55 -07:00
5113283550 Initial 2025-07-06 19:58:28 -07:00
12 changed files with 86 additions and 55 deletions

1
Android/.gitignore vendored
View File

@@ -8,6 +8,7 @@
/.idea/navEditor.xml /.idea/navEditor.xml
/.idea/assetWizardSettings.xml /.idea/assetWizardSettings.xml
/.idea/dictionaries /.idea/dictionaries
.DS_Store
/build /build
/captures /captures
.externalNativeBuild .externalNativeBuild

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" /> <bytecodeTargetLevel target="16" />
</component> </component>
</project> </project>

View File

@@ -4,10 +4,10 @@
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="testRunner" value="PLATFORM" /> <option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.8" /> <option name="gradleJvm" value="Android Studio java home" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />
@@ -15,7 +15,6 @@
</set> </set>
</option> </option>
<option name="resolveModulePerSourceSet" value="false" /> <option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings> </GradleProjectSettings>
</option> </option>
</component> </component>

View File

@@ -25,7 +25,7 @@
</option> </option>
<option name="myNotNulls"> <option name="myNotNulls">
<value> <value>
<list size="13"> <list size="14">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> <item index="1" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="2" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> <item index="2" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
@@ -39,11 +39,12 @@
<item index="10" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" /> <item index="10" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" />
<item index="11" class="java.lang.String" itemvalue="io.reactivex.annotations.NonNull" /> <item index="11" class="java.lang.String" itemvalue="io.reactivex.annotations.NonNull" />
<item index="12" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" /> <item index="12" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" />
<item index="13" class="java.lang.String" itemvalue="lombok.NonNull" />
</list> </list>
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_X" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

4
Android/README.md Normal file
View File

@@ -0,0 +1,4 @@
[![Build status](https://build.appcenter.ms/v0.1/apps/44e4ee45-fe39-4d2d-950f-943e9948ca35/branches/master/badge)](https://appcenter.ms)
# MonsterCards for Android

View File

@@ -11,22 +11,15 @@ if (propertiesFile.exists()) {
def appCenterLocalSecret = properties.getProperty('appCenter.localSecret') def appCenterLocalSecret = properties.getProperty('appCenter.localSecret')
def appCenterEnvSecret = System.getenv('APPCENTER_SECRET') def appCenterEnvSecret = System.getenv('APPCENTER_SECRET')
def appCenterSecret = appCenterLocalSecret != null ? appCenterLocalSecret : appCenterEnvSecret != null ? appCenterEnvSecret : "" def appCenterSecret = appCenterLocalSecret != null ? appCenterLocalSecret : appCenterEnvSecret != null ? appCenterEnvSecret : ""
def appCenterSdkVersion = '3.3.0'
def nav_version = '2.3.5'
def room_version = '2.3.0'
def rxjava_version = '3.0.0'
def flipper_version = '0.87.0'
def soloader_version = '0.10.1'
def gson_version = '2.8.6'
android { android {
compileSdkVersion 30 compileSdkVersion 31
buildToolsVersion '30.0.3' buildToolsVersion '30.0.3'
defaultConfig { defaultConfig {
applicationId "com.majinnaibu.monstercards" applicationId "com.majinnaibu.monstercards"
minSdkVersion 22 minSdkVersion 22
targetSdkVersion 30 targetSdkVersion 31
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
buildConfigField "String", "APPCENTER_SECRET", "\"${appCenterSecret}\"" buildConfigField "String", "APPCENTER_SECRET", "\"${appCenterSecret}\""
@@ -63,6 +56,9 @@ android {
buildFeatures { buildFeatures {
viewBinding true viewBinding true
} }
lintOptions {
checkDependencies true
}
} }
dependencies { dependencies {
@@ -73,8 +69,8 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0' implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation "androidx.navigation:navigation-fragment:$nav_version" implementation "androidx.navigation:navigation-fragment:2.3.5"
implementation "androidx.navigation:navigation-ui:$nav_version" implementation "androidx.navigation:navigation-ui:2.3.5"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.recyclerview:recyclerview:1.2.1'
@@ -87,23 +83,23 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// Room DB // Room DB
implementation "io.reactivex.rxjava3:rxjava:$rxjava_version" implementation 'io.reactivex.rxjava3:rxjava:3.1.0'
implementation "io.reactivex.rxjava3:rxandroid:$rxjava_version" implementation "io.reactivex.rxjava3:rxandroid:3.0.0"
implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-runtime:2.3.0"
annotationProcessor "androidx.room:room-compiler:$room_version" annotationProcessor "androidx.room:room-compiler:2.3.0"
implementation "androidx.room:room-rxjava3:$room_version" implementation "androidx.room:room-rxjava3:2.3.0"
//testImplementation "androidx.room:room-testing:$room_version" //testImplementation "androidx.room:room-testing:2.3.0"
// AppCenter // AppCenter
debugImplementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}" debugImplementation 'com.microsoft.appcenter:appcenter-analytics:4.2.0'
debugImplementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}" debugImplementation 'com.microsoft.appcenter:appcenter-crashes:4.2.0'
// Flipper // Flipper
debugImplementation "com.facebook.flipper:flipper:$flipper_version" debugImplementation 'com.facebook.flipper:flipper:0.102.0'
debugImplementation "com.facebook.soloader:soloader:$soloader_version" debugImplementation "com.facebook.soloader:soloader:0.10.1"
releaseImplementation "com.facebook.flipper:flipper-noop:$flipper_version" releaseImplementation 'com.facebook.flipper:flipper-noop:0.102.0'
// Other 3rd Party // Other 3rd Party
implementation 'com.atlassian.commonmark:commonmark:0.15.2' implementation 'com.atlassian.commonmark:commonmark:0.17.0'
implementation "com.google.code.gson:gson:$gson_version" implementation 'com.google.code.gson:gson:2.8.7'
} }

View File

@@ -7,6 +7,7 @@
<application <application
android:name=".MonsterCardsApplication" android:name=".MonsterCardsApplication"
android:allowBackup="true" android:allowBackup="true"
android:fullBackupOnly="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
@@ -14,6 +15,7 @@
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTask"> android:launchMode="singleTask">
<intent-filter> <intent-filter>

View File

@@ -1,8 +1,11 @@
package com.majinnaibu.monstercards; package com.majinnaibu.monstercards;
import android.content.ContentResolver;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.provider.DocumentsContract;
import android.view.MenuItem; import android.view.MenuItem;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@@ -21,6 +24,7 @@ import com.majinnaibu.monstercards.init.FlipperInitializer;
import com.majinnaibu.monstercards.utils.Logger; import com.majinnaibu.monstercards.utils.Logger;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
@@ -81,7 +85,9 @@ public class MainActivity extends AppCompatActivity {
String type = intent.getType(); String type = intent.getType();
String json; String json;
Uri uri = null; Uri uri = null;
if ("android.intent.action.SEND".equals(action) && "text/plain".equals(type)) { if ("android.intent.action.MAIN".equals(action)) {
return null;
} else if ("android.intent.action.SEND".equals(action) && "text/plain".equals(type)) {
uri = extras.getParcelable("android.intent.extra.STREAM"); uri = extras.getParcelable("android.intent.extra.STREAM");
} else if ("android.intent.action.VIEW".equals(action) && ("text/plain".equals(type) || "application/octet-stream".equals(type))) { } else if ("android.intent.action.VIEW".equals(action) && ("text/plain".equals(type) || "application/octet-stream".equals(type))) {
uri = intent.getData(); uri = intent.getData();
@@ -101,10 +107,10 @@ public class MainActivity extends AppCompatActivity {
@Nullable @Nullable
private String readContentsOfUri(Uri uri) { private String readContentsOfUri(Uri uri) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
try (InputStream inputStream = try (
getContentResolver().openInputStream(uri); InputStream inputStream = openInputStream(uri);
BufferedReader reader = new BufferedReader( BufferedReader reader = new BufferedReader(new InputStreamReader(Objects.requireNonNull(inputStream)))
new InputStreamReader(Objects.requireNonNull(inputStream)))) { ) {
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
builder.append(line); builder.append(line);
@@ -115,4 +121,36 @@ public class MainActivity extends AppCompatActivity {
} }
return builder.toString(); return builder.toString();
} }
private boolean isVirtualFile(Uri uri) {
if (!DocumentsContract.isDocumentUri(this, uri)) {
return false;
}
Cursor cursor = getContentResolver().query(
uri,
new String[]{DocumentsContract.Document.COLUMN_FLAGS},
null, null, null);
int flags = 0;
if (cursor.moveToFirst()) {
flags = cursor.getInt(0);
}
cursor.close();
return (flags & DocumentsContract.Document.FLAG_VIRTUAL_DOCUMENT) != 0;
}
private InputStream openInputStream(Uri uri) throws IOException {
ContentResolver resolver = getContentResolver();
if (isVirtualFile(uri)) {
String[] openableMimeTypes = resolver.getStreamTypes(uri, "*/*");
if (openableMimeTypes == null || openableMimeTypes.length <= 0) {
throw new FileNotFoundException();
}
return resolver.openTypedAssetFileDescriptor(uri, openableMimeTypes[0], null).createInputStream();
} else {
return resolver.openInputStream(uri);
}
}
} }

View File

@@ -20,7 +20,6 @@ import com.majinnaibu.monstercards.ui.shared.MCFragment;
import com.majinnaibu.monstercards.utils.Logger; import com.majinnaibu.monstercards.utils.Logger;
import java.util.List; import java.util.List;
import java.util.Locale;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers; import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.schedulers.Schedulers;
@@ -38,6 +37,7 @@ public class DashboardFragment extends MCFragment {
setupRecyclerView(mHolder.list); setupRecyclerView(mHolder.list);
// TODO: subscribe better
getMonsterRepository() getMonsterRepository()
.getMonsters() .getMonsters()
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
@@ -49,7 +49,6 @@ public class DashboardFragment extends MCFragment {
private void setupRecyclerView(@NonNull RecyclerView recyclerView) { private void setupRecyclerView(@NonNull RecyclerView recyclerView) {
int columnCount = Math.max(1, getResources().getConfiguration().screenWidthDp / 396); int columnCount = Math.max(1, getResources().getConfiguration().screenWidthDp / 396);
Logger.logWTF(String.format(Locale.US, "Setting column count to %d", columnCount));
Context context = requireContext(); Context context = requireContext();
GridLayoutManager layoutManager = new GridLayoutManager(context, columnCount); GridLayoutManager layoutManager = new GridLayoutManager(context, columnCount);
recyclerView.setLayoutManager(layoutManager); recyclerView.setLayoutManager(layoutManager);

View File

@@ -5,10 +5,8 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.2.2' classpath "com.android.tools.build:gradle:7.0.1"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5"
def nav_version = "2.3.0"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
@@ -22,6 +20,12 @@ allprojects {
// maven { url "https://oss.jfrog.org/libs-snapshot" } // maven { url "https://oss.jfrog.org/libs-snapshot" }
// maven { url 'http://repo1.maven.org/maven2' } // maven { url 'http://repo1.maven.org/maven2' }
} }
// Temporary workaround until room 2.4.0 is released https://issuetracker.google.com/issues/174695268?pli=1#comment10
configurations.configureEach {
resolutionStrategy {
force 'org.xerial:sqlite-jdbc:3.34.0'
}
}
} }
task clean(type: Delete) { task clean(type: Delete) {

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip