Commit graph

95 commits

Author SHA1 Message Date
Julian Winkler
1a039e5e51 add missing APIs related to scrolling 2023-11-12 12:16:23 +01:00
Julian Winkler
7ac38adae0 View.scrollTo(): invalidate View 2023-11-12 12:16:23 +01:00
Julian Winkler
36d7a1cc44 support layout margins
This makes the menu in Gravity Defied not get behind the keyboard.
Also makes the TabLayout in NewPipe not get behing the titlebar.
2023-11-12 12:16:23 +01:00
Julian Winkler
72a8b3a047 add more stubs 2023-11-12 12:16:23 +01:00
Julian Winkler
6ef1e523cc View: relayout on visibility changes 2023-11-08 22:44:39 +01:00
Julian Winkler
385f6dcf0b android_layout_measure: reuse old MeasureSpec for missing dimension
This should fix the SurfaceView in NewPipe not resizing automatically
2023-11-04 08:49:58 +01:00
Julian Winkler
4bce3544dd WrapperWidget: handle View.computeScroll()
Currently the scrolling is purely visual.
2023-11-02 23:30:21 +01:00
Julian Winkler
0a8b8a3874 use AndroidLayout class also in View implementation
drop the onMeasure hack from WrapperWidget
2023-11-02 08:20:19 +01:00
Julian Winkler
3de842b1d8 enable onTouchEvent for ViewGroups and add some stubs 2023-11-01 17:54:59 +01:00
Mis012
b714dad281 api-impl/android/view/View: apply background from attrs 2023-10-30 20:45:08 +01:00
Mis012
d483828236 android/view/View: naive implementation for setBackgroundColor 2023-10-30 17:28:38 +01:00
Julian Winkler
3bdffe7ce9 View: prevent redundant measuring for performance reasons
No need to remeasure or relayout when nothing has changed
2023-10-29 15:28:06 +01:00
Julian Winkler
4f9e672819 View: handle all invalidate methods 2023-10-29 15:28:06 +01:00
Julian Winkler
3e7f07ec71 onTouchEvent: pass return value to GTK
This allows to propagate unhandled events to the next handler
2023-10-29 15:28:06 +01:00
Mis012
4a0755c6e0 api-impl{-jni}: make view.onTouchEvent work, misc stuff to make input work for Unity games
onTouchEvent was previously incorrectly handled in GLSurfaceView; move it
to View so that it works properly with any of it's descendants.

This is done by reusing the existing setOnTouchListener implementation
and changing it to use GtkEventControllerLegacy which provides motion
events.

Technically some of the code is in WrapperWidget.c since every widget
calls wrapper_widget_set_jobject and we already have related code
there.
2023-10-17 21:33:59 +02:00
Julian Winkler
520d153c55 call View.onAttachedToWindow() method 2023-10-14 18:29:33 +02:00
Julian Winkler
b88707592a add more stubs to make exoplayer not crash 2023-10-14 18:29:33 +02:00
Julian Winkler
c830abc5f3 add more API stubs for NewPipe 2023-10-14 18:29:33 +02:00
Julian Winkler
f5fc993484 add APIs needed for non legacy NewPipe version 2023-10-14 18:29:33 +02:00
Julian Winkler
37d9b13470 View.onMeasure: handle MEASURE_SPEC_AT_MOST properly
We decide between simple widgets which handles MEASURE_SPEC_AT_MOST the same way as
MEASURE_SPEC_EXACTLY, and complex widgets which handles MEASURE_SPEC_AT_MOST by measuring the content
2023-10-14 10:01:01 +00:00
Mis012
9270d3a923 api-impl/android/view/View: add getDisplay 2023-09-14 16:05:07 +02:00
Mis012
90cb1c925a api-impl: use liblog for android.util.Log; use Log.v for debugging prints and Log.w for stub tracing 2023-09-12 13:41:52 +02:00
Julian Winkler
096919ec37 implement View.getDrawingRect() 2023-09-08 20:10:45 +02:00
Julian Winkler
255eed3e59 setLayoutParams(): better match Androids behaviour
View.setGravity() specifies gravity of children, not of the view itself
LayoutParams.weight > 0 should cause expansion of widget
2023-09-08 20:10:45 +02:00
Julian Winkler
97f8c2ed0f Add some missing APIs.
android.widget.Filter and android.webkit.MimeTypeMap are copied from
AOSP. Other new classes are only stub implementations.
2023-09-01 16:05:26 +02:00
Julian Winkler
fb1a07967e copy android.widget.Scroller from AOSP and implement missing scroll APIs
This is needed to make ViewPager functional
2023-09-01 12:13:24 +02:00
Julian Winkler
28cd0006bc some fixes to make NewPipe not crash when layouting 2023-08-23 14:52:56 +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
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
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
Mis012
4a1159f5cb api-impl: add misc stubs 2023-08-12 13:09:33 +02:00
Julian Winkler
6b79adb2c3 add missing Context attribute to all View constructors 2023-08-08 14:18:20 +02:00
Julian Winkler
520569f7c7 implement View.invalidate() 2023-08-08 13:35:47 +02:00
Mis012
0a9591c474 src/api-impl: fix up code style, mainly for code imported from AOSP
used the following (plus manual edits):
`clang-format --style="{BasedOnStyle: LLVM, IndentWidth: 8, UseTab: Always, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: true, ColumnLimit: 0}`
2023-06-22 11:45:46 +02:00
Julian Winkler
3709e30f64 load layout XMLs directly from apk file 2023-06-21 22:38:08 +02:00
Julian Winkler
0454dcbfd5 stub some APIs for Flappy Bird, mostly webview related 2023-06-18 11:28:40 +02:00
Mis012
4dd31731f9 src/api-impl: misc stubbing 2023-01-09 12:07:57 +01:00
Mis012
52ba443401 misc stubbing 2022-12-01 14:44:16 +01:00
Nikita Travkin
c7fcb0f84e Stub some stuff 2022-11-02 15:25:14 +01:00
Mis012
b801f0fb3c implement some stuff to make exaple SDL app run
NOTE: the main addition in this commit is WIP support for apps which
render on an EGL surface obtained using ANativeWindow_fromSurface

currently, this EGL surface is obtained by creating a 700x700 pixel
window with GLFW (the 700x700 size is hardcoded in several places)
and only Wayland is supported

ideally, we'd want to use a wayland subsurface to position the EGL
surface above the Surface widget it's associated with (and do
whatever for X11)
2022-10-26 18:39:04 +02:00
Mis012
3627f35bd5 fix wrong indentation of interfaces/stubs copied from AOSP 2022-10-18 18:35:29 +02:00
Mis012
449090143e refactor source tree organization, switch to meson 2022-10-09 22:59:16 +02:00