Commit Graph

83 Commits

Author SHA1 Message Date
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