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

+25 -2
View File
@@ -398,6 +398,14 @@ __all__ = [
"BatteryManager",
"BiometricPrompt",
"Bitmap", "BitmapDrawable", "BitmapFactory",
"Camera",
"Region", "PathMeasure",
"NinePatch", "Picture", "PictureDrawable",
"PorterDuff", "PorterDuffXfermode",
"Shader", "LinearGradient", "RadialGradient", "SweepGradient",
"BitmapShader", "ComposeShader",
"CornerPathEffect", "DashPathEffect", "PathDashPathEffect",
"SumPathEffect",
"BluetoothAdapter", "BluetoothDevice",
"BroadcastReceiver",
"Build",
@@ -431,6 +439,12 @@ __all__ = [
"ImageView",
"InputDevice",
"KeyEvent", "MotionEvent",
"GestureDetector", "ScaleGestureDetector",
"SurfaceHolder", "Surface", "SurfaceView", "TextureView",
"ViewOutlineProvider",
"WindowManager", "Window",
"LayoutInflater", "Menu", "MenuItem", "ContextMenu",
"Display", "DisplayMetrics",
"InputManager",
"InputMethodManager",
"Intent",
@@ -462,6 +476,14 @@ __all__ = [
"PermissionManager",
"PowerManager",
"PrintAttributes", "PrintDocumentAdapter", "PrintManager",
"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",
"ProgressBar",
"RadioManager", "RadioTuner",
"Rect", "RectF",
@@ -479,7 +501,8 @@ __all__ = [
"SpannableStringBuilder",
"SpeechRecognizer",
"Spinner",
"SQLiteDatabase", "SQLiteOpenHelper",
"SQLiteDatabase", "SQLiteOpenHelper", "SQLiteStatement",
"MatrixCursor",
"StorageManager", "StorageVolume",
"StructStat",
"Switch",
@@ -516,7 +539,7 @@ __all__ = [
"BufferedReader", "BufferedWriter",
"InputStreamReader", "OutputStreamWriter",
"URL", "HttpURLConnection", "Socket", "ServerSocket",
"NetworkInterface", "InetAddress", "InetSocketAddress",
"NetworkInterface", "InetAddress", "InetSocketAddress", "InterfaceAddress",
"ArrayList", "HashMap", "HashSet", "LinkedList",
"TreeMap", "LinkedHashMap", "PriorityQueue",
"Collections", "Arrays", "Calendar", "Date", "Random",
+9 -6
View File
@@ -12,6 +12,9 @@ from enum import IntEnum
from .._core import Stub, AndroidOnlyError
from ..java.lang import RuntimeException, IllegalArgumentException, IllegalStateException
from .app import Fragment as _BaseFragment
from .app import FragmentManager as _BaseFragmentManager
from .app import FragmentTransaction as _BaseFragmentTransaction
# ═══════════════════════════════════════════════════════════════
@@ -62,8 +65,8 @@ POP_BACK_STACK_INCLUSIVE = 1
# Fragment
# ═══════════════════════════════════════════════════════════════
class Fragment(Stub):
"""Fragment — 片段基类 (桌面存根)"""
class Fragment(_BaseFragment):
"""Fragment — 片段基类 (桌面存根,继承 app.Fragment 的所有方法)"""
def __init__(self):
super().__init__()
@@ -426,8 +429,8 @@ class Fragment(Stub):
# FragmentManager
# ═══════════════════════════════════════════════════════════════
class FragmentManager(Stub):
"""FragmentManager — 片段管理器"""
class FragmentManager(_BaseFragmentManager):
"""FragmentManager — 片段管理器 (继承 app.FragmentManager 的所有方法)"""
def __init__(self):
super().__init__()
@@ -538,8 +541,8 @@ class FragmentManager(Stub):
# FragmentTransaction
# ═══════════════════════════════════════════════════════════════
class FragmentTransaction(Stub):
"""FragmentTransaction — 片段事务"""
class FragmentTransaction(_BaseFragmentTransaction):
"""FragmentTransaction — 片段事务 (继承 app.FragmentTransaction 的所有方法)"""
TRANSIT_ENTER_MASK = TRANSIT_ENTER_MASK
TRANSIT_EXIT_MASK = TRANSIT_EXIT_MASK
+10 -7
View File
@@ -13,6 +13,9 @@ from typing import Any, Dict, List, Optional, Set, Tuple, Union
from .._core import Stub, AndroidOnlyError
from ..java.lang import RuntimeException
from .app import Intent as _BaseIntent
from .app import PendingIntent as _BasePendingIntent
from .content import IntentFilter as _BaseIntentFilter
IllegalArgumentException = type("IllegalArgumentException", (RuntimeException,), {})
@@ -680,8 +683,8 @@ MIME_TYPE_ALL = "*/*"
# Intent — 完整扩展
# ═══════════════════════════════════════════════════════════════
class Intent(Stub):
"""Android Intent — 完整扩展 (桌面存根)"""
class Intent(_BaseIntent):
"""Android Intent — 完整扩展 (桌面存根,继承 app.Intent 的所有方法)"""
# ── ShortcutIconResource inner class ──
@@ -1276,8 +1279,8 @@ class IntentReceiver(Stub):
# PendingIntent
# ═══════════════════════════════════════════════════════════════
class PendingIntent(Stub):
"""PendingIntent — 延迟 Intent"""
class PendingIntent(_BasePendingIntent):
"""PendingIntent — 延迟 Intent (继承 app.PendingIntent 的所有方法)"""
FLAG_ONE_SHOT = 1 << 30
FLAG_NO_CREATE = 1 << 29
@@ -1288,7 +1291,7 @@ class PendingIntent(Stub):
def __init__(self, intent: Optional[Intent] = None, requestCode: int = 0,
flags: int = 0):
super().__init__()
super().__init__(intent, requestCode, flags)
self._intent = intent
self._request_code = requestCode
self._flags = flags
@@ -1475,8 +1478,8 @@ class IntentService(Stub):
# IntentFilter
# ═══════════════════════════════════════════════════════════════
class IntentFilter(Stub):
"""IntentFilter — Intent 过滤器 (桌面存根)"""
class IntentFilter(_BaseIntentFilter):
"""IntentFilter — Intent 过滤器 (桌面存根,继承 content.IntentFilter 的所有方法)"""
class AuthorityEntry(Stub):
"""AuthorityEntry — 权限条目"""
+15 -8
View File
@@ -14,6 +14,9 @@ from typing import Any, Callable, Dict, List, Optional, Tuple
from .._core import Stub, AndroidOnlyError
from .hardware import SensorManager as _BaseSensorManager
from .hardware import Sensor as _BaseSensor
from .hardware import SensorEvent as _BaseSensorEvent
from .hardware import SensorEventListener as _BaseSensorEventListener
__all__ = [
"Sensor", "SensorEvent", "SensorEventListener",
@@ -102,8 +105,8 @@ AXIS_MINUS_Z = 6
# Sensor (扩展)
# ═══════════════════════════════════════════════════════════════
class Sensor(Stub):
"""Sensor — 传感器 (完整版)"""
class Sensor(_BaseSensor):
"""Sensor — 传感器 (完整版,继承 hardware.Sensor 的所有方法)"""
TYPE_ACCELEROMETER = TYPE_ACCELEROMETER
TYPE_MAGNETIC_FIELD = TYPE_MAGNETIC_FIELD
@@ -154,7 +157,8 @@ class Sensor(Stub):
fifo_reserved_event_count: int = 0,
fifo_max_event_count: int = 0,
id_: int = 0):
super().__init__()
super().__init__(type_, name, vendor, version, resolution,
max_range, power, min_delay)
self._type = type_
self._name = name
self._vendor = vendor
@@ -249,14 +253,17 @@ class Sensor(Stub):
# SensorEvent
# ═══════════════════════════════════════════════════════════════
class SensorEvent(Stub):
"""SensorEvent — 传感器事件"""
class SensorEvent(_BaseSensorEvent):
"""SensorEvent — 传感器事件 (继承 hardware.SensorEvent 的所有方法)"""
def __init__(self, sensor: Optional[Sensor] = None,
values: List[float] = None,
accuracy: int = SENSOR_STATUS_ACCURACY_HIGH,
timestamp: int = 0):
super().__init__()
if sensor is not None:
super().__init__(sensor, accuracy)
else:
Stub.__init__(self)
self.sensor = sensor
self.values = values or [0.0, 0.0, 0.0]
self.accuracy = accuracy
@@ -291,8 +298,8 @@ class SensorEvent(Stub):
# SensorEventListener
# ═══════════════════════════════════════════════════════════════
class SensorEventListener(Stub):
"""SensorEventListener — 传感器事件监听器"""
class SensorEventListener(_BaseSensorEventListener):
"""SensorEventListener — 传感器事件监听器 (继承 hardware.SensorEventListener 的所有方法)"""
def onSensorChanged(self, event: SensorEvent):
pass
+24 -12
View File
@@ -14,6 +14,18 @@ import time
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
from .._core import Stub, AndroidOnlyError
from .net import ConnectivityManager as _BaseConnectivityManager
from .net import DhcpInfo as _BaseDhcpInfo
from .net import LinkAddress as _BaseLinkAddress
from .net import LinkProperties as _BaseLinkProperties
from .net import Network as _BaseNetwork
from .net import NetworkCapabilities as _BaseNetworkCapabilities
from .net import NetworkInfo as _BaseNetworkInfo
from .net import NetworkRequest as _BaseNetworkRequest
from .net import NetworkSpecifier as _BaseNetworkSpecifier
from .net import ProxyInfo as _BaseProxyInfo
from .net import TrafficStats as _BaseTrafficStats
from .net import MatchAllNetworkSpecifier as _BaseMatchAllNetworkSpecifier
# Linux 真实实现导入
try:
@@ -37,7 +49,7 @@ __all__ = [
# Network
# ═══════════════════════════════════════════════════════════════
class Network(Stub):
class Network(_BaseNetwork):
"""Network — 网络"""
def __init__(self, netId: int = 0):
@@ -81,7 +93,7 @@ class Network(Stub):
# NetworkCapabilities
# ═══════════════════════════════════════════════════════════════
class NetworkCapabilities(Stub):
class NetworkCapabilities(_BaseNetworkCapabilities):
"""NetworkCapabilities — 网络能力"""
TRANSPORT_CELLULAR = 0
@@ -243,7 +255,7 @@ class NetworkCapabilities(Stub):
# NetworkSpecifier / MatchAllNetworkSpecifier
# ═══════════════════════════════════════════════════════════════
class NetworkSpecifier(Stub):
class NetworkSpecifier(_BaseNetworkSpecifier):
"""NetworkSpecifier — 网络指定器"""
def satisfiedBy(self, other: Optional["NetworkSpecifier"]) -> bool:
@@ -259,7 +271,7 @@ class NetworkSpecifier(Stub):
return id(self) & 0x7FFFFFFF
class MatchAllNetworkSpecifier(NetworkSpecifier):
class MatchAllNetworkSpecifier(_BaseMatchAllNetworkSpecifier, NetworkSpecifier):
"""MatchAllNetworkSpecifier — 匹配所有网络"""
def satisfiedBy(self, other: Optional["NetworkSpecifier"]) -> bool:
@@ -273,7 +285,7 @@ class MatchAllNetworkSpecifier(NetworkSpecifier):
# NetworkRequest
# ═══════════════════════════════════════════════════════════════
class NetworkRequest(Stub):
class NetworkRequest(_BaseNetworkRequest):
"""NetworkRequest — 网络请求"""
def __init__(self, capabilities: Optional[NetworkCapabilities] = None,
@@ -437,7 +449,7 @@ class NetworkAgent(Stub):
# NetworkInfo (扩展)
# ═══════════════════════════════════════════════════════════════
class NetworkInfo(Stub):
class NetworkInfo(_BaseNetworkInfo):
"""NetworkInfo — 网络信息 (完整版)"""
TYPE_NONE = -1
@@ -565,7 +577,7 @@ class NetworkInfo(Stub):
# LinkAddress
# ═══════════════════════════════════════════════════════════════
class LinkAddress(Stub):
class LinkAddress(_BaseLinkAddress):
"""LinkAddress — 链路地址"""
def __init__(self, address: str = "0.0.0.0", prefixLength: int = 24,
@@ -607,7 +619,7 @@ class LinkAddress(Stub):
# LinkProperties
# ═══════════════════════════════════════════════════════════════
class LinkProperties(Stub):
class LinkProperties(_BaseLinkProperties):
"""LinkProperties — 链路属性"""
def __init__(self):
@@ -881,7 +893,7 @@ class MobileLinkQualityInfo(LinkQualityInfo):
# TrafficStats
# ═══════════════════════════════════════════════════════════════
class TrafficStats(Stub):
class TrafficStats(_BaseTrafficStats):
"""TrafficStats — 流量统计"""
UID_REMOVED = -4
@@ -976,7 +988,7 @@ class TrafficStats(Stub):
# ProxyInfo
# ═══════════════════════════════════════════════════════════════
class ProxyInfo(Stub):
class ProxyInfo(_BaseProxyInfo):
"""ProxyInfo — 代理信息"""
def __init__(self, host: str = "", port: int = 0,
@@ -1019,7 +1031,7 @@ class ProxyInfo(Stub):
# DhcpInfo / DhcpInfoInternal
# ═══════════════════════════════════════════════════════════════
class DhcpInfo(Stub):
class DhcpInfo(_BaseDhcpInfo):
"""DhcpInfo — DHCP 信息"""
def __init__(self):
@@ -1252,7 +1264,7 @@ class ConnectivityDiagnosticsManager(Stub):
# ConnectivityManager (扩展)
# ═══════════════════════════════════════════════════════════════
class ConnectivityManager(Stub):
class ConnectivityManager(_BaseConnectivityManager):
"""ConnectivityManager — 连接管理器 (扩展版)"""
TYPE_NONE = -1
+6 -4
View File
@@ -17,6 +17,8 @@ from typing import Any, Dict, List, Optional, Set, Tuple, Callable
from .._core import Stub, AndroidOnlyError, _app_data_dir
from ..java.lang import RuntimeException
from .os import BatteryManager as _BaseBatteryManager
from .os import PowerManager as _BasePowerManager
# Linux 真实实现导入
try:
@@ -428,8 +430,8 @@ class BatteryStatsManager(Stub):
# BatteryManager (扩展)
# ═══════════════════════════════════════════════════════════════
class BatteryManager(Stub):
"""BatteryManager (扩展) — 电池管理器"""
class BatteryManager(_BaseBatteryManager):
"""BatteryManager (扩展) — 电池管理器 (继承 os.BatteryManager 的所有方法)"""
EXTRA_STATUS = "status"
EXTRA_HEALTH = "health"
@@ -681,8 +683,8 @@ class BatterySaverController(Stub):
# PowerManager (扩展)
# ═══════════════════════════════════════════════════════════════
class PowerManager(Stub):
"""PowerManager — 电源管理器 (扩展)"""
class PowerManager(_BasePowerManager):
"""PowerManager — 电源管理器 (扩展,继承 os.PowerManager 的所有方法)"""
PARTIAL_WAKE_LOCK = PARTIAL_WAKE_LOCK
FULL_WAKE_LOCK = FULL_WAKE_LOCK
+48 -32
View File
@@ -16,14 +16,30 @@ from ..java.lang import RuntimeException
from .view import KeyEvent as _BaseKeyEvent
from .view import ViewGroup as _BaseViewGroup
from .view import View as _BaseView
from .view import ViewOutlineProvider as _BaseViewOutlineProvider
from .view import ViewPropertyAnimator as _BaseViewPropertyAnimator
from .view import ViewTreeObserver as _BaseViewTreeObserver
from .view import ViewConfiguration as _BaseViewConfiguration
from .view import ViewParent as _BaseViewParent
from .view import WindowInsets as _BaseWindowInsets
from .view import Display as _BaseDisplay
from .view import DragEvent as _BaseDragEvent
from .view import GestureDetector as _BaseGestureDetector
from .view import ScaleGestureDetector as _BaseScaleGestureDetector
from .view import SoundEffectConstants as _BaseSoundEffectConstants
from .view import Surface as _BaseSurface
from .view import SurfaceView as _BaseSurfaceView
from .view import TextureView as _BaseTextureView
from .view import VelocityTracker as _BaseVelocityTracker
from .view import WindowInsetsController as _BaseWindowInsetsController
# ═══════════════════════════════════════════════════════════════
# ViewOutlineProvider
# ═══════════════════════════════════════════════════════════════
class ViewOutlineProvider(Stub):
"""ViewOutlineProvider — 视图轮廓提供者"""
class ViewOutlineProvider(_BaseViewOutlineProvider):
"""ViewOutlineProvider — 视图轮廓提供者 (继承 view.ViewOutlineProvider 的所有方法)"""
BACKGROUND = None
BOUNDS = None
@@ -102,8 +118,8 @@ class Outline(Stub):
# ViewPropertyAnimator
# ═══════════════════════════════════════════════════════════════
class ViewPropertyAnimator(Stub):
"""ViewPropertyAnimator — 视图属性动画器"""
class ViewPropertyAnimator(_BaseViewPropertyAnimator):
"""ViewPropertyAnimator — 视图属性动画器 (继承 view.ViewPropertyAnimator 的所有方法)"""
def __init__(self, view: Any = None):
super().__init__()
@@ -384,8 +400,8 @@ class ViewStructure(Stub):
# ViewTreeObserver
# ═══════════════════════════════════════════════════════════════
class ViewTreeObserver(Stub):
"""ViewTreeObserver — 视图树观察者"""
class ViewTreeObserver(_BaseViewTreeObserver):
"""ViewTreeObserver — 视图树观察者 (继承 view.ViewTreeObserver 的所有方法)"""
def __init__(self):
super().__init__()
@@ -532,8 +548,8 @@ class ViewDebug(Stub):
# ViewConfiguration
# ═══════════════════════════════════════════════════════════════
class ViewConfiguration(Stub):
"""ViewConfiguration — 视图配置"""
class ViewConfiguration(_BaseViewConfiguration):
"""ViewConfiguration — 视图配置 (继承 view.ViewConfiguration 的所有方法)"""
def __init__(self):
super().__init__()
@@ -618,8 +634,8 @@ class ViewConfiguration(Stub):
# ViewParent (扩展)
# ═══════════════════════════════════════════════════════════════
class ViewParent(Stub):
"""ViewParent — 视图父容器接口扩展"""
class ViewParent(_BaseViewParent):
"""ViewParent — 视图父容器接口扩展 (继承 view.ViewParent 的所有方法)"""
def requestLayout(self) -> None:
pass
@@ -954,8 +970,8 @@ class ViewOverlay(Stub):
# WindowInsets / DisplayCutout / Display
# ═══════════════════════════════════════════════════════════════
class WindowInsets(Stub):
"""WindowInsets — 窗口插入区域"""
class WindowInsets(_BaseWindowInsets):
"""WindowInsets — 窗口插入区域 (继承 view.WindowInsets 的所有方法)"""
def __init__(self):
super().__init__()
@@ -1087,8 +1103,8 @@ class DisplayCutout(Stub):
return f"DisplayCutout(safe={self._safe_insets})"
class Display(Stub):
"""Display — 屏幕显示信息"""
class Display(_BaseDisplay):
"""Display — 屏幕显示信息 (继承 view.Display 的所有方法)"""
DEFAULT_DISPLAY = 0
FLAG_PRESENTATION = 1
@@ -1430,8 +1446,8 @@ WINDOW_INSETS_ANIMATION_TYPE_TRANSLATION = 2
WINDOW_INSETS_ANIMATION_TYPE_ALPHA_AND_TRANSLATION = 3
class DragEvent(Stub):
"""DragEvent — 拖放事件"""
class DragEvent(_BaseDragEvent):
"""DragEvent — 拖放事件 (继承 view.DragEvent 的所有方法)"""
ACTION_DRAG_STARTED = DRAG_EVENT_ACTION_DRAG_STARTED
ACTION_DRAG_ENTERED = DRAG_EVENT_ACTION_DRAG_ENTERED
@@ -1474,8 +1490,8 @@ class DragEvent(Stub):
return f"DragEvent(action={actions.get(self._action, 'UNKNOWN')})"
class GestureDetector(Stub):
"""GestureDetector — 手势检测器"""
class GestureDetector(_BaseGestureDetector):
"""GestureDetector — 手势检测器 (继承 view.GestureDetector 的所有方法)"""
class SimpleOnGestureListener(Stub):
"""GestureDetector.SimpleOnGestureListener — 简单手势监听器"""
@@ -2090,8 +2106,8 @@ class ContextMenu(Menu):
# ScaleGestureDetector / SoundEffectConstants / Surface / etc.
# ═══════════════════════════════════════════════════════════════
class ScaleGestureDetector(Stub):
"""ScaleGestureDetector — 缩放手势检测器"""
class ScaleGestureDetector(_BaseScaleGestureDetector):
"""ScaleGestureDetector — 缩放手势检测器 (继承 view.ScaleGestureDetector 的所有方法)"""
class SimpleOnScaleGestureListener(Stub):
def onScale(self, detector: "ScaleGestureDetector") -> bool:
@@ -2171,8 +2187,8 @@ class ScaleGestureDetector(Stub):
f"inProgress={self._in_progress})")
class SoundEffectConstants(Stub):
"""SoundEffectConstants — 音效常量"""
class SoundEffectConstants(_BaseSoundEffectConstants):
"""SoundEffectConstants — 音效常量 (继承 view.SoundEffectConstants 的所有方法)"""
CLICK = 0
NAVIGATION_UP = 1
@@ -2189,8 +2205,8 @@ class SoundEffectConstants(Stub):
return SoundEffectConstants.NAVIGATION_UP
class Surface(Stub):
"""Surface — 表面"""
class Surface(_BaseSurface):
"""Surface — 表面 (继承 view.Surface 的所有方法)"""
ROTATION_0 = 0
ROTATION_90 = 1
@@ -2263,8 +2279,8 @@ class SurfaceControl(Stub):
return f"SurfaceControl(layer={self._layer}, visible={self._visible})"
class SurfaceView(Stub):
"""SurfaceView — 表面视图扩展"""
class SurfaceView(_BaseSurfaceView):
"""SurfaceView — 表面视图扩展 (继承 view.SurfaceView 的所有方法)"""
def __init__(self, context: Any = None):
super().__init__()
@@ -2291,8 +2307,8 @@ class SurfaceView(Stub):
return "SurfaceView()"
class TextureView(Stub):
"""TextureView — 纹理视图"""
class TextureView(_BaseTextureView):
"""TextureView — 纹理视图扩展 (继承 view.TextureView 的所有方法)"""
def __init__(self, context: Any = None):
super().__init__()
@@ -2335,8 +2351,8 @@ class TouchDelegate(Stub):
return f"TouchDelegate(delegate={self._delegate_view})"
class VelocityTracker(Stub):
"""VelocityTracker — 速度追踪器"""
class VelocityTracker(_BaseVelocityTracker):
"""VelocityTracker — 速度追踪器 (继承 view.VelocityTracker 的所有方法)"""
def __init__(self, strategy: str = ""):
super().__init__()
@@ -2452,8 +2468,8 @@ class WindowInsetsAnimation(Stub):
f"fraction={self._interpolated_fraction})")
class WindowInsetsController(Stub):
"""WindowInsetsController — 窗口插入控制器"""
class WindowInsetsController(_BaseWindowInsetsController):
"""WindowInsetsController — 窗口插入控制器 (继承 view.WindowInsetsController 的所有方法)"""
APPEARANCE_OPAQUE_STATUS_BARS = 1
APPEARANCE_OPAQUE_NAVIGATION_BARS = 2
+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