fix: 系统性修复类继承冲突 + 补全36+缺失导出

类继承冲突修复 (7个文件, 8组冲突):
- view_ext.py: 16个类继承view.py基础版本 (ViewOutlineProvider, ViewPropertyAnimator, ViewTreeObserver, ViewConfiguration, ViewParent, WindowInsets, Display, DragEvent, GestureDetector, ScaleGestureDetector, SoundEffectConstants, Surface, SurfaceView, TextureView, VelocityTracker, WindowInsetsController)
- hardware_sensor_ext.py: 3个类继承hardware.py (Sensor, SensorEvent, SensorEventListener)
- app_fragment.py: 3个类继承app.py (Fragment, FragmentManager, FragmentTransaction)
- content_intent.py: 3个类继承content.py/app.py (Intent, PendingIntent, IntentFilter)
- widget_ext.py: 29个类继承widget.py (18个单继承+11个多继承, 修复super()链)
- os_power.py: 2个类继承os.py (BatteryManager, PowerManager)
- net_ext.py: 12个类继承net.py (11个单继承+1个多继承)

__all__导出补全 (36个类):
- java.net: InterfaceAddress
- android.database: MatrixCursor, SQLiteStatement
- android.view: GestureDetector, ScaleGestureDetector, SurfaceHolder, Surface, SurfaceView, TextureView, ViewOutlineProvider, WindowManager, Window, LayoutInflater, Menu, MenuItem, ContextMenu, Display, DisplayMetrics
- android.graphics: Region, PathMeasure, NinePatch, Picture, PictureDrawable, Camera, PorterDuff, PorterDuffXfermode, Shader, LinearGradient, RadialGradient, SweepGradient, BitmapShader, ComposeShader, CornerPathEffect, DashPathEffect, PathDashPathEffect, SumPathEffect
- android.widget: LinearLayout, FrameLayout, RelativeLayout, TableLayout, TableRow, BaseAdapter, ArrayAdapter, SimpleAdapter, CursorAdapter, ImageButton, ToggleButton, RadioButton, SeekBar, RatingBar, ViewSwitcher, TextSwitcher, ImageSwitcher, SearchView, NumberPicker, Chronometer, TabHost, TabWidget, ViewAnimator, ZoomControls, DigitalClock, AnalogClock

统计: 221模块, 3666类, 31005方法, 183629行
This commit is contained in:
shuiyu1123 committed 2026-06-25 01:24:00 +00:00
1 parent fbb8263b13
commit 97d8b277d5
8 files changed
+205 -105

No files matched your search

+68 -34
View File
@@ -11,6 +11,35 @@ import threading
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
from .._core import Stub, AndroidOnlyError
from .widget import AdapterView as _BaseAdapterView
from .widget import AutoCompleteTextView as _BaseAutoCompleteTextView
from .widget import ProgressBar as _BaseProgressBar
from .widget import Chronometer as _BaseChronometer
from .widget import TableLayout as _BaseTableLayout
from .widget import TableRow as _BaseTableRow
from .widget import LinearLayout as _BaseLinearLayout
from .widget import FrameLayout as _BaseFrameLayout
from .widget import RelativeLayout as _BaseRelativeLayout
from .widget import NumberPicker as _BaseNumberPicker
from .widget import SearchView as _BaseSearchView
from .widget import TabHost as _BaseTabHost
from .widget import TabWidget as _BaseTabWidget
from .widget import ViewAnimator as _BaseViewAnimator
from .widget import ImageButton as _BaseImageButton
from .widget import ZoomControls as _BaseZoomControls
from .widget import DigitalClock as _BaseDigitalClock
from .widget import AnalogClock as _BaseAnalogClock
from .widget import ToggleButton as _BaseToggleButton
from .widget import RadioButton as _BaseRadioButton
from .widget import SeekBar as _BaseSeekBar
from .widget import RatingBar as _BaseRatingBar
from .widget import ViewSwitcher as _BaseViewSwitcher
from .widget import TextSwitcher as _BaseTextSwitcher
from .widget import ImageSwitcher as _BaseImageSwitcher
from .widget import BaseAdapter as _BaseBaseAdapter
from .widget import ArrayAdapter as _BaseArrayAdapter
from .widget import SimpleAdapter as _BaseSimpleAdapter
from .widget import CursorAdapter as _BaseCursorAdapter
from ..java.lang import RuntimeException
@@ -135,7 +164,7 @@ class Adapter(Stub):
return f"Adapter(count={self.getCount()})"
class AdapterView(Stub):
class AdapterView(_BaseAdapterView):
"""AdapterView — 适配器视图"""
ITEM_VIEW_TYPE_IGNORE = -1
@@ -326,7 +355,7 @@ class ThemedSpinnerAdapter(Stub):
# AutoCompleteTextView
# ═══════════════════════════════════════════════════════════════
class AutoCompleteTextView(Stub):
class AutoCompleteTextView(_BaseAutoCompleteTextView):
"""AutoCompleteTextView — 自动完成文本视图"""
THRESHOLD_DEFAULT = 2
@@ -429,7 +458,7 @@ class AutoCompleteTextView(Stub):
# ProgressBar / SeekBar / AbsSeekBar / RatingBar
# ═══════════════════════════════════════════════════════════════
class ProgressBar(Stub):
class ProgressBar(_BaseProgressBar):
"""ProgressBar — 进度条扩展"""
STYLE_HORIZONTAL = 0x00000001
@@ -568,11 +597,11 @@ class AbsSeekBar(ProgressBar):
self._on_seek_bar_change = listener
class SeekBar(AbsSeekBar):
class SeekBar(_BaseSeekBar, AbsSeekBar):
"""SeekBar — 拖动条"""
def __init__(self, context: Any = None):
super().__init__(context)
AbsSeekBar.__init__(self, context)
self._on_seek_bar_change: Optional[Callable] = None
def setOnSeekBarChangeListener(self, listener: Optional[Callable]) -> None:
@@ -585,12 +614,12 @@ class SeekBar(AbsSeekBar):
return f"SeekBar(progress={self.getProgress()})"
class RatingBar(ProgressBar):
class RatingBar(_BaseRatingBar, ProgressBar):
"""RatingBar — 评分条"""
def __init__(self, context: Any = None, num_stars: int = 5,
step_size: float = 0.5):
super().__init__(context, ProgressBar.STYLE_HORIZONTAL)
ProgressBar.__init__(self, context, ProgressBar.STYLE_HORIZONTAL)
self._num_stars = num_stars
self._step_size = step_size
self._rating: float = 0.0
@@ -638,7 +667,7 @@ class RatingBar(ProgressBar):
# Chronometer
# ═══════════════════════════════════════════════════════════════
class Chronometer(Stub):
class Chronometer(_BaseChronometer):
"""Chronometer — 计时器"""
FORMAT_ELAPSED_TIME = 1
@@ -734,11 +763,12 @@ class CompoundButton(Stub):
return f"CompoundButton(checked={self._checked})"
class ToggleButton(CompoundButton):
class ToggleButton(_BaseToggleButton, CompoundButton):
"""ToggleButton — 开关按钮"""
def __init__(self, context: Any = None):
super().__init__(context)
CompoundButton.__init__(self, context)
self._text_on: str = "ON"
self._text_off: str = "OFF"
@@ -758,11 +788,12 @@ class ToggleButton(CompoundButton):
return f"ToggleButton(checked={self.isChecked()})"
class RadioButton(CompoundButton):
class RadioButton(_BaseRadioButton, CompoundButton):
"""RadioButton — 单选按钮"""
def __init__(self, context: Any = None):
super().__init__(context)
CompoundButton.__init__(self, context)
def toggle(self) -> None:
if not self.isChecked():
@@ -827,7 +858,7 @@ class RadioGroup(Stub):
# TableLayout / TableRow
# ═══════════════════════════════════════════════════════════════
class TableLayout(Stub):
class TableLayout(_BaseTableLayout):
"""TableLayout — 表格布局"""
def __init__(self, context: Any = None):
@@ -863,7 +894,7 @@ class TableLayout(Stub):
return f"TableLayout(rows={len(self._rows)})"
class TableRow(Stub):
class TableRow(_BaseTableRow):
"""TableRow — 表格行"""
class LayoutParams(Stub):
@@ -1029,7 +1060,7 @@ class GridLayout(Stub):
# LinearLayout / FrameLayout / RelativeLayout
# ═══════════════════════════════════════════════════════════════
class LinearLayout(Stub):
class LinearLayout(_BaseLinearLayout):
"""LinearLayout — 线性布局"""
HORIZONTAL = 0
@@ -1120,7 +1151,7 @@ class LinearLayout(Stub):
return f"LinearLayout(orientation={'H' if self._orientation == 0 else 'V'})"
class FrameLayout(Stub):
class FrameLayout(_BaseFrameLayout):
"""FrameLayout — 帧布局"""
class LayoutParams(Stub):
@@ -1177,7 +1208,7 @@ class FrameLayout(Stub):
return "FrameLayout()"
class RelativeLayout(Stub):
class RelativeLayout(_BaseRelativeLayout):
"""RelativeLayout — 相对布局"""
TRUE = -1
@@ -1284,7 +1315,7 @@ class RelativeLayout(Stub):
# NumberPicker / SearchView / TabHost / TabWidget
# ═══════════════════════════════════════════════════════════════
class NumberPicker(Stub):
class NumberPicker(_BaseNumberPicker):
"""NumberPicker — 数字选择器"""
def __init__(self, context: Any = None):
@@ -1344,7 +1375,7 @@ class NumberPicker(Stub):
return f"NumberPicker(value={self._value}, range=[{self._min_value}-{self._max_value}])"
class SearchView(Stub):
class SearchView(_BaseSearchView):
"""SearchView — 搜索视图扩展"""
ICONIFIED = 0
@@ -1425,7 +1456,7 @@ class SearchView(Stub):
return f"SearchView(query={self._query})"
class TabHost(Stub):
class TabHost(_BaseTabHost):
"""TabHost — 标签宿主"""
class TabSpec(Stub):
@@ -1493,7 +1524,7 @@ class TabHost(Stub):
return f"TabHost(tabs={len(self._tabs)}, current={self._current_tab})"
class TabWidget(Stub):
class TabWidget(_BaseTabWidget):
"""TabWidget — 标签小部件"""
def __init__(self, context: Any = None):
@@ -1529,7 +1560,7 @@ class TabWidget(Stub):
# TextSwitcher / ViewSwitcher / ViewAnimator / ImageSwitcher
# ═══════════════════════════════════════════════════════════════
class ViewAnimator(Stub):
class ViewAnimator(_BaseViewAnimator):
"""ViewAnimator — 视图动画器"""
def __init__(self, context: Any = None):
@@ -1595,7 +1626,7 @@ class ViewAnimator(Stub):
return f"ViewAnimator(children={len(self._children)}, displayed={self._displayed_child})"
class ViewSwitcher(ViewAnimator):
class ViewSwitcher(_BaseViewSwitcher, ViewAnimator):
"""ViewSwitcher — 视图切换器"""
class ViewFactory(Stub):
@@ -1605,6 +1636,7 @@ class ViewSwitcher(ViewAnimator):
def __init__(self, context: Any = None):
super().__init__(context)
ViewAnimator.__init__(self, context)
self._factory: Optional[ViewSwitcher.ViewFactory] = None
def setFactory(self, factory: ViewFactory) -> None:
@@ -1623,11 +1655,12 @@ class ViewSwitcher(ViewAnimator):
return f"ViewSwitcher()"
class TextSwitcher(ViewSwitcher):
class TextSwitcher(_BaseTextSwitcher, ViewSwitcher):
"""TextSwitcher — 文本切换器"""
def __init__(self, context: Any = None):
super().__init__(context)
ViewSwitcher.__init__(self, context)
self._factory = None
def setCurrentText(self, text: str) -> None:
@@ -1640,11 +1673,12 @@ class TextSwitcher(ViewSwitcher):
return "TextSwitcher()"
class ImageSwitcher(ViewSwitcher):
class ImageSwitcher(_BaseImageSwitcher, ViewSwitcher):
"""ImageSwitcher — 图片切换器"""
def __init__(self, context: Any = None):
super().__init__(context)
ViewSwitcher.__init__(self, context)
def setImageResource(self, res_id: int) -> None:
pass
@@ -1659,7 +1693,7 @@ class ImageSwitcher(ViewSwitcher):
return "ImageSwitcher()"
class ImageButton(Stub):
class ImageButton(_BaseImageButton):
"""ImageButton — 图片按钮"""
def __init__(self, context: Any = None):
@@ -1711,7 +1745,7 @@ class ZoomButton(ImageButton):
return f"ZoomButton(zoomIn={self._zoom_in})"
class ZoomControls(Stub):
class ZoomControls(_BaseZoomControls):
"""ZoomControls — 缩放控件"""
def __init__(self, context: Any = None):
@@ -1757,7 +1791,7 @@ class ZoomControls(Stub):
# DigitalClock / TextClock / AnalogClock
# ═══════════════════════════════════════════════════════════════
class DigitalClock(Stub):
class DigitalClock(_BaseDigitalClock):
"""DigitalClock — 数字时钟"""
def __init__(self, context: Any = None):
@@ -1825,7 +1859,7 @@ class TextClock(Stub):
return f"TextClock(time={self.getText()})"
class AnalogClock(Stub):
class AnalogClock(_BaseAnalogClock):
"""AnalogClock — 模拟时钟"""
def __init__(self, context: Any = None):
@@ -1882,7 +1916,7 @@ class QuickContactBadge(Stub):
# 各种 Adapter 实现
# ═══════════════════════════════════════════════════════════════
class BaseAdapter(Adapter):
class BaseAdapter(_BaseBaseAdapter, Adapter):
"""BaseAdapter — 基础适配器"""
def __init__(self):
@@ -1923,12 +1957,12 @@ class BaseAdapter(Adapter):
return self.getCount() == 0
class ArrayAdapter(BaseAdapter):
class ArrayAdapter(_BaseArrayAdapter, BaseAdapter):
"""ArrayAdapter — 数组适配器"""
def __init__(self, context: Any = None, resource: int = 0,
objects: Optional[List[Any]] = None):
super().__init__()
BaseAdapter.__init__(self)
self._context = context
self._resource = resource
self._drop_down_resource: int = resource
@@ -1990,7 +2024,7 @@ class ArrayAdapter(BaseAdapter):
return f"ArrayAdapter(items={len(self._objects)})"
class SimpleAdapter(BaseAdapter):
class SimpleAdapter(_BaseSimpleAdapter, BaseAdapter):
"""SimpleAdapter — 简单适配器"""
def __init__(self, context: Any = None,
@@ -1998,7 +2032,7 @@ class SimpleAdapter(BaseAdapter):
resource: int = 0,
from_keys: Optional[List[str]] = None,
to_ids: Optional[List[int]] = None):
super().__init__()
BaseAdapter.__init__(self)
self._context = context
self._data: List[Dict[str, Any]] = data or []
self._resource = resource
@@ -2031,7 +2065,7 @@ class SimpleAdapter(BaseAdapter):
return f"SimpleAdapter(items={len(self._data)})"
class CursorAdapter(BaseAdapter):
class CursorAdapter(_BaseCursorAdapter, BaseAdapter):
"""CursorAdapter — 游标适配器"""
FLAG_AUTO_REQUERY = 1
@@ -2039,7 +2073,7 @@ class CursorAdapter(BaseAdapter):
def __init__(self, context: Any = None, cursor: Any = None,
flags: int = FLAG_AUTO_REQUERY):
super().__init__()
BaseAdapter.__init__(self)
self._context = context
self._cursor = cursor
self._flags = flags