-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Small cleanup of the code structure #2267
Merged
Mathias-Boulay
merged 37 commits into
PojavLauncherTeam:v3_openjdk
from
Mathias-Boulay:small_cleanup
Nov 25, 2021
Merged
Small cleanup of the code structure #2267
Mathias-Boulay
merged 37 commits into
PojavLauncherTeam:v3_openjdk
from
Mathias-Boulay:small_cleanup
Nov 25, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Improved control onTouch performance
- Remove context holding from the Gamepad object - Simplified main_with_custom_ctrl layout hierarchy
- Move static inputs methods to CallbackBridge - Restored pointerDebugTextview, now auto-instanciated. - Simplified main_with_ctrl hierarchy
- Simplified view hierarchy
Mathias-Boulay
changed the title
[UNFINISHED] Small cleanup of the code structure
Small cleanup of the code structure
Nov 21, 2021
lmao I closed it instead of merging it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sigh...
I shouldn't even have to do this, but it seems the previous people here committed heresy.
So here I am, fixing a few mistakes that took time to deal with. It also comes with more modularity, which maybe will be of some importance later on.
Anyway, what's new there ?
Not much for the end user, most things concerns the devs here
Android 12 gamepad support
Since android 12 revamped its internals, I could not rely on Java reflection to save on object creation.
The new implementation doesn't use any reflection and relies on primitive types.
A 3 months overdue fix in other words, since reflection isn't the best thing to use in production software
Fix Null reference of currentDisplayMetrics
Turns out we forgot to store the function results into this static variable.
It May not fix all crashes, seems it seems a bit device dependant but it should work for 99.99% of phones.
Modularity, rise !
Most of the effort has been put into modularizing components to unlink them from an activity.
The following changes have been made:
MineGLView
This view now handles the surface listener and user inputs and the debugging of input pointers.
Launching minecraft is still up to the BaseMainActivity.
The onTouchEvent code structure has been overhauled, now being MUCH flatter than before.
It is also slightly optimized, a welcome addition given how many times this function is called 😅
Touchpad
The
Touchpad
is its own component, with a separate touch detection from themineGLView
. It works pretty much by itself now. Work should be done to modularize this component even more ?Logger
The
Logger
class is a class following the singleton pattern.It is here to replace the
LoggableActivity
which should never have existed in the first place. WE DON'T PUT LOGGERS INTO CONTEXT CONTAINING OBJECTS !LoggerView
An almost drop-in replacement to the
LinearLayout
that was duplicated across layouts needing to check on logs.Just drop the
LoggerView
into the layout, it works by itself. You can set its visibility to display or hide logs easily.MCOptionUtils
This class now integrates a public interface
MCOptionListener
which notifies if any mc option was changed.Miscenalleous
CallbackBridge
classGamepad
doesn't hold any activity as an instance variable anymore