Commit Graph

166 Commits

Author SHA1 Message Date
Julian Winkler
0f7548f189 refactor Dialog implementation to support custom content 2023-08-23 14:52:56 +02:00
Julian Winkler
029b26beb2 main.c: window size needs to be set before calling set_up_handle_cache()
the Context class init creates a static DisplayMetric
2023-08-23 14:52:56 +02:00
Julian Winkler
e694973a1f ViewGroup: add child View at correct index 2023-08-23 14:52:56 +02:00
Julian Winkler
28cd0006bc some fixes to make NewPipe not crash when layouting 2023-08-23 14:52:56 +02:00
Julian Winkler
1474d8d3e1 TextView: get textSize from attributes 2023-08-23 12:39:55 +02:00
Julian Winkler
c4b7bdc63d ViewGroup: handle scroll events 2023-08-23 12:39:55 +02:00
Julian Winkler
960930a348 Add some stubs needed by android material library 2023-08-23 12:39:49 +02:00
Julian Winkler
ca975a0e7c add support for ViewGroups with custom onLayout()
A custom GtkLayoutManager is set to these objects, which calls into the
java handlers when measure or layout is requested.

Androids onMeasure method is quite different from GTKs measure method,
because Android already defines the final size during onMeasure.
Therefore, we call onMeasure from GTKs allocate callback instead of the
measure callback.
2023-08-23 12:39:10 +02:00
Julian Winkler
4434de4a58 implement android.widget.EditText using GtkEntry 2023-08-23 11:47:05 +02:00
Julian Winkler
f9a85017c1 implement android.widget.ImageButton using GtkButton 2023-08-23 11:47:05 +02:00
Julian Winkler
f2e71cd50f implement android.widget.Button using GtkButton 2023-08-23 11:47:05 +02:00
Julian Winkler
36b6132324 fix reference counting for GtkWidgets created from java
GtkWidgets extend GInitiallyUnowned and are automatically freed when
removing from parent widget. We need to add an extra reference, to make
sure the object keeps alive as long as the java widget has a reference
to it
2023-08-23 11:47:05 +02:00
Julian Winkler
faf4a3281e add initial support for fragments
Fragments are not added to the View hierarchy yet. Only the lifecycle
callbacks are implemented
2023-08-22 22:30:06 +02:00
Julian Winkler
83cc2e5991 load the default Application theme on startup 2023-08-22 22:30:06 +02:00
Julian Winkler
34d214e9ae AssetManager.java: fill indices array when loading TypedArray
This is needed for TypedArray.getIndexCount() and related functions
2023-08-22 22:30:03 +02:00
Julian Winkler
9bd5593657 Activity: make startActivityForResult() functional 2023-08-22 22:29:20 +02:00
Julian Winkler
3399c84e84 fix multi Activity support
jobjects have to be compared with env->IsSameObject()
and each Activity needs its own Window instance.
The GtkWindow is still shared between all Activities
2023-08-22 22:29:20 +02:00
Julian Winkler
3fd81baeaf AssetManager: fix loading without merge
use cookie values to find correct StringPool
2023-08-22 22:29:03 +02:00
Julian Winkler
2b97e3bd57 AssetManager.java: iterate tableBlocks instead of merging
The merging process is too slow
2023-08-22 19:44:09 +02:00
Julian Winkler
6547e66d4f implement android.app.AlertDialog using GtkDialog 2023-08-22 19:39:57 +02:00
Julian Winkler
fac8e6e7b5 fix Build.SDK constant 2023-08-22 19:39:57 +02:00
Julian Winkler
447041066e add StatFs class from AOSP 2023-08-22 19:39:57 +02:00
Julian Winkler
44be3ff197 copy Color.parseColor() from AOSP 2023-08-22 19:39:57 +02:00
Julian Winkler
4d90002ec6 Simplify native interface of widget implementations
Makes it easier to overwrite behavior in subclasses. Have a fallback
implementation for ViewGroup.
Save some _GET_LONG_FIELD / _SET_LONG_FIELD calls by directly passing
the native pointers to and from native methods.
2023-08-22 15:53:09 +02:00
Julian Winkler
82744e9e5e add bunch of new java APIs: mostly stubs or copied from AOSP
Many of these classes are only needed to be subclassed by androidx
support library, which is used in many android apps
2023-08-22 15:53:09 +02:00