feat: 深度完善 — 存根转真实实现、UI类方法补全、Java集合/IO增强
存根转真实实现: - ContentResolver: query/insert/update/delete对file://URI真实文件操作, getType用mimetypes - Context: getResources/getAssets/getString/getColor 委托真实Resources - Bitmap.sameAs: PIL像素比对 - Canvas: quickReject/drawTextOnPath/drawPicture/drawDoubleRoundRect 真实实现 - Paint: measureText/breakText/getTextWidths/getFontMetrics/getTextBounds 用PIL字体 - PathMeasure: 真实路径展平/长度计算/坐标切线提取 - Path.op/Region.op: 布尔运算 - Camera: 3D变换矩阵计算 - SystemClock.setCurrentTimeMillis: date -s命令 - Environment.isExternalStorageRemovable: /proc/mounts检查 - Process.myUid: os.getuid() - PowerManager.isPowerSaveMode: CPU governor检查 - Vibrator: Linux LED振动器设备支持 - FileObserver: 轮询线程检测文件变化 - SensorManager.getRotationMatrix: 完整旋转矩阵算法 - BatteryManager: LinuxPower真实电池数据 - Geocoder: Nominatim API逆地理编码 - LocationManager: addProximityAlert/setTestProviderLocation UI类方法补全: - TextView: setPaddingRelative/getTextColor/setBreakStrategy/setJustificationMode - ImageView: setColorFilter/getColorFilter/clearColorFilter - CheckBox/Switch: setOnCheckedChangeListener - ListView: clearChoices - ViewGroup: setLayoutTransition/setTouchscreenBlocksFocus/getChildVisibleRect - MotionEvent: getHistoricalX/Y/Pressure/EventTime/addBatch/getEdgeFlags/setAction Java集合增强: - ArrayList: spliterator/stream - HashSet: spliterator/stream/removeIf - TreeMap: replaceAll/compute/computeIfAbsent/computeIfPresent/merge - LinkedHashMap: clone (保留access_order) - PriorityQueue: spliterator/clone Java IO增强: - BufferedWriter: append/check - PrintWriter: append - ByteArrayOutputStream: writeTo - ByteArrayInputStream: markSupported - BufferedInputStream: available/mark/reset/markSupported + 修复_fill缓冲区填充bug - SequenceInputStream: 补全实现(Enumeration/多流/跨流聚合读取) 修复: - ViewGroup.addView: 合并重复定义为智能参数分派 - view_ext.ViewGroup: 继承view.ViewGroup - view_ext.KeyEvent: 继承view.KeyEvent - hardware_sensor_ext.SensorManager: 继承hardware.SensorManager - app_fragment: 使用java.lang.IllegalStateException - content_intent.Intent: setData/getScheme正确从Uri提取scheme - __init__.py: 补全Fragment/KeyEvent/MotionEvent/TrafficStats/RecyclerView/TreeMap/Vibrator等导出 统计: 221模块, 3662类, 30952方法, 182302行
This commit is contained in:
1 parent
39b1da37c9
commit
4235f8692c
13 files changed
+2248
-163
No files matched your search
@@ -1242,8 +1242,13 @@ class ViewGroup(View, ViewParent, ViewManager):
|
||||
|
||||
# ─── child management ──────────────────────────────────────
|
||||
|
||||
def addView(self, child: View, index: int = -1,
|
||||
def addView(self, child: View, index: Optional[int] = -1,
|
||||
params: Optional["ViewGroup.LayoutParams"] = None):
|
||||
"""addView — 支持 addView(child), addView(child, params), addView(child, index), addView(child, index, params)"""
|
||||
# 智能 参数分派:第二个参数可能是 index(int) 或 params(LayoutParams)
|
||||
if isinstance(index, ViewGroup.LayoutParams):
|
||||
params = index
|
||||
index = -1
|
||||
if params is None:
|
||||
params = ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
@@ -1255,9 +1260,6 @@ class ViewGroup(View, ViewParent, ViewManager):
|
||||
child.setLayoutParams(params)
|
||||
child.onAttachedToWindow()
|
||||
|
||||
def addView(self, child: View, params: Optional["ViewGroup.LayoutParams"] = None):
|
||||
self.addView(child, -1, params)
|
||||
|
||||
def removeView(self, view: View):
|
||||
if view in self._children:
|
||||
self._children.remove(view)
|
||||
@@ -1360,6 +1362,32 @@ class ViewGroup(View, ViewParent, ViewManager):
|
||||
def isMotionEventSplittingEnabled(self) -> bool:
|
||||
return True
|
||||
|
||||
# ─── layout transition ────────────────────────────────────
|
||||
|
||||
def setLayoutTransition(self, transition: Any):
|
||||
self._layout_transition = transition
|
||||
|
||||
def getLayoutTransition(self) -> Any:
|
||||
return getattr(self, '_layout_transition', None)
|
||||
|
||||
# ─── focus / touch blocking ───────────────────────────────
|
||||
|
||||
def setTouchscreenBlocksFocus(self, blocks: bool):
|
||||
self._touchscreen_blocks_focus = blocks
|
||||
|
||||
def isTouchscreenBlocksFocus(self) -> bool:
|
||||
return getattr(self, '_touchscreen_blocks_focus', False)
|
||||
|
||||
# ─── child visible rect ───────────────────────────────────
|
||||
|
||||
def getChildVisibleRect(self, child: View, r: Any, offset: Any) -> bool:
|
||||
if r is not None and hasattr(r, 'set'):
|
||||
r.set(child.getLeft(), child.getTop(),
|
||||
child.getRight(), child.getBottom())
|
||||
if offset is not None and hasattr(offset, 'set'):
|
||||
offset.set(0, 0)
|
||||
return True
|
||||
|
||||
def setTransitionGroup(self, is_transition_group: bool):
|
||||
pass
|
||||
|
||||
@@ -1809,6 +1837,75 @@ class MotionEvent(Stub):
|
||||
def getHistoricalSize(self, pos: int, pointer: int = 0) -> float:
|
||||
return 0.5
|
||||
|
||||
# ─── historical coordinates ───────────────────────────────
|
||||
|
||||
def getHistorySize(self) -> int:
|
||||
return len(getattr(self, '_history', []))
|
||||
|
||||
def getHistoricalX(self, pointer_index: int = 0, pos: int = 0) -> float:
|
||||
history = getattr(self, '_history', [])
|
||||
if 0 <= pos < len(history):
|
||||
return history[pos].get('x', self.getX(pointer_index))
|
||||
return self.getX(pointer_index)
|
||||
|
||||
def getHistoricalY(self, pointer_index: int = 0, pos: int = 0) -> float:
|
||||
history = getattr(self, '_history', [])
|
||||
if 0 <= pos < len(history):
|
||||
return history[pos].get('y', self.getY(pointer_index))
|
||||
return self.getY(pointer_index)
|
||||
|
||||
def getHistoricalPressure(self, pointer_index: int = 0, pos: int = 0) -> float:
|
||||
history = getattr(self, '_history', [])
|
||||
if 0 <= pos < len(history):
|
||||
return history[pos].get('pressure', 1.0)
|
||||
return 1.0
|
||||
|
||||
def getHistoricalEventTime(self, pos: int = 0) -> int:
|
||||
history = getattr(self, '_history', [])
|
||||
if 0 <= pos < len(history):
|
||||
return history[pos].get('event_time', self._event_time)
|
||||
return self._event_time
|
||||
|
||||
# ─── edge flags ───────────────────────────────────────────
|
||||
|
||||
def getEdgeFlags(self) -> int:
|
||||
return getattr(self, '_edge_flags', 0)
|
||||
|
||||
def setEdgeFlags(self, edge_flags: int):
|
||||
self._edge_flags = edge_flags
|
||||
|
||||
# ─── action mutation ──────────────────────────────────────
|
||||
|
||||
def setAction(self, action: int):
|
||||
self._action = action
|
||||
|
||||
# ─── batch ────────────────────────────────────────────────
|
||||
|
||||
def addBatch(self, event_time: int, x: float, y: float,
|
||||
pressure: float = 1.0, size: float = 0.5,
|
||||
meta_state: int = 0):
|
||||
if not hasattr(self, '_history'):
|
||||
self._history = []
|
||||
self._history.append({
|
||||
'event_time': self._event_time,
|
||||
'x': self._x,
|
||||
'y': self._y,
|
||||
'pressure': self.getPressure(0),
|
||||
'size': self.getSize(0),
|
||||
'meta_state': self._meta_state,
|
||||
})
|
||||
self._x = x
|
||||
self._y = y
|
||||
self._raw_x = x
|
||||
self._raw_y = y
|
||||
self._event_time = event_time
|
||||
self._meta_state = meta_state
|
||||
if self._pointers:
|
||||
self._pointers[0]['x'] = x
|
||||
self._pointers[0]['y'] = y
|
||||
self._pointers[0]['pressure'] = pressure
|
||||
self._pointers[0]['size'] = size
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════
|
||||
# KeyEvent
|
||||
|
||||
Reference in new issue
Block a user